metanorma-iso 2.4.7 → 2.5.0
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/base_convert.rb +7 -22
- data/lib/isodoc/iso/html/style-human.css +15 -11
- data/lib/isodoc/iso/html/style-human.scss +8 -8
- data/lib/isodoc/iso/html/style-iso.css +26 -22
- data/lib/isodoc/iso/html/style-iso.scss +19 -19
- data/lib/isodoc/iso/html_convert.rb +0 -12
- data/lib/isodoc/iso/i18n-en.yaml +6 -0
- data/lib/isodoc/iso/i18n-fr.yaml +6 -0
- data/lib/isodoc/iso/i18n-ja.yaml +1 -0
- data/lib/isodoc/iso/i18n-ru.yaml +6 -0
- data/lib/isodoc/iso/i18n-zh-Hans.yaml +3 -0
- data/lib/isodoc/iso/iso.amendment.xsl +156 -78
- data/lib/isodoc/iso/iso.international-standard.xsl +156 -78
- data/lib/isodoc/iso/presentation_xml_convert.rb +34 -1
- data/lib/isodoc/iso/sections.rb +4 -44
- data/lib/isodoc/iso/word_convert.rb +24 -17
- data/lib/isodoc/iso/word_dis_cleanup.rb +9 -0
- data/lib/isodoc/iso/word_dis_convert.rb +28 -25
- data/lib/isodoc/iso/xref.rb +1 -1
- data/lib/metanorma/iso/front.rb +18 -6
- data/lib/metanorma/iso/front_id.rb +6 -45
- data/lib/metanorma/iso/isodoc.rng +26 -4
- data/lib/metanorma/iso/validate.rb +0 -16
- data/lib/metanorma/iso/version.rb +1 -1
- data/metanorma-iso.gemspec +1 -1
- metadata +4 -4
@@ -46,12 +46,6 @@ module IsoDoc
|
|
46
46
|
{ class: "TableTitle", style: "text-align:center;" }
|
47
47
|
end
|
48
48
|
|
49
|
-
def span_parse(node, out)
|
50
|
-
out.span class: node["class"] do |x|
|
51
|
-
node.children.each { |n| parse(n, x) }
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
49
|
def word_toc_preface(level)
|
56
50
|
<<~TOC.freeze
|
57
51
|
<span lang="EN-GB"><span
|
@@ -68,7 +62,7 @@ module IsoDoc
|
|
68
62
|
|
69
63
|
def toWord(result, filename, dir, header)
|
70
64
|
result = from_xhtml(word_cleanup(to_xhtml(result)))
|
71
|
-
.gsub(
|
65
|
+
.gsub("-DOUBLE_HYPHEN_ESCAPE-", "--")
|
72
66
|
@wordstylesheet = wordstylesheet_update
|
73
67
|
::Html2Doc::IsoDIS.new(
|
74
68
|
filename: filename,
|
@@ -86,30 +80,39 @@ module IsoDoc
|
|
86
80
|
middle_title_dis(out)
|
87
81
|
end
|
88
82
|
|
89
|
-
def middle_title_dis(out)
|
83
|
+
def middle_title_dis(node, out)
|
90
84
|
out.p(class: "zzSTDTitle") do |p|
|
91
|
-
p
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
85
|
+
node.children.each { |n| parse(n, p) }
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
def middle_title_amd(node, out)
|
90
|
+
out.p(class: "zzSTDTitle2") do |p|
|
91
|
+
p.span(style: "font-weight:normal") do |s|
|
92
|
+
node.children.each { |n| parse(n, s) }
|
99
93
|
end
|
100
|
-
@meta.get[:doctitleamdlabel] || @meta.get[:doctitleamd] ||
|
101
|
-
@meta.get[:doctitlecorrlabel] and middle_title_dis_amd(p)
|
102
94
|
end
|
103
95
|
end
|
104
96
|
|
105
|
-
def
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
97
|
+
def para_parse(node, out)
|
98
|
+
case node["class"]
|
99
|
+
when "zzSTDTitle1" then middle_title_dis(node, out)
|
100
|
+
when "zzSTDTitle2" then middle_title_amd(node, out)
|
101
|
+
else super
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
def span_parse(node, out)
|
106
|
+
case node["class"]
|
107
|
+
when "nonboldtitle"
|
108
|
+
out.span(style: "font-weight:normal") do |s|
|
109
|
+
node.children.each { |n| parse(n, s) }
|
110
110
|
end
|
111
|
-
|
112
|
-
|
111
|
+
when "boldtitle"
|
112
|
+
node.children.each { |n| parse(n, out) }
|
113
|
+
else
|
114
|
+
out.span class: node["class"] do |x|
|
115
|
+
node.children.each { |n| parse(n, x) }
|
113
116
|
end
|
114
117
|
end
|
115
118
|
end
|
data/lib/isodoc/iso/xref.rb
CHANGED
@@ -43,7 +43,7 @@ module IsoDoc
|
|
43
43
|
n = Counter.new
|
44
44
|
n = section_names(doc.at(ns("//clause[@type = 'scope']")), n, 1)
|
45
45
|
n = section_names(doc.at(ns(@klass.norm_ref_xpath)), n, 1)
|
46
|
-
doc.xpath(ns("//sections/clause[not(@type = 'scope')] | " \
|
46
|
+
doc.xpath(ns("//sections/clause[not(@type = 'scope')][not(.//references)] | " \
|
47
47
|
"//sections/terms | //sections/definitions")).each do |c|
|
48
48
|
n = section_names(c, n, 1)
|
49
49
|
end
|
data/lib/metanorma/iso/front.rb
CHANGED
@@ -12,15 +12,18 @@ module Metanorma
|
|
12
12
|
def metadata_ext(node, xml)
|
13
13
|
super
|
14
14
|
structured_id(node, xml)
|
15
|
-
|
16
|
-
id.stage and metadata_stage(id, xml)
|
15
|
+
metadata_stage(node, xml)
|
17
16
|
@amd && a = node.attr("updates-document-type") and
|
18
17
|
xml.updates_document_type a
|
19
18
|
end
|
20
19
|
|
21
|
-
def metadata_stage(
|
22
|
-
|
23
|
-
|
20
|
+
def metadata_stage(node, xml)
|
21
|
+
id = iso_id_default(iso_id_params(node))
|
22
|
+
id.stage and
|
23
|
+
xml.stagename metadata_stagename(id)&.strip,
|
24
|
+
**attr_code(abbreviation: id.typed_stage_abbrev&.strip)
|
25
|
+
rescue Pubid::Core::Errors::HarmonizedStageCodeInvalidError,
|
26
|
+
Pubid::Core::Errors::TypeStageParseError
|
24
27
|
end
|
25
28
|
|
26
29
|
def metadata_stagename(id)
|
@@ -95,8 +98,17 @@ module Metanorma
|
|
95
98
|
xml.status do |s|
|
96
99
|
s.stage stage, **attr_code(abbreviation: abbrev)
|
97
100
|
s.substage substage
|
98
|
-
node.attr("iteration")
|
101
|
+
i = node.attr("iteration") and s.iteration i
|
99
102
|
end
|
103
|
+
rescue Pubid::Core::Errors::HarmonizedStageCodeInvalidError,
|
104
|
+
Pubid::Core::Errors::TypeStageParseError
|
105
|
+
report_illegal_stage(stage, substage)
|
106
|
+
end
|
107
|
+
|
108
|
+
def report_illegal_stage(stage, substage)
|
109
|
+
err = "Illegal document stage: #{stage}.#{substage}"
|
110
|
+
@log.add("Document Attributes", nil, err)
|
111
|
+
warn err
|
100
112
|
end
|
101
113
|
|
102
114
|
def metadata_committee(node, xml)
|
@@ -10,41 +10,6 @@ require "pubid-iso"
|
|
10
10
|
module Metanorma
|
11
11
|
module ISO
|
12
12
|
class Converter < Standoc::Converter
|
13
|
-
STAGE_ABBRS = {
|
14
|
-
"00": "PWI",
|
15
|
-
"10": "NP",
|
16
|
-
"20": "WD",
|
17
|
-
"30": "CD",
|
18
|
-
"40": "DIS",
|
19
|
-
"50": "FDIS",
|
20
|
-
"60": "IS",
|
21
|
-
"90": "(Review)",
|
22
|
-
"95": "(Withdrawal)",
|
23
|
-
}.freeze
|
24
|
-
|
25
|
-
STAGE_NAMES = {
|
26
|
-
"00": "Preliminary work item",
|
27
|
-
"10": "New work item proposal",
|
28
|
-
"20": "Working draft",
|
29
|
-
"30": "Committee draft",
|
30
|
-
"40": "Draft",
|
31
|
-
"50": "Final draft",
|
32
|
-
"60": "International standard",
|
33
|
-
"90": "Review",
|
34
|
-
"95": "Withdrawal",
|
35
|
-
}.freeze
|
36
|
-
|
37
|
-
def stage_abbr(stage, substage, _doctype)
|
38
|
-
return nil if stage.to_i > 60
|
39
|
-
|
40
|
-
ret = STAGE_ABBRS[stage.to_sym]
|
41
|
-
ret = "PRF" if stage == "60" && substage == "00"
|
42
|
-
ret = nil if stage == "60" && substage != "00"
|
43
|
-
ret = "AWI" if stage == "10" && substage == "99"
|
44
|
-
ret = "AWI" if stage == "20" && substage == "00"
|
45
|
-
ret
|
46
|
-
end
|
47
|
-
|
48
13
|
def metadata_id(node, xml)
|
49
14
|
if id = node.attr("docidentifier")
|
50
15
|
xml.docidentifier id, **attr_code(type: "ISO")
|
@@ -103,23 +68,19 @@ module Metanorma
|
|
103
68
|
|
104
69
|
def iso_id_params_add(node)
|
105
70
|
stage = iso_id_stage(node)
|
106
|
-
|
107
71
|
ret = { number: node.attr("amendment-number") ||
|
108
72
|
node.attr("corrigendum-number"),
|
109
73
|
year: iso_id_year(node),
|
110
74
|
iteration: node.attr("iteration") }.compact
|
111
|
-
|
112
|
-
|
75
|
+
if stage
|
76
|
+
ret[:stage] = stage
|
77
|
+
ret[:stage] == "60.00" and ret[:stage] = :PRF
|
78
|
+
end
|
113
79
|
ret
|
114
80
|
end
|
115
81
|
|
116
82
|
def iso_id_stage(node)
|
117
|
-
|
118
|
-
doctype(node))
|
119
|
-
harmonised = "#{get_stage(node)}.#{get_substage(node)}"
|
120
|
-
harmonised = nil unless /^\d\d\.\d\d/.match?(harmonised)
|
121
|
-
{ abbr: stage&.to_sym, harmonized_code: harmonised }
|
122
|
-
harmonised || stage&.to_sym
|
83
|
+
"#{get_stage(node)}.#{get_substage(node)}"
|
123
84
|
end
|
124
85
|
|
125
86
|
def iso_id_year(node)
|
@@ -195,7 +156,7 @@ module Metanorma
|
|
195
156
|
def structured_id(node, xml)
|
196
157
|
return unless node.attr("docnumber")
|
197
158
|
|
198
|
-
part, subpart = node&.attr("partnumber")&.split(
|
159
|
+
part, subpart = node&.attr("partnumber")&.split("-")
|
199
160
|
xml.structuredidentifier do |i|
|
200
161
|
i.project_number(node.attr("docnumber"), **attr_code(
|
201
162
|
part: part, subpart: subpart,
|
@@ -17,7 +17,7 @@
|
|
17
17
|
these elements; we just want one namespace for any child grammars
|
18
18
|
of this.
|
19
19
|
-->
|
20
|
-
<!-- VERSION v1.2.
|
20
|
+
<!-- VERSION v1.2.3 -->
|
21
21
|
<grammar xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
|
22
22
|
<include href="reqt.rng"/>
|
23
23
|
<include href="basicdoc.rng">
|
@@ -192,9 +192,11 @@
|
|
192
192
|
</attribute>
|
193
193
|
</optional>
|
194
194
|
<attribute name="citeas"/>
|
195
|
-
<
|
196
|
-
<
|
197
|
-
|
195
|
+
<optional>
|
196
|
+
<attribute name="type">
|
197
|
+
<ref name="ReferenceFormat"/>
|
198
|
+
</attribute>
|
199
|
+
</optional>
|
198
200
|
<optional>
|
199
201
|
<attribute name="alt"/>
|
200
202
|
</optional>
|
@@ -836,6 +838,26 @@
|
|
836
838
|
<ref name="paragraph"/>
|
837
839
|
</element>
|
838
840
|
</define>
|
841
|
+
<define name="stem">
|
842
|
+
<element name="stem">
|
843
|
+
<attribute name="type">
|
844
|
+
<choice>
|
845
|
+
<value>MathML</value>
|
846
|
+
<value>AsciiMath</value>
|
847
|
+
<value>LatexMath</value>
|
848
|
+
</choice>
|
849
|
+
</attribute>
|
850
|
+
<attribute name="block">
|
851
|
+
<data type="boolean"/>
|
852
|
+
</attribute>
|
853
|
+
<oneOrMore>
|
854
|
+
<choice>
|
855
|
+
<text/>
|
856
|
+
<ref name="AnyElement"/>
|
857
|
+
</choice>
|
858
|
+
</oneOrMore>
|
859
|
+
</element>
|
860
|
+
</define>
|
839
861
|
<define name="em">
|
840
862
|
<element name="em">
|
841
863
|
<zeroOrMore>
|
@@ -132,20 +132,6 @@ module Metanorma
|
|
132
132
|
"#{script} is not a recognised script")
|
133
133
|
end
|
134
134
|
|
135
|
-
def stage_validate(xmldoc)
|
136
|
-
stage = xmldoc&.at("//bibdata/status/stage")&.text
|
137
|
-
%w(00 10 20 30 40 50 60 90 95).include? stage or
|
138
|
-
@log.add("Document Attributes", nil,
|
139
|
-
"#{stage} is not a recognised stage")
|
140
|
-
end
|
141
|
-
|
142
|
-
def substage_validate(xmldoc)
|
143
|
-
substage = xmldoc&.at("//bibdata/status/substage")&.text or return
|
144
|
-
%w(00 20 60 90 92 93 98 99).include? substage or
|
145
|
-
@log.add("Document Attributes", nil,
|
146
|
-
"#{substage} is not a recognised substage")
|
147
|
-
end
|
148
|
-
|
149
135
|
def iteration_validate(xmldoc)
|
150
136
|
iteration = xmldoc&.at("//bibdata/status/iteration")&.text or return
|
151
137
|
/^\d+/.match(iteration) or
|
@@ -156,8 +142,6 @@ module Metanorma
|
|
156
142
|
def bibdata_validate(doc)
|
157
143
|
doctype_validate(doc)
|
158
144
|
script_validate(doc)
|
159
|
-
stage_validate(doc)
|
160
|
-
substage_validate(doc)
|
161
145
|
iteration_validate(doc)
|
162
146
|
end
|
163
147
|
|
data/metanorma-iso.gemspec
CHANGED
@@ -32,7 +32,7 @@ Gem::Specification.new do |spec|
|
|
32
32
|
spec.test_files = `git ls-files -- {spec}/*`.split("\n")
|
33
33
|
spec.required_ruby_version = Gem::Requirement.new(">= 2.7.0")
|
34
34
|
|
35
|
-
spec.add_dependency "metanorma-standoc", "~> 2.
|
35
|
+
spec.add_dependency "metanorma-standoc", "~> 2.5.0"
|
36
36
|
spec.add_dependency "mnconvert", "~> 1.14"
|
37
37
|
spec.add_dependency "pubid-iso", "~> 0.5.0"
|
38
38
|
spec.add_dependency "ruby-jing"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metanorma-iso
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-07
|
11
|
+
date: 2023-08-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: metanorma-standoc
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 2.
|
19
|
+
version: 2.5.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 2.
|
26
|
+
version: 2.5.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: mnconvert
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|