Class: Rouge::Formatters::HTMLPygments

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

Constant Summary

Constants inherited from Rouge::Formatter

Rouge::Formatter::REGISTRY

Instance Method Summary collapse

Methods inherited from Rouge::Formatter

find, format, #format, #render, tag

Constructor Details

#initialize(inner, css_class = 'codehilite') ⇒ HTMLPygments

Returns a new instance of HTMLPygments.


4
5
6
7
# File 'lib/rouge/formatters/html_pygments.rb', line 4

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>))

9
10
11
12
13
# File 'lib/rouge/formatters/html_pygments.rb', line 9

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