Module: CodeRay::Encoders::HTML::Output

### Home Classes Methods

### In Files

- lib/coderay/encoders/html/output.rb

### Methods

- #apply_title!
- #stylesheet
- #wrap!
- #wrap_in!
- #wrapped_in
- #wrapped_in?

### Class/Module Index

Quicksearch

- CodeRay
- CodeRay::Duo
- CodeRay::Encoders
- CodeRay::Encoders::CommentFilter
- CodeRay::Encoders::Count
- CodeRay::Encoders::Debug
- CodeRay::Encoders::DebugLint
- CodeRay::Encoders::Div
- CodeRay::Encoders::Encoder
- CodeRay::Encoders::Filter
- CodeRay::Encoders::HTML
- CodeRay::Encoders::HTML::Output
- CodeRay::Encoders::JSON
- CodeRay::Encoders::LinesOfCode
- CodeRay::Encoders::Lint
- CodeRay::Encoders::Null
- CodeRay::Encoders::Page
- CodeRay::Encoders::Span
- CodeRay::Encoders::Statistic
- CodeRay::Encoders::Terminal
- CodeRay::Encoders::Text
- CodeRay::Encoders::TokenKindFilter
- CodeRay::Encoders::XML
- CodeRay::Encoders::YAML
- CodeRay::FileType
- CodeRay::ForRedCloth
- CodeRay::Plugin
- CodeRay::PluginHost
- CodeRay::Scanners
- CodeRay::Scanners::C
- CodeRay::Scanners::CPlusPlus
- CodeRay::Scanners::CSS
- CodeRay::Scanners::Clojure
- CodeRay::Scanners::Debug
- CodeRay::Scanners::Delphi
- CodeRay::Scanners::Diff
- CodeRay::Scanners::ERB
- CodeRay::Scanners::Go
- CodeRay::Scanners::Groovy
- CodeRay::Scanners::HAML
- CodeRay::Scanners::HTML
- CodeRay::Scanners::JSON
- CodeRay::Scanners::Java
- CodeRay::Scanners::JavaScript
- CodeRay::Scanners::Python
- CodeRay::Scanners::Raydebug
- CodeRay::Scanners::Ruby
- CodeRay::Scanners::SQL
- CodeRay::Scanners::Sass
- CodeRay::Scanners::Scanner
- CodeRay::Scanners::Taskpaper
- CodeRay::Scanners::Text
- CodeRay::Scanners::XML
- CodeRay::Scanners::YAML
- CodeRay::Styles
- CodeRay::Styles::Alpha
- CodeRay::Styles::Style
- CodeRay::Tokens
- CodeRay::TokensProxy
- CodeRay::WordList
- CodeRay::WordList::CaseIgnoring

No matching classes.

# CodeRay::Encoders::HTML::Output

This module is included in the output String of the HTML Encoder.

It provides methods like wrap, div, page etc.

Remember to use clone instead of dup to keep the modules the object was extended with.

TODO: Rewrite this without monkey patching.

### Constants

DIV
PAGE
SPAN
TABLE

### Attributes

css[RW]
wrapped_in[W]

### Public Instance Methods

apply_title!(title) click to toggle source

    # File lib/coderay/encoders/html/output.rb, line 57
    def apply_title! title
      self.sub!(/(<title>)(<\/title>)/) { $1 + title + $2 }
      self
    end

stylesheet(in_tag = false) click to toggle source

    # File lib/coderay/encoders/html/output.rb, line 88
    def stylesheet in_tag = false
      Output.make_stylesheet @css, in_tag
    end

wrap!(element, *args) click to toggle source

    # File lib/coderay/encoders/html/output.rb, line 62
    def wrap! element, *args
      return self if not element or element == wrapped_in
      case element
      when :div
        raise "Can't wrap %p in %p" % [wrapped_in, element] unless wrapped_in? nil
        wrap_in! DIV
      when :span
        raise "Can't wrap %p in %p" % [wrapped_in, element] unless wrapped_in? nil
        wrap_in! SPAN
      when :page
        wrap! :div if wrapped_in? nil
        raise "Can't wrap %p in %p" % [wrapped_in, element] unless wrapped_in? :div
        wrap_in! Output.page_template_for_css(@css)
        if args.first.is_a?(Hash) && title = args.first[:title]
          apply_title! title
        end
        self
      when nil
        return self
      else
        raise "Unknown value %p for :wrap" % element
      end
      @wrapped_in = element
      self
    end

wrap_in!(template) click to toggle source

    # File lib/coderay/encoders/html/output.rb, line 52
    def wrap_in! template
      Template.wrap! self, template, 'CONTENT'
      self
    end

wrapped_in() click to toggle source

    # File lib/coderay/encoders/html/output.rb, line 47
    def wrapped_in
      @wrapped_in ||= nil
    end

wrapped_in?(element) click to toggle source

    # File lib/coderay/encoders/html/output.rb, line 43
    def wrapped_in? element
      wrapped_in == element
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.