Sha256: 2b5c4d6c11e08e0bea7f65e105dc7a9eaee41e03db5999a50e967ebb90220132

Contents?: true

Size: 555 Bytes

Versions: 2

Compression:

Stored size: 555 Bytes

Contents

module GEPUB
  module XMLUtil
    OPF_NS = 'http://www.idpf.org/2007/opf'
    DC_NS = 'http://purl.org/dc/elements/1.1/'
    def ns_prefix(ns)
      prefix = raw_prefix(ns)
      prefix.nil? ? nil : prefix.sub(/^xmlns:/,'')
    end

    def raw_prefix(ns)
      @namespaces.key(ns)      
    end

    def attr_to_hash(nokogiri_attrs)
      attributes = {}
      nokogiri_attrs.each {
        |k,v|
        attributes[k] = v.to_s
      }
      attributes['xml:lang'] = attributes['lang'];
      attributes.delete('lang')
      attributes
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
gepub-0.6.1 lib/gepub/xml_util.rb
gepub-0.6.0 lib/gepub/xml_util.rb