Class: Rote::Filters::Syntax
- Inherits:
-
MacroFilter
- Object
- MacroFilter
- Rote::Filters::Syntax
- Defined in:
- lib/rote/filters/syntax.rb
Overview
Page filter that supports syntax highlighting for Ruby code via the Syntax
library. Code is expected to be in the following format:
#:code#ruby#
def amethod(arg)
puts arg
end
#:code#
Instance Attribute Summary
Attributes inherited from MacroFilter
Instance Method Summary collapse
-
#initialize(macro_re = MACRO_RE) ⇒ Syntax
constructor
A new instance of Syntax.
- #macro_code(lang, body, raw) ⇒ Object
Methods inherited from MacroFilter
Constructor Details
Instance Method Details
#macro_code(lang, body, raw) ⇒ Object
32 33 34 35 |
# File 'lib/rote/filters/syntax.rb', line 32 def macro_code(lang,body,raw) converter = ::Syntax::Convertors::HTML.for_syntax(lang) "<pre class='#{lang}'><code>#{converter.convert(body,false)}</code></pre>" end |