Page filter that supports syntax highlighting for Ruby code, XML and YAML via the (extensible) Syntax ( library. Code is expected to be enclosed by the code macro:

    def amethod(arg)
      puts arg

Where the macro argument may be ‘ruby’, ‘xml’, ‘yaml’, or a custom identifier registered (with Syntax) for a custom highlighter.

The macro output will resemble:

  <pre class='#{lang}'><code class=#{lang}'>

Syntax uses <span> tags for highlighting, with CSS classes used to apply formatting. See for a list of recognised classes.

Public Class methods
new(macro_re = MACRO_RE)
    # File lib/rote/filters/syntax.rb, line 41
41:       def initialize(macro_re = MACRO_RE)
42:         super([],macro_re)
43:       end
Public Instance methods

Implementation of the code macro.

    # File lib/rote/filters/syntax.rb, line 46
46:       def macro_code(lang,body,raw)
47:         converter = ::Syntax::Convertors::HTML.for_syntax(lang)
48:         "<pre class='#{lang}'><code class='#{lang}'>#{converter.convert(body,false)}</code></pre>"
49:       end