Class: Rouge::Formatters::HTMLPygments

Inherits:
Rouge::Formatter show all
Defined in:
lib/rouge/formatters/html_pygments.rb

Instance Method Summary collapse

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(inner, css_class = 'codehilite') ⇒ HTMLPygments

Returns a new instance of HTMLPygments


6
7
8
9
# File 'lib/rouge/formatters/html_pygments.rb', line 6

def initialize(inner, css_class='codehilite')
  @inner = inner
  @css_class = css_class
end

Instance Method Details

#stream(tokens) {|%(<div class="highlight"><pre class="#{@css_class}"><code>)| ... } ⇒ Object

Yields:

  • (%(<div class="highlight"><pre class="#{@css_class}"><code>))

11
12
13
14
15
# File 'lib/rouge/formatters/html_pygments.rb', line 11

def stream(tokens, &b)
  yield %(<div class="highlight"><pre class="#{@css_class}"><code>)
  @inner.stream(tokens, &b)
  yield "</code></pre></div>"
end