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 # instead of # to keep the modules the object was extended with.

TODO: Rewrite this without monkey patching.

Constants

SPAN
DIV
TABLE
PAGE

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
57:       def apply_title! title
58:         self.sub!(/(<title>)(<\/title>)/) { $1 + title + $2 }
59:         self
60:       end
stylesheet(in_tag = false) click to toggle source
    # File lib/coderay/encoders/html/output.rb, line 88
88:       def stylesheet in_tag = false
89:         Output.make_stylesheet @css, in_tag
90:       end
wrap!(element, *args) click to toggle source
    # File lib/coderay/encoders/html/output.rb, line 62
62:       def wrap! element, *args
63:         return self if not element or element == wrapped_in
64:         case element
65:         when :div
66:           raise "Can't wrap %p in %p" % [wrapped_in, element] unless wrapped_in? nil
67:           wrap_in! DIV
68:         when :span
69:           raise "Can't wrap %p in %p" % [wrapped_in, element] unless wrapped_in? nil
70:           wrap_in! SPAN
71:         when :page
72:           wrap! :div if wrapped_in? nil
73:           raise "Can't wrap %p in %p" % [wrapped_in, element] unless wrapped_in? :div
74:           wrap_in! Output.page_template_for_css(@css)
75:           if args.first.is_a?(Hash) && title = args.first[:title]
76:             apply_title! title
77:           end
78:           self
79:         when nil
80:           return self
81:         else
82:           raise "Unknown value %p for :wrap" % element
83:         end
84:         @wrapped_in = element
85:         self
86:       end
wrap_in!(template) click to toggle source
    # File lib/coderay/encoders/html/output.rb, line 52
52:       def wrap_in! template
53:         Template.wrap! self, template, 'CONTENT'
54:         self
55:       end
wrapped_in() click to toggle source
    # File lib/coderay/encoders/html/output.rb, line 47
47:       def wrapped_in
48:         @wrapped_in ||= nil
49:       end
wrapped_in?(element) click to toggle source
    # File lib/coderay/encoders/html/output.rb, line 43
43:       def wrapped_in? element
44:         wrapped_in == element
45:       end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.