metanorma-iso 2.1.3 → 2.1.6
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/lib/isodoc/iso/html/isodoc-dis.css +1 -10
- data/lib/isodoc/iso/html/isodoc-dis.scss +1 -13
- data/lib/isodoc/iso/html/isodoc.css +4 -11
- data/lib/isodoc/iso/html/isodoc.scss +5 -15
- data/lib/isodoc/iso/html/style-human.css +3 -0
- data/lib/isodoc/iso/html/style-human.scss +4 -0
- data/lib/isodoc/iso/html/style-iso.css +3 -0
- data/lib/isodoc/iso/html/style-iso.scss +4 -0
- data/lib/isodoc/iso/i18n-en.yaml +1 -1
- data/lib/isodoc/iso/iso.amendment.xsl +3611 -2912
- data/lib/isodoc/iso/iso.international-standard.xsl +3611 -2912
- data/lib/isodoc/iso/metadata.rb +1 -1
- data/lib/isodoc/iso/presentation_xml_convert.rb +4 -0
- data/lib/isodoc/iso/word_cleanup.rb +50 -19
- data/lib/isodoc/iso/word_dis_cleanup.rb +10 -14
- data/lib/isodoc/iso/word_dis_convert.rb +1 -1
- data/lib/metanorma/iso/base.rb +0 -6
- data/lib/metanorma/iso/boilerplate-fr.xml +1 -1
- data/lib/metanorma/iso/boilerplate-ru.xml +1 -1
- data/lib/metanorma/iso/boilerplate.xml +1 -1
- data/lib/metanorma/iso/cleanup.rb +4 -2
- data/lib/metanorma/iso/front_id.rb +28 -0
- data/lib/metanorma/iso/isodoc.rng +32 -1
- data/lib/metanorma/iso/isostandard.rng +3 -1
- data/lib/metanorma/iso/reqt.rng +1 -1
- data/lib/metanorma/iso/version.rb +1 -1
- data/metanorma-iso.gemspec +2 -1
- data/spec/isodoc/blocks_spec.rb +3 -3
- data/spec/isodoc/metadata_spec.rb +1 -2
- data/spec/isodoc/postproc_spec.rb +8 -75
- data/spec/isodoc/terms_spec.rb +62 -0
- data/spec/isodoc/word_dis_spec.rb +133 -15
- data/spec/metanorma/base_spec.rb +6 -17
- data/spec/metanorma/blocks_spec.rb +0 -33
- data/spec/metanorma/cleanup_spec.rb +201 -201
- data/spec/metanorma/processor_spec.rb +1 -2
- data/spec/metanorma/refs_spec.rb +5 -3
- data/spec/metanorma/section_spec.rb +6 -6
- data/spec/spec_helper.rb +1 -1
- data/spec/vcr_cassettes/withdrawn_iso.yml +28 -28
- metadata +18 -5
- data/lib/metanorma/iso/macros.rb +0 -29
data/lib/isodoc/iso/metadata.rb
CHANGED
@@ -11,11 +11,10 @@ module IsoDoc
|
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
|
-
# force Annex h2 down to be p.h2Annex, so it is not picked up by ToC
|
15
14
|
def word_annex_cleanup1(docxml, lvl)
|
16
15
|
docxml.xpath("//h#{lvl}[ancestor::*[@class = 'Section3']]").each do |h2|
|
17
16
|
h2.name = "p"
|
18
|
-
h2["class"] = "
|
17
|
+
h2["class"] = "a#{lvl}"
|
19
18
|
end
|
20
19
|
end
|
21
20
|
|
@@ -37,40 +36,72 @@ module IsoDoc
|
|
37
36
|
|
38
37
|
def style_cleanup(docxml)
|
39
38
|
word_annex_cleanup_h1(docxml)
|
40
|
-
|
39
|
+
figure_style(docxml)
|
40
|
+
new_styles(docxml)
|
41
41
|
end
|
42
42
|
|
43
|
-
def
|
44
|
-
docxml.xpath("
|
45
|
-
|
43
|
+
def figure_style(docxml)
|
44
|
+
docxml.xpath("//div[@class = 'figure']").each do |f|
|
45
|
+
f["style"] ||= ""
|
46
|
+
f["style"] += "text-align:center;"
|
46
47
|
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def quote_style(docxml)
|
51
|
+
docxml.xpath("//div[@class = 'Quote' or @class = 'Note' or "\
|
52
|
+
"@class = 'Example' or @class = 'Admonition']").each do |d|
|
53
|
+
quote_style1(d)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
def quote_style1(div)
|
58
|
+
div.xpath(".//li").each do |p|
|
59
|
+
p["style"] ||= ""
|
60
|
+
p["style"] += "font-size:#{default_fonts({})[:smallerfontsize]};"
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
STYLESMAP = {
|
65
|
+
example: "Example",
|
66
|
+
note: "Note",
|
67
|
+
Sourcecode: "Code",
|
68
|
+
tabletitle: "Tabletitle",
|
69
|
+
Biblio: "MsoNormal",
|
70
|
+
figure: "MsoNormal",
|
71
|
+
SourceTitle: "FigureTitle",
|
72
|
+
}.freeze
|
73
|
+
|
74
|
+
def new_styles(docxml)
|
75
|
+
STYLESMAP.each do |k, v|
|
76
|
+
docxml.xpath("//*[@class = '#{k}']").each { |s| s["class"] = v }
|
77
|
+
end
|
78
|
+
docxml.xpath("//div[@class = 'Section3']//p[@class = 'Tabletitle']")
|
79
|
+
.each { |t| t["class"] = "AnnexTableTitle" }
|
47
80
|
docxml.xpath("//*[@class = 'zzHelp']/p[not(@class)]").each do |p|
|
48
81
|
p["class"] = "zzHelp"
|
49
82
|
end
|
83
|
+
quote_style(docxml)
|
50
84
|
end
|
51
85
|
|
52
86
|
def authority_hdr_cleanup(docxml)
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
87
|
+
{ "boilerplate-license": "zzWarningHdr",
|
88
|
+
"boilerplate-copyright": "zzCopyrightHdr" }.each do |k, v|
|
89
|
+
docxml.xpath("//div[@class = '#{k}']").each do |d|
|
90
|
+
d.xpath(".//h1").each do |p|
|
91
|
+
p.name = "p"
|
92
|
+
p["class"] = v
|
93
|
+
end
|
94
|
+
end
|
57
95
|
end
|
58
|
-
end
|
59
|
-
docxml&.xpath("//div[@class = 'boilerplate-copyright']")&.each do |d|
|
60
|
-
d.xpath(".//h1").each do |p|
|
61
|
-
p.name = "p"
|
62
|
-
p["class"] = "zzCopyrightHdr"
|
63
|
-
end
|
64
|
-
end
|
65
96
|
end
|
66
97
|
|
67
98
|
def authority_cleanup(docxml)
|
68
99
|
insert = docxml.at("//div[@id = 'boilerplate-license-destination']")
|
69
|
-
auth = docxml
|
100
|
+
auth = docxml.at("//div[@class = 'boilerplate-license']")&.remove
|
70
101
|
auth&.xpath(".//p[not(@class)]")&.each { |p| p["class"] = "zzWarning" }
|
71
102
|
auth and insert and insert.children = auth
|
72
103
|
insert = docxml.at("//div[@id = 'boilerplate-copyright-destination']")
|
73
|
-
auth = docxml
|
104
|
+
auth = docxml.at("//div[@class = 'boilerplate-copyright']")&.remove
|
74
105
|
auth&.xpath(".//p[not(@class)]")&.each do |p|
|
75
106
|
p["class"] = "zzCopyright"
|
76
107
|
end
|
@@ -1,11 +1,6 @@
|
|
1
1
|
module IsoDoc
|
2
2
|
module Iso
|
3
3
|
class WordDISConvert < WordConvert
|
4
|
-
def style_cleanup(docxml)
|
5
|
-
super
|
6
|
-
dis_styles(docxml)
|
7
|
-
end
|
8
|
-
|
9
4
|
STYLESMAP = {
|
10
5
|
AltTerms: "AdmittedTerm",
|
11
6
|
TableFootnote: "Tablefootnote",
|
@@ -30,7 +25,7 @@ module IsoDoc
|
|
30
25
|
zzCopyright1: "zzCopyright",
|
31
26
|
}.freeze
|
32
27
|
|
33
|
-
def
|
28
|
+
def new_styles(docxml)
|
34
29
|
STYLESMAP.each do |k, v|
|
35
30
|
docxml.xpath("//*[@class = '#{k}']").each { |s| s["class"] = v }
|
36
31
|
end
|
@@ -46,8 +41,8 @@ module IsoDoc
|
|
46
41
|
figure_style(docxml)
|
47
42
|
note_style(docxml)
|
48
43
|
example_style(docxml)
|
49
|
-
quote_style(docxml)
|
50
44
|
dis_style_interactions(docxml)
|
45
|
+
quote_style(docxml)
|
51
46
|
end
|
52
47
|
|
53
48
|
def dis_style_interactions(docxml)
|
@@ -68,13 +63,6 @@ module IsoDoc
|
|
68
63
|
end
|
69
64
|
end
|
70
65
|
|
71
|
-
def quote_style(docxml)
|
72
|
-
docxml.xpath("//div[@class = 'Quote' or @class = 'Note' or "\
|
73
|
-
"@class = 'Example' or @class = 'Admonition']").each do |d|
|
74
|
-
quote_style1(d)
|
75
|
-
end
|
76
|
-
end
|
77
|
-
|
78
66
|
def para_style_change(div, class1, class2)
|
79
67
|
s = class1 ? "@class = '#{class1}'" : "not(@class)"
|
80
68
|
div.xpath(".//p[#{s}]").each do |p|
|
@@ -230,6 +218,14 @@ module IsoDoc
|
|
230
218
|
end
|
231
219
|
end
|
232
220
|
end
|
221
|
+
|
222
|
+
def make_FigureWordToC(docxml)
|
223
|
+
super.sub(/FigureTitle,figuretitle/, "Figure title,Annex Figure Title")
|
224
|
+
end
|
225
|
+
|
226
|
+
def make_TableWordToC(docxml)
|
227
|
+
super.sub(/TableTitle,tabletitle/, "Table title,Annex Table Title")
|
228
|
+
end
|
233
229
|
end
|
234
230
|
end
|
235
231
|
end
|
@@ -98,7 +98,7 @@ module IsoDoc
|
|
98
98
|
@meta.get[:doctitlemain] && @meta.get[:doctitlepart] and p << " — "
|
99
99
|
if @meta.get[:doctitlepart]
|
100
100
|
b = @meta.get[:doctitlepartlabel] and
|
101
|
-
p << "<span style='font-weight:normal'>#{b}
|
101
|
+
p << "<span style='font-weight:normal'>#{b}:</span> "
|
102
102
|
p << " #{@meta.get[:doctitlepart]}"
|
103
103
|
end
|
104
104
|
@meta.get[:doctitleamdlabel] || @meta.get[:doctitleamd] ||
|
data/lib/metanorma/iso/base.rb
CHANGED
@@ -5,16 +5,10 @@ require "pathname"
|
|
5
5
|
require "open-uri"
|
6
6
|
require "isodoc"
|
7
7
|
require "fileutils"
|
8
|
-
require_relative "macros"
|
9
8
|
|
10
9
|
module Metanorma
|
11
10
|
module ISO
|
12
11
|
class Converter < Standoc::Converter
|
13
|
-
Asciidoctor::Extensions.register do
|
14
|
-
block Metanorma::ISO::EditorAdmonitionBlock
|
15
|
-
treeprocessor Metanorma::ISO::EditorInlineAdmonitionBlock
|
16
|
-
end
|
17
|
-
|
18
12
|
XML_ROOT_TAG = "iso-standard".freeze
|
19
13
|
XML_NAMESPACE = "https://www.metanorma.org/ns/iso".freeze
|
20
14
|
|
@@ -19,7 +19,7 @@ l’adresse ci-après ou au comité membre de l’ISO dans le pays du demandeur.
|
|
19
19
|
ISO copyright office<br/>
|
20
20
|
CP 401 • Ch. de Blandonnet 8<br/>
|
21
21
|
CH-1214 Vernier, Geneva<br/>
|
22
|
-
Tél
|
22
|
+
Tél: +41 22 749 01 11<br/>
|
23
23
|
Email: copyright@iso.org<br/>
|
24
24
|
Website: www.iso.org
|
25
25
|
</p>
|
@@ -14,7 +14,7 @@
|
|
14
14
|
Бюро ISO по охране авторских прав<br/>
|
15
15
|
CP 401 • Ch. de Blandonnet 8<br/>
|
16
16
|
CH-1214 Vernier, Geneva<br/>
|
17
|
-
|
17
|
+
Тел: +41 22 749 01 11<br/>
|
18
18
|
Электронная почта: copyright@iso.org<br/>
|
19
19
|
Сайт: www.iso.org
|
20
20
|
</p>
|
@@ -20,7 +20,7 @@ at the address below or ISO's member body in the country of the requester.
|
|
20
20
|
ISO copyright office<br/>
|
21
21
|
CP 401 • Ch. de Blandonnet 8<br/>
|
22
22
|
CH-1214 Vernier, Geneva<br/>
|
23
|
-
Phone
|
23
|
+
Phone: +41 22 749 01 11<br/>
|
24
24
|
Email: copyright@iso.org<br/>
|
25
25
|
Website: www.iso.org
|
26
26
|
</p>
|
@@ -76,7 +76,8 @@ module Metanorma
|
|
76
76
|
return 2 if bib.at("#{PUBLISHER}[abbreviation = 'IEC']")
|
77
77
|
return 2 if bib.at("#{PUBLISHER}[name = 'International "\
|
78
78
|
"Electrotechnical Commission']")
|
79
|
-
return 3 if bib.at("./docidentifier[@type][not(#{OTHERIDS})]")
|
79
|
+
return 3 if bib.at("./docidentifier[@type][not(#{OTHERIDS})]") ||
|
80
|
+
bib.at("./docidentifier[not(@type)]")
|
80
81
|
|
81
82
|
4
|
82
83
|
end
|
@@ -98,7 +99,8 @@ module Metanorma
|
|
98
99
|
def sort_biblio_key(bib)
|
99
100
|
pubclass = pub_class(bib)
|
100
101
|
num = bib&.at("./docnumber")&.text
|
101
|
-
id = bib&.at("./docidentifier[
|
102
|
+
id = bib&.at("./docidentifier[@primary]") ||
|
103
|
+
bib&.at("./docidentifier[not(#{OTHERIDS})]")
|
102
104
|
metaid = bib&.at("./docidentifier[@type = 'metanorma']")&.text
|
103
105
|
abbrid = metaid unless /^\[\d+\]$/.match?(metaid)
|
104
106
|
/\d-(?<partid>\d+)/ =~ id&.text
|
@@ -5,6 +5,34 @@ require "json"
|
|
5
5
|
require "pathname"
|
6
6
|
require "open-uri"
|
7
7
|
require "twitter_cldr"
|
8
|
+
require "pubid-iso"
|
9
|
+
|
10
|
+
# @param stage [String] stage, eg. "WD", "CD", "DIS"
|
11
|
+
# @param urn_stage [Float] numeric stage for URN rendering
|
12
|
+
# @param iteration [Integer] document iteration, eg. "1", "2", "3"
|
13
|
+
# @param joint_document [Identifier] joint document
|
14
|
+
# @param supplement [Supplement] supplement
|
15
|
+
# @param tctype [String] Technical Committee type, eg. "TC", "JTC"
|
16
|
+
# @param sctype [String] TC subsommittee, eg. "SC"
|
17
|
+
# @param wgtype [String] TC working group type, eg. "AG", "AHG"
|
18
|
+
# @param tcnumber [Integer] Technical Committee number, eg. "1", "2"
|
19
|
+
# @param scnumber [Integer] Subsommittee number, eg. "1", "2"
|
20
|
+
# @param wgnumber [Integer] Working group number, eg. "1", "2"
|
21
|
+
# @param dir [Boolean] Directives document
|
22
|
+
# @param dirtype [String] Directives document type, eg. "JTC"
|
23
|
+
# @see Supplement
|
24
|
+
# @see Identifier
|
25
|
+
# @see Pubid::Core::Identifier
|
26
|
+
# @see Parser
|
27
|
+
#
|
28
|
+
=begin
|
29
|
+
def initialize(number: nil, stage: nil, iteration: nil, supplement: nil,
|
30
|
+
joint_document: nil, urn_stage: nil,
|
31
|
+
tctype: nil, sctype: nil, wgtype: nil, tcnumber: nil,
|
32
|
+
scnumber: nil, wgnumber:nil,
|
33
|
+
dir: nil, dirtype: nil, **opts)
|
34
|
+
super(**opts.merge(number: number))
|
35
|
+
=end
|
8
36
|
|
9
37
|
module Metanorma
|
10
38
|
module ISO
|
@@ -69,6 +69,17 @@
|
|
69
69
|
</zeroOrMore>
|
70
70
|
</element>
|
71
71
|
</define>
|
72
|
+
<define name="AdmonitionType">
|
73
|
+
<choice>
|
74
|
+
<value>warning</value>
|
75
|
+
<value>note</value>
|
76
|
+
<value>tip</value>
|
77
|
+
<value>important</value>
|
78
|
+
<value>caution</value>
|
79
|
+
<value>statement</value>
|
80
|
+
<value>editorial</value>
|
81
|
+
</choice>
|
82
|
+
</define>
|
72
83
|
<define name="index">
|
73
84
|
<element name="index">
|
74
85
|
<optional>
|
@@ -116,6 +127,11 @@
|
|
116
127
|
<data type="boolean"/>
|
117
128
|
</attribute>
|
118
129
|
</optional>
|
130
|
+
<optional>
|
131
|
+
<attribute name="suppress_identifier">
|
132
|
+
<data type="boolean"/>
|
133
|
+
</attribute>
|
134
|
+
</optional>
|
119
135
|
<ref name="BibliographicItem"/>
|
120
136
|
</element>
|
121
137
|
</define>
|
@@ -1269,7 +1285,12 @@
|
|
1269
1285
|
</define>
|
1270
1286
|
<define name="span">
|
1271
1287
|
<element name="span">
|
1272
|
-
<
|
1288
|
+
<optional>
|
1289
|
+
<attribute name="class"/>
|
1290
|
+
</optional>
|
1291
|
+
<optional>
|
1292
|
+
<attribute name="style"/>
|
1293
|
+
</optional>
|
1273
1294
|
<oneOrMore>
|
1274
1295
|
<ref name="TextElement"/>
|
1275
1296
|
</oneOrMore>
|
@@ -2488,6 +2509,16 @@
|
|
2488
2509
|
<text/>
|
2489
2510
|
</element>
|
2490
2511
|
</optional>
|
2512
|
+
<optional>
|
2513
|
+
<element name="amendment">
|
2514
|
+
<text/>
|
2515
|
+
</element>
|
2516
|
+
</optional>
|
2517
|
+
<optional>
|
2518
|
+
<element name="corrigendum">
|
2519
|
+
<text/>
|
2520
|
+
</element>
|
2521
|
+
</optional>
|
2491
2522
|
<optional>
|
2492
2523
|
<element name="language">
|
2493
2524
|
<text/>
|
data/lib/metanorma/iso/reqt.rng
CHANGED
data/metanorma-iso.gemspec
CHANGED
@@ -29,11 +29,12 @@ Gem::Specification.new do |spec|
|
|
29
29
|
spec.test_files = `git ls-files -- {spec}/*`.split("\n")
|
30
30
|
spec.required_ruby_version = Gem::Requirement.new(">= 2.5.0")
|
31
31
|
|
32
|
-
spec.add_dependency "metanorma-standoc", "~> 2.
|
32
|
+
spec.add_dependency "metanorma-standoc", "~> 2.2.0"
|
33
33
|
spec.add_dependency "mnconvert", "~> 1.14"
|
34
34
|
spec.add_dependency "ruby-jing"
|
35
35
|
spec.add_dependency "tokenizer", "~> 0.3.0"
|
36
36
|
spec.add_dependency "twitter_cldr"
|
37
|
+
spec.add_dependency "pubid-iso"
|
37
38
|
|
38
39
|
spec.add_development_dependency "debug"
|
39
40
|
spec.add_development_dependency "equivalent-xml", "~> 0.6"
|
data/spec/isodoc/blocks_spec.rb
CHANGED
@@ -297,7 +297,7 @@ RSpec.describe IsoDoc do
|
|
297
297
|
<iso-standard xmlns="http://riboseinc.com/isoxml" type='presentation'>
|
298
298
|
<preface><foreword displayorder="1">
|
299
299
|
<admonition id="_70234f78-64e5-4dfc-8b6f-f3f037348b6a" type="editorial">
|
300
|
-
<p id='_e94663cc-2473-4ccc-9a72-983a74d989f2'>
|
300
|
+
<p id='_e94663cc-2473-4ccc-9a72-983a74d989f2'>EDITORIAL NOTE —
|
301
301
|
Only use paddy or parboiled rice for the
|
302
302
|
determination of husked rice yield.
|
303
303
|
</p>
|
@@ -312,7 +312,7 @@ RSpec.describe IsoDoc do
|
|
312
312
|
<div>
|
313
313
|
<h1 class='ForewordTitle'>Foreword</h1>
|
314
314
|
<div id='_70234f78-64e5-4dfc-8b6f-f3f037348b6a' class='zzHelp'>
|
315
|
-
<p>
|
315
|
+
<p>EDITORIAL NOTE —
|
316
316
|
Only use paddy or parboiled rice for the
|
317
317
|
determination of husked rice yield.
|
318
318
|
</p>
|
@@ -332,7 +332,7 @@ RSpec.describe IsoDoc do
|
|
332
332
|
<div>
|
333
333
|
<h1 class='ForewordTitle'>Foreword</h1>
|
334
334
|
<div id='_70234f78-64e5-4dfc-8b6f-f3f037348b6a' class='zzHelp'>
|
335
|
-
<p> Only use paddy or parboiled rice for the determination of husked rice yield. </p>
|
335
|
+
<p>EDITORIAL NOTE — Only use paddy or parboiled rice for the determination of husked rice yield. </p>
|
336
336
|
<p class='ForewordText' id='_e94663cc-2473-4ccc-9a72-983a74d989f3'>Para 2.</p>
|
337
337
|
</div>
|
338
338
|
</div>
|
@@ -209,7 +209,6 @@ RSpec.describe IsoDoc::Iso::Metadata do
|
|
209
209
|
</editorialgroup>
|
210
210
|
<approvalgroup>
|
211
211
|
<technical-committee number="34" type="ABC">Food products</technical-committee>
|
212
|
-
<subcommittee number="4" type="DEF">Cereals and pulses</subcommittee>
|
213
212
|
<workgroup number="3" type="GHI">Rice Group</workgroup>
|
214
213
|
</approvalgroup>
|
215
214
|
<ics><code>1.2.3</code></ics>
|
@@ -224,7 +223,7 @@ RSpec.describe IsoDoc::Iso::Metadata do
|
|
224
223
|
INPUT
|
225
224
|
output = <<~OUTPUT
|
226
225
|
{:agency=>"ISO/IEC",
|
227
|
-
:approvalgroup=>["ABC 34", "
|
226
|
+
:approvalgroup=>["ABC 34", "GHI 3"],
|
228
227
|
:docnumber=>"ISO/IEC/CD 17301-1-3",
|
229
228
|
:docnumber_lang=>"ISO/IEC/CD 17301-1-3 (E)",
|
230
229
|
:docnumber_reference=>"ISO/IEC/CD 17301-1-3 (E)",
|
@@ -126,66 +126,6 @@ RSpec.describe IsoDoc do
|
|
126
126
|
expect(File.exist?("spec/assets/iso.pdf")).to be true
|
127
127
|
end
|
128
128
|
|
129
|
-
it "converts annex subheadings to h2Annex class for Word" do
|
130
|
-
IsoDoc::Iso::WordConvert
|
131
|
-
.new(WORD_HTML_CSS.dup)
|
132
|
-
.convert("test", <<~"INPUT", false)
|
133
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
134
|
-
<annex id="P" inline-header="false" obligation="normative">
|
135
|
-
<title>Annex</title>
|
136
|
-
<clause id="Q" inline-header="false" obligation="normative">
|
137
|
-
<title>A.1
|
138
|
-
<tab/>
|
139
|
-
Annex A.1</title>
|
140
|
-
</clause>
|
141
|
-
<appendix id="Q2" inline-header="false" obligation="normative">
|
142
|
-
<title>Appendix 1
|
143
|
-
<tab/>
|
144
|
-
An Appendix</title>
|
145
|
-
</appendix>
|
146
|
-
</annex>
|
147
|
-
<bibliography>
|
148
|
-
<references id="R" normative="false"><title>Bibliography</title></references>
|
149
|
-
</bibliography>
|
150
|
-
</iso-standard>
|
151
|
-
INPUT
|
152
|
-
|
153
|
-
word = File.read("test.doc", encoding: "UTF-8")
|
154
|
-
.sub(/^.*<div class="WordSection3">/m, '<div class="WordSection3">')
|
155
|
-
.sub(%r{<br[^>]*>\s*<div class="colophon".*$}m, "")
|
156
|
-
|
157
|
-
expect(xmlpp(word)).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
158
|
-
<div class="WordSection3">
|
159
|
-
<p class="zzSTDTitle1"/>
|
160
|
-
<p class="MsoNormal">
|
161
|
-
<br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
|
162
|
-
</p>
|
163
|
-
<div class="Section3">
|
164
|
-
<a id="P" name="P"/>
|
165
|
-
<p class="ANNEX">Annex</p>
|
166
|
-
<div>
|
167
|
-
<a id="Q" name="Q"/>
|
168
|
-
<p class="h2Annex">A.1
|
169
|
-
<span style="mso-tab-count:1"> </span>
|
170
|
-
Annex A.1</p>
|
171
|
-
</div>
|
172
|
-
<div>
|
173
|
-
<a id="Q2" name="Q2"/>
|
174
|
-
<p class="h2Annex">Appendix 1
|
175
|
-
<span style="mso-tab-count:1"> </span>
|
176
|
-
An Appendix</p>
|
177
|
-
</div>
|
178
|
-
</div>
|
179
|
-
<p class='MsoNormal'>
|
180
|
-
<br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
|
181
|
-
</p>
|
182
|
-
<div>
|
183
|
-
<p class='BiblioTitle'>Bibliography</p>
|
184
|
-
</div>
|
185
|
-
</div>
|
186
|
-
OUTPUT
|
187
|
-
end
|
188
|
-
|
189
129
|
it "populates Word template with terms reference labels" do
|
190
130
|
IsoDoc::Iso::WordConvert
|
191
131
|
.new(WORD_HTML_CSS.dup)
|
@@ -817,7 +757,7 @@ RSpec.describe IsoDoc do
|
|
817
757
|
</p>
|
818
758
|
<div class="Section3">
|
819
759
|
<a id="P" name="P"/>
|
820
|
-
<div class="
|
760
|
+
<div class="MsoNormal" style='text-align:center;'>
|
821
761
|
<a id="samplecode" name="samplecode"/>
|
822
762
|
<p class="MsoNormal">Hello</p>
|
823
763
|
<p class="MsoNormal">Key</p>
|
@@ -864,7 +804,7 @@ RSpec.describe IsoDoc do
|
|
864
804
|
.sub(/^.*<div class="WordSection3">/m, '<div class="WordSection3">')
|
865
805
|
.sub(%r{<br[^>]*>\s*<div class="colophon".*$}m, "")
|
866
806
|
expect(xmlpp(word)).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
867
|
-
|
807
|
+
<div class='WordSection3'>
|
868
808
|
<p class='zzSTDTitle1'/>
|
869
809
|
<p class='MsoNormal'>
|
870
810
|
<br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
|
@@ -904,11 +844,9 @@ RSpec.describe IsoDoc do
|
|
904
844
|
<br/>
|
905
845
|
CH-1214 Vernier, Geneva, Switzerland
|
906
846
|
<br/>
|
907
|
-
|
908
|
-
<br/>
|
909
|
-
Fax + 41 22 749 09 47
|
847
|
+
Phone: +41 22 749 01 11
|
910
848
|
<br/>
|
911
|
-
copyright@iso.org
|
849
|
+
Email: copyright@iso.org
|
912
850
|
<br/>
|
913
851
|
www.iso.org</p>
|
914
852
|
</clause>
|
@@ -951,11 +889,9 @@ RSpec.describe IsoDoc do
|
|
951
889
|
<br/>
|
952
890
|
CH-1214 Vernier, Geneva, Switzerland
|
953
891
|
<br/>
|
954
|
-
|
955
|
-
<br/>
|
956
|
-
Fax + 41 22 749 09 47
|
892
|
+
Phone: +41 22 749 01 11
|
957
893
|
<br/>
|
958
|
-
copyright@iso.org
|
894
|
+
Email: copyright@iso.org
|
959
895
|
<br/>
|
960
896
|
www.iso.org</p>
|
961
897
|
</clause>
|
@@ -1015,13 +951,10 @@ RSpec.describe IsoDoc do
|
|
1015
951
|
CH-1214 Vernier, Geneva, Switzerland
|
1016
952
|
|
1017
953
|
<br/>
|
1018
|
-
|
1019
|
-
|
1020
|
-
<br/>
|
1021
|
-
Fax + 41 22 749 09 47
|
954
|
+
Phone: +41 22 749 01 11
|
1022
955
|
|
1023
956
|
<br/>
|
1024
|
-
copyright@iso.org
|
957
|
+
Email: copyright@iso.org
|
1025
958
|
|
1026
959
|
<br/>
|
1027
960
|
www.iso.org#{' '}</p>
|
data/spec/isodoc/terms_spec.rb
CHANGED
@@ -249,4 +249,66 @@ RSpec.describe IsoDoc do
|
|
249
249
|
.sub(%r{</div>\s*<br.*$}m, "")))
|
250
250
|
.to be_equivalent_to xmlpp(word)
|
251
251
|
end
|
252
|
+
|
253
|
+
it "processes related terms" do
|
254
|
+
input = <<~INPUT
|
255
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
256
|
+
<sections>
|
257
|
+
<terms id='A' obligation='normative'>
|
258
|
+
<title>Terms and definitions</title>
|
259
|
+
<term id='second'>
|
260
|
+
<preferred>
|
261
|
+
<expression>
|
262
|
+
<name>Second Term</name>
|
263
|
+
</expression>
|
264
|
+
<field-of-application>Field</field-of-application>
|
265
|
+
<usage-info>Usage Info 1</usage-info>
|
266
|
+
</preferred>
|
267
|
+
<definition><verbal-definition>Definition 1</verbal-definition></definition>
|
268
|
+
</term>
|
269
|
+
<term id="C">
|
270
|
+
<preferred language='fr' script='Latn' type='prefix'>
|
271
|
+
<expression>
|
272
|
+
<name>First Designation</name>
|
273
|
+
</expression></preferred>
|
274
|
+
<related type='contrast'>
|
275
|
+
<preferred>
|
276
|
+
<expression>
|
277
|
+
<name>Fifth Designation</name>
|
278
|
+
<grammar>
|
279
|
+
<gender>neuter</gender>
|
280
|
+
</grammar>
|
281
|
+
</expression>
|
282
|
+
</preferred>
|
283
|
+
<xref target='second'/>
|
284
|
+
</related>
|
285
|
+
<definition><verbal-definition>Definition 2</verbal-definition></definition>
|
286
|
+
</term>
|
287
|
+
</terms>
|
288
|
+
</sections>
|
289
|
+
</iso-standard>
|
290
|
+
INPUT
|
291
|
+
output = <<~OUTPUT
|
292
|
+
<?xml version='1.0'?>
|
293
|
+
<iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
|
294
|
+
<sections>
|
295
|
+
<terms id='A' obligation='normative' displayorder='1'>
|
296
|
+
<title depth='1'>1<tab/>Terms and definitions</title>
|
297
|
+
<term id='second'>
|
298
|
+
<name>1.1</name>
|
299
|
+
<preferred><strong>Second Term</strong>, <Field, Usage Info 1></preferred>
|
300
|
+
<definition>Definition 1</definition>
|
301
|
+
</term>
|
302
|
+
<term id='C'>
|
303
|
+
<name>1.2</name>
|
304
|
+
<preferred language='fr' script='Latn' type='prefix'><strong>First Designation</strong></preferred>
|
305
|
+
<definition>Definition 2</definition>
|
306
|
+
</term>
|
307
|
+
</terms>
|
308
|
+
</sections>
|
309
|
+
</iso-standard>
|
310
|
+
OUTPUT
|
311
|
+
expect(xmlpp(IsoDoc::Iso::PresentationXMLConvert.new({})
|
312
|
+
.convert("test", input, true))).to be_equivalent_to xmlpp(output)
|
313
|
+
end
|
252
314
|
end
|