require "spec_helper" require "nokogiri" RSpec.describe IsoDoc::Iec::Metadata do it "processes IsoXML metadata" do c = IsoDoc::Iec::HtmlConvert.new({}) arr = c.convert_init(<<~"INPUT", "test", false) INPUT expect(Hash[c.info(Nokogiri::XML(<<~"INPUT"), nil).sort]).to be_equivalent_to <<~"OUTPUT" Cereals and pulses Specifications and test methods Rice Céréales et légumineuses Spécification et méthodes d'essai Riz ISO/PreCD3 17301-1 17301 1730 2011 2012 20102011 2013 2014 2 2016-05-01 0.4 International Organization for Standardization ISO International Organization for Standardization ISO en 35 20 3 2016 ISO international-standard Food products Cereals and pulses Rice Group GB ISO/PreCD3 17301 INPUT {:accesseddate=>"2012", :activateddate=>"2013", :agency=>"ISO", :authors=>[], :authors_affiliations=>{}, :createddate=>"2010–2011", :docnumber=>"ISO/PreCD3 17301-1", :docnumeric=>"1730", :docsubtitle=>"Céréales et légumineuses — Spécification et méthodes d'essai — Partie 1: Riz", :docsubtitleintro=>"Céréales et légumineuses", :docsubtitlemain=>"Spécification et méthodes d'essai", :docsubtitlepart=>"Riz", :docsubtitlepartlabel=>"Partie 1", :doctitle=>"Cereals and pulses — Specifications and test methods — Part 1: Rice", :doctitleintro=>"Cereals and pulses", :doctitlemain=>"Specifications and test methods", :doctitlepart=>"Rice", :doctitlepartlabel=>"Part 1", :doctype=>"International Standard", :docyear=>"2016", :draft=>"0.4", :draftinfo=>" (draft 0.4, 2016-05-01)", :edition=>"2", :editorialgroup=>["TC 34", "SC 4", "WG 3"], :ics=>"XXX", :obsoleteddate=>"2014", :obsoletes=>nil, :obsoletes_part=>nil, :publisheddate=>"2011", :publisher=>"International Organization for Standardization", :revdate=>"2016-05-01", :revdate_monthyear=>"May 2016", :sc=>"SC 4", :secretariat=>"GB", :stage=>"35", :stage_int=>35, :stageabbr=>"CD", :statusabbr=>"3CD", :tc=>"TC 34", :tc_docnumber=>["17301"], :unpublished=>true, :wg=>"WG 3"} OUTPUT end it "processes IsoXML metadata" do c = IsoDoc::Iec::HtmlConvert.new({}) arr = c.convert_init(<<~"INPUT", "test", false) INPUT expect(Hash[c.info(Nokogiri::XML(<<~"INPUT"), nil).sort]).to be_equivalent_to <<~"OUTPUT" <title type="title-intro" language="en" format="text/plain">Cereals and pulses Specifications and test methods Rice <title type="title-intro" language="fr" format="text/plain">Céréales et légumineuses Spécification et méthodes d'essai Riz ISO/IEC/CD 17301-1-3 17301 International Organization for Standardization ISO International Organization for Standardization ISO International Electrotechnical Commission IEC en 50 20 2016 International Organization for Standardization 3.1 IEC 8121 technical-report Food products Cereals and pulses Rice Group 1.2.3 1.2.3 ISO/IEC/CD 17301 INPUT {:agency=>"ISO/IEC", :authors=>[], :authors_affiliations=>{}, :docnumber=>"ISO/IEC/CD 17301-1-3", :docnumeric=>nil, :docsubtitle=>"Céréales et légumineuses — Spécification et méthodes d'essai — Partie 1–3: Riz", :docsubtitleintro=>"Céréales et légumineuses", :docsubtitlemain=>"Spécification et méthodes d'essai", :docsubtitlepart=>"Riz", :docsubtitlepartlabel=>"Partie 1–3", :doctitle=>"Cereals and pulses — Specifications and test methods — Part 1–3: Rice", :doctitleintro=>"Cereals and pulses", :doctitlemain=>"Specifications and test methods", :doctitlepart=>"Rice", :doctitlepartlabel=>"Part 1–3", :doctype=>"Technical Report", :docyear=>"2016", :draft=>nil, :draftinfo=>"", :edition=>nil, :editorialgroup=>["ABC 34", "DEF 4", "GHI 3"], :ics=>"1.2.3, 1.2.3", :obsoletes=>"IEC 8121", :obsoletes_part=>"3.1", :publisher=>"International Organization for Standardization and International Electrotechnical Commission", :revdate=>nil, :revdate_monthyear=>nil, :sc=>"DEF 4", :secretariat=>"XXXX", :stage=>"50", :stage_int=>50, :stageabbr=>"FDIS", :statusabbr=>"CFDIS", :tc=>"ABC 34", :tc_docnumber=>["17301"], :unpublished=>true, :wg=>"GHI 3"} OUTPUT end end