Method: IsoDoc::PresentationXMLConvert#source_lex
- Defined in:
- lib/isodoc/presentation_function/sourcecode.rb
#source_lex(elem, lang) ⇒ Object
174 175 176 177 178 179 180 181 |
# File 'lib/isodoc/presentation_function/sourcecode.rb', line 174 def source_lex(elem, lang) lexer = Rouge::Lexer.find(lang || "plaintext") || Rouge::Lexer.find("plaintext") l = Rouge::Lexers::Escape.new(start: "{^^{", end: "}^^}", lang: lexer) source = to_xml(elem.children).gsub(/</, "{^^{<").gsub(/>/, ">}^^}") l.lang.reset! l.lex(@c.decode(source)) end |