Method: IsoDoc::PresentationXMLConvert#sourcecode_table_to_elem

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

#sourcecode_table_to_elem(elem, tokens) ⇒ Object



133
134
135
136
137
138
139
140
141
# File 'lib/isodoc/presentation_function/sourcecode.rb', line 133

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