metanorma-iso 1.9.6 → 1.10.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ubuntu.yml +41 -0
- data/Gemfile +3 -4
- data/Makefile +44 -0
- data/Rakefile +1 -1
- data/bin/rspec +1 -2
- data/lib/asciidoctor/iso/cleanup.rb +7 -6
- data/lib/asciidoctor/iso/front.rb +2 -2
- data/lib/asciidoctor/iso/isodoc.rng +254 -27
- data/lib/asciidoctor/iso/section.rb +1 -1
- data/lib/asciidoctor/iso/validate.rb +7 -7
- data/lib/asciidoctor/iso/validate_section.rb +1 -1
- data/lib/isodoc/iso/html/isodoc.css +0 -1
- data/lib/isodoc/iso/html/isodoc.scss +0 -1
- data/lib/isodoc/iso/html/style-human.css +0 -1
- data/lib/isodoc/iso/html/style-human.scss +0 -1
- data/lib/isodoc/iso/html/style-iso.css +0 -1
- data/lib/isodoc/iso/html/style-iso.scss +0 -1
- data/lib/isodoc/iso/i18n.rb +10 -9
- data/lib/isodoc/iso/iso.amendment.xsl +57 -17
- data/lib/isodoc/iso/iso.international-standard.xsl +57 -17
- data/lib/isodoc/iso/isosts_convert.rb +6 -2
- data/lib/isodoc/iso/presentation_xml_convert.rb +19 -9
- data/lib/isodoc/iso/sections.rb +2 -0
- data/lib/isodoc/iso/sts_convert.rb +5 -2
- data/lib/isodoc/iso/word_cleanup.rb +94 -0
- data/lib/isodoc/iso/word_convert.rb +12 -89
- data/lib/metanorma/iso/processor.rb +2 -2
- data/lib/metanorma/iso/version.rb +1 -1
- data/metanorma-iso.gemspec +4 -5
- data/spec/asciidoctor/base_spec.rb +543 -209
- data/spec/asciidoctor/blocks_spec.rb +22 -47
- data/spec/asciidoctor/cleanup_spec.rb +37 -20
- data/spec/asciidoctor/inline_spec.rb +10 -2
- data/spec/asciidoctor/refs_spec.rb +174 -88
- data/spec/asciidoctor/section_spec.rb +3 -3
- data/spec/isodoc/i18n_spec.rb +36 -22
- data/spec/isodoc/inline_spec.rb +6 -6
- data/spec/isodoc/section_spec.rb +4 -4
- data/spec/isodoc/table_spec.rb +6 -8
- data/spec/isodoc/terms_spec.rb +25 -25
- data/spec/isodoc/xref_spec.rb +1397 -1376
- data/spec/metanorma/processor_spec.rb +114 -15
- data/spec/spec_helper.rb +2 -1
- data/spec/vcr_cassettes/docrels.yml +427 -37
- data/spec/vcr_cassettes/sortrefs.yml +599 -0
- metadata +13 -24
@@ -8,6 +8,100 @@ RSpec.describe Metanorma::Iso::Processor do
|
|
8
8
|
registry.register(Metanorma::Iso::Processor)
|
9
9
|
processor = registry.find_processor(:iso)
|
10
10
|
|
11
|
+
inputxml = <<~INPUT
|
12
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
13
|
+
<bibdata type="standard">
|
14
|
+
<title language="en" format="text/plain" type="main">English</title>
|
15
|
+
<title language="en" format="text/plain" type="title-main">English</title>
|
16
|
+
<title language="fr" format="text/plain" type="main">French</title>
|
17
|
+
<title language="fr" format="text/plain" type="title-main">French</title>
|
18
|
+
<docidentifier type="ISO">ISO DIR 1</docidentifier><docidentifier type="iso-with-lang">ISO DIR 1(F)</docidentifier><docidentifier type="iso-reference">ISO DIR 1(F)</docidentifier>
|
19
|
+
<docnumber>1</docnumber>
|
20
|
+
<contributor>
|
21
|
+
<role type="author"/>
|
22
|
+
<organization>
|
23
|
+
<name>International Organization for Standardization</name>
|
24
|
+
<abbreviation>ISO</abbreviation>
|
25
|
+
</organization>
|
26
|
+
</contributor>
|
27
|
+
<contributor>
|
28
|
+
<role type="publisher"/>
|
29
|
+
<organization>
|
30
|
+
<name>International Organization for Standardization</name>
|
31
|
+
<abbreviation>ISO</abbreviation>
|
32
|
+
</organization>
|
33
|
+
</contributor>
|
34
|
+
<language>fr</language>
|
35
|
+
<script>Latn</script>
|
36
|
+
<status>
|
37
|
+
<stage abbreviation="IS">60</stage>
|
38
|
+
<substage>60</substage>
|
39
|
+
</status>
|
40
|
+
<copyright>
|
41
|
+
<from>2021</from>
|
42
|
+
<owner>
|
43
|
+
<organization>
|
44
|
+
<name>International Organization for Standardization</name>
|
45
|
+
<abbreviation>ISO</abbreviation>
|
46
|
+
</organization>
|
47
|
+
</owner>
|
48
|
+
</copyright>
|
49
|
+
<ext>
|
50
|
+
<doctype>directive</doctype>
|
51
|
+
<subdoctype>vocabulary</subdoctype>
|
52
|
+
<editorialgroup>
|
53
|
+
<technical-committee/>
|
54
|
+
<subcommittee/>
|
55
|
+
<workgroup/>
|
56
|
+
</editorialgroup>
|
57
|
+
<structuredidentifier>
|
58
|
+
<project-number>ISO 1</project-number>
|
59
|
+
</structuredidentifier>
|
60
|
+
<stagename>International standard</stagename>
|
61
|
+
</ext>
|
62
|
+
</bibdata>
|
63
|
+
<boilerplate>
|
64
|
+
<copyright-statement>
|
65
|
+
<clause>
|
66
|
+
<title>DOCUMENT PROTÉGÉ PAR COPYRIGHT</title>
|
67
|
+
<p id="boilerplate-year">© ISO 2021</p>
|
68
|
+
|
69
|
+
<p id="boilerplate-message">
|
70
|
+
Droits de reproduction réservés. Sauf indication contraire, aucune partie de cette publication ne
|
71
|
+
peut être reproduite ni utilisée sous quelque forme que ce soit et par aucun procédé, électronique
|
72
|
+
ou mécanique, y compris la photocopie, l’affichage sur l’internet ou sur un Intranet, sans
|
73
|
+
autorisation écrite préalable. Les demandes d’autorisation peuvent être adressées à l’ISO à
|
74
|
+
l’adresse ci-après ou au comité membre de l’ISO dans le pays du demandeur.
|
75
|
+
</p>
|
76
|
+
|
77
|
+
<p id="boilerplate-address" align="left">
|
78
|
+
ISO copyright office<br/>
|
79
|
+
Ch. de Blandonnet 8 • CP 401<br/>
|
80
|
+
CH-1214 Vernier, Geneva, Switzerland<br/>
|
81
|
+
Tel.  + 41 22 749 01 11<br/>
|
82
|
+
Fax  + 41 22 749 09 47<br/>
|
83
|
+
Email: copyright@iso.org<br/>
|
84
|
+
Website: www.iso.org
|
85
|
+
</p>
|
86
|
+
<p id="boilerplate-place">
|
87
|
+
Publié en Suisse
|
88
|
+
</p>
|
89
|
+
</clause>
|
90
|
+
</copyright-statement>
|
91
|
+
|
92
|
+
|
93
|
+
</boilerplate>
|
94
|
+
<sections>
|
95
|
+
<terms id="H" obligation="normative"><title>1  Terms, Definitions, Symbols and Abbreviated Terms</title>
|
96
|
+
<term id="J">
|
97
|
+
<name>1.1</name>
|
98
|
+
<preferred>Term2</preferred>
|
99
|
+
</term>
|
100
|
+
</terms>
|
101
|
+
</sections>
|
102
|
+
</iso-standard>
|
103
|
+
INPUT
|
104
|
+
|
11
105
|
it "registers against metanorma" do
|
12
106
|
expect(processor).not_to be nil
|
13
107
|
end
|
@@ -23,36 +117,30 @@ RSpec.describe Metanorma::Iso::Processor do
|
|
23
117
|
end
|
24
118
|
|
25
119
|
it "generates IsoDoc XML from a blank document" do
|
26
|
-
|
120
|
+
input = <<~INPUT
|
27
121
|
#{ASCIIDOC_BLANK_HDR}
|
28
122
|
INPUT
|
123
|
+
output = <<~OUTPUT
|
29
124
|
#{BLANK_HDR}
|
30
125
|
<sections/>
|
31
126
|
</iso-standard>
|
32
127
|
OUTPUT
|
128
|
+
expect(xmlpp(processor.input_to_isodoc(input, nil)))
|
129
|
+
.to be_equivalent_to xmlpp(output)
|
33
130
|
end
|
34
131
|
|
35
|
-
it "generates HTML from
|
132
|
+
it "generates HTML from Metanorma XML" do
|
36
133
|
FileUtils.rm_f "test.xml"
|
37
|
-
|
38
|
-
|
39
|
-
<sections>
|
40
|
-
<terms id="H" obligation="normative"><title>1  Terms, Definitions, Symbols and Abbreviated Terms</title>
|
41
|
-
<term id="J">
|
42
|
-
<name>1.1</name>
|
43
|
-
<preferred>Term2</preferred>
|
44
|
-
</term>
|
45
|
-
</terms>
|
46
|
-
</sections>
|
47
|
-
</iso-standard>
|
48
|
-
INPUT
|
134
|
+
FileUtils.rm_f "test.html"
|
135
|
+
processor.output(inputxml, "test.xml", "test.html", :html)
|
49
136
|
expect(xmlpp(File.read("test.html", encoding: "utf-8")
|
50
137
|
.gsub(%r{^.*<main}m, "<main")
|
51
138
|
.gsub(%r{</main>.*}m, "</main>")))
|
52
139
|
.to be_equivalent_to xmlpp(<<~"OUTPUT")
|
53
140
|
<main class="main-section">
|
54
141
|
<button onclick="topFunction()" id="myBtn" title="Go to top">Top</button>
|
55
|
-
<
|
142
|
+
<div class='authority'> </div>
|
143
|
+
<p class='zzSTDTitle1'>French</p>
|
56
144
|
<div id="H"><h1 id="toc0">1  Terms, Definitions, Symbols and Abbreviated Terms</h1>
|
57
145
|
<h2 class="TermNum" id="J">1.1</h2>
|
58
146
|
<p class="Terms" style="text-align:left;">Term2</p>
|
@@ -60,4 +148,15 @@ RSpec.describe Metanorma::Iso::Processor do
|
|
60
148
|
</main>
|
61
149
|
OUTPUT
|
62
150
|
end
|
151
|
+
|
152
|
+
it "generates STS from Metanorma XML" do
|
153
|
+
FileUtils.rm_f "test.xml"
|
154
|
+
FileUtils.rm_f "test.sts.xml"
|
155
|
+
FileUtils.rm_f "test.iso.sts.xml"
|
156
|
+
File.open("test.xml", "w") { |f| f.write inputxml }
|
157
|
+
processor.output(inputxml, "test.xml", "test.sts.xml", :sts)
|
158
|
+
processor.output(inputxml, "test.xml", "test.iso.sts.xml", :isosts)
|
159
|
+
expect(File.exist?("test.sts.xml")).to be true
|
160
|
+
expect(File.exist?("test.iso.sts.xml")).to be true
|
161
|
+
end
|
63
162
|
end
|
data/spec/spec_helper.rb
CHANGED