Method: IsoDoc::PresentationXMLConvert#source_highlight

Defined in:
lib/isodoc/presentation_function/sourcecode.rb

#source_highlight(elem, linenums, lang) ⇒ Object



101
102
103
104
105
106
107
108
109
110
111
112
# File 'lib/isodoc/presentation_function/sourcecode.rb', line 101

def source_highlight(elem, linenums, lang)
  @highlighter or return
  markup = source_remove_markup(elem)
  p = source_lex(elem, lang)
  elem.children = if linenums
                    r = sourcecode_table_to_elem(elem, p)
                    source_restore_markup_table(r, markup)
                  else
                    r = @highlighter[:formatter].format(p)
                    source_restore_markup(Nokogiri::XML.fragment(r), markup)
                  end
end