metanorma-iso 3.0.7 → 3.0.9
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/html_iso_titlepage.html +8 -2
- data/lib/isodoc/iso/html/isodoc.css +1 -0
- data/lib/isodoc/iso/html/isodoc.scss +1 -0
- data/lib/isodoc/iso/html/style-human.css +0 -2
- data/lib/isodoc/iso/html/style-iso.css +0 -2
- data/lib/isodoc/iso/html/word_iso_titlepage-dis.html +2 -2
- data/lib/isodoc/iso/html/word_iso_titlepage-prf.html +2 -2
- data/lib/isodoc/iso/html/word_iso_titlepage.html +8 -2
- data/lib/isodoc/iso/iso.amendment.xsl +1363 -1880
- data/lib/isodoc/iso/iso.international-standard.xsl +1363 -1880
- data/lib/isodoc/iso/metadata.rb +16 -19
- data/lib/isodoc/iso/presentation_section.rb +6 -4
- data/lib/isodoc/iso/xref.rb +1 -1
- data/lib/metanorma/iso/cleanup.rb +1 -0
- data/lib/metanorma/iso/front.rb +34 -13
- data/lib/metanorma/iso/isodoc.rng +32 -2
- data/lib/metanorma/iso/section.rb +0 -16
- data/lib/metanorma/iso/validate.rb +5 -20
- data/lib/metanorma/iso/validate_image.rb +1 -2
- data/lib/metanorma/iso/validate_section.rb +11 -7
- data/lib/metanorma/iso/validate_style.rb +2 -2
- data/lib/metanorma/iso/version.rb +1 -1
- metadata +2 -2
data/lib/isodoc/iso/metadata.rb
CHANGED
@@ -11,8 +11,7 @@ module IsoDoc
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def status_abbrev(stage, _substage, iter, draft, doctype)
|
14
|
-
return ""
|
15
|
-
|
14
|
+
stage or return ""
|
16
15
|
if %w(technical-report technical-specification).include?(doctype)
|
17
16
|
stage = "DTS" if stage == "DIS"
|
18
17
|
stage = "FDTS" if stage == "FDIS"
|
@@ -103,16 +102,16 @@ module IsoDoc
|
|
103
102
|
end
|
104
103
|
|
105
104
|
def compose_title(tparts, tnums, lang)
|
106
|
-
|
107
|
-
tparts[:main].nil? or
|
108
|
-
main = tparts[:main].children.to_xml
|
105
|
+
t = tparts[:main].nil? ? "" : tparts[:main].children.to_xml
|
109
106
|
tparts[:intro] and
|
110
|
-
|
107
|
+
t = "#{tparts[:intro].children.to_xml} — #{t}"
|
108
|
+
tparts[:complementary] and
|
109
|
+
t = "#{t} — #{tparts[:complementary].children.to_xml}"
|
111
110
|
if tparts[:part]
|
112
111
|
suffix = part_title(tparts[:part], tnums, lang)
|
113
|
-
|
112
|
+
t = "#{t} — #{suffix}"
|
114
113
|
end
|
115
|
-
|
114
|
+
t
|
116
115
|
end
|
117
116
|
|
118
117
|
def title_nums(isoxml)
|
@@ -125,16 +124,10 @@ module IsoDoc
|
|
125
124
|
end
|
126
125
|
|
127
126
|
def title_parts(isoxml, lang)
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
part: isoxml.at(ns("//bibdata/title[@type='title-part' and " \
|
133
|
-
"@language='#{lang}']")),
|
134
|
-
amd: isoxml.at(ns("//bibdata/title[@type='title-amd' and " \
|
135
|
-
"@language='#{lang}']")),
|
136
|
-
add: isoxml.at(ns("//bibdata/title[@type='title-add' and " \
|
137
|
-
"@language='#{lang}']")) }
|
127
|
+
%w(intro main complementary part amd add).each_with_object({}) do |w, m|
|
128
|
+
m[w.to_sym] = isoxml.at(ns("//bibdata/title[@type='title-#{w}' and " \
|
129
|
+
"@language='#{lang}']"))
|
130
|
+
end
|
138
131
|
end
|
139
132
|
|
140
133
|
def title(isoxml, _out)
|
@@ -142,13 +135,15 @@ module IsoDoc
|
|
142
135
|
when "fr", "ru" then @lang
|
143
136
|
else "en"
|
144
137
|
end
|
145
|
-
# intro, main, part, amd = title_parts(isoxml, lang)
|
138
|
+
# intro, main, complementary, part, amd = title_parts(isoxml, lang)
|
146
139
|
tp = title_parts(isoxml, lang)
|
147
140
|
tn = title_nums(isoxml)
|
148
141
|
set(:doctitlemain, tp[:main] ? tp[:main].children.to_xml : "")
|
149
142
|
main = compose_title(tp, tn, lang)
|
150
143
|
set(:doctitle, main)
|
151
144
|
tp[:intro] and set(:doctitleintro, tp[:intro].children.to_xml)
|
145
|
+
tp[:complementary] and
|
146
|
+
set(:doctitlecomplementary, tp[:complementary].children.to_xml)
|
152
147
|
set(:doctitlepartlabel, part_prefix(tn, lang))
|
153
148
|
set(:doctitlepart, tp[:part].children.to_xml) if tp[:part]
|
154
149
|
set(:doctitleamdlabel, amd_prefix(tn, lang)) if tn[:amd]
|
@@ -167,6 +162,8 @@ module IsoDoc
|
|
167
162
|
main = compose_title(tp, tn, lang)
|
168
163
|
set(:docsubtitle, main)
|
169
164
|
tp[:intro] and set(:docsubtitleintro, tp[:intro].children.to_xml)
|
165
|
+
tp[:complementary] and
|
166
|
+
set(:docsubtitlecomplementary, tp[:complementary].children.to_xml)
|
170
167
|
set(:docsubtitlepartlabel, part_prefix(tn, lang))
|
171
168
|
tp[:part] and set(:docsubtitlepart, tp[:part].children.to_xml)
|
172
169
|
set(:docsubtitleamdlabel, amd_prefix(tn, lang)) if tn[:amd]
|
@@ -28,9 +28,8 @@ module IsoDoc
|
|
28
28
|
|
29
29
|
def warning_for_missing_metadata_post(docxml, ret)
|
30
30
|
from = docxml.at(ns("//sections/*/@id"))&.text or return
|
31
|
-
id = UUIDTools::UUID.random_create
|
32
31
|
ret = <<~REVIEW
|
33
|
-
<review date='#{Date.today}' reviewer='Metanorma'
|
32
|
+
<review date='#{Date.today}' reviewer='Metanorma' #{add_id_text} from='#{from}' to='#{from}'>
|
34
33
|
<p><strong>Metadata warnings:</strong></p> #{ret}
|
35
34
|
</review>
|
36
35
|
REVIEW
|
@@ -98,7 +97,8 @@ module IsoDoc
|
|
98
97
|
@meta.get[:doctitleintro] && @meta.get[:doctitlemain] and
|
99
98
|
ret += " — "
|
100
99
|
ret += @meta.get[:doctitlemain]
|
101
|
-
@meta.get[:doctitlemain] &&
|
100
|
+
@meta.get[:doctitlemain] &&
|
101
|
+
(@meta.get[:doctitlepart] || @meta.get[:doctitlecomplementary]) and
|
102
102
|
ret += " — "
|
103
103
|
ret += "</span>#{middle_title_part}"
|
104
104
|
"<p class='zzSTDTitle1'>#{ret}</p>"
|
@@ -106,7 +106,9 @@ module IsoDoc
|
|
106
106
|
|
107
107
|
def middle_title_part
|
108
108
|
ret = ""
|
109
|
-
if a = @meta.get[:
|
109
|
+
if a = @meta.get[:doctitlecomplementary]
|
110
|
+
ret += "<span class='boldtitle'>#{a}</span>"
|
111
|
+
elsif a = @meta.get[:doctitlepart]
|
110
112
|
b = @meta.get[:doctitlepartlabel] and
|
111
113
|
ret += "<span class='nonboldtitle'>#{b}:</span> "
|
112
114
|
ret += "<span class='boldtitle'>#{a}</span>"
|
data/lib/isodoc/iso/xref.rb
CHANGED
@@ -160,7 +160,7 @@ module IsoDoc
|
|
160
160
|
s.xpath(ns(".//appendix//ol")) - s.xpath(ns(".//ol//ol"))
|
161
161
|
c = Counter.new
|
162
162
|
notes.noblank.each do |n|
|
163
|
-
n["id"] ||= "_#{UUIDTools::UUID.random_create}"
|
163
|
+
#n["id"] ||= "_#{UUIDTools::UUID.random_create}"
|
164
164
|
@anchors[n["id"]] = anchor_struct(increment_label(notes, n, c), n,
|
165
165
|
@labels["list"], "list",
|
166
166
|
{ unnumb: false, container: true })
|
data/lib/metanorma/iso/front.rb
CHANGED
@@ -71,6 +71,13 @@ module Metanorma
|
|
71
71
|
@log.add("Document Attributes", nil, err)
|
72
72
|
end
|
73
73
|
|
74
|
+
def title_component(node, xml, lang, attr, comp)
|
75
|
+
t = node.attr("title-#{comp[:name]}-#{lang}") or return
|
76
|
+
xml.title(**attr_code(attr.merge(type: "title-#{comp[:abbr]}"))) do |t1|
|
77
|
+
t1 << Metanorma::Utils::asciidoc_sub(t)
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
74
81
|
def title_intro(node, xml, lang, at)
|
75
82
|
t = node.attr("title-intro-#{lang}") or return
|
76
83
|
xml.title(**attr_code(at.merge(type: "title-intro"))) do |t1|
|
@@ -106,30 +113,44 @@ module Metanorma
|
|
106
113
|
end
|
107
114
|
|
108
115
|
def title_full(node, xml, lang, at)
|
109
|
-
title = node
|
110
|
-
intro = node.attr("title-intro-#{lang}")
|
111
|
-
part = node.attr("title-part-#{lang}")
|
112
|
-
amd = node.attr("title-amendment-#{lang}")
|
113
|
-
add = node.attr("title-addendum-#{lang}")
|
116
|
+
title, intro, part, amd, add = title_full_prep(node, lang)
|
114
117
|
title = "#{intro} -- #{title}" if intro
|
115
118
|
title = "#{title} -- #{part}" if part
|
116
|
-
title = "#{title} -- #{amd}" if amd
|
117
|
-
title = "#{title} -- #{add}" if
|
119
|
+
title = "#{title} -- #{amd}" if amd
|
120
|
+
title = "#{title} -- #{add}" if add
|
118
121
|
xml.title **attr_code(at.merge(type: "main")) do |t1|
|
119
122
|
t1 << Metanorma::Utils::asciidoc_sub(title)
|
120
123
|
end
|
121
124
|
end
|
122
125
|
|
126
|
+
def title_full_prep(node, lang)
|
127
|
+
title = node.attr("title-main-#{lang}")
|
128
|
+
intro = node.attr("title-intro-#{lang}")
|
129
|
+
part = node.attr("title-part-#{lang}") ||
|
130
|
+
node.attr("title-complementary-#{lang}")
|
131
|
+
@amd and amd = node.attr("title-amendment-#{lang}")
|
132
|
+
node.attr("addendum-number") and
|
133
|
+
add = node.attr("title-addendum-#{lang}")
|
134
|
+
[title, intro, part, amd, add].map { |x| x&.empty? ? nil : x }
|
135
|
+
end
|
136
|
+
|
123
137
|
def title(node, xml)
|
124
138
|
%w(en ru fr).each do |lang|
|
125
139
|
at = { language: lang, format: "text/plain" }
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
140
|
+
title1(node, xml, lang, at)
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
def title1(node, xml, lang, at)
|
145
|
+
title_full(node, xml, lang, at)
|
146
|
+
%w(intro main part complementary).each do |w|
|
147
|
+
title_component(node, xml, lang, at, { name: w, abbr: w })
|
132
148
|
end
|
149
|
+
@amd and title_component(node, xml, lang, at,
|
150
|
+
{ name: "amendment", abbr: "amd" })
|
151
|
+
node.attr("addendum-number") and
|
152
|
+
title_component(node, xml, lang, at,
|
153
|
+
{ name: "addendum", abbr: "add" })
|
133
154
|
end
|
134
155
|
|
135
156
|
def relaton_relations
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
2
2
|
<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">
|
3
|
-
<!-- VERSION v2.0.
|
3
|
+
<!-- VERSION v2.0.7 -->
|
4
4
|
|
5
5
|
<!--
|
6
6
|
ALERT: cannot have root comments, because of https://github.com/metanorma/metanorma/issues/437
|
@@ -76,6 +76,7 @@ but to `@anchor`, the user-supplied cross-reference</a:documentation>
|
|
76
76
|
<a:documentation>Title(s) of a clause</a:documentation>
|
77
77
|
<element name="title">
|
78
78
|
<a:documentation>Title proper for a clause</a:documentation>
|
79
|
+
<ref name="RequiredId"/>
|
79
80
|
<zeroOrMore>
|
80
81
|
<ref name="TextElement"/>
|
81
82
|
</zeroOrMore>
|
@@ -83,10 +84,19 @@ but to `@anchor`, the user-supplied cross-reference</a:documentation>
|
|
83
84
|
<zeroOrMore>
|
84
85
|
<element name="variant-title">
|
85
86
|
<a:documentation>Alternate title for a clause</a:documentation>
|
87
|
+
<ref name="RequiredId"/>
|
86
88
|
<ref name="TypedTitleString"/>
|
87
89
|
</element>
|
88
90
|
</zeroOrMore>
|
89
91
|
</define>
|
92
|
+
<define name="tname">
|
93
|
+
<element name="name">
|
94
|
+
<ref name="RequiredId"/>
|
95
|
+
<oneOrMore>
|
96
|
+
<ref name="NestedTextElement"/>
|
97
|
+
</oneOrMore>
|
98
|
+
</element>
|
99
|
+
</define>
|
90
100
|
<define name="UlBody">
|
91
101
|
<optional>
|
92
102
|
<ref name="tname">
|
@@ -475,6 +485,7 @@ normative or informative references, some split references into sections organiz
|
|
475
485
|
<!-- exclude figures? -->
|
476
486
|
<define name="dd">
|
477
487
|
<element name="dd">
|
488
|
+
<ref name="OptionalId"/>
|
478
489
|
<zeroOrMore>
|
479
490
|
<!-- exclude figures? -->
|
480
491
|
<ref name="BasicBlock"/>
|
@@ -526,6 +537,7 @@ normative or informative references, some split references into sections organiz
|
|
526
537
|
</choice>
|
527
538
|
</define>
|
528
539
|
<define name="TrAttributes">
|
540
|
+
<ref name="OptionalId"/>
|
529
541
|
<optional>
|
530
542
|
<attribute name="style">
|
531
543
|
<a:documentation>CSS style: only background-color supported</a:documentation>
|
@@ -595,6 +607,7 @@ gives an explicit page orientation</a:documentation>
|
|
595
607
|
</include>
|
596
608
|
<!-- end overrides -->
|
597
609
|
<define name="FnAttributes" combine="interleave">
|
610
|
+
<ref name="RequiredId"/>
|
598
611
|
<optional>
|
599
612
|
<attribute name="hiddenref">
|
600
613
|
<a:documentation>If true, number the footnote as normal, but suppress display of the footnote reference in the document body.
|
@@ -604,6 +617,7 @@ This is done if the footnote reference is already presented in some other form,
|
|
604
617
|
</optional>
|
605
618
|
</define>
|
606
619
|
<define name="TdAttributes" combine="interleave">
|
620
|
+
<ref name="RequiredId"/>
|
607
621
|
<optional>
|
608
622
|
<attribute name="style">
|
609
623
|
<a:documentation>CSS style: only background-color supported</a:documentation>
|
@@ -801,6 +815,12 @@ titlecase, or lowercase</a:documentation>
|
|
801
815
|
<a:documentation>User-supplied anchor of element; replaced by content-based id, with all references to the anchor updated accordingly</a:documentation>
|
802
816
|
</attribute>
|
803
817
|
</optional>
|
818
|
+
<optional>
|
819
|
+
<attribute name="source">
|
820
|
+
<a:documentation>Sourcing of the current element in an external data model</a:documentation>
|
821
|
+
<ref name="IdRefType"/>
|
822
|
+
</attribute>
|
823
|
+
</optional>
|
804
824
|
</define>
|
805
825
|
<define name="OptionalId" combine="interleave">
|
806
826
|
<optional>
|
@@ -808,6 +828,12 @@ titlecase, or lowercase</a:documentation>
|
|
808
828
|
<a:documentation> User-supplied anchor of element; replaced by content-based id, with all references to the anchor updated accordingly</a:documentation>
|
809
829
|
</attribute>
|
810
830
|
</optional>
|
831
|
+
<optional>
|
832
|
+
<attribute name="source">
|
833
|
+
<a:documentation>Sourcing of the current element in an external data model</a:documentation>
|
834
|
+
<ref name="IdRefType"/>
|
835
|
+
</attribute>
|
836
|
+
</optional>
|
811
837
|
</define>
|
812
838
|
<define name="ObligationType">
|
813
839
|
<a:documentation>The force of a clause in a standard document: whether it has normative or informative effect</a:documentation>
|
@@ -954,6 +980,7 @@ titlecase, or lowercase</a:documentation>
|
|
954
980
|
is used in particular to capture mutually agreed definitions of codepoints in Unicode Private Use Area</a:documentation>
|
955
981
|
</attribute>
|
956
982
|
</optional>
|
983
|
+
<ref name="OptionalId"/>
|
957
984
|
<oneOrMore>
|
958
985
|
<ref name="TextElement">
|
959
986
|
<a:documentation>Textual content of span</a:documentation>
|
@@ -1808,7 +1835,7 @@ used in document amendments</a:documentation>
|
|
1808
1835
|
</element>
|
1809
1836
|
</define>
|
1810
1837
|
<define name="TermAttributes">
|
1811
|
-
<ref name="
|
1838
|
+
<ref name="RequiredId"/>
|
1812
1839
|
<ref name="LocalizedStringAttributes"/>
|
1813
1840
|
<ref name="BlockAttributes"/>
|
1814
1841
|
</define>
|
@@ -2151,6 +2178,7 @@ used in document amendments</a:documentation>
|
|
2151
2178
|
<define name="termdefinition">
|
2152
2179
|
<a:documentation>The definition of a term applied in the current document</a:documentation>
|
2153
2180
|
<element name="definition">
|
2181
|
+
<ref name="RequiredId"/>
|
2154
2182
|
<optional>
|
2155
2183
|
<attribute name="type">
|
2156
2184
|
<a:documentation>Type of definition, used to differentiate it from other definitions of the same term if present</a:documentation>
|
@@ -2172,6 +2200,7 @@ used in document amendments</a:documentation>
|
|
2172
2200
|
</define>
|
2173
2201
|
<define name="verbaldefinition">
|
2174
2202
|
<element name="verbal-definition">
|
2203
|
+
<ref name="RequiredId"/>
|
2175
2204
|
<oneOrMore>
|
2176
2205
|
<choice>
|
2177
2206
|
<a:documentation>Content of the verbal representation of the term</a:documentation>
|
@@ -2192,6 +2221,7 @@ used in document amendments</a:documentation>
|
|
2192
2221
|
<define name="nonverbalrep">
|
2193
2222
|
<a:documentation>Non-verbal representation of the term</a:documentation>
|
2194
2223
|
<element name="non-verbal-representation">
|
2224
|
+
<ref name="RequiredId"/>
|
2195
2225
|
<oneOrMore>
|
2196
2226
|
<choice>
|
2197
2227
|
<a:documentation>Content of the non-verbal representation of the term</a:documentation>
|
@@ -5,27 +5,11 @@ module Metanorma
|
|
5
5
|
module Iso
|
6
6
|
class Converter < Standoc::Converter
|
7
7
|
|
8
|
-
# KILL
|
9
|
-
def clause_parsex(attrs, xml, node)
|
10
|
-
node.option? "appendix" and return appendix_parse(attrs, xml, node)
|
11
|
-
super
|
12
|
-
end
|
13
|
-
|
14
8
|
def scope_parse(attrs, xml, node)
|
15
9
|
attrs = attrs.merge(type: "scope") unless @amd
|
16
10
|
clause_parse(attrs, xml, node)
|
17
11
|
end
|
18
12
|
|
19
|
-
# KILL
|
20
|
-
def appendix_parsex(attrs, xml, node)
|
21
|
-
attrs[:"inline-header"] = node.option? "inline-header"
|
22
|
-
set_obligation(attrs, node)
|
23
|
-
xml.appendix **attr_code(attrs) do |xml_section|
|
24
|
-
xml_section.title { |name| name << node.title }
|
25
|
-
xml_section << node.content
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
13
|
def support_appendix?(_node)
|
30
14
|
true
|
31
15
|
end
|
@@ -25,22 +25,6 @@ module Metanorma
|
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
|
-
# KILL
|
29
|
-
def see_xrefs_validatex(root)
|
30
|
-
@lang == "en" or return
|
31
|
-
root.xpath("//xref").each do |t|
|
32
|
-
preceding = t.at("./preceding-sibling::text()[last()]")
|
33
|
-
!preceding.nil? &&
|
34
|
-
/\b(see| refer to)\p{Zs}*\Z/mi.match(preceding) or next
|
35
|
-
|
36
|
-
(target = root.at("//*[@anchor = '#{t['target']}']")) || next
|
37
|
-
target.at("./ancestor-or-self::*[@obligation = 'normative']") &&
|
38
|
-
!target.at("./ancestor::sections") and
|
39
|
-
@log.add("Style", t,
|
40
|
-
"'see #{t['target']}' is pointing to a normative section")
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
28
|
# ISO/IEC DIR 2, 15.5.3, 20.2
|
45
29
|
# does not deal with preceding text marked up
|
46
30
|
def see_xrefs_validate(root)
|
@@ -122,7 +106,8 @@ module Metanorma
|
|
122
106
|
.xpath("//sections/terms | //sections/clause[.//terms] | " \
|
123
107
|
"//annex[.//terms]").each_with_object({}) do |t, m|
|
124
108
|
t.xpath(".//*/@anchor").each { |a| m[a.text] = true }
|
125
|
-
t.
|
109
|
+
t.xpath(".//*/@id").each { |a| m[a.text] = true }
|
110
|
+
t.name == "terms" and m[t["anchor"] || t["id"]] = true
|
126
111
|
end
|
127
112
|
xmldoc.xpath(".//xref").each do |x|
|
128
113
|
term_xrefs_validate1(x, termids)
|
@@ -130,12 +115,12 @@ module Metanorma
|
|
130
115
|
end
|
131
116
|
|
132
117
|
def term_xrefs_validate1(xref, termids)
|
133
|
-
closest_id = xref.xpath("./ancestor::*[@
|
134
|
-
termids[xref["target"]] && !termids[closest_id["
|
118
|
+
closest_id = xref.xpath("./ancestor::*[@id]")&.last or return
|
119
|
+
termids[xref["target"]] && !termids[closest_id["id"]] and
|
135
120
|
@log.add("Style", xref,
|
136
121
|
"only terms clauses can cross-reference terms clause " \
|
137
122
|
"(#{xref['target']})")
|
138
|
-
!termids[xref["target"]] && termids[closest_id["
|
123
|
+
!termids[xref["target"]] && termids[closest_id["id"]] and
|
139
124
|
@log.add("Style", xref,
|
140
125
|
"non-terms clauses cannot cross-reference terms clause " \
|
141
126
|
"(#{xref['target']})")
|
@@ -77,8 +77,7 @@ module Metanorma
|
|
77
77
|
def image_name_validate(xmldoc)
|
78
78
|
prefix = image_name_prefix(xmldoc) or return
|
79
79
|
xmldoc.xpath("//image").each do |i|
|
80
|
-
|
81
|
-
|
80
|
+
i["src"].start_with?("data:") and next
|
82
81
|
case File.basename(i["src"])
|
83
82
|
when /^ISO_\d+_/
|
84
83
|
when /^(SL)?#{prefix}fig/ then image_name_validate1(i, prefix)
|
@@ -118,17 +118,17 @@ module Metanorma
|
|
118
118
|
if elem.nil? || elem.name != "clause"
|
119
119
|
@log.add("Style", elem, "Document must contain at least one clause")
|
120
120
|
end
|
121
|
-
elem&.at("./self::clause")
|
121
|
+
elem&.at("./self::clause") or
|
122
122
|
@log.add("Style", elem, "Document must contain clause after " \
|
123
123
|
"Terms and Definitions")
|
124
|
-
elem&.at("./self::clause[@type = 'scope']")
|
124
|
+
elem&.at("./self::clause[@type = 'scope']") and
|
125
125
|
@log.add("Style", elem,
|
126
|
-
"Scope must occur
|
126
|
+
"Scope must not occur after Terms and Definitions")
|
127
127
|
elem = names.shift
|
128
128
|
while elem&.name == "clause"
|
129
|
-
elem&.at("./self::clause[@type = 'scope']")
|
130
|
-
|
131
|
-
|
129
|
+
elem&.at("./self::clause[@type = 'scope']") and
|
130
|
+
@log.add("Style", elem,
|
131
|
+
"Scope must not occur after Terms and Definitions")
|
132
132
|
elem = names.shift
|
133
133
|
end
|
134
134
|
%w(annex references).include? elem&.name or
|
@@ -155,10 +155,12 @@ module Metanorma
|
|
155
155
|
"Normative References")
|
156
156
|
end
|
157
157
|
end
|
158
|
+
elem.nil? and return
|
158
159
|
elem&.at("./self::references[@normative = 'true']") ||
|
159
160
|
@log.add("Style", nil, "Document must include (references) " \
|
160
161
|
"Normative References")
|
161
162
|
elem = names&.shift
|
163
|
+
elem.nil? and return
|
162
164
|
elem&.at("./self::references[@normative = 'false']") ||
|
163
165
|
@log.add("Style", elem,
|
164
166
|
"Final section must be (references) Bibliography")
|
@@ -167,7 +169,9 @@ module Metanorma
|
|
167
169
|
"There are sections after the final Bibliography")
|
168
170
|
end
|
169
171
|
|
170
|
-
NORM_ISO_WARN =
|
172
|
+
NORM_ISO_WARN = <<~WARN.freeze
|
173
|
+
non-ISO/IEC reference is allowed as normative only subject to the conditions in ISO/IEC DIR 2 10.2
|
174
|
+
WARN
|
171
175
|
SCOPE_WARN = "Scope contains subclauses: should be succinct".freeze
|
172
176
|
|
173
177
|
def section_style(root)
|
@@ -8,8 +8,8 @@ module Metanorma
|
|
8
8
|
def extract_text(node)
|
9
9
|
node.nil? and return ""
|
10
10
|
node1 = Nokogiri::XML.fragment(node.to_s)
|
11
|
-
node1.xpath(".//link | .//locality | .//localityStack |
|
12
|
-
.each(&:remove)
|
11
|
+
node1.xpath(".//link | .//locality | .//localityStack | " \
|
12
|
+
".//stem | .//sourcecode").each(&:remove)
|
13
13
|
ret = ""
|
14
14
|
node1.traverse { |x| ret += x.text if x.text? }
|
15
15
|
HTMLEntities.new.decode(ret)
|
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: 3.0.
|
4
|
+
version: 3.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-06-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: metanorma-standoc
|