metanorma-iec 1.1.2 → 1.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/asciidoctor/iec/basicdoc.rng +31 -1
- data/lib/asciidoctor/iec/converter.rb +6 -15
- data/lib/asciidoctor/iec/front.rb +4 -4
- data/lib/asciidoctor/iec/isodoc.rng +124 -15
- data/lib/isodoc/iec/base_convert.rb +6 -58
- data/lib/isodoc/iec/html/htmlstyle.css +962 -0
- data/lib/isodoc/iec/html/isodoc.css +857 -0
- data/lib/isodoc/iec/html/isodoc.scss +19 -4
- data/lib/isodoc/iec/html/wordstyle.css +2013 -0
- data/lib/isodoc/iec/html/wordstyle.scss +15 -10
- data/lib/isodoc/iec/html_convert.rb +2 -0
- data/lib/isodoc/iec/i18n-en.yaml +13 -0
- data/lib/isodoc/iec/i18n-fr.yaml +13 -0
- data/lib/isodoc/iec/i18n-zh-Hans.yaml +11 -0
- data/lib/isodoc/iec/i18n.rb +19 -0
- data/lib/isodoc/iec/iec.international-standard.xsl +1997 -1480
- data/lib/isodoc/iec/init.rb +29 -0
- data/lib/isodoc/iec/presentation_xml_convert.rb +26 -1
- data/lib/isodoc/iec/word_convert.rb +3 -1
- data/lib/isodoc/iec/xref.rb +1 -1
- data/lib/metanorma/iec/version.rb +1 -1
- data/metanorma-iec.gemspec +2 -2
- data/spec/asciidoctor-iec/blocks_spec.rb +1 -1
- data/spec/asciidoctor-iec/cleanup_spec.rb +32 -8
- data/spec/asciidoctor-iec/iev_spec.rb +74 -1
- data/spec/asciidoctor-iec/inline_spec.rb +8 -2
- data/spec/asciidoctor-iec/section_spec.rb +17 -15
- data/spec/isodoc/blocks_spec.rb +66 -1
- data/spec/isodoc/i18n_spec.rb +296 -244
- data/spec/isodoc/iev_spec.rb +221 -18
- data/spec/isodoc/inline_spec.rb +97 -73
- data/spec/isodoc/iso_spec.rb +6 -0
- data/spec/isodoc/postproc_spec.rb +15 -29
- data/spec/isodoc/ref_spec.rb +141 -14
- data/spec/isodoc/section_spec.rb +112 -102
- data/spec/isodoc/terms_spec.rb +67 -53
- data/spec/metanorma/processor_spec.rb +2 -1
- metadata +11 -9
- data/lib/asciidoctor/iec/i18n-en.yaml +0 -12
- data/lib/asciidoctor/iec/i18n-fr.yaml +0 -11
- data/lib/asciidoctor/iec/i18n-zh-Hans.yaml +0 -9
@@ -0,0 +1,29 @@
|
|
1
|
+
require "isodoc"
|
2
|
+
require_relative "metadata"
|
3
|
+
require_relative "xref"
|
4
|
+
require_relative "i18n"
|
5
|
+
|
6
|
+
module IsoDoc
|
7
|
+
module Iec
|
8
|
+
module Init
|
9
|
+
def metadata_init(lang, script, labels)
|
10
|
+
@meta = Metadata.new(lang, script, labels)
|
11
|
+
end
|
12
|
+
|
13
|
+
def xref_init(lang, script, klass, labels, options)
|
14
|
+
@xrefs = Xref.new(lang, script, HtmlConvert.new(language: lang, script: script), labels, options)
|
15
|
+
end
|
16
|
+
|
17
|
+
def i18n_init(lang, script, i18nyaml = nil)
|
18
|
+
@i18n = I18n.new(lang, script, i18nyaml || @i18nyaml)
|
19
|
+
end
|
20
|
+
|
21
|
+
def convert1(docxml, filename, dir)
|
22
|
+
id = docxml&.at(ns("//bibdata/docnumber"))&.text
|
23
|
+
@is_iev = id == "60050"
|
24
|
+
super
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
@@ -1,9 +1,34 @@
|
|
1
|
-
require_relative "
|
1
|
+
require_relative "init"
|
2
2
|
require "isodoc"
|
3
3
|
|
4
4
|
module IsoDoc
|
5
5
|
module Iec
|
6
6
|
class PresentationXMLConvert < IsoDoc::Iso::PresentationXMLConvert
|
7
|
+
def clause(docxml)
|
8
|
+
docxml.xpath(ns("//clause[not(ancestor::annex)] | "\
|
9
|
+
"//definitions | //references | "\
|
10
|
+
"//preface/introduction[clause]")).
|
11
|
+
each do |f|
|
12
|
+
clause1(f)
|
13
|
+
end
|
14
|
+
docxml.xpath(ns("//terms")).each do |f|
|
15
|
+
termclause1(f)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def termclause1(f)
|
20
|
+
return clause1(f) unless @is_iev
|
21
|
+
return if @suppressheadingnumbers || f["unnumbered"]
|
22
|
+
lbl = @xrefs.anchor(f['id'], :label, true) or return
|
23
|
+
prefix_name(f, " ", "#{lbl}#{clausedelim}", "title")
|
24
|
+
end
|
25
|
+
|
26
|
+
def clause1(f)
|
27
|
+
IsoDoc::PresentationXMLConvert.instance_method(:clause1).bind(self).
|
28
|
+
call(f)
|
29
|
+
end
|
30
|
+
|
31
|
+
include Init
|
7
32
|
end
|
8
33
|
end
|
9
34
|
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
require "isodoc"
|
2
2
|
require "metanorma-iso"
|
3
3
|
require_relative "base_convert"
|
4
|
+
require_relative "init"
|
4
5
|
|
5
6
|
module IsoDoc
|
6
7
|
module Iec
|
@@ -171,7 +172,7 @@ module IsoDoc
|
|
171
172
|
div.p **attr_code(class: "formula") do |p|
|
172
173
|
insert_tab(div, 1)
|
173
174
|
parse(node.at(ns("./stem")), div)
|
174
|
-
lbl =
|
175
|
+
lbl = node&.at(ns("./name"))&.text
|
175
176
|
unless lbl.nil?
|
176
177
|
insert_tab(div, 1)
|
177
178
|
div << "(#{lbl})"
|
@@ -181,6 +182,7 @@ module IsoDoc
|
|
181
182
|
end
|
182
183
|
|
183
184
|
include BaseConvert
|
185
|
+
include Init
|
184
186
|
end
|
185
187
|
end
|
186
188
|
end
|
data/lib/isodoc/iec/xref.rb
CHANGED
@@ -38,7 +38,7 @@ module IsoDoc
|
|
38
38
|
def annex_name_lbl(clause, num)
|
39
39
|
obl = l10n("(#{@labels["inform_annex"]})")
|
40
40
|
obl = l10n("(#{@labels["norm_annex"]})") if clause["obligation"] == "normative"
|
41
|
-
l10n("<
|
41
|
+
l10n("<strong>#{@labels["annex"]} #{num}</strong><br/>#{obl}")
|
42
42
|
end
|
43
43
|
end
|
44
44
|
end
|
data/metanorma-iec.gemspec
CHANGED
@@ -28,8 +28,8 @@ Gem::Specification.new do |spec|
|
|
28
28
|
spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
|
29
29
|
|
30
30
|
spec.add_dependency "ruby-jing"
|
31
|
-
spec.add_dependency "isodoc", "~> 1.
|
32
|
-
spec.add_dependency "metanorma-iso", "~> 1.
|
31
|
+
spec.add_dependency "isodoc", "~> 1.2.0"
|
32
|
+
spec.add_dependency "metanorma-iso", "~> 1.5.0"
|
33
33
|
|
34
34
|
spec.add_development_dependency "byebug"
|
35
35
|
spec.add_development_dependency "sassc", "2.4.0"
|
@@ -265,7 +265,7 @@ RSpec.describe Asciidoctor::Iec do
|
|
265
265
|
INPUT
|
266
266
|
#{BLANK_HDR}
|
267
267
|
<preface><foreword id="_" obligation="informative">
|
268
|
-
<title>
|
268
|
+
<title>FOREWORD</title>
|
269
269
|
<p id="_">This is a preamble</p>
|
270
270
|
</foreword></preface><sections>
|
271
271
|
<clause id="_" inline-header="false" obligation="normative">
|
@@ -34,7 +34,19 @@ RSpec.describe Asciidoctor::Iec do
|
|
34
34
|
<p id="_">For the purposes of this document,
|
35
35
|
the following terms and definitions apply.</p>
|
36
36
|
#{TERMS_BOILERPLATE}
|
37
|
-
<term id="term-t90"><preferred><stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub><
|
37
|
+
<term id="term-t90"><preferred><stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mrow>
|
38
|
+
<mi>t</mi>
|
39
|
+
</mrow>
|
40
|
+
<mrow>
|
41
|
+
<mn>90</mn>
|
42
|
+
</mrow>
|
43
|
+
</msub></math></stem></preferred><admitted><stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mrow>
|
44
|
+
<mi>t</mi>
|
45
|
+
</mrow>
|
46
|
+
<mrow>
|
47
|
+
<mn>91</mn>
|
48
|
+
</mrow>
|
49
|
+
</msub></math></stem></admitted>
|
38
50
|
<definition><p id="_">Time</p></definition></term>
|
39
51
|
</terms>
|
40
52
|
</sections>
|
@@ -70,8 +82,20 @@ RSpec.describe Asciidoctor::Iec do
|
|
70
82
|
<p id="_">For the purposes of this document,
|
71
83
|
the following terms and definitions apply.</p>
|
72
84
|
#{TERMS_BOILERPLATE}
|
73
|
-
<term id="term-t90"><preferred><stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub><
|
74
|
-
|
85
|
+
<term id="term-t90"><preferred><stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mrow>
|
86
|
+
<mi>t</mi>
|
87
|
+
</mrow>
|
88
|
+
<mrow>
|
89
|
+
<mn>90</mn>
|
90
|
+
</mrow>
|
91
|
+
</msub></math></stem></preferred><definition><formula id="_">
|
92
|
+
<stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mrow>
|
93
|
+
<mi>t</mi>
|
94
|
+
</mrow>
|
95
|
+
<mrow>
|
96
|
+
<mi>A</mi>
|
97
|
+
</mrow>
|
98
|
+
</msub></math></stem>
|
75
99
|
</formula><p id="_">This paragraph is extraneous</p></definition>
|
76
100
|
</term>
|
77
101
|
</terms>
|
@@ -121,7 +145,7 @@ RSpec.describe Asciidoctor::Iec do
|
|
121
145
|
#{BLANK_HDR}
|
122
146
|
<preface>
|
123
147
|
<foreword id="_" obligation="informative">
|
124
|
-
<title>
|
148
|
+
<title>FOREWORD</title>
|
125
149
|
<p id="_">
|
126
150
|
<eref type="inline" bibitemid="iso216" citeas="ISO 216"/>
|
127
151
|
</p>
|
@@ -189,7 +213,7 @@ RSpec.describe Asciidoctor::Iec do
|
|
189
213
|
INPUT
|
190
214
|
#{BLANK_HDR}
|
191
215
|
<sections></sections>
|
192
|
-
<bibliography><references id="_" obligation="informative" normative="true"><title>Normative
|
216
|
+
<bibliography><references id="_" obligation="informative" normative="true"><title>Normative references</title>
|
193
217
|
<p id="_">The following documents are referred to in the text in such a way that some or all of their content constitutes requirements of this document. For dated references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments) applies.</p>
|
194
218
|
<bibitem id="iso216" type="standard">
|
195
219
|
<title format="text/plain">Reference</title>
|
@@ -257,9 +281,9 @@ RSpec.describe Asciidoctor::Iec do
|
|
257
281
|
<sections><table id="_">
|
258
282
|
<tbody>
|
259
283
|
<tr>
|
260
|
-
<td align="left">a</td>
|
261
|
-
<td align="left">b</td>
|
262
|
-
<td align="left">c</td>
|
284
|
+
<td valign="top" align="left">a</td>
|
285
|
+
<td valign="top" align="left">b</td>
|
286
|
+
<td valign="top" align="left">c</td>
|
263
287
|
</tr>
|
264
288
|
</tbody>
|
265
289
|
<dl id="_">
|
@@ -68,7 +68,7 @@ RSpec.describe Asciidoctor::Iec do
|
|
68
68
|
<sections> </sections>
|
69
69
|
<bibliography>
|
70
70
|
<references id='_' obligation='informative' normative="true">
|
71
|
-
<title>Normative
|
71
|
+
<title>Normative references</title>
|
72
72
|
<p id='_'>There are no normative references in this document.</p>
|
73
73
|
<bibitem id='A'>
|
74
74
|
<formattedref format='application/x-isodoc+xml'>
|
@@ -158,4 +158,77 @@ INPUT
|
|
158
158
|
|
159
159
|
OUTPUT
|
160
160
|
end
|
161
|
+
|
162
|
+
it "uses IEV introduction title" do
|
163
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
164
|
+
= Document title
|
165
|
+
Author
|
166
|
+
:docfile: test.adoc
|
167
|
+
:nodoc:
|
168
|
+
:novalid:
|
169
|
+
:no-isobib:
|
170
|
+
:docnumber: 60050
|
171
|
+
|
172
|
+
== Introduction
|
173
|
+
|
174
|
+
Text
|
175
|
+
INPUT
|
176
|
+
<?xml version='1.0' encoding='UTF-8'?>
|
177
|
+
<iec-standard xmlns='https://www.metanorma.org/ns/iec'>
|
178
|
+
<bibdata type='standard'>
|
179
|
+
<docidentifier type='ISO'>IEC 60050 ED 1</docidentifier>
|
180
|
+
<docnumber>60050</docnumber>
|
181
|
+
<contributor>
|
182
|
+
<role type='author'/>
|
183
|
+
<organization>
|
184
|
+
<name>International Electrotechnical Commission</name>
|
185
|
+
<abbreviation>IEC</abbreviation>
|
186
|
+
</organization>
|
187
|
+
</contributor>
|
188
|
+
<contributor>
|
189
|
+
<role type='publisher'/>
|
190
|
+
<organization>
|
191
|
+
<name>International Electrotechnical Commission</name>
|
192
|
+
<abbreviation>IEC</abbreviation>
|
193
|
+
</organization>
|
194
|
+
</contributor>
|
195
|
+
<language>en</language>
|
196
|
+
<script>Latn</script>
|
197
|
+
<status>
|
198
|
+
<stage abbreviation='PPUB'>60</stage>
|
199
|
+
<substage abbreviation='PPUB'>60</substage>
|
200
|
+
</status>
|
201
|
+
<copyright>
|
202
|
+
<from>2020</from>
|
203
|
+
<owner>
|
204
|
+
<organization>
|
205
|
+
<name>International Electrotechnical Commission</name>
|
206
|
+
<abbreviation>IEC</abbreviation>
|
207
|
+
</organization>
|
208
|
+
</owner>
|
209
|
+
</copyright>
|
210
|
+
<ext>
|
211
|
+
<doctype>article</doctype>
|
212
|
+
<editorialgroup>
|
213
|
+
<technical-committee/>
|
214
|
+
<subcommittee/>
|
215
|
+
<workgroup/>
|
216
|
+
</editorialgroup>
|
217
|
+
<structuredidentifier>
|
218
|
+
<project-number>IEC 60050</project-number>
|
219
|
+
</structuredidentifier>
|
220
|
+
<stagename>International standard</stagename>
|
221
|
+
</ext>
|
222
|
+
</bibdata>
|
223
|
+
#{BOILERPLATE}
|
224
|
+
<preface>
|
225
|
+
<introduction id='_' obligation='informative'>
|
226
|
+
<title>INTRODUCTION<br/>Principles and rules followed</title>
|
227
|
+
<p id='_'>Text</p>
|
228
|
+
</introduction>
|
229
|
+
</preface>
|
230
|
+
<sections> </sections>
|
231
|
+
</iec-standard>
|
232
|
+
OUTPUT
|
233
|
+
end
|
161
234
|
end
|
@@ -28,7 +28,13 @@ RSpec.describe Asciidoctor::Iec do
|
|
28
28
|
‘single quote’
|
29
29
|
super<sup>script</sup>
|
30
30
|
sub<sub>script</sub>
|
31
|
-
<stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub><
|
31
|
+
<stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mrow>
|
32
|
+
<mi>a</mi>
|
33
|
+
</mrow>
|
34
|
+
<mrow>
|
35
|
+
<mn>90</mn>
|
36
|
+
</mrow>
|
37
|
+
</msub></math></stem>
|
32
38
|
<stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub> <mrow> <mrow> <mi mathvariant="bold-italic">F</mi> </mrow> </mrow> <mrow> <mrow> <mi mathvariant="bold-italic">Α</mi> </mrow> </mrow> </msub> </math></stem>
|
33
39
|
<admitted>alt</admitted>
|
34
40
|
<deprecates>deprecated</deprecates>
|
@@ -128,7 +134,7 @@ RSpec.describe Asciidoctor::Iec do
|
|
128
134
|
<sections>
|
129
135
|
|
130
136
|
</sections><bibliography><references id="_" obligation="informative" normative="true">
|
131
|
-
<title>Normative
|
137
|
+
<title>Normative references</title>
|
132
138
|
<p id="_">The following documents are referred to in the text in such a way that some or all of their content constitutes requirements of this document. For dated references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments) applies.</p>
|
133
139
|
<bibitem id="ISO712">
|
134
140
|
<formattedref format="application/x-isodoc+xml">Reference</formattedref>
|
@@ -54,13 +54,14 @@ RSpec.describe Asciidoctor::Iec do
|
|
54
54
|
INPUT
|
55
55
|
#{BLANK_HDR}
|
56
56
|
<preface><foreword id="_" obligation="informative">
|
57
|
-
<title>
|
57
|
+
<title>FOREWORD</title>
|
58
58
|
<p id="_">Text</p>
|
59
|
-
</foreword><introduction id="_" obligation="informative"
|
59
|
+
</foreword><introduction id="_" obligation="informative">
|
60
|
+
<title>INTRODUCTION</title><clause id="_" inline-header="false" obligation="informative">
|
60
61
|
<title>Introduction Subsection</title>
|
61
62
|
</clause>
|
62
63
|
</introduction></preface><sections>
|
63
|
-
<clause id="_" obligation="normative">
|
64
|
+
<clause id="_" obligation="normative" type="scope" inline-header='false'>
|
64
65
|
<title>Scope</title>
|
65
66
|
<p id="_">Text</p>
|
66
67
|
</clause>
|
@@ -98,8 +99,8 @@ RSpec.describe Asciidoctor::Iec do
|
|
98
99
|
<preferred>Term2</preferred>
|
99
100
|
</term>
|
100
101
|
</terms>
|
101
|
-
<definitions id="_"><title>Symbols and
|
102
|
-
<definitions id="_"><title>Symbols and
|
102
|
+
<definitions id="_" obligation="normative"><title>Symbols and abbreviated terms</title></definitions></clause>
|
103
|
+
<definitions id="_" obligation="normative"><title>Symbols and abbreviated terms</title></definitions>
|
103
104
|
<clause id="_" inline-header="false" obligation="normative"><title>Clause 4</title><clause id="_" inline-header="false" obligation="normative">
|
104
105
|
<title>Introduction</title>
|
105
106
|
</clause>
|
@@ -119,7 +120,7 @@ RSpec.describe Asciidoctor::Iec do
|
|
119
120
|
<appendix id="_" inline-header="false" obligation="normative">
|
120
121
|
<title>Appendix 1</title>
|
121
122
|
</appendix></annex><bibliography><references id="_" obligation="informative" normative="true">
|
122
|
-
<title>Normative
|
123
|
+
<title>Normative references</title><p id="_">There are no normative references in this document.</p>
|
123
124
|
</references><clause id="_" obligation="informative">
|
124
125
|
<title>Bibliography</title>
|
125
126
|
<references id="_" obligation="informative" normative="false">
|
@@ -191,16 +192,17 @@ RSpec.describe Asciidoctor::Iec do
|
|
191
192
|
#{BLANK_HDR}
|
192
193
|
<preface>
|
193
194
|
<foreword id="_" obligation="informative">
|
194
|
-
<title>
|
195
|
+
<title>FOREWORD</title>
|
195
196
|
<p id="_">Text</p>
|
196
197
|
</foreword>
|
197
|
-
<introduction id="_" obligation="informative"
|
198
|
+
<introduction id="_" obligation="informative">
|
199
|
+
<title>INTRODUCTION</title><clause id="_" inline-header="false" obligation="informative">
|
198
200
|
<title>Introduction Subsection</title>
|
199
201
|
</clause>
|
200
202
|
</introduction>
|
201
203
|
</preface>
|
202
204
|
<sections>
|
203
|
-
<clause id="_" obligation="normative">
|
205
|
+
<clause id="_" obligation="normative" type="scope" inline-header='false'>
|
204
206
|
<title>Scope</title>
|
205
207
|
<p id="_">Text</p>
|
206
208
|
</clause>
|
@@ -214,7 +216,7 @@ RSpec.describe Asciidoctor::Iec do
|
|
214
216
|
</term>
|
215
217
|
</terms>
|
216
218
|
<clause id='_' obligation='normative'>
|
217
|
-
<title>Terms and
|
219
|
+
<title>Terms, definitions, symbols and abbreviated terms</title>
|
218
220
|
<terms id='_' obligation='normative'>
|
219
221
|
<title>Normal Terms</title>
|
220
222
|
<p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
|
@@ -240,12 +242,12 @@ RSpec.describe Asciidoctor::Iec do
|
|
240
242
|
<preferred>Term2</preferred>
|
241
243
|
</term>
|
242
244
|
</terms>
|
243
|
-
<definitions id='_'>
|
244
|
-
<title
|
245
|
+
<definitions id='_' obligation="normative">
|
246
|
+
<title>Symbols and abbreviated terms</title>
|
245
247
|
</definitions>
|
246
248
|
</clause>
|
247
|
-
<definitions id='_'>
|
248
|
-
<title
|
249
|
+
<definitions id='_' obligation="normative">
|
250
|
+
<title>Symbols and abbreviated terms</title>
|
249
251
|
</definitions>
|
250
252
|
<clause id='_' inline-header='false' obligation='normative'>
|
251
253
|
<title>Clause 4</title>
|
@@ -268,7 +270,7 @@ RSpec.describe Asciidoctor::Iec do
|
|
268
270
|
</annex>
|
269
271
|
<bibliography>
|
270
272
|
<references id='_' obligation='informative' normative="true">
|
271
|
-
<title>Normative
|
273
|
+
<title>Normative references</title>
|
272
274
|
<p id="_">There are no normative references in this document.</p>
|
273
275
|
</references>
|
274
276
|
<clause id='_' obligation='informative'>
|
data/spec/isodoc/blocks_spec.rb
CHANGED
@@ -80,10 +80,11 @@ RSpec.describe IsoDoc::Iec do
|
|
80
80
|
</dd>
|
81
81
|
</dl>
|
82
82
|
<note id="_83083c7a-6c85-43db-a9fa-4d8edd0c9fc0">
|
83
|
+
<name>NOTE</name>
|
83
84
|
<p id="_511aaa98-4116-42af-8e5b-c87cdf5bfdc8">[durationUnits] is essentially a duration statement without the "P" prefix. "P" is unnecessary because between "G" and "U" duration is always expressed.</p>
|
84
85
|
</note>
|
85
86
|
</formula>
|
86
|
-
<formula id="_be9158af-7e93-4ee2-90c5-26d31c181935">
|
87
|
+
<formula id="_be9158af-7e93-4ee2-90c5-26d31c181935"><name>1</name>
|
87
88
|
<stem type="AsciiMath">r = 1 %</stem>
|
88
89
|
</formula>
|
89
90
|
</foreword></preface>
|
@@ -151,4 +152,68 @@ RSpec.describe IsoDoc::Iec do
|
|
151
152
|
OUTPUT
|
152
153
|
end
|
153
154
|
|
155
|
+
it "cross-references formulae" do
|
156
|
+
expect(xmlpp(IsoDoc::Iec::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true).gsub(%r{^.*<body}m, "<body").gsub(%r{</body>.*}m, "</body>"))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
157
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
158
|
+
<preface>
|
159
|
+
<foreword>
|
160
|
+
<p>
|
161
|
+
<xref target="N1"/>
|
162
|
+
<xref target="N2"/>
|
163
|
+
</p>
|
164
|
+
</foreword>
|
165
|
+
</preface>
|
166
|
+
<sections>
|
167
|
+
<clause id="intro"><title>First</title>
|
168
|
+
<formula id="N1">
|
169
|
+
<stem type="AsciiMath">r = 1 %</stem>
|
170
|
+
</formula>
|
171
|
+
<clause id="xyz"><title>Preparatory</title>
|
172
|
+
<formula id="N2" inequality="true">
|
173
|
+
<stem type="AsciiMath">r = 1 %</stem>
|
174
|
+
</formula>
|
175
|
+
<xref target="N2"/>
|
176
|
+
</clause>
|
177
|
+
</sections>
|
178
|
+
</iso-standard>
|
179
|
+
INPUT
|
180
|
+
<iso-standard xmlns='http://riboseinc.com/isoxml'>
|
181
|
+
<preface>
|
182
|
+
<foreword>
|
183
|
+
<p>
|
184
|
+
<xref target='N1'>Clause 1, Equation (1)</xref>
|
185
|
+
<xref target='N2'>1.1, Inequality (2)</xref>
|
186
|
+
</p>
|
187
|
+
</foreword>
|
188
|
+
</preface>
|
189
|
+
<sections>
|
190
|
+
<clause id='intro'>
|
191
|
+
<title depth='1'>
|
192
|
+
1
|
193
|
+
<tab/>
|
194
|
+
First
|
195
|
+
</title>
|
196
|
+
<formula id='N1'>
|
197
|
+
<name>1</name>
|
198
|
+
<stem type='AsciiMath'>r = 1 %</stem>
|
199
|
+
</formula>
|
200
|
+
<clause id='xyz'>
|
201
|
+
<title depth='2'>
|
202
|
+
1.1
|
203
|
+
<tab/>
|
204
|
+
Preparatory
|
205
|
+
</title>
|
206
|
+
<formula id='N2' inequality='true'>
|
207
|
+
<name>2</name>
|
208
|
+
<stem type='AsciiMath'>r = 1 %</stem>
|
209
|
+
</formula>
|
210
|
+
<xref target='N2'>Inequality (2)</xref>
|
211
|
+
</clause>
|
212
|
+
</clause>
|
213
|
+
</sections>
|
214
|
+
</iso-standard>
|
215
|
+
OUTPUT
|
216
|
+
end
|
217
|
+
|
218
|
+
|
154
219
|
end
|