Class: Rouge::Formatters::HTMLLegacy
- Inherits:
-
Rouge::Formatter
- Object
- Rouge::Formatter
- Rouge::Formatters::HTMLLegacy
- Defined in:
- lib/rouge/formatters/html_legacy.rb
Overview
Transforms a token stream into HTML output.
Instance Method Summary collapse
-
#initialize(opts = {}) ⇒ HTMLLegacy
constructor
Initialize with options.
- #stream(tokens) { ... } ⇒ Object
Methods inherited from Rouge::Formatter
disable_escape!, enable_escape!, #escape?, escape_enabled?, #filter_escapes, find, format, #format, #render, tag, #token_lines, with_escape
Constructor Details
#initialize(opts = {}) ⇒ HTMLLegacy
Initialize with options.
If :inline_theme
is given, then instead of rendering the
tokens as tags with CSS classes, the styles according to
the given theme will be inlined in "style" attributes. This is
useful for formats in which stylesheets are not available.
Content will be wrapped in a tag (div
if tableized, pre
if
not) with the given :css_class
unless :wrap
is set to false
.
27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/rouge/formatters/html_legacy.rb', line 27 def initialize(opts={}) @formatter = opts[:inline_theme] ? HTMLInline.new(opts[:inline_theme]) : HTML.new @formatter = HTMLTable.new(@formatter, opts) if opts[:line_numbers] if opts.fetch(:wrap, true) @formatter = HTMLPygments.new(@formatter, opts.fetch(:css_class, 'codehilite')) end end |
Instance Method Details
#stream(tokens) { ... } ⇒ Object
40 41 42 |
# File 'lib/rouge/formatters/html_legacy.rb', line 40 def stream(tokens, &b) @formatter.stream(tokens, &b) end |