metanorma-iso 1.4.2 → 1.5.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ubuntu.yml +1 -1
- data/lib/asciidoctor/iso/base.rb +8 -19
- data/lib/asciidoctor/iso/cleanup.rb +2 -3
- data/lib/asciidoctor/iso/front.rb +4 -5
- data/lib/asciidoctor/iso/front_id.rb +1 -1
- data/lib/asciidoctor/iso/isodoc.rng +12 -6
- data/lib/asciidoctor/iso/section.rb +5 -11
- data/lib/asciidoctor/iso/term_lookup_cleanup.rb +0 -1
- data/lib/asciidoctor/iso/validate_section.rb +40 -44
- data/lib/isodoc/iso/base_convert.rb +3 -64
- data/lib/isodoc/iso/html/htmlstyle.css +47 -0
- data/lib/isodoc/iso/html/isodoc.css +862 -0
- data/lib/isodoc/iso/html/style-human.css +968 -0
- data/lib/isodoc/iso/html/style-iso.css +996 -0
- data/lib/isodoc/iso/html/wordstyle.css +1515 -0
- data/lib/isodoc/iso/html_convert.rb +2 -1
- data/lib/{asciidoctor → isodoc}/iso/i18n-en.yaml +0 -1
- data/lib/{asciidoctor → isodoc}/iso/i18n-fr.yaml +0 -0
- data/lib/{asciidoctor → isodoc}/iso/i18n-zh-Hans.yaml +0 -0
- data/lib/isodoc/iso/i18n.rb +19 -0
- data/lib/isodoc/iso/init.rb +33 -0
- data/lib/isodoc/iso/iso.amendment.xsl +1226 -1702
- data/lib/isodoc/iso/iso.international-standard.xsl +1226 -1702
- data/lib/isodoc/iso/metadata.rb +1 -1
- data/lib/isodoc/iso/presentation_xml_convert.rb +99 -1
- data/lib/isodoc/iso/sections.rb +3 -8
- data/lib/isodoc/iso/word_convert.rb +2 -1
- data/lib/isodoc/iso/xref.rb +2 -0
- data/lib/metanorma/iso/version.rb +1 -1
- data/metanorma-iso.gemspec +3 -3
- data/spec/asciidoctor-iso/base_spec.rb +3 -11
- data/spec/asciidoctor-iso/cleanup_spec.rb +4 -4
- data/spec/asciidoctor-iso/inline_spec.rb +1 -1
- data/spec/asciidoctor-iso/refs_spec.rb +3 -3
- data/spec/asciidoctor-iso/section_spec.rb +9 -6
- data/spec/asciidoctor-iso/validate_spec.rb +100 -21
- data/spec/isodoc/amd_spec.rb +309 -153
- data/spec/isodoc/blocks_spec.rb +362 -28
- data/spec/isodoc/i18n_spec.rb +468 -108
- data/spec/isodoc/inline_spec.rb +99 -31
- data/spec/isodoc/iso_spec.rb +95 -29
- data/spec/isodoc/postproc_spec.rb +114 -149
- data/spec/isodoc/ref_spec.rb +175 -3
- data/spec/isodoc/section_spec.rb +148 -82
- data/spec/isodoc/table_spec.rb +142 -5
- data/spec/isodoc/terms_spec.rb +78 -53
- data/spec/isodoc/xref_spec.rb +831 -658
- data/spec/metanorma/processor_spec.rb +2 -1
- metadata +20 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7dc868b1792a227210079cc57a26f3d6a149738feb8cc1003a081f2db6a8c035
|
4
|
+
data.tar.gz: 4ce69ed98d486e5618ad68bbac05b6b8589d8ac7b1b76bff90c4bed08b242315
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8a759e049bbc37f0b3027a7ff7ed012e123645c28099e9b4c9af86cc3da964e7b121f69c4ae0d4b0d9d9a804009bb93c368716ad115ff45a761fa0d3cec89245
|
7
|
+
data.tar.gz: cc1c85767b13826f10d1289621379892722166aa38008009577be1c6703b3ad194870db780f050457e73e0f76b301186d64469c935007c56539c23f78651bc17
|
@@ -39,7 +39,7 @@ jobs:
|
|
39
39
|
polling_interval_seconds: 5
|
40
40
|
timeout_minutes: 5
|
41
41
|
max_attempts: 3
|
42
|
-
command: sudo bash -c "curl -L https://github.com/metanorma/plantuml-install/raw/master/ubuntu.sh | bash"
|
42
|
+
command: sudo apt-get update -y && sudo bash -c "curl -L https://github.com/metanorma/plantuml-install/raw/master/ubuntu.sh | bash"
|
43
43
|
- name: Run specs
|
44
44
|
run: |
|
45
45
|
bundle exec rake
|
data/lib/asciidoctor/iso/base.rb
CHANGED
@@ -3,7 +3,6 @@ require "nokogiri"
|
|
3
3
|
require "json"
|
4
4
|
require "pathname"
|
5
5
|
require "open-uri"
|
6
|
-
require "pp"
|
7
6
|
require "isodoc"
|
8
7
|
require "fileutils"
|
9
8
|
require 'asciidoctor/iso/macros'
|
@@ -53,26 +52,16 @@ module Asciidoctor
|
|
53
52
|
def outputs(node, ret)
|
54
53
|
File.open(@filename + ".xml", "w:UTF-8") { |f| f.write(ret) }
|
55
54
|
presentation_xml_converter(node).convert(@filename + ".xml")
|
56
|
-
html_converter_alt(node).convert(@filename + ".presentation.xml",
|
57
|
-
|
58
|
-
|
59
|
-
|
55
|
+
html_converter_alt(node).convert(@filename + ".presentation.xml",
|
56
|
+
nil, false, "#{@filename}_alt.html")
|
57
|
+
html_converter(node).convert(@filename + ".presentation.xml",
|
58
|
+
nil, false, "#{@filename}.html")
|
59
|
+
doc_converter(node).convert(@filename + ".presentation.xml",
|
60
|
+
nil, false, "#{@filename}.doc")
|
61
|
+
pdf_converter(node)&.convert(@filename + ".presentation.xml",
|
62
|
+
nil, false, "#{@filename}.pdf")
|
60
63
|
#sts_converter(node)&.convert(@filename + ".xml")
|
61
64
|
end
|
62
|
-
|
63
|
-
def load_yaml(lang, script)
|
64
|
-
y = if @i18nyaml then YAML.load_file(@i18nyaml)
|
65
|
-
elsif lang == "en"
|
66
|
-
YAML.load_file(File.join(File.dirname(__FILE__), "i18n-en.yaml"))
|
67
|
-
elsif lang == "fr"
|
68
|
-
YAML.load_file(File.join(File.dirname(__FILE__), "i18n-fr.yaml"))
|
69
|
-
elsif lang == "zh" && script == "Hans"
|
70
|
-
YAML.load_file(File.join(File.dirname(__FILE__), "i18n-zh-Hans.yaml"))
|
71
|
-
else
|
72
|
-
YAML.load_file(File.join(File.dirname(__FILE__), "i18n-en.yaml"))
|
73
|
-
end
|
74
|
-
super.merge(y)
|
75
|
-
end
|
76
65
|
end
|
77
66
|
end
|
78
67
|
end
|
@@ -4,20 +4,19 @@ require "htmlentities"
|
|
4
4
|
require "json"
|
5
5
|
require "pathname"
|
6
6
|
require "open-uri"
|
7
|
-
require "pp"
|
8
7
|
require "asciidoctor/iso/term_lookup_cleanup"
|
9
8
|
|
10
9
|
module Asciidoctor
|
11
10
|
module ISO
|
12
11
|
class Converter < Standoc::Converter
|
13
12
|
PRE_NORMREF_FOOTNOTES = "//preface//fn | "\
|
14
|
-
"//clause[
|
13
|
+
"//clause[@type = 'scope']//fn".freeze
|
15
14
|
|
16
15
|
NORMREF_FOOTNOTES =
|
17
16
|
"//references[@normative = 'true']//fn".freeze
|
18
17
|
|
19
18
|
POST_NORMREF_FOOTNOTES =
|
20
|
-
"//sections//clause[not(
|
19
|
+
"//sections//clause[not(@type = 'scope')]//fn | "\
|
21
20
|
"//annex//fn | "\
|
22
21
|
"//references[@normative = 'false']//fn".freeze
|
23
22
|
|
@@ -4,7 +4,6 @@ require "htmlentities"
|
|
4
4
|
require "json"
|
5
5
|
require "pathname"
|
6
6
|
require "open-uri"
|
7
|
-
require "pp"
|
8
7
|
require_relative "front_id"
|
9
8
|
|
10
9
|
module Asciidoctor
|
@@ -35,7 +34,7 @@ module Asciidoctor
|
|
35
34
|
|
36
35
|
def metadata_author(node, xml)
|
37
36
|
publishers = node.attr("publisher") || "ISO"
|
38
|
-
publishers
|
37
|
+
csv_split(publishers).each do |p|
|
39
38
|
xml.contributor do |c|
|
40
39
|
c.role **{ type: "author" }
|
41
40
|
c.organization { |a| organization(a, p) }
|
@@ -45,7 +44,7 @@ module Asciidoctor
|
|
45
44
|
|
46
45
|
def metadata_publisher(node, xml)
|
47
46
|
publishers = node.attr("publisher") || "ISO"
|
48
|
-
publishers
|
47
|
+
csv_split(publishers).each do |p|
|
49
48
|
xml.contributor do |c|
|
50
49
|
c.role **{ type: "publisher" }
|
51
50
|
c.organization { |a| organization(a, p) }
|
@@ -54,8 +53,8 @@ module Asciidoctor
|
|
54
53
|
end
|
55
54
|
|
56
55
|
def metadata_copyright(node, xml)
|
57
|
-
publishers = node.attr("publisher") || "ISO"
|
58
|
-
publishers
|
56
|
+
publishers = node.attr("copyright-holder") || node.attr("publisher") || "ISO"
|
57
|
+
csv_split(publishers).each do |p|
|
59
58
|
xml.copyright do |c|
|
60
59
|
c.from (node.attr("copyright-year") || Date.today.year)
|
61
60
|
c.owner do |owner|
|
@@ -133,7 +133,7 @@ module Asciidoctor
|
|
133
133
|
end
|
134
134
|
|
135
135
|
def id_stage_abbr(stage, substage, node)
|
136
|
-
ret = IsoDoc::Iso::Metadata.new("en", "Latn",
|
136
|
+
ret = IsoDoc::Iso::Metadata.new("en", "Latn", @i18n).
|
137
137
|
status_abbrev(stage_abbr(stage, substage, node.attr("doctype")),
|
138
138
|
substage, node.attr("iteration"),
|
139
139
|
node.attr("draft"), node.attr("doctype"))
|
@@ -922,6 +922,9 @@
|
|
922
922
|
<optional>
|
923
923
|
<attribute name="script"/>
|
924
924
|
</optional>
|
925
|
+
<optional>
|
926
|
+
<attribute name="type"/>
|
927
|
+
</optional>
|
925
928
|
<optional>
|
926
929
|
<attribute name="obligation">
|
927
930
|
<choice>
|
@@ -961,9 +964,6 @@
|
|
961
964
|
</define>
|
962
965
|
<define name="content-subsection">
|
963
966
|
<element name="clause">
|
964
|
-
<optional>
|
965
|
-
<attribute name="type"/>
|
966
|
-
</optional>
|
967
967
|
<ref name="Content-Section"/>
|
968
968
|
</element>
|
969
969
|
</define>
|
@@ -992,6 +992,9 @@
|
|
992
992
|
</choice>
|
993
993
|
</attribute>
|
994
994
|
</optional>
|
995
|
+
<optional>
|
996
|
+
<attribute name="type"/>
|
997
|
+
</optional>
|
995
998
|
<optional>
|
996
999
|
<ref name="section-title"/>
|
997
1000
|
</optional>
|
@@ -1011,9 +1014,6 @@
|
|
1011
1014
|
</define>
|
1012
1015
|
<define name="clause">
|
1013
1016
|
<element name="clause">
|
1014
|
-
<optional>
|
1015
|
-
<attribute name="type"/>
|
1016
|
-
</optional>
|
1017
1017
|
<ref name="Clause-Section"/>
|
1018
1018
|
</element>
|
1019
1019
|
</define>
|
@@ -1042,6 +1042,9 @@
|
|
1042
1042
|
</choice>
|
1043
1043
|
</attribute>
|
1044
1044
|
</optional>
|
1045
|
+
<optional>
|
1046
|
+
<attribute name="type"/>
|
1047
|
+
</optional>
|
1045
1048
|
<optional>
|
1046
1049
|
<ref name="section-title"/>
|
1047
1050
|
</optional>
|
@@ -1180,6 +1183,9 @@
|
|
1180
1183
|
<optional>
|
1181
1184
|
<attribute name="script"/>
|
1182
1185
|
</optional>
|
1186
|
+
<optional>
|
1187
|
+
<attribute name="type"/>
|
1188
|
+
</optional>
|
1183
1189
|
<optional>
|
1184
1190
|
<attribute name="obligation">
|
1185
1191
|
<choice>
|
@@ -5,13 +5,15 @@ module Asciidoctor
|
|
5
5
|
module ISO
|
6
6
|
class Converter < Standoc::Converter
|
7
7
|
def clause_parse(attrs, xml, node)
|
8
|
-
title = node&.attr("heading")&.downcase ||
|
9
|
-
node.title.gsub(/<[^>]+>/, "").downcase
|
10
|
-
title == "scope" and return scope_parse(attrs, xml, node)
|
11
8
|
node.option? "appendix" and return appendix_parse(attrs, xml, node)
|
12
9
|
super
|
13
10
|
end
|
14
11
|
|
12
|
+
def scope_parse(attrs, xml, node)
|
13
|
+
attrs = attrs.merge(type: "scope") unless @amd
|
14
|
+
clause_parse(attrs, xml, node)
|
15
|
+
end
|
16
|
+
|
15
17
|
def appendix_parse(attrs, xml, node)
|
16
18
|
attrs["inline-header".to_sym] = node.option? "inline-header"
|
17
19
|
set_obligation(attrs, node)
|
@@ -28,14 +30,6 @@ module Asciidoctor
|
|
28
30
|
xml << node.content
|
29
31
|
end
|
30
32
|
|
31
|
-
def scope_parse(attrs, xml, node)
|
32
|
-
xml.clause **attr_code(attrs) do |xml_section|
|
33
|
-
xml_section.title { |t| t << "Scope" }
|
34
|
-
content = node.content
|
35
|
-
xml_section << content
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
33
|
def section_attributes(node)
|
40
34
|
super.merge(
|
41
35
|
change: @amd ? node.attr("change") : nil,
|
@@ -75,7 +75,6 @@ module Asciidoctor
|
|
75
75
|
|
76
76
|
def unique_text_id(text)
|
77
77
|
return "term-#{text}" if xmldoc.at("//*[@id = 'term-#{text}']").nil?
|
78
|
-
|
79
78
|
(1..Float::INFINITY).lazy.each do |index|
|
80
79
|
if xmldoc.at("//*[@id = 'term-#{text}-#{index}']").nil?
|
81
80
|
break("term-#{text}-#{index}")
|
@@ -7,6 +7,7 @@ module Asciidoctor
|
|
7
7
|
foreword_validate(doc.root)
|
8
8
|
normref_validate(doc.root)
|
9
9
|
symbols_validate(doc.root)
|
10
|
+
sections_presence_validate(doc.root)
|
10
11
|
sections_sequence_validate(doc.root)
|
11
12
|
section_style(doc.root)
|
12
13
|
subclause_validate(doc.root)
|
@@ -46,46 +47,44 @@ module Asciidoctor
|
|
46
47
|
end
|
47
48
|
|
48
49
|
def seqcheck(names, msg, accepted)
|
49
|
-
n = names.shift
|
50
|
-
|
50
|
+
n = names.shift
|
51
|
+
return [] if n.nil?
|
52
|
+
test = accepted.map { |a| n.at(a) }
|
53
|
+
if test.all? { |a| a.nil? }
|
51
54
|
@log.add("Style", nil, msg)
|
52
|
-
names = []
|
53
55
|
end
|
54
56
|
names
|
55
57
|
end
|
56
58
|
|
59
|
+
def sections_presence_validate(root)
|
60
|
+
root.at("//sections/clause[@type = 'scope']") or
|
61
|
+
@log.add("Style", nil, "Scope clause missing")
|
62
|
+
root.at("//references[@normative = 'true']") or
|
63
|
+
@log.add("Style", nil, "Normative references missing")
|
64
|
+
root.at("//terms") or
|
65
|
+
@log.add("Style", nil, "Terms & definitions missing")
|
66
|
+
end
|
67
|
+
|
57
68
|
# spec of permissible section sequence
|
58
69
|
# we skip normative references, it goes to end of list
|
59
70
|
SEQ =
|
60
71
|
[
|
61
72
|
{
|
62
73
|
msg: "Initial section must be (content) Foreword",
|
63
|
-
val: [
|
74
|
+
val: ["./self::foreword"]
|
64
75
|
},
|
65
76
|
{
|
66
77
|
msg: "Prefatory material must be followed by (clause) Scope",
|
67
|
-
val:
|
68
|
-
{ tag: "clause", title: "Scope" }],
|
78
|
+
val: ["./self::introduction", "./self::clause[@type = 'scope']" ]
|
69
79
|
},
|
70
80
|
{
|
71
81
|
msg: "Prefatory material must be followed by (clause) Scope",
|
72
|
-
val: [
|
82
|
+
val: ["./self::clause[@type = 'scope']" ]
|
73
83
|
},
|
74
84
|
{
|
75
85
|
msg: "Normative References must be followed by "\
|
76
86
|
"Terms and Definitions",
|
77
|
-
val: [
|
78
|
-
{ tag: "terms", title: "Terms and definitions" },
|
79
|
-
{ tag: "clause", title: "Terms and definitions" },
|
80
|
-
{
|
81
|
-
tag: "terms",
|
82
|
-
title: "Terms, definitions, symbols and abbreviated terms",
|
83
|
-
},
|
84
|
-
{
|
85
|
-
tag: "clause",
|
86
|
-
title: "Terms, definitions, symbols and abbreviated terms",
|
87
|
-
},
|
88
|
-
],
|
87
|
+
val: ["./self::terms | .//terms"]
|
89
88
|
},
|
90
89
|
].freeze
|
91
90
|
|
@@ -95,50 +94,47 @@ module Asciidoctor
|
|
95
94
|
"//clause[descendant::references][not(parent::clause)]".freeze
|
96
95
|
|
97
96
|
def sections_sequence_validate(root)
|
98
|
-
|
99
|
-
names =
|
100
|
-
names = seqcheck(names, SEQ[0][:msg], SEQ[0][:val]) || return
|
97
|
+
names = root.xpath(SECTIONS_XPATH)
|
98
|
+
names = seqcheck(names, SEQ[0][:msg], SEQ[0][:val])
|
101
99
|
n = names[0]
|
102
|
-
names = seqcheck(names, SEQ[1][:msg], SEQ[1][:val])
|
103
|
-
if n
|
104
|
-
names = seqcheck(names, SEQ[2][:msg], SEQ[2][:val])
|
100
|
+
names = seqcheck(names, SEQ[1][:msg], SEQ[1][:val])
|
101
|
+
if n&.at("./self::introduction")
|
102
|
+
names = seqcheck(names, SEQ[2][:msg], SEQ[2][:val])
|
105
103
|
end
|
106
|
-
names = seqcheck(names, SEQ[3][:msg], SEQ[3][:val])
|
104
|
+
names = seqcheck(names, SEQ[3][:msg], SEQ[3][:val])
|
107
105
|
n = names.shift
|
108
|
-
if n
|
109
|
-
n = names.shift
|
106
|
+
if n&.at("./self::definitions")
|
107
|
+
n = names.shift
|
110
108
|
end
|
111
|
-
|
109
|
+
if n.nil? || n.name != "clause"
|
112
110
|
@log.add("Style", nil, "Document must contain at least one clause")
|
113
|
-
return
|
114
111
|
end
|
115
|
-
n
|
112
|
+
n&.at("./self::clause") ||
|
116
113
|
@log.add("Style", nil, "Document must contain clause after "\
|
117
114
|
"Terms and Definitions")
|
118
|
-
n
|
115
|
+
n&.at("./self::clause[@type = 'scope']") &&
|
119
116
|
@log.add("Style", nil, "Scope must occur before Terms and Definitions")
|
120
|
-
n = names.shift
|
121
|
-
while n
|
122
|
-
n[
|
117
|
+
n = names.shift
|
118
|
+
while n&.name == "clause"
|
119
|
+
n&.at("./self::clause[@type = 'scope']")
|
123
120
|
@log.add("Style", nil, "Scope must occur before Terms and Definitions")
|
124
|
-
n = names.shift
|
121
|
+
n = names.shift
|
125
122
|
end
|
126
|
-
unless
|
123
|
+
unless %w(annex references).include? n&.name
|
127
124
|
@log.add("Style", nil, "Only annexes and references can follow clauses")
|
128
125
|
end
|
129
|
-
while n
|
126
|
+
while n&.name == "annex"
|
130
127
|
n = names.shift
|
131
128
|
if n.nil?
|
132
129
|
@log.add("Style", nil, "Document must include (references) "\
|
133
130
|
"Normative References")
|
134
|
-
return
|
135
131
|
end
|
136
132
|
end
|
137
|
-
n
|
133
|
+
n&.at("./self::references[@normative = 'true']") ||
|
138
134
|
@log.add("Style", nil, "Document must include (references) "\
|
139
135
|
"Normative References")
|
140
|
-
n = names
|
141
|
-
n
|
136
|
+
n = names&.shift
|
137
|
+
n&.at("./self::references[@normative = 'false']") ||
|
142
138
|
@log.add("Style", nil, "Final section must be (references) Bibliography")
|
143
139
|
names.empty? ||
|
144
140
|
@log.add("Style", nil, "There are sections after the final Bibliography")
|
@@ -157,8 +153,8 @@ module Asciidoctor
|
|
157
153
|
def section_style(root)
|
158
154
|
foreword_style(root.at("//foreword"))
|
159
155
|
introduction_style(root.at("//introduction"))
|
160
|
-
scope_style(root.at("//clause[
|
161
|
-
scope = root.at("//clause[
|
156
|
+
scope_style(root.at("//clause[@type = 'scope']"))
|
157
|
+
scope = root.at("//clause[@type = 'scope']/clause")
|
162
158
|
# ISO/IEC DIR 2, 14.4
|
163
159
|
scope.nil? || style_warning(scope, SCOPE_WARN, nil)
|
164
160
|
end
|
@@ -1,25 +1,10 @@
|
|
1
1
|
require "isodoc"
|
2
|
-
require_relative "metadata"
|
3
2
|
require_relative "sections"
|
4
|
-
require_relative "xref"
|
5
3
|
require "fileutils"
|
6
4
|
|
7
5
|
module IsoDoc
|
8
6
|
module Iso
|
9
7
|
module BaseConvert
|
10
|
-
def metadata_init(lang, script, labels)
|
11
|
-
@meta = Metadata.new(lang, script, labels)
|
12
|
-
end
|
13
|
-
|
14
|
-
def xref_init(lang, script, klass, labels, options)
|
15
|
-
@xrefs = Xref.new(lang, script, klass, labels, options)
|
16
|
-
end
|
17
|
-
|
18
|
-
def amd(docxml)
|
19
|
-
doctype = docxml&.at(ns("//bibdata/ext/doctype"))&.text
|
20
|
-
%w(amendment technical-corrigendum).include? doctype
|
21
|
-
end
|
22
|
-
|
23
8
|
def convert1(docxml, filename, dir)
|
24
9
|
if amd(docxml)
|
25
10
|
@oldsuppressheadingnumbers = @suppressheadingnumbers
|
@@ -41,46 +26,10 @@ module IsoDoc
|
|
41
26
|
end
|
42
27
|
end
|
43
28
|
|
44
|
-
def eref_localities1_zh(target, type, from, to, delim)
|
45
|
-
subsection = from&.text&.match(/\./)
|
46
|
-
ret = (delim == ";") ? ";" : (type == "list") ? "" : delim
|
47
|
-
ret += " 第#{from.text}" if from
|
48
|
-
ret += "–#{to}" if to
|
49
|
-
loc = (@locality[type] || type.sub(/^locality:/, "").capitalize )
|
50
|
-
ret += " #{loc}" unless subsection && type == "clause" ||
|
51
|
-
type == "list" || target.match(/^IEV$|^IEC 60050-/)
|
52
|
-
ret += ")" if type == "list"
|
53
|
-
ret
|
54
|
-
end
|
55
|
-
|
56
|
-
def eref_localities1(target, type, from, to, delim, lang = "en")
|
57
|
-
return "" if type == "anchor"
|
58
|
-
subsection = from&.text&.match(/\./)
|
59
|
-
type = type.downcase
|
60
|
-
return l10n(eref_localities1_zh(target, type, from, to, delim)) if lang == "zh"
|
61
|
-
ret = (delim == ";") ? ";" : (type == "list") ? "" : delim
|
62
|
-
loc = @locality[type] || type.sub(/^locality:/, "").capitalize
|
63
|
-
ret += " #{loc}" unless subsection && type == "clause" ||
|
64
|
-
type == "list" || target.match(/^IEV$|^IEC 60050-/)
|
65
|
-
ret += " #{from.text}" if from
|
66
|
-
ret += "–#{to.text}" if to
|
67
|
-
ret += ")" if type == "list"
|
68
|
-
l10n(ret)
|
69
|
-
end
|
70
|
-
|
71
|
-
def prefix_container(container, linkend, target)
|
72
|
-
delim = @xrefs.anchor(target, :type) == "listitem" ? " " : ", "
|
73
|
-
l10n(@xrefs.anchor(container, :xref) + delim + linkend)
|
74
|
-
end
|
75
|
-
|
76
29
|
def example_span_label(node, div, name)
|
77
|
-
|
30
|
+
return if name.nil?
|
78
31
|
div.span **{ class: "example_label" } do |p|
|
79
|
-
|
80
|
-
l10n("#{@example_lbl} #{n[:label]}")
|
81
|
-
p << lbl
|
82
|
-
name and !lbl.nil? and p << " — "
|
83
|
-
name and name.children.each { |n| parse(n, div) }
|
32
|
+
name.children.each { |n| parse(n, div) }
|
84
33
|
end
|
85
34
|
end
|
86
35
|
|
@@ -142,10 +91,6 @@ module IsoDoc
|
|
142
91
|
super
|
143
92
|
end
|
144
93
|
|
145
|
-
def clausedelim
|
146
|
-
""
|
147
|
-
end
|
148
|
-
|
149
94
|
def cleanup(docxml)
|
150
95
|
super
|
151
96
|
table_th_center(docxml)
|
@@ -165,7 +110,7 @@ module IsoDoc
|
|
165
110
|
dl&.at(ns("./dd"))&.elements&.size == 1 &&
|
166
111
|
dl&.at(ns("./dd/p")))
|
167
112
|
out.span **{ class: "zzMoveToFollowing" } do |s|
|
168
|
-
s << "#{@
|
113
|
+
s << "#{@i18n.where} "
|
169
114
|
dl.at(ns("./dt")).children.each { |n| parse(n, s) }
|
170
115
|
s << " "
|
171
116
|
end
|
@@ -202,13 +147,7 @@ module IsoDoc
|
|
202
147
|
end
|
203
148
|
|
204
149
|
def figure_name_parse(node, div, name)
|
205
|
-
lbl = @xrefs.anchor(node['id'], :label, false)
|
206
|
-
lbl = nil if labelled_ancestor(node) && node.ancestors("figure").empty?
|
207
|
-
return if lbl.nil? && name.nil?
|
208
150
|
div.p **{ class: "FigureTitle", style: "text-align:center;" } do |p|
|
209
|
-
figname = node.parent.name == "figure" ? "" : "#{@figure_lbl} "
|
210
|
-
lbl.nil? or p << l10n("#{figname}#{lbl}")
|
211
|
-
name and !lbl.nil? and p << " — "
|
212
151
|
name and name.children.each { |n| parse(n, div) }
|
213
152
|
end
|
214
153
|
end
|