Method: IsoDoc::PresentationXMLConvert#sourcecode_table_to_elem

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

#sourcecode_table_to_elem(elem, tokens) ⇒ Object



164
165
166
167
168
169
170
171
172
# File 'lib/isodoc/presentation_function/sourcecode.rb', line 164

def sourcecode_table_to_elem(elem, tokens)
  r = Nokogiri::XML(@highlighter[:formatter_line].format(tokens)).root
  r.xpath(".//td[@class = 'rouge-code']/pre").each do |pre|
    %w(style).each { |n| elem[n] and pre[n] = elem[n] }
    pre.name = "sourcecode"
    pre.children = to_xml(pre.children).sub(/\s+$/, "")
  end
  r
end