lib/utils/xml.rb in metanorma-utils-1.7.2 vs lib/utils/xml.rb in metanorma-utils-1.7.3

- old
+ new

@@ -133,8 +133,17 @@ e = v.elements and e.size == 1 && e.first.name == "p" and v = e.first v.name = name ins.next = v ins.next end + + def case_transform_xml(xml, kase) + x = Nokogiri::XML("<root>#{xml}</root>") + x.traverse do |e| + e.text? or next + e.replace(e.text.send(kase)) + end + x.root.children.to_xml + end end end end