metanorma-iso 1.5.9 → 1.5.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/rake.yml +66 -0
- data/README.adoc +5 -6
- data/lib/asciidoctor/iso/base.rb +5 -5
- data/lib/asciidoctor/iso/basicdoc.rng +32 -0
- data/lib/asciidoctor/iso/boilerplate-fr.xml +40 -0
- data/lib/asciidoctor/iso/boilerplate.xml +1 -0
- data/lib/asciidoctor/iso/cleanup.rb +38 -6
- data/lib/asciidoctor/iso/front.rb +11 -3
- data/lib/asciidoctor/iso/isodoc.rng +29 -44
- data/lib/asciidoctor/iso/isostandard.rng +11 -0
- data/lib/asciidoctor/iso/validate.rb +1 -1
- data/lib/asciidoctor/iso/validate_section.rb +9 -0
- data/lib/isodoc/iso/base_convert.rb +2 -1
- data/lib/isodoc/iso/html/header.html +12 -24
- data/lib/isodoc/iso/html/htmlstyle.css +1 -1
- data/lib/isodoc/iso/html/htmlstyle.scss +1 -1
- data/lib/isodoc/iso/html/isodoc.css +42 -42
- data/lib/isodoc/iso/html/isodoc.scss +42 -42
- data/lib/isodoc/iso/html/style-human.css +14 -10
- data/lib/isodoc/iso/html/style-human.scss +7 -7
- data/lib/isodoc/iso/html/style-iso.css +12 -8
- data/lib/isodoc/iso/html/style-iso.scss +5 -5
- data/lib/isodoc/iso/html/wordstyle.css +67 -67
- data/lib/isodoc/iso/html/wordstyle.scss +67 -67
- data/lib/isodoc/iso/html_convert.rb +4 -0
- data/lib/isodoc/iso/i18n-en.yaml +4 -0
- data/lib/isodoc/iso/i18n-fr.yaml +5 -0
- data/lib/isodoc/iso/i18n-zh-Hans.yaml +5 -0
- data/lib/isodoc/iso/i18n.rb +10 -11
- data/lib/isodoc/iso/iso.amendment.xsl +562 -120
- data/lib/isodoc/iso/iso.international-standard.xsl +562 -120
- data/lib/isodoc/iso/metadata.rb +20 -19
- data/lib/isodoc/iso/word_convert.rb +4 -0
- data/lib/isodoc/iso/xref.rb +10 -0
- data/lib/metanorma/iso/fonts_manifest.yaml +6 -0
- data/lib/metanorma/iso/processor.rb +0 -9
- data/lib/metanorma/iso/version.rb +1 -1
- data/metanorma-iso.gemspec +1 -1
- data/spec/asciidoctor-iso/base_spec.rb +140 -12
- data/spec/asciidoctor-iso/blocks_spec.rb +1 -1
- data/spec/asciidoctor-iso/cleanup_spec.rb +4 -4
- data/spec/asciidoctor-iso/lists_spec.rb +6 -6
- data/spec/asciidoctor-iso/refs_spec.rb +174 -143
- data/spec/asciidoctor-iso/section_spec.rb +5 -0
- data/spec/asciidoctor-iso/validate_spec.rb +52 -15
- data/spec/assets/xref_error.adoc +7 -0
- data/spec/isodoc/amd_spec.rb +188 -29
- data/spec/isodoc/blocks_spec.rb +1 -0
- data/spec/isodoc/i18n_spec.rb +9 -22
- data/spec/isodoc/inline_spec.rb +1 -1
- data/spec/isodoc/metadata_spec.rb +172 -19
- data/spec/isodoc/postproc_spec.rb +2 -5
- data/spec/isodoc/ref_spec.rb +4 -7
- data/spec/isodoc/section_spec.rb +20 -0
- data/spec/isodoc/xref_spec.rb +12 -0
- data/spec/spec_helper.rb +21 -1
- metadata +8 -10
- data/.github/workflows/macos.yml +0 -41
- data/.github/workflows/ubuntu.yml +0 -45
- data/.github/workflows/windows.yml +0 -43
- data/lib/asciidoctor/iso/macros.rb +0 -21
- data/lib/asciidoctor/iso/term_lookup_cleanup.rb +0 -86
- data/spec/asciidoctor-iso/macros_spec.rb +0 -310
data/spec/isodoc/amd_spec.rb
CHANGED
@@ -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>
|
@@ -60,14 +60,9 @@ RSpec.describe IsoDoc do
|
|
60
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
|
-
<local_bibdata>
|
67
|
-
<ext>
|
68
|
-
<doctype>amendment</doctype>
|
69
|
-
</ext>
|
70
|
-
</local_bibdata>
|
71
66
|
<preface>
|
72
67
|
<foreword>
|
73
68
|
<p>
|
@@ -158,7 +153,7 @@ RSpec.describe IsoDoc do
|
|
158
153
|
end
|
159
154
|
|
160
155
|
it "cross-references sections" do
|
161
|
-
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")
|
162
157
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
163
158
|
<bibdata> <ext> <doctype>amendment</doctype> </ext> </bibdata>
|
164
159
|
<preface>
|
@@ -226,14 +221,9 @@ RSpec.describe IsoDoc do
|
|
226
221
|
<iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
|
227
222
|
<bibdata>
|
228
223
|
<ext>
|
229
|
-
<doctype>amendment</doctype>
|
224
|
+
<doctype language="">amendment</doctype>
|
230
225
|
</ext>
|
231
226
|
</bibdata>
|
232
|
-
<local_bibdata>
|
233
|
-
<ext>
|
234
|
-
<doctype>amendment</doctype>
|
235
|
-
</ext>
|
236
|
-
</local_bibdata>
|
237
227
|
<preface>
|
238
228
|
<foreword obligation='informative'>
|
239
229
|
<title>Foreword</title>
|
@@ -409,14 +399,9 @@ RSpec.describe IsoDoc do
|
|
409
399
|
<iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
|
410
400
|
<bibdata>
|
411
401
|
<ext>
|
412
|
-
<doctype>amendment</doctype>
|
402
|
+
<doctype language="">amendment</doctype>
|
413
403
|
</ext>
|
414
404
|
</bibdata>
|
415
|
-
<local_bibdata>
|
416
|
-
<ext>
|
417
|
-
<doctype>amendment</doctype>
|
418
|
-
</ext>
|
419
|
-
</local_bibdata>
|
420
405
|
<boilerplate>
|
421
406
|
<copyright-statement>
|
422
407
|
<clause>
|
@@ -633,7 +618,7 @@ RSpec.describe IsoDoc do
|
|
633
618
|
</body>
|
634
619
|
</html>
|
635
620
|
OUTPUT
|
636
|
-
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)
|
637
622
|
expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({}).convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
|
638
623
|
end
|
639
624
|
|
@@ -642,7 +627,7 @@ OUTPUT
|
|
642
627
|
arr = c.convert_init(<<~"INPUT", "test", false)
|
643
628
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
644
629
|
INPUT
|
645
|
-
expect(
|
630
|
+
expect(metadata(c.info(Nokogiri::XML(<<~"INPUT"), nil))).to be_equivalent_to <<~"OUTPUT"
|
646
631
|
<iso-standard xmlns='https://www.metanorma.org/ns/iso'>
|
647
632
|
<bibdata type='standard'>
|
648
633
|
<title language='en' format='text/plain' type='main'>Introduction — Main Title — Title — Title Part — Mass fraction of
|
@@ -734,9 +719,11 @@ OUTPUT
|
|
734
719
|
<sections/>
|
735
720
|
</iso-standard>
|
736
721
|
INPUT
|
737
|
-
{:
|
738
|
-
:
|
739
|
-
:
|
722
|
+
{:accesseddate=>"XXX",
|
723
|
+
:agency=>"ISO",
|
724
|
+
:circulateddate=>"XXX",
|
725
|
+
:confirmeddate=>"XXX",
|
726
|
+
:copieddate=>"XXX",
|
740
727
|
:createddate=>"2016-05-01",
|
741
728
|
:docnumber=>"ISO/PreNWIP3 17301-1:2016/Amd.1",
|
742
729
|
:docnumber_lang=>"ISO/PreNWIP3 17301-1:2016/Amd.1(E)",
|
@@ -759,31 +746,203 @@ INPUT
|
|
759
746
|
:doctitlepart=>"Title Part",
|
760
747
|
:doctitlepartlabel=>"Part 1",
|
761
748
|
:doctype=>"Amendment",
|
749
|
+
:doctype_display=>"Amendment",
|
762
750
|
:docyear=>"2017",
|
763
751
|
:draft=>"0.3.4",
|
764
752
|
:draftinfo=>" (draft 0.3.4, 2000-01-01)",
|
765
753
|
:edition=>"2",
|
766
754
|
:editorialgroup=>["A 1", "B 2", "C 3"],
|
767
755
|
:ics=>"1, 2, 3",
|
768
|
-
:
|
769
|
-
:
|
770
|
-
:
|
756
|
+
:implementeddate=>"XXX",
|
757
|
+
:issueddate=>"XXX",
|
758
|
+
:lang=>"en",
|
759
|
+
:obsoleteddate=>"XXX",
|
760
|
+
:publisheddate=>"XXX",
|
771
761
|
:publisher=>"International Organization for Standardization",
|
762
|
+
:receiveddate=>"XXX",
|
772
763
|
:revdate=>"2000-01-01",
|
773
764
|
:revdate_monthyear=>"January 2000",
|
774
765
|
:sc=>"B 2",
|
766
|
+
:script=>"Latn",
|
775
767
|
:secretariat=>"SECRETARIAT",
|
776
768
|
:stage=>"10",
|
777
769
|
:stage_int=>10,
|
778
770
|
:stageabbr=>"NWIP",
|
779
771
|
:statusabbr=>"PreNWIP3",
|
780
772
|
:tc=>"A 1",
|
781
|
-
:
|
773
|
+
:transmitteddate=>"XXX",
|
774
|
+
:unchangeddate=>"XXX",
|
782
775
|
:unpublished=>true,
|
776
|
+
:updateddate=>"XXX",
|
777
|
+
:vote_endeddate=>"XXX",
|
778
|
+
:vote_starteddate=>"XXX",
|
783
779
|
:wg=>"C 3"}
|
784
780
|
OUTPUT
|
785
781
|
end
|
786
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 — Main Title — Title — Part 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 1",
|
898
|
+
:docsubtitlecorrlabel=>"TECHNICAL CORRIGENDUM 2",
|
899
|
+
:docsubtitleintro=>"Introduction",
|
900
|
+
:docsubtitlemain=>"Main Title — Title",
|
901
|
+
:docsubtitlepart=>"Title Part",
|
902
|
+
:docsubtitlepartlabel=>"Part 1",
|
903
|
+
:doctitle=>"Introduction Française — Titre Principal — Partie 1: Part du Titre",
|
904
|
+
:doctitleamd=>"Fraction massique de matière étrangère, riz usiné (non gluant), diviseurs d’échantillon et recommandations relatives aux conditions d’entreposage et de transport",
|
905
|
+
:doctitleamdlabel=>"AMENDMENT 1",
|
906
|
+
:doctitlecorrlabel=>"RECTIFICATIF TECHNIQUE 2",
|
907
|
+
:doctitleintro=>"Introduction Française",
|
908
|
+
:doctitlemain=>"Titre Principal",
|
909
|
+
:doctitlepart=>"Part du Titre",
|
910
|
+
:doctitlepartlabel=>"Partie 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
|
+
|
787
946
|
it "processes middle title" do
|
788
947
|
expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
789
948
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
data/spec/isodoc/blocks_spec.rb
CHANGED
data/spec/isodoc/i18n_spec.rb
CHANGED
@@ -74,11 +74,8 @@ RSpec.describe IsoDoc do
|
|
74
74
|
presxml = <<~OUTPUT
|
75
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
|
-
<local_bibdata>
|
80
|
-
<language>en</language>
|
81
|
-
</local_bibdata>
|
82
79
|
<preface>
|
83
80
|
<foreword obligation='informative'>
|
84
81
|
<title>Foreword</title>
|
@@ -241,12 +238,12 @@ RSpec.describe IsoDoc do
|
|
241
238
|
</body>
|
242
239
|
</html>
|
243
240
|
OUTPUT
|
244
|
-
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)
|
245
242
|
expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({}).convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
|
246
243
|
end
|
247
244
|
|
248
245
|
it "defaults to English" do
|
249
|
-
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")
|
250
247
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
251
248
|
<bibdata>
|
252
249
|
<language>tlh</language>
|
@@ -316,11 +313,8 @@ RSpec.describe IsoDoc do
|
|
316
313
|
INPUT
|
317
314
|
<iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
|
318
315
|
<bibdata>
|
319
|
-
<language>tlh</language>
|
316
|
+
<language current="true">tlh</language>
|
320
317
|
</bibdata>
|
321
|
-
<local_bibdata>
|
322
|
-
<language>tlh</language>
|
323
|
-
</local_bibdata>
|
324
318
|
<preface>
|
325
319
|
<foreword obligation='informative'>
|
326
320
|
<title>Foreword</title>
|
@@ -528,11 +522,8 @@ RSpec.describe IsoDoc do
|
|
528
522
|
presxml = <<~OUTPUT
|
529
523
|
<iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
|
530
524
|
<bibdata>
|
531
|
-
<language>fr</language>
|
525
|
+
<language current="true">fr</language>
|
532
526
|
</bibdata>
|
533
|
-
<local_bibdata>
|
534
|
-
<language>fr</language>
|
535
|
-
</local_bibdata>
|
536
527
|
<preface>
|
537
528
|
<foreword obligation='informative'>
|
538
529
|
<title>Foreword</title>
|
@@ -694,7 +685,7 @@ OUTPUT
|
|
694
685
|
</body>
|
695
686
|
</html>
|
696
687
|
OUTPUT
|
697
|
-
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)
|
698
689
|
expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({}).convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
|
699
690
|
end
|
700
691
|
|
@@ -781,13 +772,9 @@ OUTPUT
|
|
781
772
|
presxml = <<~OUTPUT
|
782
773
|
<iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
|
783
774
|
<bibdata>
|
784
|
-
<language>zh</language>
|
785
|
-
<script>Hans</script>
|
775
|
+
<language current="true">zh</language>
|
776
|
+
<script current="true">Hans</script>
|
786
777
|
</bibdata>
|
787
|
-
<local_bibdata>
|
788
|
-
<language>zh</language>
|
789
|
-
<script>Hans</script>
|
790
|
-
</local_bibdata>
|
791
778
|
<preface>
|
792
779
|
<foreword obligation='informative'>
|
793
780
|
<title>Foreword</title>
|
@@ -960,7 +947,7 @@ OUTPUT
|
|
960
947
|
</body>
|
961
948
|
</html>
|
962
949
|
OUTPUT
|
963
|
-
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)
|
964
951
|
expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({}).convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
|
965
952
|
end
|
966
953
|
|
data/spec/isodoc/inline_spec.rb
CHANGED
@@ -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>
|
@@ -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(
|
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>
|
@@ -64,6 +64,7 @@ RSpec.describe IsoDoc::Iso::Metadata do
|
|
64
64
|
<keyword>kw1</keyword>
|
65
65
|
<ext>
|
66
66
|
<doctype>international-standard</doctype>
|
67
|
+
<horizontal>true</horizontal>
|
67
68
|
<editorialgroup>
|
68
69
|
<technical-committee number="34">Food products</technical-committee>
|
69
70
|
<subcommittee number="4">Cereals and pulses</subcommittee>
|
@@ -81,8 +82,9 @@ INPUT
|
|
81
82
|
{:accesseddate=>"2012",
|
82
83
|
:activateddate=>"2013",
|
83
84
|
:agency=>"ISO",
|
84
|
-
:
|
85
|
-
:
|
85
|
+
:circulateddate=>"XXX",
|
86
|
+
:confirmeddate=>"XXX",
|
87
|
+
:copieddate=>"XXX",
|
86
88
|
:createddate=>"2010–2011",
|
87
89
|
:docnumber=>"ISO/PreCD3 17301-1",
|
88
90
|
:docnumber_lang=>"ISO/PreCD3 17301-1 (E)",
|
@@ -99,21 +101,25 @@ INPUT
|
|
99
101
|
:doctitlepart=>"Rice",
|
100
102
|
:doctitlepartlabel=>"Part 1",
|
101
103
|
:doctype=>"International Standard",
|
104
|
+
:doctype_display=>"International Standard",
|
102
105
|
:docyear=>"2016",
|
103
106
|
:draft=>"0.4",
|
104
107
|
:draftinfo=>" (draft 0.4, 2016-05-01)",
|
105
108
|
:edition=>"2",
|
106
109
|
:editorialgroup=>["TC 34", "SC 4", "WG 3"],
|
107
|
-
:
|
110
|
+
:horizontal=>"true",
|
111
|
+
:implementeddate=>"XXX",
|
112
|
+
:issueddate=>"XXX",
|
108
113
|
:keywords=>["kw2", "kw1"],
|
114
|
+
:lang=>"en",
|
109
115
|
:obsoleteddate=>"2014",
|
110
|
-
:obsoletes=>nil,
|
111
|
-
:obsoletes_part=>nil,
|
112
116
|
:publisheddate=>"2011",
|
113
117
|
:publisher=>"International Organization for Standardization",
|
118
|
+
:receiveddate=>"XXX",
|
114
119
|
:revdate=>"2016-05-01",
|
115
120
|
:revdate_monthyear=>"May 2016",
|
116
121
|
:sc=>"SC 4",
|
122
|
+
:script=>"Latn",
|
117
123
|
:secretariat=>"GB",
|
118
124
|
:stage=>"30",
|
119
125
|
:stage_int=>30,
|
@@ -121,17 +127,22 @@ INPUT
|
|
121
127
|
:statusabbr=>"PreCD3",
|
122
128
|
:tc=>"TC 34",
|
123
129
|
:tc_docnumber=>["17301", "17302"],
|
130
|
+
:transmitteddate=>"XXX",
|
131
|
+
:unchangeddate=>"XXX",
|
124
132
|
:unpublished=>true,
|
133
|
+
:updateddate=>"XXX",
|
134
|
+
:vote_endeddate=>"XXX",
|
135
|
+
:vote_starteddate=>"XXX",
|
125
136
|
:wg=>"WG 3"}
|
126
137
|
OUTPUT
|
127
138
|
end
|
128
139
|
|
129
|
-
it "processes IsoXML metadata" do
|
140
|
+
it "processes IsoXML metadata #2" do
|
130
141
|
c = IsoDoc::Iso::HtmlConvert.new({})
|
131
142
|
arr = c.convert_init(<<~"INPUT", "test", false)
|
132
143
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
133
144
|
INPUT
|
134
|
-
expect(
|
145
|
+
expect(metadata(c.info(Nokogiri::XML(<<~"INPUT"), nil))).to be_equivalent_to <<~"OUTPUT"
|
135
146
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
136
147
|
<bibdata type="standard">
|
137
148
|
<title>
|
@@ -203,13 +214,15 @@ OUTPUT
|
|
203
214
|
</bibdata>
|
204
215
|
</iso-standard>
|
205
216
|
INPUT
|
206
|
-
{:
|
207
|
-
:
|
208
|
-
:
|
217
|
+
{:accesseddate=>"XXX",
|
218
|
+
:agency=>"ISO/IEC",
|
219
|
+
:circulateddate=>"XXX",
|
220
|
+
:confirmeddate=>"XXX",
|
221
|
+
:copieddate=>"XXX",
|
222
|
+
:createddate=>"XXX",
|
209
223
|
:docnumber=>"ISO/IEC/CD 17301-1-3",
|
210
224
|
:docnumber_lang=>"ISO/IEC/CD 17301-1-3 (E)",
|
211
225
|
:docnumber_reference=>"ISO/IEC/CD 17301-1-3 (E)",
|
212
|
-
:docnumeric=>nil,
|
213
226
|
:docsubtitle=>"Céréales et légumineuses — Spécification et méthodes d'essai — Partie 1–3: Riz",
|
214
227
|
:docsubtitleintro=>"Céréales et légumineuses",
|
215
228
|
:docsubtitlemain=>"Spécification et méthodes d'essai",
|
@@ -221,26 +234,166 @@ INPUT
|
|
221
234
|
:doctitlepart=>"Rice",
|
222
235
|
:doctitlepartlabel=>"Part 1–3",
|
223
236
|
:doctype=>"International Standard",
|
237
|
+
:doctype_display=>"International Standard",
|
224
238
|
:docyear=>"2016",
|
225
|
-
:draft=>nil,
|
226
|
-
:draftinfo=>"",
|
227
|
-
:edition=>nil,
|
228
239
|
:editorialgroup=>["ABC 34", "DEF 4", "GHI 3"],
|
229
240
|
:ics=>"1.2.3, 1.2.3",
|
230
|
-
:
|
241
|
+
:implementeddate=>"XXX",
|
242
|
+
:issueddate=>"XXX",
|
243
|
+
:lang=>"en",
|
244
|
+
:obsoleteddate=>"XXX",
|
231
245
|
:obsoletes=>"IEC 8121",
|
232
246
|
:obsoletes_part=>"3.1",
|
247
|
+
:publisheddate=>"XXX",
|
233
248
|
:publisher=>"International Organization for Standardization and International Electrotechnical Commission",
|
234
|
-
:
|
235
|
-
:
|
249
|
+
:receiveddate=>"XXX",
|
250
|
+
:sc=>"DEF 4",
|
251
|
+
:script=>"Latn",
|
252
|
+
:secretariat=>"XXX",
|
253
|
+
:stage=>"60",
|
254
|
+
:stage_int=>60,
|
255
|
+
:statusabbr=>"IS",
|
256
|
+
:tc=>"ABC 34",
|
257
|
+
:tc_docnumber=>["17301"],
|
258
|
+
:transmitteddate=>"XXX",
|
259
|
+
:unchangeddate=>"XXX",
|
260
|
+
:unpublished=>false,
|
261
|
+
:updateddate=>"XXX",
|
262
|
+
:vote_endeddate=>"XXX",
|
263
|
+
:vote_starteddate=>"XXX",
|
264
|
+
:wg=>"GHI 3"}
|
265
|
+
OUTPUT
|
266
|
+
end
|
267
|
+
|
268
|
+
it "processes IsoXML metadata in French" do
|
269
|
+
c = IsoDoc::Iso::HtmlConvert.new({})
|
270
|
+
arr = c.convert_init(<<~"INPUT", "test", false)
|
271
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
272
|
+
<bibdata>
|
273
|
+
<language>fr</language>
|
274
|
+
</bibdata>
|
275
|
+
</iso-standard>
|
276
|
+
INPUT
|
277
|
+
expect(metadata(c.info(Nokogiri::XML(<<~"INPUT"), nil))).to be_equivalent_to <<~"OUTPUT"
|
278
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
279
|
+
<bibdata type="standard">
|
280
|
+
<title>
|
281
|
+
<title type="title-intro" language="en" format="text/plain">Cereals and pulses</title>
|
282
|
+
<title type="title-main" language="en" format="text/plain">Specifications and test methods</title>
|
283
|
+
<title type="title-part" language="en" format="text/plain">Rice</title>
|
284
|
+
</title>
|
285
|
+
<title>
|
286
|
+
<title type="title-intro" language="fr" format="text/plain">Céréales et légumineuses</title>
|
287
|
+
<title type="title-main" language="fr" format="text/plain">Spécification et méthodes d'essai</title>
|
288
|
+
<title type="title-part" language="fr" format="text/plain">Riz</title>
|
289
|
+
</title>
|
290
|
+
<docidentifier type="ISO">ISO/IEC/CD 17301-1-3</docidentifier>
|
291
|
+
<docidentifier type="iso-with-lang">ISO/IEC/CD 17301-1-3 (E)</docidentifier>
|
292
|
+
<docidentifier type="iso-reference">ISO/IEC/CD 17301-1-3 (E)</docidentifier>
|
293
|
+
<docidentifier type="iso-tc">17301</docidentifier>
|
294
|
+
<contributor>
|
295
|
+
<role type="author"/>
|
296
|
+
<organization>
|
297
|
+
<name>ISO</name>
|
298
|
+
</organization>
|
299
|
+
</contributor>
|
300
|
+
<contributor>
|
301
|
+
<role type="publisher"/>
|
302
|
+
<organization>
|
303
|
+
<name>International Organization for Standardization</name>
|
304
|
+
<abbreviation>ISO</abbreviation>
|
305
|
+
</organization>
|
306
|
+
</contributor>
|
307
|
+
<contributor>
|
308
|
+
<role type="publisher"/>
|
309
|
+
<organization>
|
310
|
+
<name>International Electrotechnical Commission</name>
|
311
|
+
<abbreviation>IEC</abbreviation>
|
312
|
+
</organization>
|
313
|
+
</contributor>
|
314
|
+
<language>fr</language>
|
315
|
+
<script>Latn</script>
|
316
|
+
<status>
|
317
|
+
<stage abbreviation="IS">60</stage>
|
318
|
+
<substage>92</substage>
|
319
|
+
</status>
|
320
|
+
<copyright>
|
321
|
+
<from>2016</from>
|
322
|
+
<owner>
|
323
|
+
<organization>
|
324
|
+
<name>International Organization for Standardization</name>
|
325
|
+
</organization>
|
326
|
+
</owner>
|
327
|
+
</copyright>
|
328
|
+
<relation type="obsoletes">
|
329
|
+
<locality type="clause"><referenceFrom>3.1</referenceFrom></locality>
|
330
|
+
<docidentifier>IEC 8121</docidentifier>
|
331
|
+
</relation>
|
332
|
+
<ext>
|
333
|
+
<doctype language="">international-standard</doctype>
|
334
|
+
<doctype language="fr">Standard International</doctype>
|
335
|
+
<editorialgroup>
|
336
|
+
<technical-committee number="34" type="ABC">Food products</technical-committee>
|
337
|
+
<subcommittee number="4" type="DEF">Cereals and pulses</subcommittee>
|
338
|
+
<workgroup number="3" type="GHI">Rice Group</workgroup>
|
339
|
+
</editorialgroup>
|
340
|
+
<ics><code>1.2.3</code></ics>
|
341
|
+
<ics><code>1.2.3</code></ics>
|
342
|
+
<structuredidentifier>
|
343
|
+
<project-number part="1" subpart="3">ISO/IEC/CD 17301</project-number>
|
344
|
+
</strucuredidentifier>
|
345
|
+
<stagename>International standard</stagename>
|
346
|
+
</ext>
|
347
|
+
</bibdata>
|
348
|
+
</iso-standard>
|
349
|
+
INPUT
|
350
|
+
{:accesseddate=>"XXX",
|
351
|
+
:agency=>"ISO/IEC",
|
352
|
+
:circulateddate=>"XXX",
|
353
|
+
:confirmeddate=>"XXX",
|
354
|
+
:copieddate=>"XXX",
|
355
|
+
:createddate=>"XXX",
|
356
|
+
:docnumber=>"ISO/IEC/CD 17301-1-3",
|
357
|
+
:docnumber_lang=>"ISO/IEC/CD 17301-1-3 (E)",
|
358
|
+
:docnumber_reference=>"ISO/IEC/CD 17301-1-3 (E)",
|
359
|
+
:docsubtitle=>"Cereals and pulses — Specifications and test methods — Part 1–3: Rice",
|
360
|
+
:docsubtitleintro=>"Cereals and pulses",
|
361
|
+
:docsubtitlemain=>"Specifications and test methods",
|
362
|
+
:docsubtitlepart=>"Rice",
|
363
|
+
:docsubtitlepartlabel=>"Part 1–3",
|
364
|
+
:doctitle=>"Céréales et légumineuses — Spécification et méthodes d'essai — Partie 1–3: Riz",
|
365
|
+
:doctitleintro=>"Céréales et légumineuses",
|
366
|
+
:doctitlemain=>"Spécification et méthodes d'essai",
|
367
|
+
:doctitlepart=>"Riz",
|
368
|
+
:doctitlepartlabel=>"Partie 1–3",
|
369
|
+
:doctype=>"International Standard",
|
370
|
+
:doctype_display=>"Standard International",
|
371
|
+
:docyear=>"2016",
|
372
|
+
:editorialgroup=>["ABC 34", "DEF 4", "GHI 3"],
|
373
|
+
:ics=>"1.2.3, 1.2.3",
|
374
|
+
:implementeddate=>"XXX",
|
375
|
+
:issueddate=>"XXX",
|
376
|
+
:lang=>"fr",
|
377
|
+
:obsoleteddate=>"XXX",
|
378
|
+
:obsoletes=>"IEC 8121",
|
379
|
+
:obsoletes_part=>"3.1",
|
380
|
+
:publisheddate=>"XXX",
|
381
|
+
:publisher=>"International Organization for Standardization et International Electrotechnical Commission",
|
382
|
+
:receiveddate=>"XXX",
|
236
383
|
:sc=>"DEF 4",
|
237
|
-
:
|
384
|
+
:script=>"Latn",
|
385
|
+
:secretariat=>"XXX",
|
238
386
|
:stage=>"60",
|
239
387
|
:stage_int=>60,
|
240
388
|
:statusabbr=>"IS",
|
241
389
|
:tc=>"ABC 34",
|
242
390
|
:tc_docnumber=>["17301"],
|
391
|
+
:transmitteddate=>"XXX",
|
392
|
+
:unchangeddate=>"XXX",
|
243
393
|
:unpublished=>false,
|
394
|
+
:updateddate=>"XXX",
|
395
|
+
:vote_endeddate=>"XXX",
|
396
|
+
:vote_starteddate=>"XXX",
|
244
397
|
:wg=>"GHI 3"}
|
245
398
|
OUTPUT
|
246
399
|
end
|