require "spec_helper" require "fileutils" RSpec.describe Asciidoctor::ISO do it "processes amendment sections" do expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT") #{AMD_BLANK_HDR} == Foreword Text == Introduction === Introduction Subsection == Scope Text == Acknowledgements == Normative References == Terms and Definitions === Term1 == Terms, Definitions, Symbols and Abbreviated Terms === Normal Terms ==== Term2 === Symbols and Abbreviated Terms == Symbols and Abbreviated Terms == Clause 4 === Introduction === Clause 4.2 == Terms and Definitions [appendix] == Annex === Annex A.1 [%appendix] === Appendix 1 == Bibliography === Bibliography Subsection INPUT #{BLANK_HDR.sub(%r{article}, "amendment")} Foreword

Text

Introduction Introduction Subsection Scope

Text

Acknowledgements Normative References Terms and Definitions Term1 Terms, Definitions, Symbols and Abbreviated Terms Normal Terms Term2 Symbols and Abbreviated Terms Symbols and Abbreviated Terms Clause 4 Introduction Clause 4.2 Terms and Definitions Bibliography Bibliography Subsection
Annex Annex A.1 Appendix 1 OUTPUT end it "processes default metadata, amendment" do expect(xmlpp(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true).sub(%r{.*}m, ""))).to be_equivalent_to xmlpp(<<~"OUTPUT") = Document title Author :docfile: test.adoc :nodoc: :novalid: :no-isobib: :docnumber: 17301 :partnumber: 1 :edition: 2 :revdate: 2000-01-01 :draft: 0.3.4 :technical-committee: TC :technical-committee-number: 1 :technical-committee-type: A :subcommittee: SC :subcommittee-number: 2 :subcommittee-type: B :workgroup: WG :workgroup-number: 3 :workgroup-type: C :technical-committee_2: TC1 :technical-committee-number_2: 11 :technical-committee-type_2: A1 :subcommittee_2: SC1 :subcommittee-number_2: 21 :subcommittee-type_2: B1 :workgroup_2: WG1 :workgroup-number_2: 31 :workgroup-type_2: C1 :secretariat: SECRETARIAT :docstage: 10 :docsubstage: 20 :iteration: 3 :language: en :title-intro-en: Introduction :title-main-en: Main Title -- Title :title-part-en: Title Part :title-intro-fr: Introduction Française :title-main-fr: Titre Principal :title-part-fr: Part du Titre :library-ics: 1,2,3 :copyright-year: 2017 :updates: ISO 17301-1:2016 :created-date: 2016-05-01 :amendment-number: 1 :title-amendment-en: Mass fraction of extraneous matter, milled rice (nonglutinous), sample dividers and recommendations relating to storage and transport conditions :title-amendment-fr: Fraction massique de matière étrangère, riz usiné (non gluant), diviseurs d’échantillon et recommandations relatives aux conditions d’entreposage et de transport :doctype: amendment :updates-document-type: international-standard INPUT Introduction — Main Title — Title — Title Part — Mass fraction of extraneous matter, milled rice (nonglutinous), sample dividers and recommendations relating to storage and transport conditions Introduction Main Title — Title Title Part Mass fraction of extraneous matter, milled rice (nonglutinous), sample dividers and recommendations relating to storage and transport conditions Introduction Française — Titre Principal — Part du Titre — Fraction massique de matière étrangère, riz usiné (non gluant), diviseurs d’échantillon et recommandations relatives aux conditions d’entreposage et de transport Introduction Française Titre Principal Part du Titre Fraction massique de matière étrangère, riz usiné (non gluant), diviseurs d’échantillon et recommandations relatives aux conditions d’entreposage et de transport ISO 17301-1:2016/PreNP Amd 1 ISO 17301-1:2016/PreNP Amd 1(E) ISO 17301-1:2016/PreNP Amd 1:2017(E) 17301 2016-05-01 International Organization for Standardization ISO International Organization for Standardization ISO 2 2000-01-01 0.3.4 en 10 20 3 2017 International Organization for Standardization ISO amendment TC TC1 SC SC1 WG WG1 SECRETARIAT 1 2 3 17301 New work item proposal international-standard OUTPUT end it "processes metadata, amendment" do expect(xmlpp(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true).sub(%r{.*}m, ""))).to be_equivalent_to xmlpp(<<~"OUTPUT") = Document title Author :docfile: test.adoc :nodoc: :novalid: :no-isobib: :docnumber: 17301 :partnumber: 1 :doctype: amendment :docstage: 30 :updates: ISO 17301-1:2030 :amendment-number: 1 INPUT ISO 17301-1:2030/CD Amd 1 ISO 17301-1:2030/CD Amd 1(E) ISO 17301-1:2030/CD Amd 1(E) 17301 International Organization for Standardization ISO International Organization for Standardization ISO en 30 00 2020 International Organization for Standardization ISO amendment 17301 Committee draft OUTPUT end it "processes metadata, amendment" do expect(xmlpp(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true).sub(%r{.*}m, ""))).to be_equivalent_to xmlpp(<<~"OUTPUT") = Document title Author :docfile: test.adoc :nodoc: :novalid: :no-isobib: :docnumber: 17301 :partnumber: 1 :doctype: amendment :docstage: 40 :updates: ISO 17301-1:2030 :amendment-number: 1 INPUT ISO 17301-1:2030/DAmd 1 ISO 17301-1:2030/DAmd 1(E) ISO 17301-1:2030/DAmd 1(E) 17301 International Organization for Standardization ISO International Organization for Standardization ISO en 40 00 2020 International Organization for Standardization ISO amendment 17301 Draft OUTPUT end it "processes metadata, amendment" do expect(xmlpp(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true).sub(%r{.*}m, ""))).to be_equivalent_to xmlpp(<<~"OUTPUT") = Document title Author :docfile: test.adoc :nodoc: :novalid: :no-isobib: :docnumber: 17301 :partnumber: 1 :doctype: amendment :updates: ISO 17301-1:2030 :amendment-number: 1 INPUT ISO 17301-1:2030/Amd 1 ISO 17301-1:2030/Amd 1(E) ISO 17301-1:2030/Amd 1(E) 17301 International Organization for Standardization ISO International Organization for Standardization ISO en 60 60 2020 International Organization for Standardization ISO amendment 17301 International standard OUTPUT end it "processes metadata, corrigendum" do expect(xmlpp(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true).sub(%r{.*}m, ""))).to be_equivalent_to xmlpp(<<~"OUTPUT") = Document title Author :docfile: test.adoc :nodoc: :novalid: :no-isobib: :docnumber: 17301 :partnumber: 1 :doctype: technical-corrigendum :docstage: 30 :updates: ISO 17301-1:2030 :corrigendum-number: 3 INPUT ISO 17301-1:2030/CD Cor.3 ISO 17301-1:2030/CD Cor.3(E) ISO 17301-1:2030/CD Cor.3(E) 17301 International Organization for Standardization ISO International Organization for Standardization ISO en 30 00 2020 International Organization for Standardization ISO technical-corrigendum 17301 Committee draft OUTPUT end it "processes metadata, corrigendum" do expect(xmlpp(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true).sub(%r{.*}m, ""))).to be_equivalent_to xmlpp(<<~"OUTPUT") = Document title Author :docfile: test.adoc :nodoc: :novalid: :no-isobib: :docnumber: 17301 :partnumber: 1 :doctype: technical-corrigendum :docstage: 50 :updates: ISO 17301-1:2030 :corrigendum-number: 3 INPUT ISO 17301-1:2030/FDCor.3 ISO 17301-1:2030/FDCor.3(E) ISO 17301-1:2030/FDCor.3(E) 17301 International Organization for Standardization ISO International Organization for Standardization ISO en 50 00 2020 International Organization for Standardization ISO technical-corrigendum 17301 Final draft OUTPUT end it "processes metadata, corrigendum" do expect(xmlpp(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true).sub(%r{.*}m, ""))).to be_equivalent_to xmlpp(<<~"OUTPUT") = Document title Author :docfile: test.adoc :nodoc: :novalid: :no-isobib: :docnumber: 17301 :partnumber: 1 :doctype: technical-corrigendum :updates: ISO 17301-1:2030 :corrigendum-number: 3 INPUT ISO 17301-1:2030/Cor.3 ISO 17301-1:2030/Cor.3(E) ISO 17301-1:2030/Cor.3(E) 17301 International Organization for Standardization ISO International Organization for Standardization ISO en 60 60 2020 International Organization for Standardization ISO technical-corrigendum 17301 International standard OUTPUT end end