Method: IsoDoc::Function::Utils#noko

Defined in:
lib/isodoc/function/utils.rb

#noko(&block) ⇒ Object

block for processing XML document fragments as XHTML, to allow for HTMLentities



30
31
32
33
34
35
36
37
# File 'lib/isodoc/function/utils.rb', line 30

def noko(&block)
  doc = ::Nokogiri::XML.parse(NOKOHEAD)
  fragment = doc.fragment("")
  ::Nokogiri::XML::Builder.with fragment, &block
  fragment.to_xml(encoding: "US-ASCII").lines.map do |l|
    l.gsub(/\s*\n/, "")
  end
end