metanorma-iso 3.1.2 → 3.1.4
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/iso.amendment.xsl +867 -323
- data/lib/isodoc/iso/iso.international-standard.xsl +867 -323
- data/lib/isodoc/iso/metadata.rb +20 -32
- data/lib/isodoc/iso/presentation_bibdata.rb +0 -29
- data/lib/isodoc/iso/presentation_section.rb +2 -2
- data/lib/isodoc/iso/word_cleanup.rb +17 -2
- data/lib/metanorma/iso/biblio-standoc.rng +0 -49
- data/lib/metanorma/iso/biblio.rng +11 -1
- data/lib/metanorma/iso/cleanup.rb +20 -35
- data/lib/metanorma/iso/front_contributor.rb +35 -176
- data/lib/metanorma/iso/isodoc.rng +24 -1
- data/lib/metanorma/iso/relaton-iso.rng +0 -50
- data/lib/metanorma/iso/validate.rb +24 -129
- data/lib/metanorma/iso/validate_numeric.rb +128 -0
- data/lib/metanorma/iso/validate_style.rb +0 -72
- data/lib/metanorma/iso/validate_xref.rb +130 -0
- data/lib/metanorma/iso/version.rb +1 -1
- metadata +4 -3
- data/lib/metanorma/iso/validate_image.rb +0 -97
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.1.
|
4
|
+
version: 3.1.4
|
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-09-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: metanorma-standoc
|
@@ -376,12 +376,13 @@ files:
|
|
376
376
|
- lib/metanorma/iso/reqt.rng
|
377
377
|
- lib/metanorma/iso/section.rb
|
378
378
|
- lib/metanorma/iso/validate.rb
|
379
|
-
- lib/metanorma/iso/validate_image.rb
|
380
379
|
- lib/metanorma/iso/validate_list.rb
|
380
|
+
- lib/metanorma/iso/validate_numeric.rb
|
381
381
|
- lib/metanorma/iso/validate_requirements.rb
|
382
382
|
- lib/metanorma/iso/validate_section.rb
|
383
383
|
- lib/metanorma/iso/validate_style.rb
|
384
384
|
- lib/metanorma/iso/validate_title.rb
|
385
|
+
- lib/metanorma/iso/validate_xref.rb
|
385
386
|
- lib/metanorma/iso/version.rb
|
386
387
|
- lib/metanorma/requirements/modspec.rb
|
387
388
|
- lib/metanorma/requirements/requirements.rb
|
@@ -1,97 +0,0 @@
|
|
1
|
-
module Metanorma
|
2
|
-
module Iso
|
3
|
-
class Converter < Standoc::Converter
|
4
|
-
# DRG directives 3.7; but anticipated by standoc
|
5
|
-
def subfigure_validate(xmldoc)
|
6
|
-
elems = { footnote: "fn", note: "note", key: "dl" }
|
7
|
-
xmldoc.xpath("//figure//figure").each do |f|
|
8
|
-
elems.each do |k, v|
|
9
|
-
f.xpath(".//#{v}").each do |n|
|
10
|
-
@log.add("Style", n, "#{k} is not permitted in a subfigure")
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
def image_name_prefix(xmldoc)
|
17
|
-
std = xmldoc.at("//bibdata/ext/structuredidentifier/project-number") or
|
18
|
-
return
|
19
|
-
num = xmldoc.at("//bibdata/docnumber")&.text or return
|
20
|
-
ed = xmldoc.at("//bibdata/edition")&.text || "1"
|
21
|
-
prefix = num
|
22
|
-
std["part"] and prefix += "-#{std['part']}"
|
23
|
-
prefix += "_ed#{ed}"
|
24
|
-
amd = std["amendment"] and prefix += "amd#{amd}"
|
25
|
-
prefix
|
26
|
-
end
|
27
|
-
|
28
|
-
def image_name_suffix(xmldoc)
|
29
|
-
case xmldoc.at("//bibdata/language")&.text
|
30
|
-
when "fr" then "_f"
|
31
|
-
when "de" then "_d"
|
32
|
-
when "ru" then "_r"
|
33
|
-
when "es" then "_s"
|
34
|
-
when "ar" then "_a"
|
35
|
-
# when "en" then "_e"
|
36
|
-
else
|
37
|
-
"_e"
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
def disjunct_error(img, cond1, cond2, msg1, msg2)
|
42
|
-
cond1 && !cond2 and
|
43
|
-
@log.add("Style", img, "image name #{img['src']} #{msg1}")
|
44
|
-
!cond1 && cond2 and
|
45
|
-
@log.add("Style", img, "image name #{img['src']} #{msg2}")
|
46
|
-
end
|
47
|
-
|
48
|
-
def image_name_parse(img, prefix)
|
49
|
-
m = %r[(SL)?#{prefix}fig(?<tab>Tab)?(?<annex>[A-Z])?(Text)?(?<num>\d+)
|
50
|
-
(?<subfig>[a-z])?(?<key>_key\d+)?(?<lang>_[a-z])?$]x
|
51
|
-
.match(File.basename(img["src"], ".*"))
|
52
|
-
m.nil? and
|
53
|
-
@log.add("Style", img,
|
54
|
-
"image name #{img['src']} does not match DRG requirements")
|
55
|
-
m
|
56
|
-
end
|
57
|
-
|
58
|
-
def image_name_validate1(i, prefix)
|
59
|
-
m = image_name_parse(i, prefix) or return
|
60
|
-
warn i["src"]
|
61
|
-
disjunct_error(i, i.at("./ancestor::table"), !m[:tab].nil?,
|
62
|
-
"is under a table but is not so labelled",
|
63
|
-
"is labelled as under a table but is not")
|
64
|
-
disjunct_error(i, i.at("./ancestor::annex"), !m[:annex].nil?,
|
65
|
-
"is under an annex but is not so labelled",
|
66
|
-
"is labelled as under an annex but is not")
|
67
|
-
disjunct_error(i, i.xpath("./ancestor::figure").size > 1, !m[:subfig].nil?,
|
68
|
-
"does not have a subfigure letter but is a subfigure",
|
69
|
-
"has a subfigure letter but is not a subfigure")
|
70
|
-
lang = image_name_suffix(i.document.root)
|
71
|
-
(m[:lang] || "_e") == lang or
|
72
|
-
@log.add("Style", i,
|
73
|
-
"image name #{i['src']} expected to have suffix #{lang}")
|
74
|
-
end
|
75
|
-
|
76
|
-
# DRG directives 3.2
|
77
|
-
def image_name_validate(xmldoc)
|
78
|
-
prefix = image_name_prefix(xmldoc) or return
|
79
|
-
xmldoc.xpath("//image").each do |i|
|
80
|
-
i["src"].start_with?("data:") and next
|
81
|
-
case File.basename(i["src"])
|
82
|
-
when /^ISO_\d+_/
|
83
|
-
when /^(SL)?#{prefix}fig/ then image_name_validate1(i, prefix)
|
84
|
-
else
|
85
|
-
@log.add("Style", i,
|
86
|
-
"image name #{i['src']} does not match DRG requirements: expect #{prefix}fig")
|
87
|
-
end
|
88
|
-
end
|
89
|
-
end
|
90
|
-
|
91
|
-
def figure_validate(xmldoc)
|
92
|
-
image_name_validate(xmldoc)
|
93
|
-
subfigure_validate(xmldoc)
|
94
|
-
end
|
95
|
-
end
|
96
|
-
end
|
97
|
-
end
|