metanorma-iso 1.5.10 → 1.6.0
Sign up to get free protection for your applications and to get access to all the features.
- 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 +50 -3
- 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 +5 -0
- data/lib/asciidoctor/iso/isodoc.rng +36 -43
- 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 +13 -9
- data/lib/isodoc/iso/html/style-human.scss +7 -7
- data/lib/isodoc/iso/html/style-iso.css +11 -7
- 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 +391 -88
- data/lib/isodoc/iso/iso.international-standard.xsl +391 -88
- 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/processor.rb +11 -9
- data/lib/metanorma/iso/version.rb +1 -1
- data/metanorma-iso.gemspec +2 -2
- data/spec/asciidoctor-iso/base_spec.rb +26 -14
- data/spec/asciidoctor-iso/blocks_spec.rb +1 -1
- data/spec/asciidoctor-iso/cleanup_spec.rb +11 -5
- 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 +18 -1
- data/spec/isodoc/amd_spec.rb +187 -22
- 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 +170 -3
- 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 +17 -1
- metadata +8 -12
- 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
@@ -50,6 +50,8 @@ RSpec.describe Asciidoctor::ISO do
|
|
50
50
|
[%appendix]
|
51
51
|
=== Appendix 1
|
52
52
|
|
53
|
+
==== Appendix subclause
|
54
|
+
|
53
55
|
== Bibliography
|
54
56
|
|
55
57
|
=== Bibliography Subsection
|
@@ -136,6 +138,9 @@ standardization at the following addresses:</p>
|
|
136
138
|
</clause>
|
137
139
|
<appendix id="_" inline-header="false" obligation="normative">
|
138
140
|
<title>Appendix 1</title>
|
141
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
142
|
+
<title>Appendix subclause</title>
|
143
|
+
</clause>
|
139
144
|
</appendix></annex><bibliography><references id="_" obligation="informative" normative="true">
|
140
145
|
<title>Normative references</title>
|
141
146
|
<p id="_">There are no normative references in this document.</p>
|
@@ -202,6 +202,23 @@ it "Warns of illegal script" do
|
|
202
202
|
expect(File.read("test.err")).to include "pizza is not a recognised script"
|
203
203
|
end
|
204
204
|
|
205
|
+
it "warns that technical report may contain requirement" do
|
206
|
+
FileUtils.rm_f "test.err"
|
207
|
+
Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
|
208
|
+
= Document title
|
209
|
+
Author
|
210
|
+
:docfile: test.adoc
|
211
|
+
:nodoc:
|
212
|
+
:no-isobib:
|
213
|
+
:doctype: technical-report
|
214
|
+
|
215
|
+
== Random clause
|
216
|
+
|
217
|
+
The widget is required not to be larger than 15 cm.
|
218
|
+
INPUT
|
219
|
+
expect(File.read("test.err")).to include "Technical Report clause may contain requirement"
|
220
|
+
end
|
221
|
+
|
205
222
|
|
206
223
|
it "warns that introduction may contain requirement" do
|
207
224
|
FileUtils.rm_f "test.err"
|
@@ -962,7 +979,7 @@ it "No warning if joint IEC/non-IEC document with subpart" do
|
|
962
979
|
:nodoc:
|
963
980
|
:docnumber: 10
|
964
981
|
:partnumber: 1-1
|
965
|
-
:publisher: ISO
|
982
|
+
:publisher: ISO;IEC
|
966
983
|
:no-isobib:
|
967
984
|
|
968
985
|
INPUT
|
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
|
|
@@ -734,7 +719,11 @@ OUTPUT
|
|
734
719
|
<sections/>
|
735
720
|
</iso-standard>
|
736
721
|
INPUT
|
737
|
-
{:
|
722
|
+
{:accesseddate=>"XXX",
|
723
|
+
:agency=>"ISO",
|
724
|
+
:circulateddate=>"XXX",
|
725
|
+
:confirmeddate=>"XXX",
|
726
|
+
:copieddate=>"XXX",
|
738
727
|
:createddate=>"2016-05-01",
|
739
728
|
:docnumber=>"ISO/PreNWIP3 17301-1:2016/Amd.1",
|
740
729
|
:docnumber_lang=>"ISO/PreNWIP3 17301-1:2016/Amd.1(E)",
|
@@ -757,27 +746,203 @@ INPUT
|
|
757
746
|
:doctitlepart=>"Title Part",
|
758
747
|
:doctitlepartlabel=>"Part 1",
|
759
748
|
:doctype=>"Amendment",
|
749
|
+
:doctype_display=>"Amendment",
|
760
750
|
:docyear=>"2017",
|
761
751
|
:draft=>"0.3.4",
|
762
752
|
:draftinfo=>" (draft 0.3.4, 2000-01-01)",
|
763
753
|
:edition=>"2",
|
764
754
|
:editorialgroup=>["A 1", "B 2", "C 3"],
|
765
755
|
:ics=>"1, 2, 3",
|
756
|
+
:implementeddate=>"XXX",
|
757
|
+
:issueddate=>"XXX",
|
758
|
+
:lang=>"en",
|
759
|
+
:obsoleteddate=>"XXX",
|
760
|
+
:publisheddate=>"XXX",
|
766
761
|
:publisher=>"International Organization for Standardization",
|
762
|
+
:receiveddate=>"XXX",
|
767
763
|
:revdate=>"2000-01-01",
|
768
764
|
:revdate_monthyear=>"January 2000",
|
769
765
|
:sc=>"B 2",
|
766
|
+
:script=>"Latn",
|
770
767
|
:secretariat=>"SECRETARIAT",
|
771
768
|
:stage=>"10",
|
772
769
|
:stage_int=>10,
|
773
770
|
:stageabbr=>"NWIP",
|
774
771
|
:statusabbr=>"PreNWIP3",
|
775
772
|
:tc=>"A 1",
|
773
|
+
:transmitteddate=>"XXX",
|
774
|
+
:unchangeddate=>"XXX",
|
776
775
|
:unpublished=>true,
|
776
|
+
:updateddate=>"XXX",
|
777
|
+
:vote_endeddate=>"XXX",
|
778
|
+
:vote_starteddate=>"XXX",
|
777
779
|
:wg=>"C 3"}
|
778
780
|
OUTPUT
|
779
781
|
end
|
780
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
|
+
|
781
946
|
it "processes middle title" do
|
782
947
|
expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
783
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>
|
@@ -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,6 +82,9 @@ INPUT
|
|
81
82
|
{:accesseddate=>"2012",
|
82
83
|
:activateddate=>"2013",
|
83
84
|
:agency=>"ISO",
|
85
|
+
:circulateddate=>"XXX",
|
86
|
+
:confirmeddate=>"XXX",
|
87
|
+
:copieddate=>"XXX",
|
84
88
|
:createddate=>"2010–2011",
|
85
89
|
:docnumber=>"ISO/PreCD3 17301-1",
|
86
90
|
:docnumber_lang=>"ISO/PreCD3 17301-1 (E)",
|
@@ -97,18 +101,25 @@ INPUT
|
|
97
101
|
:doctitlepart=>"Rice",
|
98
102
|
:doctitlepartlabel=>"Part 1",
|
99
103
|
:doctype=>"International Standard",
|
104
|
+
:doctype_display=>"International Standard",
|
100
105
|
:docyear=>"2016",
|
101
106
|
:draft=>"0.4",
|
102
107
|
:draftinfo=>" (draft 0.4, 2016-05-01)",
|
103
108
|
:edition=>"2",
|
104
109
|
:editorialgroup=>["TC 34", "SC 4", "WG 3"],
|
110
|
+
:horizontal=>"true",
|
111
|
+
:implementeddate=>"XXX",
|
112
|
+
:issueddate=>"XXX",
|
105
113
|
:keywords=>["kw2", "kw1"],
|
114
|
+
:lang=>"en",
|
106
115
|
:obsoleteddate=>"2014",
|
107
116
|
:publisheddate=>"2011",
|
108
117
|
:publisher=>"International Organization for Standardization",
|
118
|
+
:receiveddate=>"XXX",
|
109
119
|
:revdate=>"2016-05-01",
|
110
120
|
:revdate_monthyear=>"May 2016",
|
111
121
|
:sc=>"SC 4",
|
122
|
+
:script=>"Latn",
|
112
123
|
:secretariat=>"GB",
|
113
124
|
:stage=>"30",
|
114
125
|
:stage_int=>30,
|
@@ -116,12 +127,17 @@ INPUT
|
|
116
127
|
:statusabbr=>"PreCD3",
|
117
128
|
:tc=>"TC 34",
|
118
129
|
:tc_docnumber=>["17301", "17302"],
|
130
|
+
:transmitteddate=>"XXX",
|
131
|
+
:unchangeddate=>"XXX",
|
119
132
|
:unpublished=>true,
|
133
|
+
:updateddate=>"XXX",
|
134
|
+
:vote_endeddate=>"XXX",
|
135
|
+
:vote_starteddate=>"XXX",
|
120
136
|
:wg=>"WG 3"}
|
121
137
|
OUTPUT
|
122
138
|
end
|
123
139
|
|
124
|
-
it "processes IsoXML metadata" do
|
140
|
+
it "processes IsoXML metadata #2" do
|
125
141
|
c = IsoDoc::Iso::HtmlConvert.new({})
|
126
142
|
arr = c.convert_init(<<~"INPUT", "test", false)
|
127
143
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
@@ -198,7 +214,12 @@ OUTPUT
|
|
198
214
|
</bibdata>
|
199
215
|
</iso-standard>
|
200
216
|
INPUT
|
201
|
-
{:
|
217
|
+
{:accesseddate=>"XXX",
|
218
|
+
:agency=>"ISO/IEC",
|
219
|
+
:circulateddate=>"XXX",
|
220
|
+
:confirmeddate=>"XXX",
|
221
|
+
:copieddate=>"XXX",
|
222
|
+
:createddate=>"XXX",
|
202
223
|
:docnumber=>"ISO/IEC/CD 17301-1-3",
|
203
224
|
:docnumber_lang=>"ISO/IEC/CD 17301-1-3 (E)",
|
204
225
|
:docnumber_reference=>"ISO/IEC/CD 17301-1-3 (E)",
|
@@ -213,20 +234,166 @@ INPUT
|
|
213
234
|
:doctitlepart=>"Rice",
|
214
235
|
:doctitlepartlabel=>"Part 1–3",
|
215
236
|
:doctype=>"International Standard",
|
237
|
+
:doctype_display=>"International Standard",
|
216
238
|
:docyear=>"2016",
|
217
239
|
:editorialgroup=>["ABC 34", "DEF 4", "GHI 3"],
|
218
240
|
:ics=>"1.2.3, 1.2.3",
|
241
|
+
:implementeddate=>"XXX",
|
242
|
+
:issueddate=>"XXX",
|
243
|
+
:lang=>"en",
|
244
|
+
:obsoleteddate=>"XXX",
|
219
245
|
:obsoletes=>"IEC 8121",
|
220
246
|
:obsoletes_part=>"3.1",
|
247
|
+
:publisheddate=>"XXX",
|
221
248
|
:publisher=>"International Organization for Standardization and International Electrotechnical Commission",
|
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",
|
222
383
|
:sc=>"DEF 4",
|
223
|
-
:
|
384
|
+
:script=>"Latn",
|
385
|
+
:secretariat=>"XXX",
|
224
386
|
:stage=>"60",
|
225
387
|
:stage_int=>60,
|
226
388
|
:statusabbr=>"IS",
|
227
389
|
:tc=>"ABC 34",
|
228
390
|
:tc_docnumber=>["17301"],
|
391
|
+
:transmitteddate=>"XXX",
|
392
|
+
:unchangeddate=>"XXX",
|
229
393
|
:unpublished=>false,
|
394
|
+
:updateddate=>"XXX",
|
395
|
+
:vote_endeddate=>"XXX",
|
396
|
+
:vote_starteddate=>"XXX",
|
230
397
|
:wg=>"GHI 3"}
|
231
398
|
OUTPUT
|
232
399
|
end
|