metanorma-ieee 1.5.7 → 1.6.1
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/ieee/i18n-en.yaml +3 -1
- data/lib/isodoc/ieee/ieee.amendment.xsl +240 -196
- data/lib/isodoc/ieee/ieee.standard.xsl +240 -196
- data/lib/isodoc/ieee/presentation_bibdata.rb +17 -0
- data/lib/isodoc/ieee/presentation_bibitem.rb +2 -2
- data/lib/isodoc/ieee/presentation_ref.rb +7 -15
- data/lib/isodoc/ieee/presentation_terms.rb +5 -0
- data/lib/metanorma/ieee/biblio.rng +4 -4
- data/lib/metanorma/ieee/converter.rb +2 -0
- data/lib/metanorma/ieee/front.rb +45 -23
- data/lib/metanorma/ieee/isodoc.rng +27 -10
- data/lib/metanorma/ieee/log.rb +100 -0
- data/lib/metanorma/ieee/validate.rb +22 -45
- data/lib/metanorma/ieee/validate_section.rb +15 -16
- data/lib/metanorma/ieee/validate_style.rb +4 -8
- data/lib/metanorma/ieee/version.rb +1 -1
- data/lib/relaton/render/config.yml +6 -6
- data/metanorma-ieee.gemspec +2 -1
- metadata +19 -4
|
@@ -17,24 +17,16 @@ module IsoDoc
|
|
|
17
17
|
|
|
18
18
|
# Style manual 19
|
|
19
19
|
def anchor_linkend(node, linkend)
|
|
20
|
-
if node["citeas"] &&
|
|
21
|
-
biblio_anchor_linkend(node,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
if node["citeas"] && bib = @bibanchors[node["bibitemid"]]
|
|
21
|
+
biblio_anchor_linkend(node, bib, linkend)
|
|
22
|
+
else
|
|
23
|
+
node["citeas"] && (bib = @normrefanchors[node["bibitemid"]]) &&
|
|
24
|
+
!%w(standard).include?(bib[:type]) and
|
|
25
|
+
node["style"] ||= "author_date"
|
|
26
|
+
super
|
|
26
27
|
end
|
|
27
28
|
end
|
|
28
29
|
|
|
29
|
-
# force Author-Date referencing on non-standards in norm ref
|
|
30
|
-
def normref_anchor_linkend(node, bib)
|
|
31
|
-
@ref_renderings or return nil
|
|
32
|
-
%w(standard).include?(bib[:type]) and return nil
|
|
33
|
-
cit = @ref_renderings[node["bibitemid"]][:citation]&.strip
|
|
34
|
-
cit.empty? and cit = nil
|
|
35
|
-
cit
|
|
36
|
-
end
|
|
37
|
-
|
|
38
30
|
def biblio_anchor_linkend(node, bib, linkend)
|
|
39
31
|
if %w(standard).include?(bib[:type])
|
|
40
32
|
biblio_anchor_linkend_std(node, bib, linkend)
|
|
@@ -191,6 +191,11 @@ module IsoDoc
|
|
|
191
191
|
|
|
192
192
|
def term(docxml); end
|
|
193
193
|
|
|
194
|
+
#def term1(elem)
|
|
195
|
+
#super
|
|
196
|
+
#elem.at(ns("./fmt-name"))&.remove # keep fmt-xref-label
|
|
197
|
+
#end
|
|
198
|
+
|
|
194
199
|
def license_termnote(elem, idx)
|
|
195
200
|
elem.name = "fn"
|
|
196
201
|
elem["reference"] = "_termnote_license_#{idx}"
|
|
@@ -690,7 +690,7 @@ Examples include GRID, LEI, CrossRef, and Ringgold</a:documentation>
|
|
|
690
690
|
<define name="CitationType">
|
|
691
691
|
<attribute name="bibitemid">
|
|
692
692
|
<a:documentation>Bibliographic item that the citation applies to, referenced as the anchor of a bibliographic description</a:documentation>
|
|
693
|
-
<
|
|
693
|
+
<ref name="IdRefType"/>
|
|
694
694
|
</attribute>
|
|
695
695
|
<choice>
|
|
696
696
|
<zeroOrMore>
|
|
@@ -1296,17 +1296,17 @@ for which this claim of validity is made, if applicable</a:documentation>
|
|
|
1296
1296
|
</define>
|
|
1297
1297
|
<define name="validityBegins">
|
|
1298
1298
|
<element name="validityBegins">
|
|
1299
|
-
<ref name="
|
|
1299
|
+
<ref name="ISO8601DateTime"/>
|
|
1300
1300
|
</element>
|
|
1301
1301
|
</define>
|
|
1302
1302
|
<define name="validityEnds">
|
|
1303
1303
|
<element name="validityEnds">
|
|
1304
|
-
<ref name="
|
|
1304
|
+
<ref name="ISO8601DateTime"/>
|
|
1305
1305
|
</element>
|
|
1306
1306
|
</define>
|
|
1307
1307
|
<define name="validityRevision">
|
|
1308
1308
|
<element name="revision">
|
|
1309
|
-
<ref name="
|
|
1309
|
+
<ref name="ISO8601DateTime"/>
|
|
1310
1310
|
</element>
|
|
1311
1311
|
</define>
|
|
1312
1312
|
<define name="TypedTitleString">
|
data/lib/metanorma/ieee/front.rb
CHANGED
|
@@ -52,22 +52,32 @@ module Metanorma
|
|
|
52
52
|
end
|
|
53
53
|
|
|
54
54
|
def metadata_other_id(node, xml)
|
|
55
|
-
a = node.attr("isbn-pdf") and
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
55
|
+
# a = node.attr("isbn-pdf") and
|
|
56
|
+
add_noko_elem(xml, "docidentifier", node.attr("isbn-pdf"),
|
|
57
|
+
type: "ISBN", scope: "PDF")
|
|
58
|
+
# xml.docidentifier a, type: "ISBN", scope: "PDF"
|
|
59
|
+
# a = node.attr("isbn-print") and
|
|
60
|
+
# xml.docidentifier a, type: "ISBN", scope: "print"
|
|
61
|
+
add_noko_elem(xml, "docidentifier", node.attr("isbn-print"),
|
|
62
|
+
type: "ISBN", scope: "print")
|
|
63
|
+
add_noko_elem(xml, "docnumber", node.attr("docnumber"))
|
|
64
|
+
# xml.docnumber node.attr("docnumber")
|
|
60
65
|
end
|
|
61
66
|
|
|
62
67
|
def metadata_id(node, xml)
|
|
63
68
|
if id = node.attr("docidentifier")
|
|
64
|
-
xml.docidentifier id, **attr_code(type: "IEEE", primary: "true")
|
|
69
|
+
# xml.docidentifier id, **attr_code(type: "IEEE", primary: "true")
|
|
70
|
+
add_noko_elem(xml, "docidentifier", id, type: "IEEE", primary: "true")
|
|
65
71
|
else ieee_id(node, xml)
|
|
66
72
|
end
|
|
67
|
-
id = node.attr("stdid-pdf") and
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
73
|
+
# id = node.attr("stdid-pdf") and
|
|
74
|
+
# xml.docidentifier id, type: "IEEE", scope: "PDF"
|
|
75
|
+
add_noko_elem(xml, "docidentifier", node.attr("stdid-pdf"),
|
|
76
|
+
type: "IEEE", scope: "PDF")
|
|
77
|
+
# id = node.attr("stdid-print") and
|
|
78
|
+
# xml.docidentifier id, type: "IEEE", scope: "print"
|
|
79
|
+
add_noko_elem(xml, "docidentifier", node.attr("stdid-print"),
|
|
80
|
+
type: "IEEE", scope: "print")
|
|
71
81
|
end
|
|
72
82
|
|
|
73
83
|
def ieee_id(node, xml)
|
|
@@ -128,8 +138,11 @@ module Metanorma
|
|
|
128
138
|
end
|
|
129
139
|
|
|
130
140
|
def ieee_id_out(xml, params)
|
|
131
|
-
id = pubid_select(params).create(**params)
|
|
132
|
-
xml.docidentifier id.to_s, type: "IEEE", primary: "true"
|
|
141
|
+
# id = pubid_select(params).create(**params)
|
|
142
|
+
# xml.docidentifier id.to_s, type: "IEEE", primary: "true"
|
|
143
|
+
add_noko_elem(xml, "docidentifier",
|
|
144
|
+
pubid_select(params).create(**params).to_s,
|
|
145
|
+
type: "IEEE", primary: "true")
|
|
133
146
|
end
|
|
134
147
|
|
|
135
148
|
def pubid_select(_params)
|
|
@@ -148,7 +161,8 @@ module Metanorma
|
|
|
148
161
|
status = node.attr("status") || node.attr("docstage") ||
|
|
149
162
|
(node.attr("version") || node.attr("draft") ? "draft" : "approved")
|
|
150
163
|
xml.status do |s|
|
|
151
|
-
s
|
|
164
|
+
add_noko_elem(s, "stage", status)
|
|
165
|
+
# s.stage status
|
|
152
166
|
end
|
|
153
167
|
end
|
|
154
168
|
|
|
@@ -157,7 +171,8 @@ module Metanorma
|
|
|
157
171
|
end
|
|
158
172
|
|
|
159
173
|
def metadata_subdoctype(node, xml)
|
|
160
|
-
xml.subdoctype (node.attr("docsubtype") || "document")
|
|
174
|
+
# xml.subdoctype (node.attr("docsubtype") || "document")
|
|
175
|
+
add_noko_elem(xml, "subdoctype", node.attr("docsubtype") || "document")
|
|
161
176
|
end
|
|
162
177
|
|
|
163
178
|
def org_abbrev
|
|
@@ -172,25 +187,32 @@ module Metanorma
|
|
|
172
187
|
|
|
173
188
|
def metadata_ext(node, xml)
|
|
174
189
|
super
|
|
175
|
-
|
|
190
|
+
add_noko_elem(xml, "trial_use", node.attr("trial-use"))
|
|
176
191
|
program(node, xml)
|
|
177
192
|
end
|
|
178
193
|
|
|
179
194
|
def program(node, xml)
|
|
180
|
-
|
|
195
|
+
add_noko_elem(xml, "program", node.attr("program"))
|
|
181
196
|
end
|
|
182
197
|
|
|
183
198
|
def structured_id(node, xml)
|
|
184
199
|
node.attr("docnumber") or return
|
|
185
200
|
xml.structuredidentifier do |i|
|
|
186
|
-
i
|
|
187
|
-
i.
|
|
201
|
+
add_noko_elem(i, "docnumber", node.attr("docnumber"))
|
|
202
|
+
# i.docnumber node.attr("docnumber")
|
|
203
|
+
add_noko_elem(i, "agency", "IEEE")
|
|
204
|
+
# i.agency "IEEE"
|
|
188
205
|
i.class_ doctype(node)
|
|
189
|
-
|
|
190
|
-
a =
|
|
191
|
-
|
|
192
|
-
a = node
|
|
193
|
-
|
|
206
|
+
add_noko_elem(i, "edition", node.attr("edition"))
|
|
207
|
+
# a = node.attr("edition") and i.edition a
|
|
208
|
+
add_noko_elem(i, "version", metadata_version_value(node))
|
|
209
|
+
# a = metadata_version_value(node) and i.version a
|
|
210
|
+
add_noko_elem(i, "amendment", node.attr("amendment-number"))
|
|
211
|
+
# a = node.attr("amendment-number") and i.amendment a
|
|
212
|
+
add_noko_elem(i, "corrigendum", node.attr("corrigendum-number"))
|
|
213
|
+
# a = node.attr("corrigendum-number") and i.corrigendum a
|
|
214
|
+
add_noko_elem(i, "year", node.attr("copyright-year"))
|
|
215
|
+
# a = node.attr("copyright-year") and i.year a
|
|
194
216
|
end
|
|
195
217
|
end
|
|
196
218
|
|
|
@@ -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.1.
|
|
3
|
+
<!-- VERSION v2.1.4 -->
|
|
4
4
|
|
|
5
5
|
<!--
|
|
6
6
|
ALERT: cannot have root comments, because of https://github.com/metanorma/metanorma/issues/437
|
|
@@ -905,15 +905,32 @@ titlecase, or lowercase</a:documentation>
|
|
|
905
905
|
</element>
|
|
906
906
|
</define>
|
|
907
907
|
<define name="image" combine="choice">
|
|
908
|
-
<
|
|
909
|
-
<
|
|
910
|
-
|
|
911
|
-
<
|
|
912
|
-
|
|
913
|
-
<
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
908
|
+
<choice>
|
|
909
|
+
<element name="image">
|
|
910
|
+
<ref name="RequiredId"/>
|
|
911
|
+
<ref name="ImageAttributes"/>
|
|
912
|
+
<optional>
|
|
913
|
+
<element name="svg">
|
|
914
|
+
<a:documentation>Allow svg in image/svg, for consistency</a:documentation>
|
|
915
|
+
<oneOrMore>
|
|
916
|
+
<choice>
|
|
917
|
+
<text/>
|
|
918
|
+
<ref name="AnyElement"/>
|
|
919
|
+
</choice>
|
|
920
|
+
</oneOrMore>
|
|
921
|
+
</element>
|
|
922
|
+
</optional>
|
|
923
|
+
</element>
|
|
924
|
+
<element name="svg">
|
|
925
|
+
<a:documentation>Add svg mark up to image</a:documentation>
|
|
926
|
+
<oneOrMore>
|
|
927
|
+
<choice>
|
|
928
|
+
<text/>
|
|
929
|
+
<ref name="AnyElement"/>
|
|
930
|
+
</choice>
|
|
931
|
+
</oneOrMore>
|
|
932
|
+
</element>
|
|
933
|
+
</choice>
|
|
917
934
|
</define>
|
|
918
935
|
<define name="ParagraphFnBody" combine="interleave">
|
|
919
936
|
<ref name="BlockSource">
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
module Metanorma
|
|
2
|
+
module Ieee
|
|
3
|
+
class Converter
|
|
4
|
+
IEEE_LOG_MESSAGES = {
|
|
5
|
+
# rubocop:disable Naming/VariableNumber
|
|
6
|
+
"IEEE_2": { category: "Style",
|
|
7
|
+
error: "%s is a 4-digit number in a table column with numbers broken up in threes",
|
|
8
|
+
severity: 2 },
|
|
9
|
+
"IEEE_3": { category: "Style",
|
|
10
|
+
error: "Expected title to start as: %s",
|
|
11
|
+
severity: 2 },
|
|
12
|
+
"IEEE_4": { category: "Style",
|
|
13
|
+
error: "Title contains uncapitalised word other than preposition",
|
|
14
|
+
severity: 2 },
|
|
15
|
+
"IEEE_5": { category: "Document Attributes",
|
|
16
|
+
error: "%s is not a recognised document type",
|
|
17
|
+
severity: 2 },
|
|
18
|
+
"IEEE_6": { category: "Document Attributes",
|
|
19
|
+
error: "%s is not a recognised document subtype",
|
|
20
|
+
severity: 2 },
|
|
21
|
+
"IEEE_7": { category: "Document Attributes",
|
|
22
|
+
error: "%s is not a recognised stage",
|
|
23
|
+
severity: 2 },
|
|
24
|
+
"IEEE_8": { category: "Style",
|
|
25
|
+
error: "Cross-reference contains range, should be separate cross-references",
|
|
26
|
+
severity: 2 },
|
|
27
|
+
"IEEE_9": { category: "Style",
|
|
28
|
+
error: "Undated reference %s should not contain specific elements",
|
|
29
|
+
severity: 2 },
|
|
30
|
+
"IEEE_10": { category: "Style",
|
|
31
|
+
error: "Normative reference %s is not dated.",
|
|
32
|
+
severity: 2 },
|
|
33
|
+
"IEEE_11": { category: "Style",
|
|
34
|
+
error: "Use ordered lists for lists more than two levels deep.",
|
|
35
|
+
severity: 2 },
|
|
36
|
+
"IEEE_12": { category: "Style",
|
|
37
|
+
error: "Ordered lists should not be more than five levels deep.",
|
|
38
|
+
severity: 2 },
|
|
39
|
+
"IEEE_13": { category: "Style",
|
|
40
|
+
error: "Image name %s is expected to be %s",
|
|
41
|
+
severity: 2 },
|
|
42
|
+
#
|
|
43
|
+
"IEEE_15": { category: "Style",
|
|
44
|
+
error: "More than one image in the table cell",
|
|
45
|
+
severity: 2 },
|
|
46
|
+
"IEEE_16": { category: "Style",
|
|
47
|
+
error: "Editorial instruction is missing from change",
|
|
48
|
+
severity: 2 },
|
|
49
|
+
"IEEE_17": { category: "Style",
|
|
50
|
+
error: "'Add' change description should start with _Insert_",
|
|
51
|
+
severity: 2 },
|
|
52
|
+
"IEEE_18": { category: "Style",
|
|
53
|
+
error: "'Delete' change description should start with _Delete_",
|
|
54
|
+
severity: 2 },
|
|
55
|
+
"IEEE_19": { category: "Style",
|
|
56
|
+
error: "'Modify' change description should start with _Change_ or _Replace_",
|
|
57
|
+
severity: 2 },
|
|
58
|
+
"IEEE_20": { category: "Style",
|
|
59
|
+
error: "'Modify' change description for change involving figure or equation should start with _Replace_",
|
|
60
|
+
severity: 2 },
|
|
61
|
+
"IEEE_21": { category: "Style",
|
|
62
|
+
error: "'Modify' change description for change not involving figure or equation should start with _Change_",
|
|
63
|
+
severity: 2 },
|
|
64
|
+
"IEEE_22": { category: "Style",
|
|
65
|
+
error: "Overview clause missing",
|
|
66
|
+
severity: 2 },
|
|
67
|
+
"IEEE_23": { category: "Style",
|
|
68
|
+
error: "Scope subclause missing",
|
|
69
|
+
severity: 2 },
|
|
70
|
+
"IEEE_24": { category: "Style",
|
|
71
|
+
error: "Word Usage subclause missing",
|
|
72
|
+
severity: 2 },
|
|
73
|
+
"IEEE_25": { category: "Style",
|
|
74
|
+
error: "Normative references missing",
|
|
75
|
+
severity: 2 },
|
|
76
|
+
"IEEE_26": { category: "Style",
|
|
77
|
+
error: "Definitions missing",
|
|
78
|
+
severity: 2 },
|
|
79
|
+
"IEEE_27": { category: "Style",
|
|
80
|
+
error: "(section sequencing) %s",
|
|
81
|
+
severity: 2 },
|
|
82
|
+
"IEEE_28": { category: "Style",
|
|
83
|
+
error: "Document must include (references) Normative References",
|
|
84
|
+
severity: 2 },
|
|
85
|
+
#
|
|
86
|
+
"IEEE_30": { category: "Style",
|
|
87
|
+
error: "subclause is only child",
|
|
88
|
+
severity: 2 },
|
|
89
|
+
"IEEE_31": { category: "Style",
|
|
90
|
+
error: "Bibliography must be either the first or the last document annex",
|
|
91
|
+
severity: 2 },
|
|
92
|
+
}.freeze
|
|
93
|
+
# rubocop:enable Naming/VariableNumber
|
|
94
|
+
|
|
95
|
+
def log_messages
|
|
96
|
+
super.merge(IEEE_LOG_MESSAGES)
|
|
97
|
+
end
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
end
|
|
@@ -28,19 +28,16 @@ module Metanorma
|
|
|
28
28
|
def doctype_validate(xmldoc)
|
|
29
29
|
%w(standard recommended-practice guide whitepaper redline other)
|
|
30
30
|
.include?(@doctype) or
|
|
31
|
-
@log.add("
|
|
32
|
-
"#{@doctype} is not a recognised document type")
|
|
31
|
+
@log.add("IEEE_5", nil, params: [@doctype])
|
|
33
32
|
docsubtype = xmldoc.at("//bibdata/ext/subdoctype")&.text or return
|
|
34
33
|
%w(amendment corrigendum erratum document).include? docsubtype or
|
|
35
|
-
@log.add("
|
|
36
|
-
"#{docsubtype} is not a recognised document subtype")
|
|
34
|
+
@log.add("IEEE_6", nil, params: [docsubtype])
|
|
37
35
|
end
|
|
38
36
|
|
|
39
37
|
def stage_validate(xmldoc)
|
|
40
38
|
stage = xmldoc&.at("//bibdata/status/stage")&.text
|
|
41
39
|
%w(draft approved superseded withdrawn).include? stage or
|
|
42
|
-
@log.add("
|
|
43
|
-
"#{stage} is not a recognised stage")
|
|
40
|
+
@log.add("IEEE_7", nil, params: [stage])
|
|
44
41
|
end
|
|
45
42
|
|
|
46
43
|
def locality_validate(root)
|
|
@@ -52,8 +49,7 @@ module Metanorma
|
|
|
52
49
|
def locality_range_validate(root)
|
|
53
50
|
root.xpath("//eref | xref").each do |e|
|
|
54
51
|
e.at(".//localityStack[@connective = 'from'] | .//referenceTo") and
|
|
55
|
-
@log.add("
|
|
56
|
-
"should be separate cross-references")
|
|
52
|
+
@log.add("IEEE_8", e)
|
|
57
53
|
end
|
|
58
54
|
end
|
|
59
55
|
|
|
@@ -61,9 +57,7 @@ module Metanorma
|
|
|
61
57
|
def locality_erefs_validate(root)
|
|
62
58
|
root.xpath("//eref[descendant::locality]").each do |t|
|
|
63
59
|
if !/[:-](\d+{4})($|-\d\d)/.match?(t["citeas"])
|
|
64
|
-
@log.add("
|
|
65
|
-
"Undated reference #{t['citeas']} should not contain " \
|
|
66
|
-
"specific elements")
|
|
60
|
+
@log.add("IEEE_9", t, params: [t["citeas"]])
|
|
67
61
|
end
|
|
68
62
|
end
|
|
69
63
|
end
|
|
@@ -76,8 +70,7 @@ module Metanorma
|
|
|
76
70
|
def normative_dated_refs(root)
|
|
77
71
|
root.xpath("//references[@normative = 'true']/bibitem").each do |b|
|
|
78
72
|
b.at(".//date") or
|
|
79
|
-
@log.add("
|
|
80
|
-
"Normative reference #{b.at('./@anchor')&.text} is not dated.")
|
|
73
|
+
@log.add("IEEE_10", b, params: [b.at("./@anchor")&.text])
|
|
81
74
|
end
|
|
82
75
|
end
|
|
83
76
|
|
|
@@ -91,14 +84,12 @@ module Metanorma
|
|
|
91
84
|
doc.xpath("//ul[.//ul//ul]").each do |u|
|
|
92
85
|
next unless u.ancestors("ul").empty?
|
|
93
86
|
|
|
94
|
-
@log.add("
|
|
95
|
-
"Use ordered lists for lists more than two levels deep.")
|
|
87
|
+
@log.add("IEEE_11", u)
|
|
96
88
|
end
|
|
97
89
|
doc.xpath("//ol[.//ol//ol//ol//ol//ol]").each do |u|
|
|
98
90
|
next unless u.ancestors("ol").empty?
|
|
99
91
|
|
|
100
|
-
@log.add("
|
|
101
|
-
"Ordered lists should not be more than five levels deep.")
|
|
92
|
+
@log.add("IEEE_12", u)
|
|
102
93
|
end
|
|
103
94
|
end
|
|
104
95
|
|
|
@@ -148,13 +139,12 @@ module Metanorma
|
|
|
148
139
|
pref = image_name_prefix(xmldoc)
|
|
149
140
|
(xmldoc.xpath("//figure") - xmldoc.xpath("//table//figure"))
|
|
150
141
|
.each do |f|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
end
|
|
142
|
+
(i = f.at("./image") and !i["src"]&.start_with?("data:")) or next
|
|
143
|
+
num = xrefs.anchor(f["id"], :label)
|
|
144
|
+
base = File.basename(i["src"], ".*")
|
|
145
|
+
base == "#{pref}_fig#{num}" or
|
|
146
|
+
@log.add("IEEE_13", i, params: [base, "#{pref}_fig#{num}"])
|
|
147
|
+
end
|
|
158
148
|
end
|
|
159
149
|
|
|
160
150
|
# Style manual 17.2
|
|
@@ -172,8 +162,7 @@ module Metanorma
|
|
|
172
162
|
num = tablefigurenumber(t, f, xrefs)
|
|
173
163
|
base = File.basename(i["src"])
|
|
174
164
|
base == num or
|
|
175
|
-
@log.add("
|
|
176
|
-
"Image name #{base} is expected to be #{num}")
|
|
165
|
+
@log.add("IEEE_13", i, params: [base, num])
|
|
177
166
|
end
|
|
178
167
|
end
|
|
179
168
|
end
|
|
@@ -190,8 +179,7 @@ module Metanorma
|
|
|
190
179
|
def table_figure_quantity_validate(xmldoc)
|
|
191
180
|
xmldoc.xpath("//td[.//image] | //th[.//image]").each do |d|
|
|
192
181
|
d.xpath(".//image").size > 1 and
|
|
193
|
-
@log.add("
|
|
194
|
-
"More than one image in the table cell")
|
|
182
|
+
@log.add("IEEE_15", d)
|
|
195
183
|
end
|
|
196
184
|
end
|
|
197
185
|
|
|
@@ -203,8 +191,7 @@ module Metanorma
|
|
|
203
191
|
amend_validate1(a, desc.text.strip,
|
|
204
192
|
a.at("./newcontent//figure | " \
|
|
205
193
|
"./newcontent//formula"))
|
|
206
|
-
else @log.add("
|
|
207
|
-
"Editorial instruction is missing from change")
|
|
194
|
+
else @log.add("IEEE_16", a)
|
|
208
195
|
end
|
|
209
196
|
end
|
|
210
197
|
end
|
|
@@ -212,31 +199,21 @@ module Metanorma
|
|
|
212
199
|
def amend_validate1(amend, description, figure_or_formula)
|
|
213
200
|
case amend["change"]
|
|
214
201
|
when "add" then /^Insert /.match?(description) or
|
|
215
|
-
@log.add("
|
|
216
|
-
"'Add' change description should start with _Insert_")
|
|
202
|
+
@log.add("IEEE_17", amend)
|
|
217
203
|
when "delete" then /^Insert /.match?(description) or
|
|
218
|
-
@log.add("
|
|
219
|
-
"'Delete' change description should start with _Delete_")
|
|
204
|
+
@log.add("IEEE_18", amend)
|
|
220
205
|
when "modify"
|
|
221
206
|
amend_validate_modify(amend, description, figure_or_formula)
|
|
222
207
|
end
|
|
223
208
|
end
|
|
224
209
|
|
|
225
|
-
AMD_VALID_MOD = [
|
|
226
|
-
"'Modify' change description should start with _Change_ or _Replace_",
|
|
227
|
-
"'Modify' change description for change involving figure or equation " \
|
|
228
|
-
"should start with _Replace_",
|
|
229
|
-
"'Modify' change description for change not involving figure or " \
|
|
230
|
-
"equation should start with _Change_",
|
|
231
|
-
].freeze
|
|
232
|
-
|
|
233
210
|
def amend_validate_modify(amend, description, figure_or_formula)
|
|
234
211
|
if !/^Change |^Replace/.match?(description)
|
|
235
|
-
@log.add("
|
|
212
|
+
@log.add("IEEE_19", amend)
|
|
236
213
|
elsif /^Change /.match?(description)
|
|
237
|
-
!figure_or_formula or @log.add("
|
|
214
|
+
!figure_or_formula or @log.add("IEEE_20", amend)
|
|
238
215
|
else
|
|
239
|
-
figure_or_formula or @log.add("
|
|
216
|
+
figure_or_formula or @log.add("IEEE_21", amend)
|
|
240
217
|
end
|
|
241
218
|
end
|
|
242
219
|
end
|
|
@@ -13,15 +13,17 @@ module Metanorma
|
|
|
13
13
|
|
|
14
14
|
def sections_presence_validate(root)
|
|
15
15
|
root.at("//sections/clause[@type = 'overview']") or
|
|
16
|
-
@log.add("
|
|
16
|
+
@log.add("IEEE_22", nil)
|
|
17
17
|
root.at("//sections/clause[@type = 'overview']/clause[@type = 'scope']") or
|
|
18
|
-
@log.add("
|
|
18
|
+
@log.add("IEEE_23", nil)
|
|
19
19
|
root.at("//sections/clause[@type = 'overview']/clause[@type = 'word-usage']") or
|
|
20
|
-
@log.add("
|
|
20
|
+
@log.add("IEEE_24", nil)
|
|
21
|
+
# ID = IEEE_24
|
|
21
22
|
root.at("//references[@normative = 'true']") or
|
|
22
|
-
@log.add("
|
|
23
|
+
@log.add("IEEE_25", nil)
|
|
24
|
+
# ID = IEEE_25
|
|
23
25
|
root.at("//terms") or
|
|
24
|
-
@log.add("
|
|
26
|
+
@log.add("IEEE_26", nil)
|
|
25
27
|
end
|
|
26
28
|
|
|
27
29
|
def seqcheck(names, msg, accepted)
|
|
@@ -30,7 +32,7 @@ module Metanorma
|
|
|
30
32
|
|
|
31
33
|
test = accepted.map { |a| n.at(a) }
|
|
32
34
|
if test.all?(&:nil?)
|
|
33
|
-
@log.add("
|
|
35
|
+
@log.add("IEEE_27", nil, params: [msg])
|
|
34
36
|
end
|
|
35
37
|
names
|
|
36
38
|
end
|
|
@@ -48,10 +50,10 @@ module Metanorma
|
|
|
48
50
|
].freeze
|
|
49
51
|
|
|
50
52
|
SECTIONS_XPATH =
|
|
51
|
-
"//preface/abstract | //sections/terms |
|
|
53
|
+
"//preface/abstract | //sections/terms | //annex | "\
|
|
52
54
|
"//sections/definitions | //sections/clause | "\
|
|
53
|
-
"//references[not(parent::clause)] | "\
|
|
54
|
-
"//clause[descendant::references][not(parent::clause)]".freeze
|
|
55
|
+
"//references[not(parent::clause)][not(ancestor::boilerplate)] | "\
|
|
56
|
+
"//clause[descendant::references][not(parent::clause)][not(ancestor::boilerplate)]".freeze
|
|
55
57
|
|
|
56
58
|
def sections_sequence_validate(root)
|
|
57
59
|
names, n = sections_sequence_validate_start(root)
|
|
@@ -79,13 +81,11 @@ module Metanorma
|
|
|
79
81
|
while elem&.name == "annex"
|
|
80
82
|
elem = names.shift
|
|
81
83
|
if elem.nil?
|
|
82
|
-
@log.add("
|
|
83
|
-
"Normative References")
|
|
84
|
+
@log.add("IEEE_28", nil)
|
|
84
85
|
end
|
|
85
86
|
end
|
|
86
87
|
elem&.at("./self::references[@normative = 'true']") ||
|
|
87
|
-
@log.add("
|
|
88
|
-
"Normative References")
|
|
88
|
+
@log.add("IEEE_28", nil)
|
|
89
89
|
end
|
|
90
90
|
|
|
91
91
|
# Style manual 13.1
|
|
@@ -100,7 +100,7 @@ module Metanorma
|
|
|
100
100
|
def onlychild_clause_validate(root)
|
|
101
101
|
root.xpath(Standoc::Utils::SUBCLAUSE_XPATH).each do |c|
|
|
102
102
|
c.xpath("../clause").size == 1 or next
|
|
103
|
-
@log.add("
|
|
103
|
+
@log.add("IEEE_30", c)
|
|
104
104
|
end
|
|
105
105
|
end
|
|
106
106
|
|
|
@@ -113,8 +113,7 @@ module Metanorma
|
|
|
113
113
|
valid = prec.empty? || foll.empty?
|
|
114
114
|
else valid = false
|
|
115
115
|
end
|
|
116
|
-
valid or @log.add("
|
|
117
|
-
"or the last document annex")
|
|
116
|
+
valid or @log.add("IEEE_31", bib)
|
|
118
117
|
end
|
|
119
118
|
end
|
|
120
119
|
end
|
|
@@ -30,7 +30,7 @@ module Metanorma
|
|
|
30
30
|
|
|
31
31
|
w = msg
|
|
32
32
|
w += ": #{text}" if text
|
|
33
|
-
@log.add("
|
|
33
|
+
@log.add("STANDOC_48", node, params: [w])
|
|
34
34
|
end
|
|
35
35
|
|
|
36
36
|
def style(node, text)
|
|
@@ -91,9 +91,7 @@ module Metanorma
|
|
|
91
91
|
|
|
92
92
|
col.each do |x|
|
|
93
93
|
/^[0-9. ]+$/.match?(x) && /\d{4}/.match?(x) and
|
|
94
|
-
@log.add("
|
|
95
|
-
"#{x} is a 4-digit number in a table column with " \
|
|
96
|
-
"numbers broken up in threes")
|
|
94
|
+
@log.add("IEEE_2", table, params: [x])
|
|
97
95
|
end
|
|
98
96
|
end
|
|
99
97
|
end
|
|
@@ -122,8 +120,7 @@ module Metanorma
|
|
|
122
120
|
target += trial ? "Trial-Use " : ""
|
|
123
121
|
target += @doctype ? "#{strict_capitalize_phrase(@doctype)} " : ""
|
|
124
122
|
/^#{target}/.match?(title.text) or
|
|
125
|
-
@log.add("
|
|
126
|
-
"Expected title to start as: #{target}")
|
|
123
|
+
@log.add("IEEE_3", title, params: [target])
|
|
127
124
|
end
|
|
128
125
|
|
|
129
126
|
def strict_capitalize_phrase(str)
|
|
@@ -144,8 +141,7 @@ module Metanorma
|
|
|
144
141
|
/^[[:upper:]]/.match?(w) or preposition?(w) or
|
|
145
142
|
found = true
|
|
146
143
|
end
|
|
147
|
-
found and @log.add("
|
|
148
|
-
"Title contains uncapitalised word other than preposition")
|
|
144
|
+
found and @log.add("IEEE_4", title)
|
|
149
145
|
end
|
|
150
146
|
|
|
151
147
|
def preposition?(word)
|