Sha256: 9a5021378ab3158f6c1a95f1b586757b84ddce2552e421a5e21505e95c28beaf
Contents?: true
Size: 1.49 KB
Versions: 3
Compression:
Stored size: 1.49 KB
Contents
module Relaton module Plateau class XMLParser < RelatonBib::XMLParser class << self private # # Parse bibitem data # # @param bibitem [Nokogiri::XML::Element] bibitem element # # @return [Hash] bibitem data # def item_data(doc) resp = super ext = doc.at("./ext") return resp unless ext resp[:cover] = fetch_cover ext resp[:filesize] = fetch_filesize ext resp[:stagename] = fetch_stagename ext resp end def fetch_cover(ext) img = ext.at("./cover/image") return unless img Cover.new fetch_image(img) end def fetch_filesize(elm) fs = elm.at("./filesize") return unless fs fs.text.to_i end def fetch_stagename(ext) sn = ext.at("./stagename") return unless sn Stagename.new content: sn.text, abbreviation: sn[:abbreviation] end # # override RelatonBib::XMLParser#bib_item method # # @param item_hash [Hash] # # @return [RelatonCcsds::BibliographicItem] # def bib_item(item_hash) BibItem.new(**item_hash) end def create_docid(**args) Docidentifier.new(**args) end def create_doctype(type) DocumentType.new type: type.text, abbreviation: type[:abbreviation] end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
relaton-plateau-1.20.0 | lib/relaton/plateau/xml_parser.rb |
relaton-plateau-1.19.5 | lib/relaton/plateau/xml_parser.rb |
relaton-plateau-1.19.4 | lib/relaton/plateau/xml_parser.rb |