Class: Metanorma::Document::Components::AncillaryBlocks::SourcecodeBody

Inherits:
Lutaml::Model::Serializable
  • Object
show all
Defined in:
lib/metanorma/document/components/ancillary_blocks/sourcecode_body.rb

Instance Method Summary collapse

Instance Method Details

#decoded_contentObject

The source text with XML entities DECODED (&lt;<).

content is markup-encoded by design: map_all_content keeps the raw inner markup so to_xml can re-emit it verbatim (roundtrip fidelity). Consumers that display the code as text need the decoded form — without it they double-escape (&amp;lt;) or hand-roll fragile gsub chains. Comments in the listing stay literal ("").



25
26
27
# File 'lib/metanorma/document/components/ancillary_blocks/sourcecode_body.rb', line 25

def decoded_content
  CGI.unescapeHTML(Array(content).join)
end