metanorma-iso 1.5.6 → 1.5.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/macos.yml +9 -1
  3. data/.github/workflows/ubuntu.yml +8 -0
  4. data/.github/workflows/windows.yml +7 -0
  5. data/lib/asciidoctor/iso/basicdoc.rng +4 -11
  6. data/lib/asciidoctor/iso/boilerplate-fr.xml +40 -0
  7. data/lib/asciidoctor/iso/boilerplate.xml +1 -0
  8. data/lib/asciidoctor/iso/cleanup.rb +5 -0
  9. data/lib/asciidoctor/iso/front.rb +9 -15
  10. data/lib/asciidoctor/iso/isodoc.rng +14 -50
  11. data/lib/asciidoctor/iso/isostandard.rng +8 -1
  12. data/lib/isodoc/iso/html/header.html +8 -16
  13. data/lib/isodoc/iso/html/style-human.css +5 -1
  14. data/lib/isodoc/iso/html/style-iso.css +5 -1
  15. data/lib/isodoc/iso/i18n-en.yaml +3 -0
  16. data/lib/isodoc/iso/i18n-fr.yaml +3 -0
  17. data/lib/isodoc/iso/i18n-zh-Hans.yaml +4 -0
  18. data/lib/isodoc/iso/iso.amendment.xsl +543 -94
  19. data/lib/isodoc/iso/iso.international-standard.xsl +543 -94
  20. data/lib/isodoc/iso/isosts_convert.rb +31 -0
  21. data/lib/isodoc/iso/metadata.rb +19 -19
  22. data/lib/metanorma-iso.rb +1 -0
  23. data/lib/metanorma/iso/processor.rb +1 -1
  24. data/lib/metanorma/iso/version.rb +1 -1
  25. data/metanorma-iso.gemspec +1 -1
  26. data/spec/asciidoctor-iso/amd_spec.rb +7 -7
  27. data/spec/asciidoctor-iso/base_spec.rb +144 -18
  28. data/spec/asciidoctor-iso/validate_spec.rb +35 -15
  29. data/spec/assets/xref_error.adoc +7 -0
  30. data/spec/isodoc/amd_spec.rb +191 -17
  31. data/spec/isodoc/blocks_spec.rb +1 -1
  32. data/spec/isodoc/i18n_spec.rb +13 -13
  33. data/spec/isodoc/inline_spec.rb +2 -2
  34. data/spec/isodoc/iso_spec.rb +2 -2
  35. data/spec/isodoc/metadata_spec.rb +170 -19
  36. data/spec/isodoc/postproc_spec.rb +3 -3
  37. data/spec/isodoc/ref_spec.rb +3 -3
  38. data/spec/isodoc/section_spec.rb +2 -2
  39. data/spec/isodoc/table_spec.rb +1 -1
  40. data/spec/isodoc/terms_spec.rb +1 -1
  41. data/spec/isodoc/xref_spec.rb +11 -11
  42. data/spec/metanorma/processor_spec.rb +1 -1
  43. data/spec/spec_helper.rb +22 -2
  44. metadata +7 -4
@@ -0,0 +1,7 @@
1
+ = X
2
+ A
3
+
4
+ == Clause
5
+
6
+ <<a,b>>
7
+
@@ -2,7 +2,7 @@ require "spec_helper"
2
2
 
3
3
  RSpec.describe IsoDoc do
4
4
  it "cross-references notes in amendments" do
