Module: GEPUB::XMLUtil
Constant Summary collapse
- OPF_NS =
'http://www.idpf.org/2007/opf'
- DC_NS =
'http://purl.org/dc/elements/1.1/'
Instance Method Summary collapse
Instance Method Details
#attr_to_hash(nokogiri_attrs) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/gepub/xml_util.rb', line 14 def attr_to_hash(nokogiri_attrs) attributes = {} nokogiri_attrs.each { |k,v| attributes[k] = v.to_s } if attributes['lang'] attributes['xml:lang'] = attributes['lang']; attributes.delete('lang') end attributes end |
#ns_prefix(ns) ⇒ Object
5 6 7 8 |
# File 'lib/gepub/xml_util.rb', line 5 def ns_prefix(ns) prefix = raw_prefix(ns) prefix.nil? ? nil : prefix.sub(/^xmlns:/,'') end |
#raw_prefix(ns) ⇒ Object
10 11 12 |
# File 'lib/gepub/xml_util.rb', line 10 def raw_prefix(ns) @namespaces.key(ns) end |