Method: IsoDoc::PresentationXMLConvert#source_highlight

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

#source_highlight(elem) ⇒ Object



70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/isodoc/presentation_function/sourcecode.rb', line 70

def source_highlight(elem)
  @highlighter or return
  markup = source_remove_markup(elem)
  p = source_lex(elem)
  elem.children = if elem["linenums"] == "true"
                    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