5
- expect(xmlpp(IsoDoc::Iso::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
5
+ expect(xmlpp(IsoDoc::Iso::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true)).sub(%r{<localized-strings>.*</localized-strings>}m, "")).to be_equivalent_to xmlpp(<<~"OUTPUT")
6
6
  <iso-standard xmlns="http://riboseinc.com/isoxml">
7
7
  <bibdata> <ext> <doctype>amendment</doctype> </ext> </bibdata>
8
8
  <preface>
@@ -57,10 +57,10 @@ RSpec.describe IsoDoc do
57
57
  </iso-standard>
58
58
  INPUT
59
59
  <?xml version='1.0'?>
60
- <iso-standard xmlns='http://riboseinc.com/isoxml'>
60
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
61
61
  <bibdata>
62
62
  <ext>
63
- <doctype>amendment</doctype>
63
+ <doctype language="">amendment</doctype>
64
64
  </ext>
65
65
  </bibdata>
66
66
  <preface>
@@ -153,7 +153,7 @@ RSpec.describe IsoDoc do
153
153
  end
154
154
 
155
155
  it "cross-references sections" do
156
- expect(xmlpp(IsoDoc::Iso::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
156
+ expect(xmlpp(IsoDoc::Iso::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true)).sub(%r{<localized-strings>.*</localized-strings>}m, "")).to be_equivalent_to xmlpp(<<~"OUTPUT")
157
157
  <iso-standard xmlns="http://riboseinc.com/isoxml">
158
158
  <bibdata> <ext> <doctype>amendment</doctype> </ext> </bibdata>
159
159
  <preface>
@@ -218,10 +218,10 @@ RSpec.describe IsoDoc do
218
218
  </iso-standard>
219
219
  INPUT
220
220
  <?xml version='1.0'?>
221
- <iso-standard xmlns='http://riboseinc.com/isoxml'>
221
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
222
222
  <bibdata>
223
223
  <ext>
224
- <doctype>amendment</doctype>
224
+ <doctype language="">amendment</doctype>
225
225
  </ext>
226
226
  </bibdata>
227
227
  <preface>
@@ -396,10 +396,10 @@ RSpec.describe IsoDoc do
396
396
  </iso-standard>
397
397
  INPUT
398
398
  presxml = <<~OUTPUT
399
- <iso-standard xmlns='http://riboseinc.com/isoxml'>
399
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
400
400
  <bibdata>
401
401
  <ext>
402
- <doctype>amendment</doctype>
402
+ <doctype language="">amendment</doctype>
403
403
  </ext>
404
404
  </bibdata>
405
405
  <boilerplate>
@@ -618,7 +618,7 @@ RSpec.describe IsoDoc do
618
618
  </body>
619
619
  </html>
620
620
  OUTPUT
621
- expect(xmlpp(IsoDoc::Iso::PresentationXMLConvert.new({}).convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
621
+ expect(xmlpp(IsoDoc::Iso::PresentationXMLConvert.new({}).convert("test", input, true)).sub(%r{<localized-strings>.*</localized-strings>}m, "")).to be_equivalent_to xmlpp(presxml)
622
622
  expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({}).convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
623
623
  end
624
624
 
@@ -627,7 +627,7 @@ OUTPUT
627
627
  arr = c.convert_init(<<~"INPUT", "test", false)
628
628
  <iso-standard xmlns="http://riboseinc.com/isoxml">
629
629
  INPUT
630
- expect(Hash[c.info(Nokogiri::XML(<<~"INPUT"), nil).sort]).to be_equivalent_to <<~"OUTPUT"
630
+ expect(metadata(c.info(Nokogiri::XML(<<~"INPUT"), nil))).to be_equivalent_to <<~"OUTPUT"
631
631
  <iso-standard xmlns='https://www.metanorma.org/ns/iso'>
632
632
  <bibdata type='standard'>
633
633
  <title language='en' format='text/plain' type='main'>Introduction — Main Title — Title — Title Part  — Mass fraction of
@@ -719,9 +719,11 @@ OUTPUT
719
719
  <sections/>
720
720
  </iso-standard>
721
721
  INPUT
722
- {:agency=>"ISO",
723
- :authors=>[],
724
- :authors_affiliations=>{},
722
+ {:accesseddate=>"XXX",
723
+ :agency=>"ISO",
724
+ :circulateddate=>"XXX",
725
+ :confirmeddate=>"XXX",
726
+ :copieddate=>"XXX",
725
727
  :createddate=>"2016-05-01",
726
728
  :docnumber=>"ISO/PreNWIP3 17301-1:2016/Amd.1",
727
729
  :docnumber_lang=>"ISO/PreNWIP3 17301-1:2016/Amd.1(E)",
@@ -744,31 +746,203 @@ INPUT
744
746
  :doctitlepart=>"Title Part",
745
747
  :doctitlepartlabel=>"Part&nbsp;1",
746
748
  :doctype=>"Amendment",
749
+ :doctype_display=>"Amendment",
747
750
  :docyear=>"2017",
748
751
  :draft=>"0.3.4",
749
752
  :draftinfo=>" (draft 0.3.4, 2000-01-01)",
750
753
  :edition=>"2",
751
754
  :editorialgroup=>["A 1", "B 2", "C 3"],
752
755
  :ics=>"1, 2, 3",
753
- :keywords=>[],
754
- :obsoletes=>nil,
755
- :obsoletes_part=>nil,
756
+ :implementeddate=>"XXX",
757
+ :issueddate=>"XXX",
758
+ :lang=>"en",
759
+ :obsoleteddate=>"XXX",
760
+ :publisheddate=>"XXX",
756
761
  :publisher=>"International Organization for Standardization",
762
+ :receiveddate=>"XXX",
757
763
  :revdate=>"2000-01-01",
758
764
  :revdate_monthyear=>"January 2000",
759
765
  :sc=>"B 2",
766
+ :script=>"Latn",
760
767
  :secretariat=>"SECRETARIAT",
761
768
  :stage=>"10",
762
769
  :stage_int=>10,
763
770
  :stageabbr=>"NWIP",
764
771
  :statusabbr=>"PreNWIP3",
765
772
  :tc=>"A 1",
766
- :tc_docnumber=>[],
773
+ :transmitteddate=>"XXX",
774
+ :unchangeddate=>"XXX",
767
775
  :unpublished=>true,
776
+ :updateddate=>"XXX",
777
+ :vote_endeddate=>"XXX",
778
+ :vote_starteddate=>"XXX",
768
779
  :wg=>"C 3"}
769
780
  OUTPUT
770
781
  end
771
782
 
783
+ it "processes IsoXML metadata in French" do
784
+ c = IsoDoc::Iso::HtmlConvert.new({})
785
+ arr = c.convert_init(<<~"INPUT", "test", false)
786
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
787
+ <bibdata>
788
+ <language>fr</language>
789
+ </bibdata>
790
+ </iso-standard>
791
+ INPUT
792
+ expect(metadata(c.info(Nokogiri::XML(<<~"INPUT"), nil))).to be_equivalent_to <<~"OUTPUT"
793
+ <iso-standard xmlns='https://www.metanorma.org/ns/iso'>
794
+ <bibdata type='standard'>
795
+ <title language='en' format='text/plain' type='main'>Introduction — Main Title — Title — Title Part  — Mass fraction of
796
+ extraneous matter, milled rice (nonglutinous), sample dividers and
797
+ recommendations relating to storage and transport conditions</title>
798
+ <title language='en' format='text/plain' type='title-intro'>Introduction</title>
799
+ <title language='en' format='text/plain' type='title-main'>Main Title — Title</title>
800
+ <title language='en' format='text/plain' type='title-part'>Title Part</title>
801
+ <title language='en' format='text/plain' type='title-amd'>Mass fraction of extraneous matter, milled rice (nonglutinous), sample dividers and recommendations relating to storage and transport conditions</title>
802
+ <title language='fr' format='text/plain' type='main'>
803
+ Introduction Française — Titre Principal — Part du Titre — Fraction
804
+ massique de matière étrangère, riz usiné (non gluant), diviseurs
805
+ d’échantillon et recommandations relatives aux conditions d’entreposage et
806
+ de transport
807
+ </title>
808
+ <title language='fr' format='text/plain' type='title-intro'>Introduction Française</title>
809
+ <title language='fr' format='text/plain' type='title-main'>Titre Principal</title>
810
+ <title language='fr' format='text/plain' type='title-part'>Part du Titre</title>
811
+ <title language='fr' format='text/plain' type='title-amd'>Fraction massique de matière étrangère, riz usiné (non gluant), diviseurs d’échantillon et recommandations relatives aux conditions d’entreposage et de transport</title>
812
+ <docidentifier type='ISO'>ISO/PreNWIP3 17301-1:2016/Amd.1</docidentifier>
813
+ <docidentifier type='iso-with-lang'>ISO/PreNWIP3 17301-1:2016/Amd.1(E)</docidentifier>
814
+ <docidentifier type='iso-reference'>ISO/PreNWIP3 17301-1:2016/Amd.1:2017(E)</docidentifier>
815
+ <docnumber>17301</docnumber>
816
+ <date type='created'>
817
+ <on>2016-05-01</on>
818
+ </date>
819
+ <contributor>
820
+ <role type='author'/>
821
+ <organization>
822
+ <name>International Organization for Standardization</name>
823
+ <abbreviation>ISO</abbreviation>
824
+ </organization>
825
+ </contributor>
826
+ <contributor>
827
+ <role type='publisher'/>
828
+ <organization>
829
+ <name>International Organization for Standardization</name>
830
+ <abbreviation>ISO</abbreviation>
831
+ </organization>
832
+ </contributor>
833
+ <edition>2</edition>
834
+ <version>
835
+ <revision-date>2000-01-01</revision-date>
836
+ <draft>0.3.4</draft>
837
+ </version>
838
+ <language>fr</language>
839
+ <script>Latn</script>
840
+ <status>
841
+ <stage abbreviation='NWIP'>10</stage>
842
+ <substage>20</substage>
843
+ <iteration>3</iteration>
844
+ </status>
845
+ <copyright>
846
+ <from>2017</from>
847
+ <owner>
848
+ <organization>
849
+ <name>International Organization for Standardization</name>
850
+ <abbreviation>ISO</abbreviation>
851
+ </organization>
852
+ </owner>
853
+ </copyright>
854
+ <ext>
855
+ <doctype language="">amendment</doctype>
856
+ <doctype language="fr">Amendment</doctype>
857
+ <editorialgroup>
858
+ <technical-committee number='1' type='A'>TC</technical-committee>
859
+ <technical-committee number='11' type='A1'>TC1</technical-committee>
860
+ <subcommittee number='2' type='B'>SC</subcommittee>
861
+ <subcommittee number='21' type='B1'>SC1</subcommittee>
862
+ <workgroup number='3' type='C'>WG</workgroup>
863
+ <workgroup number='31' type='C1'>WG1</workgroup>
864
+ <secretariat>SECRETARIAT</secretariat>
865
+ </editorialgroup>
866
+ <ics>
867
+ <code>1</code>
868
+ </ics>
869
+ <ics>
870
+ <code>2</code>
871
+ </ics>
872
+ <ics>
873
+ <code>3</code>
874
+ </ics>
875
+ <structuredidentifier>
876
+ <project-number part='1' amendment='1' corrigendum='2' origyr='2016-05-01'>17301</project-number>
877
+ </structuredidentifier>
878
+ <stagename>New work item proposal</stagename>
879
+ <updates-document-type>international-standard</updates-document-type>
880
+ </ext>
881
+ </bibdata>
882
+ <sections/>
883
+ </iso-standard>
884
+ INPUT
885
+ {:accesseddate=>"XXX",
886
+ :agency=>"ISO",
887
+ :circulateddate=>"XXX",
888
+ :confirmeddate=>"XXX",
889
+ :copieddate=>"XXX",
890
+ :createddate=>"2016-05-01",
891
+ :docnumber=>"ISO/PreNWIP3 17301-1:2016/Amd.1",
892
+ :docnumber_lang=>"ISO/PreNWIP3 17301-1:2016/Amd.1(E)",
893
+ :docnumber_reference=>"ISO/PreNWIP3 17301-1:2016/Amd.1:2017(E)",
894
+ :docnumeric=>"17301",
895
+ :docsubtitle=>"Introduction&nbsp;&mdash; Main Title&#x2009;&#x2014;&#x2009;Title&nbsp;&mdash; Part&nbsp;1: Title Part",
896
+ :docsubtitleamd=>"Mass fraction of extraneous matter, milled rice (nonglutinous), sample dividers and recommendations relating to storage and transport conditions",
897
+ :docsubtitleamdlabel=>"AMENDMENT&nbsp;1",
898
+ :docsubtitlecorrlabel=>"TECHNICAL CORRIGENDUM&nbsp;2",
899
+ :docsubtitleintro=>"Introduction",
900
+ :docsubtitlemain=>"Main Title&#x2009;&#x2014;&#x2009;Title",
901
+ :docsubtitlepart=>"Title Part",
902
+ :docsubtitlepartlabel=>"Part&nbsp;1",
903
+ :doctitle=>"Introduction Fran&#xe7;aise&nbsp;&mdash; Titre Principal&nbsp;&mdash; Partie&nbsp;1: Part du Titre",
904
+ :doctitleamd=>"Fraction massique de mati&#xe8;re &#xe9;trang&#xe8;re, riz usin&#xe9; (non gluant), diviseurs d&#x2019;&#xe9;chantillon et recommandations relatives aux conditions d&#x2019;entreposage et de transport",
905
+ :doctitleamdlabel=>"AMENDMENT&nbsp;1",
906
+ :doctitlecorrlabel=>"RECTIFICATIF TECHNIQUE&nbsp;2",
907
+ :doctitleintro=>"Introduction Fran&#xe7;aise",
908
+ :doctitlemain=>"Titre Principal",
909
+ :doctitlepart=>"Part du Titre",
910
+ :doctitlepartlabel=>"Partie&nbsp;1",
911
+ :doctype=>"Amendment",
912
+ :doctype_display=>"Amendment",
913
+ :docyear=>"2017",
914
+ :draft=>"0.3.4",
915
+ :draftinfo=>" (brouillon 0.3.4, 2000-01-01)",
916
+ :edition=>"2",
917
+ :editorialgroup=>["A 1", "B 2", "C 3"],
918
+ :ics=>"1, 2, 3",
919
+ :implementeddate=>"XXX",
920
+ :issueddate=>"XXX",
921
+ :lang=>"fr",
922
+ :obsoleteddate=>"XXX",
923
+ :publisheddate=>"XXX",
924
+ :publisher=>"International Organization for Standardization",
925
+ :receiveddate=>"XXX",
926
+ :revdate=>"2000-01-01",
927
+ :revdate_monthyear=>"Janvier 2000",
928
+ :sc=>"B 2",
929
+ :script=>"Latn",
930
+ :secretariat=>"SECRETARIAT",
931
+ :stage=>"10",
932
+ :stage_int=>10,
933
+ :stageabbr=>"NWIP",
934
+ :statusabbr=>"PreNWIP3",
935
+ :tc=>"A 1",
936
+ :transmitteddate=>"XXX",
937
+ :unchangeddate=>"XXX",
938
+ :unpublished=>true,
939
+ :updateddate=>"XXX",
940
+ :vote_endeddate=>"XXX",
941
+ :vote_starteddate=>"XXX",
942
+ :wg=>"C 3"}
943
+ OUTPUT
944
+ end
945
+
772
946
  it "processes middle title" do
773
947
  expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
774
948
  <iso-standard xmlns="http://riboseinc.com/isoxml">
@@ -272,7 +272,7 @@ RSpec.describe IsoDoc do
272
272
  </iso-standard>
273
273
  INPUT
274
274
  <?xml version='1.0'?>
275
- <iso-standard xmlns='http://riboseinc.com/isoxml'>
275
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
276
276
  <preface>
277
277
  <foreword>
278
278
  <formula id='_be9158af-7e93-4ee2-90c5-26d31c181934' unnumbered='true'>
@@ -72,9 +72,9 @@ RSpec.describe IsoDoc do
72
72
  INPUT
73
73
 
74
74
  presxml = <<~OUTPUT
75
- <iso-standard xmlns='http://riboseinc.com/isoxml'>
75
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
76
76
  <bibdata>
77
- <language>en</language>
77
+ <language current="true">en</language>
78
78
  </bibdata>
79
79
  <preface>
80
80
  <foreword obligation='informative'>
@@ -238,12 +238,12 @@ RSpec.describe IsoDoc do
238
238
  </body>
239
239
  </html>
240
240
  OUTPUT
241
- expect(xmlpp(IsoDoc::Iso::PresentationXMLConvert.new({}).convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
241
+ expect(xmlpp(IsoDoc::Iso::PresentationXMLConvert.new({}).convert("test", input, true)).sub(%r{<localized-strings>.*</localized-strings>}m, "")).to be_equivalent_to xmlpp(presxml)
242
242
  expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({}).convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
243
243
  end
244
244
 
245
245
  it "defaults to English" do
246
- expect(xmlpp(IsoDoc::Iso::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
246
+ expect(xmlpp(IsoDoc::Iso::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true)).sub(%r{<localized-strings>.*</localized-strings>}m, "")).to be_equivalent_to xmlpp(<<~"OUTPUT")
247
247
  <iso-standard xmlns="http://riboseinc.com/isoxml">
248
248
  <bibdata>
249
249
  <language>tlh</language>
@@ -311,9 +311,9 @@ RSpec.describe IsoDoc do
311
311
  </bibliography>
312
312
  </iso-standard>
313
313
  INPUT
314
- <iso-standard xmlns='http://riboseinc.com/isoxml'>
314
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
315
315
  <bibdata>
316
- <language>tlh</language>
316
+ <language current="true">tlh</language>
317
317
  </bibdata>
318
318
  <preface>
319
319
  <foreword obligation='informative'>
@@ -520,9 +520,9 @@ RSpec.describe IsoDoc do
520
520
  INPUT
521
521
 
522
522
  presxml = <<~OUTPUT
523
- <iso-standard xmlns='http://riboseinc.com/isoxml'>
523
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
524
524
  <bibdata>
525
- <language>fr</language>
525
+ <language current="true">fr</language>
526
526
  </bibdata>
527
527
  <preface>
528
528
  <foreword obligation='informative'>
@@ -685,7 +685,7 @@ OUTPUT
685
685
  </body>
686
686
  </html>
687
687
  OUTPUT
688
- expect(xmlpp(IsoDoc::Iso::PresentationXMLConvert.new({}).convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
688
+ expect(xmlpp(IsoDoc::Iso::PresentationXMLConvert.new({}).convert("test", input, true)).sub(%r{<localized-strings>.*</localized-strings>}m, "")).to be_equivalent_to xmlpp(presxml)
689
689
  expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({}).convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
690
690
  end
691
691
 
@@ -770,10 +770,10 @@ OUTPUT
770
770
  </iso-standard>
771
771
  INPUT
772
772
  presxml = <<~OUTPUT
773
- <iso-standard xmlns='http://riboseinc.com/isoxml'>
773
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
774
774
  <bibdata>
775
- <language>zh</language>
776
- <script>Hans</script>
775
+ <language current="true">zh</language>
776
+ <script current="true">Hans</script>
777
777
  </bibdata>
778
778
  <preface>
779
779
  <foreword obligation='informative'>
@@ -947,7 +947,7 @@ OUTPUT
947
947
  </body>
948
948
  </html>
949
949
  OUTPUT
950
- expect(xmlpp(IsoDoc::Iso::PresentationXMLConvert.new({}).convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
950
+ expect(xmlpp(IsoDoc::Iso::PresentationXMLConvert.new({}).convert("test", input, true)).sub(%r{<localized-strings>.*</localized-strings>}m, "")).to be_equivalent_to xmlpp(presxml)
951
951
  expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({}).convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
952
952
  end
953
953
 
@@ -194,7 +194,7 @@ RSpec.describe IsoDoc do
194
194
  end
195
195
 
196
196
  it "processes eref content" do
197
- expect(xmlpp(IsoDoc::Iso::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
197
+ expect(xmlpp(IsoDoc::Iso::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true)).sub(%r{<i18nyaml>.*</i18nyaml>}m, "")).to be_equivalent_to xmlpp(<<~"OUTPUT")
198
198
  <iso-standard xmlns="http://riboseinc.com/isoxml">
199
199
  <preface><foreword>
200
200
  <p>
@@ -229,7 +229,7 @@ RSpec.describe IsoDoc do
229
229
  </iso-standard>
230
230
  INPUT
231
231
  <?xml version='1.0'?>
232
- <iso-standard xmlns='http://riboseinc.com/isoxml'>
232
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
233
233
  <preface>
234
234
  <foreword>
235
235
  <p>
@@ -175,7 +175,7 @@ end
175
175
  </iso-standard>
176
176
  INPUT
177
177
  <?xml version='1.0'?>
178
- <iso-standard xmlns='http://riboseinc.com/isoxml'>
178
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
179
179
  <preface>
180
180
  <foreword>
181
181
  <example id='samplecode'>
@@ -231,7 +231,7 @@ OUTPUT
231
231
  </iso-standard>
232
232
  INPUT
233
233
  <?xml version='1.0'?>
234
- <iso-standard xmlns='http://riboseinc.com/isoxml'>
234
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
235
235
  <preface>
236
236
  <foreword>
237
237
  <example id='samplecode'>
@@ -7,7 +7,7 @@ RSpec.describe IsoDoc::Iso::Metadata do
7
7
  arr = c.convert_init(<<~"INPUT", "test", false)
8
8
  <iso-standard xmlns="http://riboseinc.com/isoxml">
9
9
  INPUT
10
- expect(Hash[c.info(Nokogiri::XML(<<~"INPUT"), nil).sort]).to be_equivalent_to <<~"OUTPUT"
10
+ expect(metadata(c.info(Nokogiri::XML(<<~"INPUT"), nil))).to be_equivalent_to <<~"OUTPUT"
11
11
  <iso-standard xmlns="http://riboseinc.com/isoxml">
12
12
  <bibdata type="standard">
13
13
  <title type="title-intro" language="en" format="text/plain">Cereals and pulses</title>
@@ -81,8 +81,9 @@ INPUT
81
81
  {:accesseddate=>"2012",
82
82
  :activateddate=>"2013",
83
83
  :agency=>"ISO",
84
- :authors=>[],
85
- :authors_affiliations=>{},
84
+ :circulateddate=>"XXX",
85
+ :confirmeddate=>"XXX",
86
+ :copieddate=>"XXX",
86
87
  :createddate=>"2010&ndash;2011",
87
88
  :docnumber=>"ISO/PreCD3 17301-1",
88
89
  :docnumber_lang=>"ISO/PreCD3 17301-1 (E)",
@@ -99,21 +100,24 @@ INPUT
99
100
  :doctitlepart=>"Rice",
100
101
  :doctitlepartlabel=>"Part&nbsp;1",
101
102
  :doctype=>"International Standard",
103
+ :doctype_display=>"International Standard",
102
104
  :docyear=>"2016",
103
105
  :draft=>"0.4",
104
106
  :draftinfo=>" (draft 0.4, 2016-05-01)",
105
107
  :edition=>"2",
106
108
  :editorialgroup=>["TC 34", "SC 4", "WG 3"],
107
- :ics=>nil,
109
+ :implementeddate=>"XXX",
110
+ :issueddate=>"XXX",
108
111
  :keywords=>["kw2", "kw1"],
112
+ :lang=>"en",
109
113
  :obsoleteddate=>"2014",
110
- :obsoletes=>nil,
111
- :obsoletes_part=>nil,
112
114
  :publisheddate=>"2011",
113
115
  :publisher=>"International Organization for Standardization",
116
+ :receiveddate=>"XXX",
114
117
  :revdate=>"2016-05-01",
115
118
  :revdate_monthyear=>"May 2016",
116
119
  :sc=>"SC 4",
120
+ :script=>"Latn",
117
121
  :secretariat=>"GB",
118
122
  :stage=>"30",
119
123
  :stage_int=>30,
@@ -121,17 +125,22 @@ INPUT
121
125
  :statusabbr=>"PreCD3",
122
126
  :tc=>"TC 34",
123
127
  :tc_docnumber=>["17301", "17302"],
128
+ :transmitteddate=>"XXX",
129
+ :unchangeddate=>"XXX",
124
130
  :unpublished=>true,
131
+ :updateddate=>"XXX",
132
+ :vote_endeddate=>"XXX",
133
+ :vote_starteddate=>"XXX",
125
134
  :wg=>"WG 3"}
126
135
  OUTPUT
127
136
  end
128
137
 
129
- it "processes IsoXML metadata" do
138
+ it "processes IsoXML metadata #2" do
130
139
  c = IsoDoc::Iso::HtmlConvert.new({})
131
140
  arr = c.convert_init(<<~"INPUT", "test", false)
132
141
  <iso-standard xmlns="http://riboseinc.com/isoxml">
133
142
  INPUT
134
- expect(Hash[c.info(Nokogiri::XML(<<~"INPUT"), nil).sort]).to be_equivalent_to <<~"OUTPUT"
143
+ expect(metadata(c.info(Nokogiri::XML(<<~"INPUT"), nil))).to be_equivalent_to <<~"OUTPUT"
135
144
  <iso-standard xmlns="http://riboseinc.com/isoxml">
136
145
  <bibdata type="standard">
137
146
  <title>
@@ -203,13 +212,15 @@ OUTPUT
203
212
  </bibdata>
204
213
  </iso-standard>
205
214
  INPUT
206
- {:agency=>"ISO/IEC",
207
- :authors=>[],
208
- :authors_affiliations=>{},
215
+ {:accesseddate=>"XXX",
216
+ :agency=>"ISO/IEC",
217
+ :circulateddate=>"XXX",
218
+ :confirmeddate=>"XXX",
219
+ :copieddate=>"XXX",
220
+ :createddate=>"XXX",
209
221
  :docnumber=>"ISO/IEC/CD 17301-1-3",
210
222
  :docnumber_lang=>"ISO/IEC/CD 17301-1-3 (E)",
211
223
  :docnumber_reference=>"ISO/IEC/CD 17301-1-3 (E)",
212
- :docnumeric=>nil,
213
224
  :docsubtitle=>"C&#xe9;r&#xe9;ales et l&#xe9;gumineuses&nbsp;&mdash; Sp&#xe9;cification et m&#xe9;thodes d&#x27;essai&nbsp;&mdash; Partie&nbsp;1&ndash;3: Riz",
214
225
  :docsubtitleintro=>"C&#xe9;r&#xe9;ales et l&#xe9;gumineuses",
215
226
  :docsubtitlemain=>"Sp&#xe9;cification et m&#xe9;thodes d&#x27;essai",
@@ -221,26 +232,166 @@ INPUT
221
232
  :doctitlepart=>"Rice",
222
233
  :doctitlepartlabel=>"Part&nbsp;1&ndash;3",
223
234
  :doctype=>"International Standard",
235
+ :doctype_display=>"International Standard",
224
236
  :docyear=>"2016",
225
- :draft=>nil,
226
- :draftinfo=>"",
227
- :edition=>nil,
228
237
  :editorialgroup=>["ABC 34", "DEF 4", "GHI 3"],
229
238
  :ics=>"1.2.3, 1.2.3",
230
- :keywords=>[],
239
+ :implementeddate=>"XXX",
240
+ :issueddate=>"XXX",
241
+ :lang=>"en",
242
+ :obsoleteddate=>"XXX",
231
243
  :obsoletes=>"IEC 8121",
232
244
  :obsoletes_part=>"3.1",
245
+ :publisheddate=>"XXX",
233
246
  :publisher=>"International Organization for Standardization and International Electrotechnical Commission",
234
- :revdate=>nil,
235
- :revdate_monthyear=>nil,
247
+ :receiveddate=>"XXX",
248
+ :sc=>"DEF 4",
249
+ :script=>"Latn",
250
+ :secretariat=>"XXX",
251
+ :stage=>"60",
252
+ :stage_int=>60,
253
+ :statusabbr=>"IS",
254
+ :tc=>"ABC 34",
255
+ :tc_docnumber=>["17301"],
256
+ :transmitteddate=>"XXX",
257
+ :unchangeddate=>"XXX",
258
+ :unpublished=>false,
259
+ :updateddate=>"XXX",
260
+ :vote_endeddate=>"XXX",
261
+ :vote_starteddate=>"XXX",
262
+ :wg=>"GHI 3"}
263
+ OUTPUT
264
+ end
265
+
266
+ it "processes IsoXML metadata in French" do
267
+ c = IsoDoc::Iso::HtmlConvert.new({})
268
+ arr = c.convert_init(<<~"INPUT", "test", false)
269
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
270
+ <bibdata>
271
+ <language>fr</language>
272
+ </bibdata>
273
+ </iso-standard>
274
+ INPUT
275
+ expect(metadata(c.info(Nokogiri::XML(<<~"INPUT"), nil))).to be_equivalent_to <<~"OUTPUT"
276
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
277
+ <bibdata type="standard">
278
+ <title>
279
+ <title type="title-intro" language="en" format="text/plain">Cereals and pulses</title>
280
+ <title type="title-main" language="en" format="text/plain">Specifications and test methods</title>
281
+ <title type="title-part" language="en" format="text/plain">Rice</title>
282
+ </title>
283
+ <title>
284
+ <title type="title-intro" language="fr" format="text/plain">Céréales et légumineuses</title>
285
+ <title type="title-main" language="fr" format="text/plain">Spécification et méthodes d'essai</title>
286
+ <title type="title-part" language="fr" format="text/plain">Riz</title>
287
+ </title>
288
+ <docidentifier type="ISO">ISO/IEC/CD 17301-1-3</docidentifier>
289
+ <docidentifier type="iso-with-lang">ISO/IEC/CD 17301-1-3 (E)</docidentifier>
290
+ <docidentifier type="iso-reference">ISO/IEC/CD 17301-1-3 (E)</docidentifier>
291
+ <docidentifier type="iso-tc">17301</docidentifier>
292
+ <contributor>
293
+ <role type="author"/>
294
+ <organization>
295
+ <name>ISO</name>
296
+ </organization>
297
+ </contributor>
298
+ <contributor>
299
+ <role type="publisher"/>
300
+ <organization>
301
+ <name>International Organization for Standardization</name>
302
+ <abbreviation>ISO</abbreviation>
303
+ </organization>
304
+ </contributor>
305
+ <contributor>
306
+ <role type="publisher"/>
307
+ <organization>
308
+ <name>International Electrotechnical Commission</name>
309
+ <abbreviation>IEC</abbreviation>
310
+ </organization>
311
+ </contributor>
312
+ <language>fr</language>
313
+ <script>Latn</script>
314
+ <status>
315
+ <stage abbreviation="IS">60</stage>
316
+ <substage>92</substage>
317
+ </status>
318
+ <copyright>
319
+ <from>2016</from>
320
+ <owner>
321
+ <organization>
322
+ <name>International Organization for Standardization</name>
323
+ </organization>
324
+ </owner>
325
+ </copyright>
326
+ <relation type="obsoletes">
327
+ <locality type="clause"><referenceFrom>3.1</referenceFrom></locality>
328
+ <docidentifier>IEC 8121</docidentifier>
329
+ </relation>
330
+ <ext>
331
+ <doctype language="">international-standard</doctype>
332
+ <doctype language="fr">Standard International</doctype>
333
+ <editorialgroup>
334
+ <technical-committee number="34" type="ABC">Food products</technical-committee>
335
+ <subcommittee number="4" type="DEF">Cereals and pulses</subcommittee>
336
+ <workgroup number="3" type="GHI">Rice Group</workgroup>
337
+ </editorialgroup>
338
+ <ics><code>1.2.3</code></ics>
339
+ <ics><code>1.2.3</code></ics>
340
+ <structuredidentifier>
341
+ <project-number part="1" subpart="3">ISO/IEC/CD 17301</project-number>
342
+ </strucuredidentifier>
343
+ <stagename>International standard</stagename>
344
+ </ext>
345
+ </bibdata>
346
+ </iso-standard>
347
+ INPUT
348
+ {:accesseddate=>"XXX",
349
+ :agency=>"ISO/IEC",
350
+ :circulateddate=>"XXX",
351
+ :confirmeddate=>"XXX",
352
+ :copieddate=>"XXX",
353
+ :createddate=>"XXX",
354
+ :docnumber=>"ISO/IEC/CD 17301-1-3",
355
+ :docnumber_lang=>"ISO/IEC/CD 17301-1-3 (E)",
356
+ :docnumber_reference=>"ISO/IEC/CD 17301-1-3 (E)",
357
+ :docsubtitle=>"Cereals and pulses&nbsp;&mdash; Specifications and test methods&nbsp;&mdash; Part&nbsp;1&ndash;3: Rice",
358
+ :docsubtitleintro=>"Cereals and pulses",
359
+ :docsubtitlemain=>"Specifications and test methods",
360
+ :docsubtitlepart=>"Rice",
361
+ :docsubtitlepartlabel=>"Part&nbsp;1&ndash;3",
362
+ :doctitle=>"C&#xe9;r&#xe9;ales et l&#xe9;gumineuses&nbsp;&mdash; Sp&#xe9;cification et m&#xe9;thodes d&#x27;essai&nbsp;&mdash; Partie&nbsp;1&ndash;3: Riz",
363
+ :doctitleintro=>"C&#xe9;r&#xe9;ales et l&#xe9;gumineuses",
364
+ :doctitlemain=>"Sp&#xe9;cification et m&#xe9;thodes d&#x27;essai",
365
+ :doctitlepart=>"Riz",
366
+ :doctitlepartlabel=>"Partie&nbsp;1&ndash;3",
367
+ :doctype=>"International Standard",
368
+ :doctype_display=>"Standard International",
369
+ :docyear=>"2016",
370
+ :editorialgroup=>["ABC 34", "DEF 4", "GHI 3"],
371
+ :ics=>"1.2.3, 1.2.3",
372
+ :implementeddate=>"XXX",
373
+ :issueddate=>"XXX",
374
+ :lang=>"fr",
375
+ :obsoleteddate=>"XXX",
376
+ :obsoletes=>"IEC 8121",
377
+ :obsoletes_part=>"3.1",
378
+ :publisheddate=>"XXX",
379
+ :publisher=>"International Organization for Standardization et International Electrotechnical Commission",
380
+ :receiveddate=>"XXX",
236
381
  :sc=>"DEF 4",
237
- :secretariat=>"XXXX",
382
+ :script=>"Latn",
383
+ :secretariat=>"XXX",
238
384
  :stage=>"60",
239
385
  :stage_int=>60,
240
386
  :statusabbr=>"IS",
241
387
  :tc=>"ABC 34",
242
388
  :tc_docnumber=>["17301"],
389
+ :transmitteddate=>"XXX",
390
+ :unchangeddate=>"XXX",
243
391
  :unpublished=>false,
392
+ :updateddate=>"XXX",
393
+ :vote_endeddate=>"XXX",
394
+ :vote_starteddate=>"XXX",
244
395
  :wg=>"GHI 3"}
245
396
  OUTPUT
246
397
  end