Class: Redmine::SyntaxHighlighting::Rouge::CustomHTMLLinewise
- Inherits:
-
Rouge::Formatter
- Object
- Rouge::Formatter
- Redmine::SyntaxHighlighting::Rouge::CustomHTMLLinewise
- Defined in:
- lib/redmine/syntax_highlighting.rb
Overview
Customized formatter based on Rouge::Formatters::HTMLLinewise Syntax highlighting is completed within each line.
Instance Method Summary collapse
-
#initialize(formatter) ⇒ CustomHTMLLinewise
constructor
A new instance of CustomHTMLLinewise.
- #stream(tokens, &b) ⇒ Object
Constructor Details
#initialize(formatter) ⇒ CustomHTMLLinewise
Returns a new instance of CustomHTMLLinewise
61 62 63 |
# File 'lib/redmine/syntax_highlighting.rb', line 61 def initialize(formatter) @formatter = formatter end |
Instance Method Details
#stream(tokens, &b) ⇒ Object
65 66 67 68 69 70 71 72 |
# File 'lib/redmine/syntax_highlighting.rb', line 65 def stream(tokens, &b) token_lines(tokens) do |line| line.each do |tok, val| yield @formatter.span(tok, val) end yield "\n" end end |