isodoc 2.10.0 → 3.0.0
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/.rubocop.yml +1 -1
- data/isodoc.gemspec +9 -4
- data/lib/isodoc/base_style/all.css +96 -0
- data/lib/isodoc/base_style/reset.css +96 -0
- data/lib/isodoc/base_style/reset.scss +75 -0
- data/lib/isodoc/base_style/scripts.html +45 -14
- data/lib/isodoc/class_utils.rb +4 -2
- data/lib/isodoc/convert.rb +0 -21
- data/lib/isodoc/css.rb +2 -4
- data/lib/isodoc/function/blocks.rb +37 -52
- data/lib/isodoc/function/blocks_example_note.rb +75 -29
- data/lib/isodoc/function/cleanup.rb +9 -44
- data/lib/isodoc/function/inline.rb +67 -13
- data/lib/isodoc/function/lists.rb +20 -14
- data/lib/isodoc/function/references.rb +9 -126
- data/lib/isodoc/function/reqt.rb +4 -3
- data/lib/isodoc/function/section.rb +30 -35
- data/lib/isodoc/function/section_titles.rb +22 -11
- data/lib/isodoc/function/table.rb +3 -3
- data/lib/isodoc/function/terms.rb +49 -26
- data/lib/isodoc/function/to_word_html.rb +46 -16
- data/lib/isodoc/function/utils.rb +11 -12
- data/lib/isodoc/gem_tasks.rb +1 -1
- data/lib/isodoc/html_function/footnotes.rb +2 -1
- data/lib/isodoc/html_function/html.rb +5 -7
- data/lib/isodoc/html_function/postprocess.rb +25 -6
- data/lib/isodoc/html_function/postprocess_cover.rb +13 -7
- data/lib/isodoc/html_function/postprocess_footnotes.rb +52 -47
- data/lib/isodoc/init.rb +31 -0
- data/lib/isodoc/metadata.rb +20 -13
- data/lib/isodoc/metadata_contributor.rb +5 -10
- data/lib/isodoc/metadata_date.rb +1 -1
- data/lib/isodoc/presentation_function/autonum.rb +153 -0
- data/lib/isodoc/presentation_function/bibdata.rb +4 -5
- data/lib/isodoc/presentation_function/block.rb +107 -40
- data/lib/isodoc/presentation_function/concepts.rb +184 -19
- data/lib/isodoc/presentation_function/docid.rb +78 -0
- data/lib/isodoc/presentation_function/erefs.rb +55 -31
- data/lib/isodoc/presentation_function/image.rb +64 -19
- data/lib/isodoc/presentation_function/index.rb +180 -0
- data/lib/isodoc/presentation_function/inline.rb +47 -16
- data/lib/isodoc/presentation_function/math.rb +128 -71
- data/lib/isodoc/presentation_function/metadata.rb +29 -66
- data/lib/isodoc/presentation_function/refs.rb +75 -28
- data/lib/isodoc/presentation_function/reqt.rb +7 -4
- data/lib/isodoc/presentation_function/section.rb +51 -129
- data/lib/isodoc/presentation_function/sourcecode.rb +52 -19
- data/lib/isodoc/presentation_function/terms.rb +107 -118
- data/lib/isodoc/presentation_function/title.rb +107 -0
- data/lib/isodoc/presentation_function/xrefs.rb +37 -17
- data/lib/isodoc/presentation_xml_convert.rb +24 -10
- data/lib/isodoc/version.rb +1 -1
- data/lib/isodoc/word_function/body.rb +9 -37
- data/lib/isodoc/word_function/comments.rb +0 -1
- data/lib/isodoc/word_function/footnotes.rb +1 -1
- data/lib/isodoc/word_function/lists.rb +13 -9
- data/lib/isodoc/word_function/postprocess.rb +6 -0
- data/lib/isodoc/word_function/postprocess_cover.rb +6 -4
- data/lib/isodoc/word_function/postprocess_table.rb +1 -1
- data/lib/isodoc/word_function/postprocess_toc.rb +10 -6
- data/lib/isodoc/word_function/table.rb +2 -2
- data/lib/isodoc/xref/clause_order.rb +41 -0
- data/lib/isodoc/xref/xref_anchor.rb +31 -16
- data/lib/isodoc/xref/xref_counter.rb +18 -3
- data/lib/isodoc/xref/xref_counter_types.rb +14 -0
- data/lib/isodoc/xref/xref_gen.rb +61 -37
- data/lib/isodoc/xref/xref_gen_seq.rb +148 -81
- data/lib/isodoc/xref/xref_sect_gen.rb +84 -88
- data/lib/isodoc/xref/xref_util.rb +53 -4
- data/lib/isodoc/xref.rb +29 -10
- data/lib/isodoc/xslfo_convert.rb +14 -9
- data/lib/isodoc-yaml/i18n-ar.yaml +17 -13
- data/lib/isodoc-yaml/i18n-de.yaml +17 -13
- data/lib/isodoc-yaml/i18n-en.yaml +18 -17
- data/lib/isodoc-yaml/i18n-es.yaml +17 -13
- data/lib/isodoc-yaml/i18n-fr.yaml +17 -13
- data/lib/isodoc-yaml/i18n-ja.yaml +56 -52
- data/lib/isodoc-yaml/i18n-ru.yaml +17 -16
- data/lib/isodoc-yaml/i18n-zh-Hans.yaml +17 -13
- data/lib/nokogiri/xml/node.rb +14 -0
- data/lib/relaton/render-isodoc/config.yml +1 -1
- metadata +90 -13
|
@@ -1,16 +1,7 @@
|
|
|
1
1
|
module IsoDoc
|
|
2
2
|
module Function
|
|
3
3
|
module References
|
|
4
|
-
|
|
5
|
-
# references anyway; keeping here instead of in IsoDoc::Iso for now
|
|
6
|
-
def docid_l10n(text)
|
|
7
|
-
text.nil? and return text
|
|
8
|
-
@i18n.all_parts and text.gsub!(/All Parts/i, @i18n.all_parts.downcase)
|
|
9
|
-
text.size < 20 and text.gsub!(/ /, " ")
|
|
10
|
-
text
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
def nonstd_bibitem(list, bib, _ordinal, biblio)
|
|
4
|
+
def bibitem_entry(list, bib, _ordinal, biblio)
|
|
14
5
|
list.p **attr_code(iso_bibitem_entry_attrs(bib, biblio)) do |ref|
|
|
15
6
|
tag = bib.at(ns("./biblio-tag"))
|
|
16
7
|
tag&.children&.each { |n| parse(n, ref) }
|
|
@@ -18,132 +9,24 @@ module IsoDoc
|
|
|
18
9
|
end
|
|
19
10
|
end
|
|
20
11
|
|
|
21
|
-
def std_bibitem_entry(list, bib, _ordinal, biblio)
|
|
22
|
-
list.p **attr_code(iso_bibitem_entry_attrs(bib, biblio)) do |ref|
|
|
23
|
-
tag = bib.at(ns("./biblio-tag"))
|
|
24
|
-
tag&.children&.each { |n| parse(n, ref) }
|
|
25
|
-
reference_format(bib, ref)
|
|
26
|
-
end
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
SKIP_DOCID = <<~XPATH.strip.freeze
|
|
30
|
-
@type = 'DOI' or @type = 'doi' or @type = 'ISSN' or @type = 'issn' or @type = 'ISBN' or @type = 'isbn' or starts-with(@type, 'ISSN.') or starts-with(@type, 'ISBN.') or starts-with(@type, 'issn.') or starts-with(@type, 'isbn.')
|
|
31
|
-
XPATH
|
|
32
|
-
|
|
33
|
-
def pref_ref_code(bib)
|
|
34
|
-
bib["suppress_identifier"] == "true" and return nil
|
|
35
|
-
ret = bib.xpath(ns("./docidentifier[@scope = 'biblio-tag']"))
|
|
36
|
-
ret.empty? or return ret.map(&:text)
|
|
37
|
-
ret = pref_ref_code_parse(bib) or return nil
|
|
38
|
-
ins = bib.at(ns("./docidentifier[last()]"))
|
|
39
|
-
ret.reverse.each do |r|
|
|
40
|
-
ins.next = "<docidentifier scope='biblio-tag'>#{docid_l10n(r)}</docidentifier>"
|
|
41
|
-
end
|
|
42
|
-
ret
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
def pref_ref_code_parse(bib)
|
|
46
|
-
data, = @bibrender.parse(bib)
|
|
47
|
-
ret = data[:authoritative_identifier] or return nil
|
|
48
|
-
ret.empty? and return nil
|
|
49
|
-
ret
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
# returns [metanorma, non-metanorma, DOI/ISSN/ISBN] identifiers
|
|
53
|
-
def bibitem_ref_code(bib)
|
|
54
|
-
id = bib.at(ns("./docidentifier[@type = 'metanorma']"))
|
|
55
|
-
id1 = pref_ref_code(bib)
|
|
56
|
-
id2 = bib.at(ns("./docidentifier[#{SKIP_DOCID}]"))
|
|
57
|
-
id3 = bib.at(ns("./docidentifier[@type = 'metanorma-ordinal']"))
|
|
58
|
-
return [id, id1, id2, id3] if id || id1 || id2 || id3
|
|
59
|
-
return [nil, nil, nil, nil] if bib["suppress_identifier"] == "true"
|
|
60
|
-
|
|
61
|
-
id = Nokogiri::XML::Node.new("docidentifier", bib.document)
|
|
62
|
-
id << "(NO ID)"
|
|
63
|
-
[nil, id, nil, nil]
|
|
64
|
-
end
|
|
65
|
-
|
|
66
|
-
def bracket_if_num(num)
|
|
67
|
-
return nil if num.nil?
|
|
68
|
-
|
|
69
|
-
num = num.text.sub(/^\[/, "").sub(/\]$/, "")
|
|
70
|
-
return "[#{num}]" if /^\d+$/.match?(num)
|
|
71
|
-
|
|
72
|
-
num
|
|
73
|
-
end
|
|
74
|
-
|
|
75
|
-
def unbracket1(ident)
|
|
76
|
-
ident.nil? and return nil
|
|
77
|
-
ident.is_a?(String) or ident = ident.text
|
|
78
|
-
ident.sub(/^\[/, "").sub(/\]$/, "")
|
|
79
|
-
end
|
|
80
|
-
|
|
81
|
-
def unbracket(ident)
|
|
82
|
-
if ident.respond_to?(:size)
|
|
83
|
-
ident.map { |x| unbracket1(x) }.join(" / ")
|
|
84
|
-
else
|
|
85
|
-
unbracket1(ident)
|
|
86
|
-
end
|
|
87
|
-
end
|
|
88
|
-
|
|
89
|
-
def render_identifier(ident)
|
|
90
|
-
{ metanorma: bracket_if_num(ident[0]),
|
|
91
|
-
sdo: unbracket(ident[1]),
|
|
92
|
-
doi: unbracket(ident[2]),
|
|
93
|
-
ordinal: bracket_if_num(ident[3]) }
|
|
94
|
-
end
|
|
95
|
-
|
|
96
|
-
def docid_prefix(prefix, docid)
|
|
97
|
-
docid = "#{prefix} #{docid}" if prefix && !omit_docid_prefix(prefix) &&
|
|
98
|
-
!/^#{prefix}\b/.match(docid)
|
|
99
|
-
docid_l10n(docid)
|
|
100
|
-
end
|
|
101
|
-
|
|
102
|
-
def omit_docid_prefix(prefix)
|
|
103
|
-
return true if prefix.nil? || prefix.empty?
|
|
104
|
-
|
|
105
|
-
%w(ISO IEC IEV ITU W3C BIPM csd metanorma repository metanorma-ordinal)
|
|
106
|
-
.include? prefix
|
|
107
|
-
end
|
|
108
|
-
|
|
109
12
|
def iso_bibitem_entry_attrs(bib, biblio)
|
|
110
13
|
{ id: bib["id"], class: biblio ? "Biblio" : "NormRef" }
|
|
111
14
|
end
|
|
112
15
|
|
|
113
|
-
# reference not to be rendered because it is deemed implicit
|
|
114
|
-
# in the standards environment
|
|
115
|
-
def implicit_reference(bib)
|
|
116
|
-
bib["hidden"] == "true"
|
|
117
|
-
end
|
|
118
|
-
|
|
119
16
|
def reference_format(bib, out)
|
|
120
17
|
ftitle = bib.at(ns("./formattedref"))
|
|
121
18
|
ftitle&.children&.each { |n| parse(n, out) }
|
|
122
19
|
end
|
|
123
20
|
|
|
124
|
-
def standard?(bib)
|
|
125
|
-
ret = false
|
|
126
|
-
bib.xpath(ns("./docidentifier")).each do |id|
|
|
127
|
-
next if id["type"].nil? ||
|
|
128
|
-
id.at(".//self::*[#{SKIP_DOCID} or @type = 'metanorma']")
|
|
129
|
-
|
|
130
|
-
ret = true
|
|
131
|
-
end
|
|
132
|
-
ret
|
|
133
|
-
end
|
|
134
|
-
|
|
135
21
|
def biblio_list(refs, div, biblio)
|
|
136
22
|
i = 0
|
|
137
23
|
refs.children.each do |b|
|
|
138
24
|
if b.name == "bibitem"
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
if standard?(b) then std_bibitem_entry(div, b, i, biblio)
|
|
143
|
-
else nonstd_bibitem(div, b, i, biblio)
|
|
144
|
-
end
|
|
25
|
+
b["hidden"] == "true" and next
|
|
26
|
+
i += 1
|
|
27
|
+
bibitem_entry(div, b, i, biblio)
|
|
145
28
|
else
|
|
146
|
-
parse(b, div) unless %w(title).include? b.name
|
|
29
|
+
parse(b, div) unless %w(fmt-title).include? b.name
|
|
147
30
|
end
|
|
148
31
|
end
|
|
149
32
|
end
|
|
@@ -158,9 +41,9 @@ module IsoDoc
|
|
|
158
41
|
def norm_ref(node, out)
|
|
159
42
|
node["hidden"] != "true" or return
|
|
160
43
|
out.div do |div|
|
|
161
|
-
clause_name(node, node.at(ns("./title")), div, nil)
|
|
44
|
+
clause_name(node, node.at(ns("./fmt-title")), div, nil)
|
|
162
45
|
if node.name == "clause"
|
|
163
|
-
node.elements.each { |e| parse(e, div) unless e.name == "title" }
|
|
46
|
+
node.elements.each { |e| parse(e, div) unless e.name == "fmt-title" }
|
|
164
47
|
else biblio_list(node, div, false)
|
|
165
48
|
end
|
|
166
49
|
end
|
|
@@ -177,7 +60,7 @@ module IsoDoc
|
|
|
177
60
|
page_break(out)
|
|
178
61
|
out.div do |div|
|
|
179
62
|
div.h1 class: "Section3" do |h1|
|
|
180
|
-
node.at(ns("./title"))&.children&.each { |c2| parse(c2, h1) }
|
|
63
|
+
node.at(ns("./fmt-title"))&.children&.each { |c2| parse(c2, h1) }
|
|
181
64
|
end
|
|
182
65
|
biblio_list(node, div, true)
|
|
183
66
|
end
|
|
@@ -186,7 +69,7 @@ module IsoDoc
|
|
|
186
69
|
def bibliography_parse(node, out)
|
|
187
70
|
node["hidden"] != true or return
|
|
188
71
|
out.div do |div|
|
|
189
|
-
clause_parse_title(node, div, node.at(ns("./title")), out,
|
|
72
|
+
clause_parse_title(node, div, node.at(ns("./fmt-title")), out,
|
|
190
73
|
{ class: "Section3" })
|
|
191
74
|
biblio_list(node, div, true)
|
|
192
75
|
end
|
data/lib/isodoc/function/reqt.rb
CHANGED
|
@@ -20,9 +20,10 @@ module IsoDoc
|
|
|
20
20
|
end
|
|
21
21
|
|
|
22
22
|
def recommendation_parse1(node, out)
|
|
23
|
-
|
|
24
|
-
node.
|
|
25
|
-
|
|
23
|
+
p = node.at(ns("./fmt-provision")) or return
|
|
24
|
+
recommendation_name(node.at(ns("./fmt-name")), out)
|
|
25
|
+
p.children.each do |n|
|
|
26
|
+
parse(n, out)
|
|
26
27
|
end
|
|
27
28
|
end
|
|
28
29
|
|
|
@@ -10,8 +10,8 @@ module IsoDoc
|
|
|
10
10
|
# used for subclauses
|
|
11
11
|
def clause_parse(node, out)
|
|
12
12
|
out.div **attr_code(clause_attrs(node)) do |div|
|
|
13
|
-
clause_parse_title(node, div, node.at(ns("./title")), out)
|
|
14
|
-
node.children.reject { |c1| c1.name == "title" }.each do |c1|
|
|
13
|
+
clause_parse_title(node, div, node.at(ns("./fmt-title")), out)
|
|
14
|
+
node.children.reject { |c1| c1.name == "fmt-title" }.each do |c1|
|
|
15
15
|
parse(c1, div)
|
|
16
16
|
end
|
|
17
17
|
end
|
|
@@ -19,8 +19,8 @@ module IsoDoc
|
|
|
19
19
|
|
|
20
20
|
def clause(node, out)
|
|
21
21
|
out.div **attr_code(clause_attrs(node)) do |s|
|
|
22
|
-
clause_name(node, node.at(ns("./title")), s, nil)
|
|
23
|
-
node.elements.reject { |c1| c1.name == "title" }.each do |c1|
|
|
22
|
+
clause_name(node, node.at(ns("./fmt-title")), s, nil)
|
|
23
|
+
node.elements.reject { |c1| c1.name == "fmt-title" }.each do |c1|
|
|
24
24
|
parse(c1, s)
|
|
25
25
|
end
|
|
26
26
|
end
|
|
@@ -34,7 +34,7 @@ module IsoDoc
|
|
|
34
34
|
page_break(out)
|
|
35
35
|
out.div **attr_code(annex_attrs(node)) do |s|
|
|
36
36
|
node.elements.each do |c1|
|
|
37
|
-
if c1.name == "title" then annex_name(node, c1, s)
|
|
37
|
+
if c1.name == "fmt-title" then annex_name(node, c1, s)
|
|
38
38
|
else parse(c1, s)
|
|
39
39
|
end
|
|
40
40
|
end
|
|
@@ -47,9 +47,9 @@ module IsoDoc
|
|
|
47
47
|
|
|
48
48
|
def scope(node, out)
|
|
49
49
|
out.div **attr_code(id: node["id"]) do |div|
|
|
50
|
-
clause_name(node, node.at(ns("./title")), div, nil)
|
|
50
|
+
clause_name(node, node.at(ns("./fmt-title")), div, nil)
|
|
51
51
|
node.elements.each do |e|
|
|
52
|
-
parse(e, div) unless e.name == "title"
|
|
52
|
+
parse(e, div) unless e.name == "fmt-title"
|
|
53
53
|
end
|
|
54
54
|
end
|
|
55
55
|
end
|
|
@@ -59,9 +59,9 @@ module IsoDoc
|
|
|
59
59
|
|
|
60
60
|
def terms_defs(node, out)
|
|
61
61
|
out.div **attr_code(id: node["id"]) do |div|
|
|
62
|
-
clause_name(node, node.at(ns("./title")), div, nil)
|
|
62
|
+
clause_name(node, node.at(ns("./fmt-title")), div, nil)
|
|
63
63
|
node.elements.each do |e|
|
|
64
|
-
parse(e, div) unless %w{title source}.include? e.name
|
|
64
|
+
parse(e, div) unless %w{fmt-title source}.include? e.name
|
|
65
65
|
end
|
|
66
66
|
end
|
|
67
67
|
end
|
|
@@ -73,27 +73,25 @@ module IsoDoc
|
|
|
73
73
|
|
|
74
74
|
def symbols_abbrevs(node, out)
|
|
75
75
|
out.div **attr_code(id: node["id"], class: "Symbols") do |div|
|
|
76
|
-
clause_name(node, node.at(ns("./title")), div, nil)
|
|
76
|
+
clause_name(node, node.at(ns("./fmt-title")), div, nil)
|
|
77
77
|
node.elements.each do |e|
|
|
78
|
-
parse(e, div) unless e.name == "title"
|
|
78
|
+
parse(e, div) unless e.name == "fmt-title"
|
|
79
79
|
end
|
|
80
80
|
end
|
|
81
81
|
end
|
|
82
82
|
|
|
83
83
|
# subclause
|
|
84
84
|
def symbols_parse(isoxml, out)
|
|
85
|
-
isoxml.at(ns("./title")) or
|
|
86
|
-
isoxml.children.first.previous = "<title>#{@i18n.symbols}</title>"
|
|
87
85
|
clause_parse(isoxml, out)
|
|
88
86
|
end
|
|
89
87
|
|
|
90
88
|
def introduction(clause, out)
|
|
91
89
|
page_break(out)
|
|
92
90
|
out.div class: "Section3", id: clause["id"] do |div|
|
|
93
|
-
clause_name(clause, clause.at(ns("./title")), div,
|
|
91
|
+
clause_name(clause, clause.at(ns("./fmt-title")), div,
|
|
94
92
|
{ class: "IntroTitle" })
|
|
95
93
|
clause.elements.each do |e|
|
|
96
|
-
parse(e, div) unless e.name == "title"
|
|
94
|
+
parse(e, div) unless e.name == "fmt-title"
|
|
97
95
|
end
|
|
98
96
|
end
|
|
99
97
|
end
|
|
@@ -101,9 +99,9 @@ module IsoDoc
|
|
|
101
99
|
def foreword(clause, out)
|
|
102
100
|
page_break(out)
|
|
103
101
|
out.div **attr_code(id: clause["id"]) do |s|
|
|
104
|
-
clause_name(clause, clause.at(ns("./title"))
|
|
102
|
+
clause_name(clause, clause.at(ns("./fmt-title")), s,
|
|
105
103
|
{ class: "ForewordTitle" })
|
|
106
|
-
clause.elements.each { |e| parse(e, s) unless e.name == "title" }
|
|
104
|
+
clause.elements.each { |e| parse(e, s) unless e.name == "fmt-title" }
|
|
107
105
|
end
|
|
108
106
|
end
|
|
109
107
|
|
|
@@ -111,9 +109,9 @@ module IsoDoc
|
|
|
111
109
|
title_attr = { class: "IntroTitle" }
|
|
112
110
|
page_break(out)
|
|
113
111
|
out.div class: "Section3", id: clause["id"] do |div|
|
|
114
|
-
clause_name(clause, clause.at(ns("./title")), div, title_attr)
|
|
112
|
+
clause_name(clause, clause.at(ns("./fmt-title")), div, title_attr)
|
|
115
113
|
clause.elements.each do |e|
|
|
116
|
-
parse(e, div) unless e.name == "title"
|
|
114
|
+
parse(e, div) unless e.name == "fmt-title"
|
|
117
115
|
end
|
|
118
116
|
end
|
|
119
117
|
end
|
|
@@ -121,9 +119,9 @@ module IsoDoc
|
|
|
121
119
|
def abstract(clause, out)
|
|
122
120
|
page_break(out)
|
|
123
121
|
out.div **attr_code(id: clause["id"]) do |s|
|
|
124
|
-
clause_name(clause, clause.at(ns("./title")), s,
|
|
122
|
+
clause_name(clause, clause.at(ns("./fmt-title")), s,
|
|
125
123
|
{ class: "AbstractTitle" })
|
|
126
|
-
clause.elements.each { |e| parse(e, s) unless e.name == "title" }
|
|
124
|
+
clause.elements.each { |e| parse(e, s) unless e.name == "fmt-title" }
|
|
127
125
|
end
|
|
128
126
|
end
|
|
129
127
|
|
|
@@ -143,21 +141,22 @@ module IsoDoc
|
|
|
143
141
|
def preface_normal(clause, out)
|
|
144
142
|
page_break(out)
|
|
145
143
|
out.div **attr_code(preface_attrs(clause)) do |div|
|
|
146
|
-
clause_name(clause, clause.at(ns("./title")), div,
|
|
144
|
+
clause_name(clause, clause.at(ns("./fmt-title")), div,
|
|
147
145
|
{ class: "IntroTitle" })
|
|
148
146
|
clause.elements.each do |e|
|
|
149
|
-
parse(e, div) unless e.name == "title"
|
|
147
|
+
parse(e, div) unless e.name == "fmt-title"
|
|
150
148
|
end
|
|
151
149
|
end
|
|
152
150
|
end
|
|
153
151
|
|
|
154
152
|
def table_of_contents(clause, out)
|
|
153
|
+
@bare and return
|
|
155
154
|
page_break(out)
|
|
156
155
|
out.div **attr_code(preface_attrs(clause)) do |div|
|
|
157
|
-
clause_name(clause, clause.at(ns("./title")), div,
|
|
156
|
+
clause_name(clause, clause.at(ns("./fmt-title")), div,
|
|
158
157
|
{ class: "IntroTitle" })
|
|
159
158
|
clause.elements.each do |e|
|
|
160
|
-
parse(e, div) unless e.name == "title"
|
|
159
|
+
parse(e, div) unless e.name == "fmt-title"
|
|
161
160
|
end
|
|
162
161
|
end
|
|
163
162
|
end
|
|
@@ -166,10 +165,10 @@ module IsoDoc
|
|
|
166
165
|
@seen_colophon or page_break(out)
|
|
167
166
|
@seen_colophon = true
|
|
168
167
|
out.div class: "Section3", id: node["id"] do |div|
|
|
169
|
-
clause_name(node, node.at(ns("./title")), div,
|
|
168
|
+
clause_name(node, node.at(ns("./fmt-title")), div,
|
|
170
169
|
{ class: "IntroTitle" })
|
|
171
170
|
node.elements.each do |e|
|
|
172
|
-
parse(e, div) unless e.name == "title"
|
|
171
|
+
parse(e, div) unless e.name == "fmt-title"
|
|
173
172
|
end
|
|
174
173
|
end
|
|
175
174
|
end
|
|
@@ -194,32 +193,28 @@ module IsoDoc
|
|
|
194
193
|
end
|
|
195
194
|
|
|
196
195
|
def copyright_parse(node, out)
|
|
197
|
-
|
|
198
|
-
|
|
196
|
+
@bare and return
|
|
199
197
|
out.div class: "boilerplate-copyright" do |div|
|
|
200
198
|
node.children.each { |n| parse(n, div) }
|
|
201
199
|
end
|
|
202
200
|
end
|
|
203
201
|
|
|
204
202
|
def license_parse(node, out)
|
|
205
|
-
|
|
206
|
-
|
|
203
|
+
@bare and return
|
|
207
204
|
out.div class: "boilerplate-license" do |div|
|
|
208
205
|
node.children.each { |n| parse(n, div) }
|
|
209
206
|
end
|
|
210
207
|
end
|
|
211
208
|
|
|
212
209
|
def legal_parse(node, out)
|
|
213
|
-
|
|
214
|
-
|
|
210
|
+
@bare and return
|
|
215
211
|
out.div class: "boilerplate-legal" do |div|
|
|
216
212
|
node.children.each { |n| parse(n, div) }
|
|
217
213
|
end
|
|
218
214
|
end
|
|
219
215
|
|
|
220
216
|
def feedback_parse(node, out)
|
|
221
|
-
|
|
222
|
-
|
|
217
|
+
@bare and return
|
|
223
218
|
out.div class: "boilerplate-feedback" do |div|
|
|
224
219
|
node.children.each { |n| parse(n, div) }
|
|
225
220
|
end
|
|
@@ -10,7 +10,7 @@ module IsoDoc
|
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
def inline_header_title(out, node, title)
|
|
13
|
-
out.span class: "zzMoveToFollowing" do |s|
|
|
13
|
+
out.span class: "zzMoveToFollowing inline-header" do |s|
|
|
14
14
|
s.b do |b|
|
|
15
15
|
title&.children&.each { |c2| parse(c2, b) }
|
|
16
16
|
clausedelimspace(node, out) if /\S/.match?(title&.text)
|
|
@@ -18,10 +18,24 @@ module IsoDoc
|
|
|
18
18
|
end
|
|
19
19
|
end
|
|
20
20
|
|
|
21
|
+
def sections_names
|
|
22
|
+
%w[clause annex terms references definitions
|
|
23
|
+
acknowledgements introduction abstract foreword appendix]
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def freestanding_title(node, out)
|
|
27
|
+
# node.parent.at(ns("./fmt-title[@source = '#{node['id']}']")) and
|
|
28
|
+
# return # this title is already being rendered as fmt-title
|
|
29
|
+
# For testing convenience, let's just go by parent
|
|
30
|
+
sections_names.include?(node.parent.name) and return
|
|
31
|
+
parents = node.ancestors(sections_names.join(", "))
|
|
32
|
+
clause_parse_title(parents.empty? ? node : parents.first,
|
|
33
|
+
out, node, out)
|
|
34
|
+
end
|
|
35
|
+
|
|
21
36
|
# used for subclauses
|
|
22
37
|
def clause_parse_title(node, div, title, out, header_class = {})
|
|
23
|
-
|
|
24
|
-
|
|
38
|
+
title.nil? and return
|
|
25
39
|
if node["inline-header"] == "true"
|
|
26
40
|
inline_header_title(out, node, title)
|
|
27
41
|
else
|
|
@@ -38,9 +52,7 @@ module IsoDoc
|
|
|
38
52
|
end
|
|
39
53
|
|
|
40
54
|
def clause_title_depth(node, title)
|
|
41
|
-
depth = node.ancestors("
|
|
42
|
-
"definitions, acknowledgements, introduction, " \
|
|
43
|
-
"foreword").size + 1
|
|
55
|
+
depth = node.ancestors(sections_names.join(", ")).size + 1
|
|
44
56
|
depth = title["depth"] if title && title["depth"]
|
|
45
57
|
depth
|
|
46
58
|
end
|
|
@@ -55,12 +67,12 @@ module IsoDoc
|
|
|
55
67
|
end
|
|
56
68
|
|
|
57
69
|
# top level clause names
|
|
58
|
-
def clause_name(
|
|
70
|
+
def clause_name(_node, title, div, header_class)
|
|
59
71
|
header_class = {} if header_class.nil?
|
|
60
72
|
div.h1 **attr_code(header_class) do |h1|
|
|
61
73
|
if title.is_a?(String) then h1 << title
|
|
62
|
-
|
|
63
|
-
title
|
|
74
|
+
elsif title
|
|
75
|
+
children_parse(title, h1)
|
|
64
76
|
clause_parse_subtitle(title, h1)
|
|
65
77
|
end
|
|
66
78
|
end
|
|
@@ -68,8 +80,7 @@ module IsoDoc
|
|
|
68
80
|
end
|
|
69
81
|
|
|
70
82
|
def annex_name(_annex, name, div)
|
|
71
|
-
|
|
72
|
-
|
|
83
|
+
name.nil? and return
|
|
73
84
|
div.h1 class: "Annex" do |t|
|
|
74
85
|
name.children.each { |c2| parse(c2, t) }
|
|
75
86
|
clause_parse_subtitle(name, t)
|
|
@@ -2,7 +2,7 @@ module IsoDoc
|
|
|
2
2
|
module Function
|
|
3
3
|
module Table
|
|
4
4
|
def table_title_parse(node, out)
|
|
5
|
-
name = node.at(ns("./name")) or return
|
|
5
|
+
name = node.at(ns("./fmt-name")) or return
|
|
6
6
|
out.p class: "TableTitle", style: "text-align:center;" do |p|
|
|
7
7
|
name&.children&.each { |n| parse(n, p) }
|
|
8
8
|
end
|
|
@@ -112,12 +112,12 @@ module IsoDoc
|
|
|
112
112
|
!header && cell.name == "th" and
|
|
113
113
|
scope = (cell["rowspan"] ? "rowgroup" : "row")
|
|
114
114
|
{ rowspan: cell["rowspan"], colspan: cell["colspan"],
|
|
115
|
-
style: style.
|
|
115
|
+
style: style.delete("\n"), scope: scope, class: cell["class"] }
|
|
116
116
|
end
|
|
117
117
|
|
|
118
118
|
def make_tr_attr_style(row, rowmax, totalrows, _header, bordered)
|
|
119
119
|
bordered or return ""
|
|
120
|
-
<<~STYLE.
|
|
120
|
+
<<~STYLE.delete("\n")
|
|
121
121
|
border-top:#{row.zero? ? "#{SW} 1.5pt;" : 'none;'}
|
|
122
122
|
border-bottom:#{SW} #{rowmax >= totalrows ? '1.5' : '1.0'}pt;
|
|
123
123
|
STYLE
|
|
@@ -10,62 +10,85 @@ module IsoDoc
|
|
|
10
10
|
para.children.each { |n| parse(n, out) }
|
|
11
11
|
end
|
|
12
12
|
|
|
13
|
+
def semx_deprecated_term_parse(node, out); end
|
|
14
|
+
|
|
13
15
|
def deprecated_term_parse(node, out)
|
|
14
|
-
|
|
15
|
-
|
|
16
|
+
node.children.each do |c|
|
|
17
|
+
if c.name == "p"
|
|
18
|
+
out.p class: "DeprecatedTerms", style: "text-align:left;" do |p|
|
|
19
|
+
c.children.each { |c1| parse(c1, p) }
|
|
20
|
+
end
|
|
21
|
+
else parse(c, out)
|
|
22
|
+
end
|
|
16
23
|
end
|
|
17
24
|
end
|
|
18
25
|
|
|
26
|
+
def semx_admitted_term_parse(node, out); end
|
|
27
|
+
|
|
19
28
|
def admitted_term_parse(node, out)
|
|
20
|
-
|
|
21
|
-
|
|
29
|
+
node.children.each do |c|
|
|
30
|
+
if c.name == "p"
|
|
31
|
+
out.p class: "AltTerms", style: "text-align:left;" do |p|
|
|
32
|
+
c.children.each { |c1| parse(c1, p) }
|
|
33
|
+
end
|
|
34
|
+
else parse(c, out)
|
|
35
|
+
end
|
|
22
36
|
end
|
|
23
37
|
end
|
|
24
38
|
|
|
25
|
-
def
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
end
|
|
29
|
-
end
|
|
39
|
+
def semx_term_parse(node, out); end
|
|
40
|
+
|
|
41
|
+
def semx_related_parse(node, out); end
|
|
30
42
|
|
|
31
|
-
def
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
43
|
+
def term_parse(node, out)
|
|
44
|
+
node.children.each do |c|
|
|
45
|
+
if c.name == "p"
|
|
46
|
+
out.p class: "Terms", style: "text-align:left;" do |p|
|
|
47
|
+
c.children.each { |c1| parse(c1, p) }
|
|
48
|
+
end
|
|
49
|
+
else parse(c, out)
|
|
50
|
+
end
|
|
37
51
|
end
|
|
38
52
|
end
|
|
39
53
|
|
|
40
|
-
def
|
|
41
|
-
|
|
54
|
+
def termnote_p_class
|
|
55
|
+
nil
|
|
42
56
|
end
|
|
43
57
|
|
|
44
58
|
def termnote_parse(node, out)
|
|
45
|
-
|
|
59
|
+
para = block_body_first_elem(node)
|
|
46
60
|
out.div **note_attrs(node) do |div|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
61
|
+
termnote_parse1(node, para, div)
|
|
62
|
+
para&.xpath("./following-sibling::*")&.each { |n| parse(n, div) }
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def termnote_parse1(node, para, div)
|
|
67
|
+
div.p **attr_code(class: termnote_p_class) do |p|
|
|
68
|
+
name = node.at(ns("./fmt-name")) and
|
|
69
|
+
p.span class: "termnote_label" do |s|
|
|
70
|
+
children_parse(name, s)
|
|
51
71
|
end
|
|
52
|
-
|
|
53
|
-
end
|
|
72
|
+
para&.name == "p" and children_parse(para, p)
|
|
54
73
|
end
|
|
74
|
+
para&.name != "p" and parse(para, div)
|
|
55
75
|
end
|
|
56
76
|
|
|
77
|
+
def semx_termref_parse(node, out); end
|
|
78
|
+
|
|
57
79
|
def termref_parse(node, out)
|
|
58
80
|
out.p do |p|
|
|
59
81
|
node.children.each { |n| parse(n, p) }
|
|
60
82
|
end
|
|
61
83
|
end
|
|
62
84
|
|
|
85
|
+
def termdomain_parse(node, out); end
|
|
86
|
+
|
|
63
87
|
def termdef_parse(node, out)
|
|
64
|
-
name = node
|
|
88
|
+
name = node.at(ns("./fmt-name"))&.remove
|
|
65
89
|
out.p class: "TermNum", id: node["id"] do |p|
|
|
66
90
|
name&.children&.each { |n| parse(n, p) }
|
|
67
91
|
end
|
|
68
|
-
set_termdomain("")
|
|
69
92
|
node.children.each { |n| parse(n, out) }
|
|
70
93
|
end
|
|
71
94
|
|