Class: Rouge::Formatters::HTMLPygments
- Inherits:
-
Rouge::Formatter
- Object
- Rouge::Formatter
- Rouge::Formatters::HTMLPygments
- Defined in:
- lib/rouge/formatters/html_pygments.rb
Constant Summary
Constants inherited from Rouge::Formatter
Instance Method Summary collapse
-
#initialize(inner, css_class = 'codehilite') ⇒ HTMLPygments
constructor
A new instance of HTMLPygments.
- #stream(tokens) {|%(<div class="highlight"><pre class="#{@css_class}"><code>)| ... } ⇒ Object
Methods inherited from Rouge::Formatter
disable_escape!, enable_escape!, #escape?, escape_enabled?, #filter_escapes, find, #format, format, #render, tag, 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
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 |