metanorma-iso 1.8.0 → 1.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/asciidoctor/iso/base.rb +13 -11
- data/lib/asciidoctor/iso/cleanup.rb +27 -23
- data/lib/asciidoctor/iso/front.rb +25 -15
- data/lib/asciidoctor/iso/validate.rb +22 -110
- data/lib/asciidoctor/iso/validate_image.rb +97 -0
- data/lib/asciidoctor/iso/validate_requirements.rb +26 -20
- data/lib/asciidoctor/iso/validate_section.rb +39 -20
- data/lib/asciidoctor/iso/validate_style.rb +36 -24
- data/lib/asciidoctor/iso/validate_title.rb +2 -4
- data/lib/isodoc/iso/base_convert.rb +8 -2
- data/lib/isodoc/iso/iso.amendment.xsl +326 -61
- data/lib/isodoc/iso/iso.international-standard.xsl +326 -61
- data/lib/isodoc/iso/presentation_xml_convert.rb +15 -14
- data/lib/isodoc/iso/xref.rb +2 -2
- data/lib/metanorma/iso/processor.rb +1 -0
- data/lib/metanorma/iso/version.rb +1 -1
- data/spec/asciidoctor/base_spec.rb +36 -7
- data/spec/asciidoctor/validate_spec.rb +120 -65
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9d170797212efc1050755714c1c875246a5b1b07ca8c4c1b6562b51ab2ee44a9
|
4
|
+
data.tar.gz: a6deb053bf737183c275a1f93a110d89f8fa42a093bafd514c7d672b5e16f427
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 63752e6b4a75cba612fca7cacf5c0ccd7a4553f51b9743e667d7a2891737dff68deace61efcab395be2f22e8b4d6559ee8eee6c50ad84e3f13e627af1ca98a68
|
7
|
+
data.tar.gz: 401f42f155a7424266d3bf62cb6fca9a67ad1adeddf01145c55de95397a91de22847b56fa92563d64045eb6dc2682511eab3925d60f74b1ca737f8ecefacee63
|
data/lib/asciidoctor/iso/base.rb
CHANGED
@@ -17,8 +17,8 @@ module Asciidoctor
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def html_converter_alt(node)
|
20
|
-
IsoDoc::Iso::HtmlConvert.new(html_extract_attributes(node)
|
21
|
-
merge(alt: true))
|
20
|
+
IsoDoc::Iso::HtmlConvert.new(html_extract_attributes(node)
|
21
|
+
.merge(alt: true))
|
22
22
|
end
|
23
23
|
|
24
24
|
def doc_converter(node)
|
@@ -27,11 +27,13 @@ module Asciidoctor
|
|
27
27
|
|
28
28
|
def pdf_converter(node)
|
29
29
|
return nil if node.attr("no-pdf")
|
30
|
+
|
30
31
|
IsoDoc::Iso::PdfConvert.new(doc_extract_attributes(node))
|
31
32
|
end
|
32
33
|
|
33
34
|
def sts_converter(node)
|
34
35
|
return nil if node.attr("no-pdf")
|
36
|
+
|
35
37
|
IsoDoc::Iso::StsConvert.new(html_extract_attributes(node))
|
36
38
|
end
|
37
39
|
|
@@ -45,22 +47,22 @@ module Asciidoctor
|
|
45
47
|
end
|
46
48
|
|
47
49
|
def ol_attrs(node)
|
48
|
-
attr_code(keep_attrs(node)
|
49
|
-
merge(id: ::Metanorma::Utils::anchor_or_uuid(node)))
|
50
|
+
attr_code(keep_attrs(node)
|
51
|
+
.merge(id: ::Metanorma::Utils::anchor_or_uuid(node)))
|
50
52
|
end
|
51
53
|
|
52
54
|
def outputs(node, ret)
|
53
|
-
File.open(@filename
|
54
|
-
presentation_xml_converter(node).convert(@filename
|
55
|
-
html_converter_alt(node).convert(@filename
|
55
|
+
File.open("#{@filename}.xml", "w:UTF-8") { |f| f.write(ret) }
|
56
|
+
presentation_xml_converter(node).convert("#{@filename}.xml")
|
57
|
+
html_converter_alt(node).convert("#{@filename}.presentation.xml",
|
56
58
|
nil, false, "#{@filename}_alt.html")
|
57
|
-
html_converter(node).convert(@filename
|
59
|
+
html_converter(node).convert("#{@filename}.presentation.xml",
|
58
60
|
nil, false, "#{@filename}.html")
|
59
|
-
doc_converter(node).convert(@filename
|
61
|
+
doc_converter(node).convert("#{@filename}.presentation.xml",
|
60
62
|
nil, false, "#{@filename}.doc")
|
61
|
-
pdf_converter(node)&.convert(@filename
|
63
|
+
pdf_converter(node)&.convert("#{@filename}.presentation.xml",
|
62
64
|
nil, false, "#{@filename}.pdf")
|
63
|
-
#sts_converter(node)&.convert(@filename + ".xml")
|
65
|
+
# sts_converter(node)&.convert(@filename + ".xml")
|
64
66
|
end
|
65
67
|
end
|
66
68
|
end
|
@@ -22,20 +22,19 @@ module Asciidoctor
|
|
22
22
|
def other_footnote_renumber(xmldoc)
|
23
23
|
seen = {}
|
24
24
|
i = 0
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
end
|
31
|
-
xmldoc.xpath(POST_NORMREF_FOOTNOTES).each do |fn|
|
32
|
-
i, seen = other_footnote_renumber1(fn, i, seen)
|
25
|
+
[PRE_NORMREF_FOOTNOTES, NORMREF_FOOTNOTES,
|
26
|
+
POST_NORMREF_FOOTNOTES].each do |xpath|
|
27
|
+
xmldoc.xpath(xpath).each do |fn|
|
28
|
+
i, seen = other_footnote_renumber1(fn, i, seen)
|
29
|
+
end
|
33
30
|
end
|
34
31
|
end
|
35
32
|
|
36
33
|
def id_prefix(prefix, id)
|
37
|
-
|
38
|
-
|
34
|
+
# we're just inheriting the prefixes from parent doc
|
35
|
+
return id.text if @amd
|
36
|
+
|
37
|
+
prefix.join("/") + (id.text.match?(%{^/}) ? "" : " ") + id.text
|
39
38
|
end
|
40
39
|
|
41
40
|
def get_id_prefix(xmldoc)
|
@@ -79,6 +78,7 @@ module Asciidoctor
|
|
79
78
|
return 2 if bib.at("#{PUBLISHER}[name = 'International "\
|
80
79
|
"Electrotechnical Commission']")
|
81
80
|
return 3 if bib.at("./docidentifier[@type][not(#{OTHERIDS})]")
|
81
|
+
|
82
82
|
4
|
83
83
|
end
|
84
84
|
|
@@ -101,25 +101,26 @@ module Asciidoctor
|
|
101
101
|
num = bib&.at("./docnumber")&.text
|
102
102
|
id = bib&.at("./docidentifier[not(#{OTHERIDS})]")
|
103
103
|
metaid = bib&.at("./docidentifier[@type = 'metanorma']")&.text
|
104
|
-
abbrid = metaid unless /^\[\d+\]$/.match(metaid)
|
104
|
+
abbrid = metaid unless /^\[\d+\]$/.match?(metaid)
|
105
105
|
/\d-(?<partid>\d+)/ =~ id&.text
|
106
|
-
type = id[
|
106
|
+
type = id["type"] if id
|
107
107
|
title = bib&.at("./title[@type = 'main']")&.text ||
|
108
108
|
bib&.at("./title")&.text || bib&.at("./formattedref")&.text
|
109
109
|
"#{pubclass} :: #{type} :: "\
|
110
|
-
"#{num.nil? ? abbrid : sprintf(
|
110
|
+
"#{num.nil? ? abbrid : sprintf('%09d', num.to_i)} :: "\
|
111
111
|
"#{partid} :: #{id&.text} :: #{title}"
|
112
112
|
end
|
113
113
|
|
114
|
-
def sections_cleanup(
|
114
|
+
def sections_cleanup(xml)
|
115
115
|
super
|
116
116
|
return unless @amd
|
117
|
-
|
118
|
-
|
117
|
+
|
118
|
+
xml.xpath("//*[@inline-header]").each do |h|
|
119
|
+
h.delete("inline-header")
|
119
120
|
end
|
120
121
|
end
|
121
122
|
|
122
|
-
def boilerplate_file(
|
123
|
+
def boilerplate_file(_xmldoc)
|
123
124
|
file = @lang == "fr" ? "boilerplate-fr.xml" : "boilerplate.xml"
|
124
125
|
File.join(@libdir, file)
|
125
126
|
end
|
@@ -146,14 +147,17 @@ module Asciidoctor
|
|
146
147
|
end
|
147
148
|
|
148
149
|
def unpublished_note(xmldoc)
|
149
|
-
xmldoc.xpath("//bibitem[not(note[@type = 'Unpublished-Status'])]")
|
150
|
+
xmldoc.xpath("//bibitem[not(note[@type = 'Unpublished-Status'])]")
|
151
|
+
.each do |b|
|
150
152
|
next if pub_class(b) > 2
|
151
|
-
next unless s = b.at("./status/stage")
|
153
|
+
next unless (s = b.at("./status/stage")) && (s.text.to_i < 60)
|
154
|
+
|
152
155
|
id = b.at("docidentifier").text
|
153
|
-
b.at("./language | ./script | ./abstract | ./status")
|
154
|
-
|
155
|
-
|
156
|
-
|
156
|
+
b.at("./language | ./script | ./abstract | ./status")
|
157
|
+
.previous = <<~NOTE
|
158
|
+
<note type="Unpublished-Status">
|
159
|
+
<p>#{@i18n.under_preparation.sub(/%/, id)}</p></note>
|
160
|
+
NOTE
|
157
161
|
end
|
158
162
|
end
|
159
163
|
end
|
@@ -33,7 +33,9 @@ module Asciidoctor
|
|
33
33
|
csv_split(publishers).each do |p|
|
34
34
|
xml.contributor do |c|
|
35
35
|
c.role **{ type: "author" }
|
36
|
-
c.organization
|
36
|
+
c.organization do |a|
|
37
|
+
organization(a, p, false, node, !node.attr("publisher"))
|
38
|
+
end
|
37
39
|
end
|
38
40
|
end
|
39
41
|
end
|
@@ -43,20 +45,25 @@ module Asciidoctor
|
|
43
45
|
csv_split(publishers).each do |p|
|
44
46
|
xml.contributor do |c|
|
45
47
|
c.role **{ type: "publisher" }
|
46
|
-
c.organization
|
48
|
+
c.organization do |a|
|
49
|
+
organization(a, p, true, node, !node.attr("publisher"))
|
50
|
+
end
|
47
51
|
end
|
48
52
|
end
|
49
53
|
end
|
50
54
|
|
51
55
|
def metadata_copyright(node, xml)
|
52
|
-
publishers = node.attr("copyright-holder") || node.attr("publisher") ||
|
56
|
+
publishers = node.attr("copyright-holder") || node.attr("publisher") ||
|
57
|
+
"ISO"
|
53
58
|
csv_split(publishers).each do |p|
|
54
59
|
xml.copyright do |c|
|
55
60
|
c.from (node.attr("copyright-year") || Date.today.year)
|
56
61
|
c.owner do |owner|
|
57
62
|
owner.organization do |o|
|
58
|
-
organization(
|
59
|
-
|
63
|
+
organization(
|
64
|
+
o, p, true, node,
|
65
|
+
!(node.attr("copyright-holder") || node.attr("publisher"))
|
66
|
+
)
|
60
67
|
end
|
61
68
|
end
|
62
69
|
end
|
@@ -82,34 +89,37 @@ module Asciidoctor
|
|
82
89
|
end
|
83
90
|
end
|
84
91
|
|
85
|
-
def title_intro(node,
|
92
|
+
def title_intro(node, xml, lang, at)
|
86
93
|
return unless node.attr("title-intro-#{lang}")
|
87
|
-
|
94
|
+
|
95
|
+
xml.title(**attr_code(at.merge(type: "title-intro"))) do |t1|
|
88
96
|
t1 << Metanorma::Utils::asciidoc_sub(node.attr("title-intro-#{lang}"))
|
89
97
|
end
|
90
98
|
end
|
91
99
|
|
92
|
-
def title_main(node,
|
93
|
-
|
100
|
+
def title_main(node, xml, lang, at)
|
101
|
+
xml.title **attr_code(at.merge(type: "title-main")) do |t1|
|
94
102
|
t1 << Metanorma::Utils::asciidoc_sub(node.attr("title-main-#{lang}"))
|
95
103
|
end
|
96
104
|
end
|
97
105
|
|
98
|
-
def title_part(node,
|
106
|
+
def title_part(node, xml, lang, at)
|
99
107
|
return unless node.attr("title-part-#{lang}")
|
100
|
-
|
108
|
+
|
109
|
+
xml.title(**attr_code(at.merge(type: "title-part"))) do |t1|
|
101
110
|
t1 << Metanorma::Utils::asciidoc_sub(node.attr("title-part-#{lang}"))
|
102
111
|
end
|
103
112
|
end
|
104
113
|
|
105
|
-
def title_amd(node,
|
114
|
+
def title_amd(node, xml, lang, at)
|
106
115
|
return unless node.attr("title-amendment-#{lang}")
|
107
|
-
|
116
|
+
|
117
|
+
xml.title(**attr_code(at.merge(type: "title-amd"))) do |t1|
|
108
118
|
t1 << Metanorma::Utils::asciidoc_sub(node.attr("title-amendment-#{lang}"))
|
109
119
|
end
|
110
120
|
end
|
111
121
|
|
112
|
-
def title_full(node,
|
122
|
+
def title_full(node, xml, lang, at)
|
113
123
|
title = node.attr("title-main-#{lang}")
|
114
124
|
intro = node.attr("title-intro-#{lang}")
|
115
125
|
part = node.attr("title-part-#{lang}")
|
@@ -117,7 +127,7 @@ module Asciidoctor
|
|
117
127
|
title = "#{intro} -- #{title}" if intro
|
118
128
|
title = "#{title} -- #{part}" if part
|
119
129
|
title = "#{title} -- #{amd}" if amd && @amd
|
120
|
-
|
130
|
+
xml.title **attr_code(at.merge(type: "main")) do |t1|
|
121
131
|
t1 << Metanorma::Utils::asciidoc_sub(title)
|
122
132
|
end
|
123
133
|
end
|
@@ -1,8 +1,9 @@
|
|
1
1
|
require "metanorma-standoc"
|
2
|
-
require_relative "./validate_style
|
3
|
-
require_relative "./validate_requirements
|
4
|
-
require_relative "./validate_section
|
5
|
-
require_relative "./validate_title
|
2
|
+
require_relative "./validate_style"
|
3
|
+
require_relative "./validate_requirements"
|
4
|
+
require_relative "./validate_section"
|
5
|
+
require_relative "./validate_title"
|
6
|
+
require_relative "./validate_image"
|
6
7
|
require "nokogiri"
|
7
8
|
require "jing"
|
8
9
|
require "iev"
|
@@ -10,17 +11,6 @@ require "iev"
|
|
10
11
|
module Asciidoctor
|
11
12
|
module ISO
|
12
13
|
class Converter < Standoc::Converter
|
13
|
-
# ISO/IEC DIR 2, 22.3.2
|
14
|
-
def onlychild_clause_validate(root)
|
15
|
-
root.xpath(Standoc::Utils::SUBCLAUSE_XPATH).each do |c|
|
16
|
-
next unless c.xpath("../clause").size == 1
|
17
|
-
title = c.at("./title")
|
18
|
-
location = c["id"] || c.text[0..60] + "..."
|
19
|
-
location += ":#{title.text}" if c["id"] && !title.nil?
|
20
|
-
@log.add("Style", nil, "#{location}: subclause is only child")
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
14
|
def isosubgroup_validate(root)
|
25
15
|
root.xpath("//technical-committee/@type").each do |t|
|
26
16
|
unless %w{TC PC JTC JPC}.include? t.text
|
@@ -37,12 +27,13 @@ module Asciidoctor
|
|
37
27
|
end
|
38
28
|
|
39
29
|
# ISO/IEC DIR 2, 15.5.3
|
30
|
+
# does not deal with preceding text marked up
|
40
31
|
def see_xrefs_validate(root)
|
41
32
|
root.xpath("//xref").each do |t|
|
42
|
-
# does not deal with preceding text marked up
|
43
33
|
preceding = t.at("./preceding-sibling::text()[last()]")
|
44
34
|
next unless !preceding.nil? &&
|
45
35
|
/\b(see| refer to)\s*$/mi.match(preceding)
|
36
|
+
|
46
37
|
(target = root.at("//*[@id = '#{t['target']}']")) || next
|
47
38
|
if target&.at("./ancestor-or-self::*[@obligation = 'normative']")
|
48
39
|
@log.add("Style", t,
|
@@ -54,36 +45,34 @@ module Asciidoctor
|
|
54
45
|
# ISO/IEC DIR 2, 15.5.3
|
55
46
|
def see_erefs_validate(root)
|
56
47
|
root.xpath("//eref").each do |t|
|
57
|
-
|
58
|
-
next unless !
|
59
|
-
|
48
|
+
prec = t.at("./preceding-sibling::text()[last()]")
|
49
|
+
next unless !prec.nil? && /\b(see|refer to)\s*$/mi.match(prec)
|
50
|
+
|
60
51
|
unless target = root.at("//*[@id = '#{t['bibitemid']}']")
|
61
52
|
@log.add("Bibliography", t,
|
62
53
|
"'#{t} is not pointing to a real reference")
|
63
54
|
next
|
64
55
|
end
|
65
|
-
|
56
|
+
target.at("./ancestor::references[@normative = 'true']") and
|
66
57
|
@log.add("Style", t,
|
67
58
|
"'see #{t}' is pointing to a normative reference")
|
68
|
-
end
|
69
59
|
end
|
70
60
|
end
|
71
61
|
|
72
62
|
# ISO/IEC DIR 2, 10.4
|
73
63
|
def locality_erefs_validate(root)
|
74
64
|
root.xpath("//eref[descendant::locality]").each do |t|
|
75
|
-
if /^(ISO|IEC)/.match
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
end
|
65
|
+
if /^(ISO|IEC)/.match?(t["citeas"]) &&
|
66
|
+
!(/: ?(\d+{4}|–)$/.match?(t["citeas"]))
|
67
|
+
@log.add("Style", t,
|
68
|
+
"undated reference #{t['citeas']} should not contain "\
|
69
|
+
"specific elements")
|
81
70
|
end
|
82
71
|
end
|
83
72
|
end
|
84
73
|
|
85
|
-
def termdef_warn(text,
|
86
|
-
|
74
|
+
def termdef_warn(text, regex, elem, term, msg)
|
75
|
+
regex.match(text) && @log.add("Style", elem, "#{term}: #{msg}")
|
87
76
|
end
|
88
77
|
|
89
78
|
# ISO/IEC DIR 2, 16.5.6
|
@@ -103,6 +92,7 @@ module Asciidoctor
|
|
103
92
|
def cited_term_style(xmldoc)
|
104
93
|
xmldoc.xpath("//term//xref").each do |x|
|
105
94
|
next unless xmldoc.at("//term[@id = '#{x['target']}']")
|
95
|
+
|
106
96
|
x&.previous&.text == " (" and x&.previous&.previous&.name == "em" or
|
107
97
|
style_warning(x, "term citation not preceded with italicised term",
|
108
98
|
x.parent.text)
|
@@ -111,8 +101,8 @@ module Asciidoctor
|
|
111
101
|
|
112
102
|
def doctype_validate(xmldoc)
|
113
103
|
doctype = xmldoc&.at("//bibdata/ext/doctype")&.text
|
114
|
-
%w(international-standard technical-specification technical-report
|
115
|
-
publicly-available-specification international-workshop-agreement
|
104
|
+
%w(international-standard technical-specification technical-report
|
105
|
+
publicly-available-specification international-workshop-agreement
|
116
106
|
guide amendment technical-corrigendum).include? doctype or
|
117
107
|
@log.add("Document Attributes", nil,
|
118
108
|
"#{doctype} is not a recognised document type")
|
@@ -146,84 +136,6 @@ module Asciidoctor
|
|
146
136
|
"#{iteration} is not a recognised iteration")
|
147
137
|
end
|
148
138
|
|
149
|
-
# DRG directives 3.7; but anticipated by standoc
|
150
|
-
def subfigure_validate(xmldoc)
|
151
|
-
xmldoc.xpath("//figure//figure").each do |f|
|
152
|
-
{ footnote: "fn", note: "note", key: "dl" }.each do |k, v|
|
153
|
-
f.xpath(".//#{v}").each do |n|
|
154
|
-
@log.add("Style", n, "#{k} is not permitted in a subfigure")
|
155
|
-
end
|
156
|
-
end
|
157
|
-
end
|
158
|
-
end
|
159
|
-
|
160
|
-
def image_name_prefix(xmldoc)
|
161
|
-
std = xmldoc&.at("//bibdata/ext/structuredidentifier/project-number") or return
|
162
|
-
num = xmldoc&.at("//bibdata/docnumber")&.text or return
|
163
|
-
ed = xmldoc&.at("//bibdata/edition")&.text || "1"
|
164
|
-
prefix = num
|
165
|
-
part = std["part"] and prefix += "-#{std['part']}"
|
166
|
-
prefix += "_ed#{ed}"
|
167
|
-
amd = std["amendment"] and prefix += "amd#{amd}"
|
168
|
-
prefix
|
169
|
-
end
|
170
|
-
|
171
|
-
def image_name_suffix(xmldoc)
|
172
|
-
case xmldoc&.at("//bibdata/language")&.text
|
173
|
-
when "fr" then "_f"
|
174
|
-
when "de" then "_d"
|
175
|
-
when "ru" then "_r"
|
176
|
-
when "es" then "_s"
|
177
|
-
when "ar" then "_a"
|
178
|
-
when "en" then "_e"
|
179
|
-
else
|
180
|
-
"_e"
|
181
|
-
end
|
182
|
-
end
|
183
|
-
|
184
|
-
def disjunct_error(i, cond1, cond2, msg1, msg2)
|
185
|
-
cond1 && !cond2 and @log.add("Style", i, "image name #{i['src']} #{msg1}")
|
186
|
-
!cond1 && cond2 and @log.add("Style", i, "image name #{i['src']} #{msg2}")
|
187
|
-
end
|
188
|
-
|
189
|
-
def image_name_validate1(i, prefix)
|
190
|
-
m = %r[(SL)?#{prefix}fig(?<tab>Tab)?(?<annex>[A-Z])?(Text)?(?<num>\d+)
|
191
|
-
(?<subfig>[a-z])?(?<key>_key\d+)?(?<lang>_[a-z])?$]x.match(File.basename(i["src"], ".*"))
|
192
|
-
if m.nil?
|
193
|
-
@log.add("Style", i, "image name #{i['src']} does not match DRG requirements")
|
194
|
-
return
|
195
|
-
end
|
196
|
-
warn i['src']
|
197
|
-
disjunct_error(i, i.at("./ancestor::table"), !m[:tab].nil?,
|
198
|
-
"is under a table but is not so labelled", "is labelled as under a table but is not")
|
199
|
-
disjunct_error(i, i.at("./ancestor::annex"), !m[:annex].nil?,
|
200
|
-
"is under an annex but is not so labelled", "is labelled as under an annex but is not")
|
201
|
-
disjunct_error(i, i.xpath("./ancestor::figure").size > 1, !m[:subfig].nil?,
|
202
|
-
"does not have a subfigure letter but is a subfigure",
|
203
|
-
"has a subfigure letter but is not a subfigure")
|
204
|
-
lang = image_name_suffix(i.document.root)
|
205
|
-
(m[:lang] || "_e") == lang or @log.add("Style", i, "image name #{i['src']} expected to have suffix #{lang}")
|
206
|
-
end
|
207
|
-
|
208
|
-
# DRG directives 3.2
|
209
|
-
def image_name_validate(xmldoc)
|
210
|
-
prefix = image_name_prefix(xmldoc) or return
|
211
|
-
xmldoc.xpath("//image").each do |i|
|
212
|
-
next if i["src"].start_with?("data:")
|
213
|
-
if /^ISO_\d+_/.match(File.basename(i["src"]))
|
214
|
-
elsif /^(SL)?#{prefix}fig/.match(File.basename(i["src"]))
|
215
|
-
image_name_validate1(i, prefix)
|
216
|
-
else
|
217
|
-
@log.add("Style", i, "image name #{i['src']} does not match DRG requirements: expect #{prefix}fig")
|
218
|
-
end
|
219
|
-
end
|
220
|
-
end
|
221
|
-
|
222
|
-
def figure_validate(xmldoc)
|
223
|
-
image_name_validate(xmldoc)
|
224
|
-
subfigure_validate(xmldoc)
|
225
|
-
end
|
226
|
-
|
227
139
|
def bibdata_validate(doc)
|
228
140
|
doctype_validate(doc)
|
229
141
|
script_validate(doc)
|
@@ -251,7 +163,7 @@ module Asciidoctor
|
|
251
163
|
xmldoc.xpath("//bibitem[date/on = '–']").each do |b|
|
252
164
|
b.at("./note[@type = 'Unpublished-Status']") or
|
253
165
|
@log.add("Style", b,
|
254
|
-
"Reference #{b&.at(
|
166
|
+
"Reference #{b&.at('./@id')&.text} does not have an "\
|
255
167
|
"associated footnote indicating unpublished status")
|
256
168
|
end
|
257
169
|
end
|