Method: IsoDoc::ClassUtils#case_with_markup

Defined in:
lib/isodoc/class_utils.rb

#case_with_markup(linkend, casing, script, firstonly: true) ⇒ Object



55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/isodoc/class_utils.rb', line 55

def case_with_markup(linkend, casing, script, firstonly: true)
  seen = false
  xml = Nokogiri::XML("<root>#{linkend}</root>")
  xml.traverse do |b|
    next unless b.text? && !seen

    b.replace(Common::case_strict(b.text, casing, script,
                                  firstonly: firstonly))
    seen = true if firstonly
  end
  to_xml(xml.root.children)
end