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) ⇒ Object
Constructor Details
#initialize(formatter) ⇒ CustomHTMLLinewise
Returns a new instance of CustomHTMLLinewise.
70 71 72 73 |
# File 'lib/redmine/syntax_highlighting.rb', line 70 def initialize(formatter) super() @formatter = formatter end |
Instance Method Details
#stream(tokens) ⇒ Object
75 76 77 78 79 80 81 82 |
# File 'lib/redmine/syntax_highlighting.rb', line 75 def stream(tokens, &) token_lines(tokens) do |line| line.each do |tok, val| yield @formatter.span(tok, val) end yield "\n" end end |