isodoc 3.6.5 → 3.6.7
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 +13 -1
- data/isodoc.gemspec +2 -2
- data/lib/isodoc/convert.rb +1 -0
- data/lib/isodoc/function/blocks.rb +15 -7
- data/lib/isodoc/function/blocks_example_note.rb +28 -3
- data/lib/isodoc/function/lists.rb +2 -2
- data/lib/isodoc/function/table.rb +29 -9
- data/lib/isodoc/function/utils.rb +11 -0
- data/lib/isodoc/html_function/html.rb +2 -1
- data/lib/isodoc/init.rb +1 -0
- data/lib/isodoc/presentation_function/math.rb +34 -9
- data/lib/isodoc/presentation_function/metadata.rb +4 -2
- data/lib/isodoc/version.rb +1 -1
- data/lib/isodoc/word_function/body.rb +1 -0
- data/lib/isodoc/word_function/postprocess_toc.rb +27 -0
- data/lib/isodoc/word_function/table.rb +9 -3
- data/lib/isodoc/xslfo_convert.rb +1 -1
- data/lib/isodoc-yaml/i18n-ar.yaml +1 -0
- data/lib/isodoc-yaml/i18n-de.yaml +1 -0
- data/lib/isodoc-yaml/i18n-en.yaml +1 -0
- data/lib/isodoc-yaml/i18n-es.yaml +1 -0
- data/lib/isodoc-yaml/i18n-fr.yaml +1 -0
- data/lib/isodoc-yaml/i18n-ja.yaml +1 -0
- data/lib/isodoc-yaml/i18n-ru.yaml +1 -0
- data/lib/isodoc-yaml/i18n-zh-Hans.yaml +1 -0
- data/lib/relaton/render-isodoc/config.yml +1 -1
- metadata +6 -9
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: eb5eaaa62e081fd25bff232ebc2a38ef74f3d73c4207da35cde420169fbfe0b1
|
|
4
|
+
data.tar.gz: baa0b652f47d32440c93e1f0f823ef2ef734ec78bd351f3112d3e2fc14906c2c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 711a67de087b11beb0fc089d21e9fe62694fbe5e0d8d1bbd6a37a7fb2b0546c7ba43a95da22cb5073ee4263bee4127e57b5455d7cf3c40c7a020f4a490936947
|
|
7
|
+
data.tar.gz: 64d9a08ecd6e2355a738702b843d8873fcf66e191f359b1ef84eac09c57e9f136535f3edc685a96289339c021c743349d6550e9eac92d3417cb42d18d99851a4
|
data/.rubocop.yml
CHANGED
|
@@ -3,8 +3,20 @@
|
|
|
3
3
|
inherit_from:
|
|
4
4
|
- https://raw.githubusercontent.com/riboseinc/oss-guides/main/ci/rubocop.yml
|
|
5
5
|
|
|
6
|
+
# Rubocop plugins enabled centrally so every metanorma-org gem picks them up
|
|
7
|
+
# on cimas sync — best practice belongs at the shared-template layer, not
|
|
8
|
+
# per-repo. Per ronaldtse feedback on metanorma/ci#332.
|
|
9
|
+
plugins:
|
|
10
|
+
- rubocop-rspec
|
|
11
|
+
- rubocop-performance
|
|
12
|
+
- rubocop-rake
|
|
13
|
+
|
|
6
14
|
# local repo-specific modifications
|
|
7
15
|
# ...
|
|
8
16
|
|
|
9
17
|
AllCops:
|
|
10
|
-
|
|
18
|
+
# 3.3 matches the org-wide minimum being pushed via #274 (Raise minimum
|
|
19
|
+
# Ruby version to 3.3 due to EOL of 3.2 on 2026-03-31). Was 3.4 before
|
|
20
|
+
# this commit — 3.4 was above the org's stated minimum and would have
|
|
21
|
+
# applied Rubocop rules that fail-close on gems still targeting 3.3.
|
|
22
|
+
TargetRubyVersion: 3.3
|
data/isodoc.gemspec
CHANGED
|
@@ -26,7 +26,7 @@ Gem::Specification.new do |spec|
|
|
|
26
26
|
f.match(%r{^(test|spec|features|bin|.github)/}) \
|
|
27
27
|
|| f.match(%r{Rakefile|bin/rspec})
|
|
28
28
|
end
|
|
29
|
-
spec.required_ruby_version = Gem::Requirement.new(">= 3.
|
|
29
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 3.3.0")
|
|
30
30
|
|
|
31
31
|
spec.add_dependency "base64"
|
|
32
32
|
spec.add_dependency "bigdecimal"
|
|
@@ -36,7 +36,7 @@ Gem::Specification.new do |spec|
|
|
|
36
36
|
# spec.add_dependency "metanorma-utils", "~> 1.5.0" # already in isodoc-i18n
|
|
37
37
|
spec.add_dependency "mn2pdf", ">= 2.13"
|
|
38
38
|
spec.add_dependency "mn-requirements", "~> 0.5.0"
|
|
39
|
-
spec.add_dependency "relaton-render", "~> 1.
|
|
39
|
+
spec.add_dependency "relaton-render", "~> 1.3.0"
|
|
40
40
|
spec.add_dependency "roman-numerals"
|
|
41
41
|
spec.add_dependency "rouge", "~> 4.0"
|
|
42
42
|
spec.add_dependency "thread_safe"
|
data/lib/isodoc/convert.rb
CHANGED
|
@@ -45,6 +45,7 @@ module IsoDoc
|
|
|
45
45
|
# tocfigures: add ToC for figures
|
|
46
46
|
# toctables: add ToC for tables
|
|
47
47
|
# tocrecommendations: add ToC for rcommendations
|
|
48
|
+
# tocexamples: add ToC for examples
|
|
48
49
|
# fonts: fontist fonts to install
|
|
49
50
|
# fontlicenseagreement: fontist font license agreement
|
|
50
51
|
# modspecidentifierbase: base prefix for any Modspec identifiers
|
|
@@ -11,11 +11,16 @@ module IsoDoc
|
|
|
11
11
|
end
|
|
12
12
|
|
|
13
13
|
def figure_attrs(node)
|
|
14
|
-
attr_code(id: node["id"], class: "figure",
|
|
14
|
+
attr_code(id: node["id"], class: merge_html_class("figure", node),
|
|
15
|
+
style: keep_style(node))
|
|
15
16
|
end
|
|
16
17
|
|
|
17
18
|
def figure_parse(node, out)
|
|
18
|
-
|
|
19
|
+
# metanorma/metanorma-standoc#1197: "pseudocode" may be one of several
|
|
20
|
+
# space-separated classes; dispatch on its presence, not equality, so a
|
|
21
|
+
# custom class alongside it is preserved.
|
|
22
|
+
node["class"]&.split&.include?("pseudocode") ||
|
|
23
|
+
node["type"] == "pseudocode" and
|
|
19
24
|
return pseudocode_parse(node, out)
|
|
20
25
|
@in_figure = true
|
|
21
26
|
figure_parse1(node, out)
|
|
@@ -32,7 +37,10 @@ module IsoDoc
|
|
|
32
37
|
end
|
|
33
38
|
|
|
34
39
|
def pseudocode_attrs(node)
|
|
35
|
-
|
|
40
|
+
classes = node["class"]&.split || []
|
|
41
|
+
classes.include?("pseudocode") or classes.unshift("pseudocode")
|
|
42
|
+
attr_code(id: node["id"], class: classes.join(" "),
|
|
43
|
+
style: keep_style(node))
|
|
36
44
|
end
|
|
37
45
|
|
|
38
46
|
def pseudocode_tag
|
|
@@ -58,7 +66,8 @@ module IsoDoc
|
|
|
58
66
|
end
|
|
59
67
|
|
|
60
68
|
def sourcecode_attrs(node)
|
|
61
|
-
attr_code(id: node["id"], class: "Sourcecode",
|
|
69
|
+
attr_code(id: node["id"], class: merge_html_class("Sourcecode", node),
|
|
70
|
+
style: keep_style(node))
|
|
62
71
|
end
|
|
63
72
|
|
|
64
73
|
def sourcecode_parse(node, out)
|
|
@@ -151,8 +160,7 @@ module IsoDoc
|
|
|
151
160
|
classtype = "MsoCommentText" if in_comment
|
|
152
161
|
node["type"] == "floating-title" and
|
|
153
162
|
classtype = "h#{node['depth'] || '1'}"
|
|
154
|
-
classtype
|
|
155
|
-
classtype
|
|
163
|
+
merge_html_class(classtype, node)
|
|
156
164
|
end
|
|
157
165
|
|
|
158
166
|
def para_attrs(node)
|
|
@@ -187,7 +195,7 @@ module IsoDoc
|
|
|
187
195
|
end
|
|
188
196
|
|
|
189
197
|
def quote_attrs(node)
|
|
190
|
-
ret = para_attrs(node).merge(class: "Quote")
|
|
198
|
+
ret = para_attrs(node).merge(class: merge_html_class("Quote", node))
|
|
191
199
|
node["type"] == "newcontent" and
|
|
192
200
|
ret[:class] += " AmendNewcontent"
|
|
193
201
|
ret
|
|
@@ -13,7 +13,8 @@ module IsoDoc
|
|
|
13
13
|
margin-left:0pt;vertical-align:top;" }.freeze
|
|
14
14
|
|
|
15
15
|
def example_div_attr(node)
|
|
16
|
-
attr_code(id: node["id"], class: "example",
|
|
16
|
+
attr_code(id: node["id"], class: merge_html_class("example", node),
|
|
17
|
+
style: keep_style(node))
|
|
17
18
|
end
|
|
18
19
|
|
|
19
20
|
# used if we are boxing examples
|
|
@@ -51,7 +52,26 @@ module IsoDoc
|
|
|
51
52
|
end
|
|
52
53
|
|
|
53
54
|
def example_parse(node, out)
|
|
54
|
-
|
|
55
|
+
if node["collapsible"] == "true"
|
|
56
|
+
example_collapsible_parse(node, out)
|
|
57
|
+
else
|
|
58
|
+
example_div_parse(node, out)
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
# HTML5 collapsible example: label in <summary>, body in the example div
|
|
63
|
+
def example_collapsible_parse(node, out)
|
|
64
|
+
out.details(open: "open") do |det|
|
|
65
|
+
name = node.at(ns("./fmt-name"))
|
|
66
|
+
det.summary do |s|
|
|
67
|
+
name and children_parse(name, s)
|
|
68
|
+
end
|
|
69
|
+
det.div(**example_div_attr(node)) do |div|
|
|
70
|
+
node.children.each do |n|
|
|
71
|
+
parse(n, div) unless n.name == "fmt-name"
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
end
|
|
55
75
|
end
|
|
56
76
|
|
|
57
77
|
def block_body_first_elem(node)
|
|
@@ -111,6 +131,7 @@ module IsoDoc
|
|
|
111
131
|
def note_attrs(node)
|
|
112
132
|
classes = node["type"]&.split(",") || []
|
|
113
133
|
classes << "Note"
|
|
134
|
+
node["class"] and classes << node["class"]
|
|
114
135
|
attr_code(id: node["id"], class: classes.join(" "),
|
|
115
136
|
style: keep_style(node), coverpage: node["coverpage"])
|
|
116
137
|
end
|
|
@@ -135,7 +156,11 @@ module IsoDoc
|
|
|
135
156
|
end
|
|
136
157
|
|
|
137
158
|
def admonition_class(node)
|
|
138
|
-
|
|
159
|
+
# metanorma/metanorma-standoc#1197: admonition @class is unused by the
|
|
160
|
+
# type-driven labelling/numbering, so it is repurposed for additive
|
|
161
|
+
# custom HTML classes appended after the built-in Admonition classes.
|
|
162
|
+
["Admonition", admonition_subclass(node), node["class"]]
|
|
163
|
+
.compact.join(" ").strip
|
|
139
164
|
end
|
|
140
165
|
|
|
141
166
|
def admonition_subclass(node)
|
|
@@ -9,7 +9,7 @@ module IsoDoc
|
|
|
9
9
|
end
|
|
10
10
|
|
|
11
11
|
def ul_attrs(node)
|
|
12
|
-
{ id: node["id"], style: keep_style(node) }
|
|
12
|
+
{ id: node["id"], class: node["class"], style: keep_style(node) }
|
|
13
13
|
end
|
|
14
14
|
|
|
15
15
|
def ul_parse(node, out)
|
|
@@ -46,7 +46,7 @@ module IsoDoc
|
|
|
46
46
|
{ # type: node["type"] ? ol_style(node["type"].to_sym) : ol_depth(node),
|
|
47
47
|
type: ol_style(node["type"]&.to_sym),
|
|
48
48
|
start: node["start"],
|
|
49
|
-
id: node["id"], style: keep_style(node)
|
|
49
|
+
id: node["id"], class: node["class"], style: keep_style(node)
|
|
50
50
|
}
|
|
51
51
|
end
|
|
52
52
|
|
|
@@ -46,21 +46,37 @@ module IsoDoc
|
|
|
46
46
|
end
|
|
47
47
|
end
|
|
48
48
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
49
|
+
# Bordering is governed by %plain only, NOT by the presence of a custom
|
|
50
|
+
# @class (metanorma/metanorma-pdfa#33). A non-plain table -- including one
|
|
51
|
+
# carrying a custom class, or the internal modspec variant -- keeps the
|
|
52
|
+
# ISO borders. The internal `rouge-line-table` (sourcecode line numbering)
|
|
53
|
+
# is the exception: like %plain it is mutually exclusive with MsoISOTable
|
|
54
|
+
# and takes no ISO border additions.
|
|
55
|
+
def bordered_table_style(node, klass = nil)
|
|
56
|
+
node["plain"] == "true" and return ""
|
|
57
|
+
klass == "rouge-line-table" and return ""
|
|
58
|
+
"border-width:1px;border-spacing:0;"
|
|
54
59
|
end
|
|
55
60
|
|
|
56
61
|
def table_attrs(node)
|
|
57
62
|
c = node["class"]
|
|
58
63
|
style = table_attrs_style(node, c)
|
|
59
64
|
attr_code(id: node["id"],
|
|
60
|
-
class: node
|
|
65
|
+
class: table_html_class(node, c),
|
|
61
66
|
style: style, title: node["alt"])
|
|
62
67
|
end
|
|
63
68
|
|
|
69
|
+
# metanorma/metanorma-pdfa#33: a custom @class is ADDITIVE -- it augments
|
|
70
|
+
# the computed base class (MsoISOTable, or "plain" under %plain) rather
|
|
71
|
+
# than replacing it, and is orthogonal to bordering. `modspec` and the
|
|
72
|
+
# sourcecode line-numbering `rouge-line-table` stay grandfathered internal
|
|
73
|
+
# values with replace semantics (mutually exclusive with MsoISOTable).
|
|
74
|
+
def table_html_class(node, custom)
|
|
75
|
+
node["plain"] == "true" and return ["plain", custom].compact.join(" ")
|
|
76
|
+
%w(modspec rouge-line-table).include?(custom) and return custom
|
|
77
|
+
["MsoISOTable", custom].compact.join(" ")
|
|
78
|
+
end
|
|
79
|
+
|
|
64
80
|
def table_attrs_style(node, klass)
|
|
65
81
|
width = node["width"] ? "width:#{node['width']};" : nil
|
|
66
82
|
bordered = bordered_table_style(node, klass)
|
|
@@ -146,10 +162,14 @@ module IsoDoc
|
|
|
146
162
|
STYLE
|
|
147
163
|
end
|
|
148
164
|
|
|
165
|
+
# Cell bordering follows %plain only, not the custom @class, with
|
|
166
|
+
# `rouge-line-table` excluded like %plain (see bordered_table_style).
|
|
167
|
+
# metanorma/metanorma-pdfa#33
|
|
149
168
|
def table_bordered?(node)
|
|
150
|
-
node.parent.parent
|
|
151
|
-
|
|
152
|
-
|
|
169
|
+
table = node.parent.parent
|
|
170
|
+
table["plain"] == "true" and return false
|
|
171
|
+
table["class"] == "rouge-line-table" and return false
|
|
172
|
+
true
|
|
153
173
|
end
|
|
154
174
|
|
|
155
175
|
def tr_parse(node, out, ord, totalrows, header)
|
|
@@ -38,6 +38,17 @@ module IsoDoc
|
|
|
38
38
|
end
|
|
39
39
|
end
|
|
40
40
|
|
|
41
|
+
# metanorma/metanorma-standoc#1197: render an author's custom @class
|
|
42
|
+
# additively, augmenting a block's built-in HTML class rather than
|
|
43
|
+
# replacing it. `base` is the block's hardcoded class ("figure",
|
|
44
|
+
# "Sourcecode", ...) or nil for blocks with no built-in class; the author
|
|
45
|
+
# class (if any) is appended. Returns nil when the result is empty, so a
|
|
46
|
+
# class-less block does not gain an empty class attribute.
|
|
47
|
+
def merge_html_class(base, node)
|
|
48
|
+
ret = [base, node["class"]].compact.join(" ")
|
|
49
|
+
ret.empty? ? nil : ret
|
|
50
|
+
end
|
|
51
|
+
|
|
41
52
|
DOCTYPE_HDR = "<!DOCTYPE html SYSTEM " \
|
|
42
53
|
'"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'.freeze
|
|
43
54
|
|
|
@@ -73,7 +73,8 @@ module IsoDoc
|
|
|
73
73
|
def sourcecode_parse(node, out)
|
|
74
74
|
tag, child_tag = sourcecode_tag(node)
|
|
75
75
|
s = node.at(ns("./fmt-sourcecode")) || node
|
|
76
|
-
attr = sourcecode_attrs(node)
|
|
76
|
+
attr = sourcecode_attrs(node)
|
|
77
|
+
.merge(class: merge_html_class("sourcecode", node))
|
|
77
78
|
out.send tag, **attr do |div|
|
|
78
79
|
sourcecode_pre_wrap(child_tag, s, div)
|
|
79
80
|
annotation_parse(s, div)
|
data/lib/isodoc/init.rb
CHANGED
|
@@ -169,6 +169,7 @@ module IsoDoc
|
|
|
169
169
|
@tocfigures = options[:tocfigures]
|
|
170
170
|
@toctables = options[:toctables]
|
|
171
171
|
@tocrecommendations = options[:tocrecommendations]
|
|
172
|
+
@tocexamples = options[:tocexamples]
|
|
172
173
|
end
|
|
173
174
|
|
|
174
175
|
AGENCIES = %w(ISO IEC ITU IETF NIST OGC IEEE BIPM BSI BS JIS IANA UN W3C
|
|
@@ -50,21 +50,46 @@ module IsoDoc
|
|
|
50
50
|
precision: num_precision(num.text))
|
|
51
51
|
end
|
|
52
52
|
|
|
53
|
+
# The `data-metanorma-numberformat` options metanorma types, by target
|
|
54
|
+
# type. The single source of truth lives here in isodoc (metanorma's
|
|
55
|
+
# concern), not in plurimath.
|
|
56
|
+
NUMBERFORMAT_INTEGER = %i(precision significant digit_count group_digits
|
|
57
|
+
fraction_group_digits base).freeze
|
|
58
|
+
NUMBERFORMAT_SYMBOL = %i(notation exponent_sign number_sign locale
|
|
59
|
+
hex_capital).freeze
|
|
60
|
+
NUMBERFORMAT_NULLABLE = %i(base_prefix base_suffix).freeze
|
|
61
|
+
# plurimath options metanorma deliberately passes through unchanged (string)
|
|
62
|
+
NUMBERFORMAT_PASSTHROUGH = %i(fraction_group decimal group times e).freeze
|
|
63
|
+
NUMBERFORMAT_KNOWN = (NUMBERFORMAT_INTEGER + NUMBERFORMAT_SYMBOL +
|
|
64
|
+
NUMBERFORMAT_NULLABLE + NUMBERFORMAT_PASSTHROUGH).freeze
|
|
65
|
+
|
|
53
66
|
def numberformat_type(ret)
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
end
|
|
59
|
-
%i(notation exponent_sign number_sign locale hex_capital).each do |i|
|
|
60
|
-
ret[i] &&= ret[i].to_sym
|
|
61
|
-
end
|
|
62
|
-
%i(base_prefix base_suffix).each do |i|
|
|
67
|
+
numberformat_unclassified_warn
|
|
68
|
+
NUMBERFORMAT_INTEGER.each { |i| ret[i] &&= ret[i].to_i }
|
|
69
|
+
NUMBERFORMAT_SYMBOL.each { |i| ret[i] &&= ret[i].to_sym }
|
|
70
|
+
NUMBERFORMAT_NULLABLE.each do |i|
|
|
63
71
|
["", "nil"].include?(ret[i]) and ret[i] = nil
|
|
64
72
|
end
|
|
65
73
|
ret
|
|
66
74
|
end
|
|
67
75
|
|
|
76
|
+
# Union plurimath's option defaults against metanorma's known lists, and
|
|
77
|
+
# warn (once) on anything plurimath exposes that metanorma has not
|
|
78
|
+
# classified -- e.g. a passthrough option added upstream (potentially via a
|
|
79
|
+
# direct Peter Wyatt request) that we would otherwise be none the wiser of.
|
|
80
|
+
# DEFAULT_OPTIONS is the passthrough watch-point, not plurimath's entire
|
|
81
|
+
# option surface. See metanorma/basicdoc-models#35.
|
|
82
|
+
def numberformat_unclassified_warn
|
|
83
|
+
@numberformat_warned and return
|
|
84
|
+
@numberformat_warned = true
|
|
85
|
+
unknown = Plurimath::Formatter::Standard::DEFAULT_OPTIONS.keys -
|
|
86
|
+
NUMBERFORMAT_KNOWN
|
|
87
|
+
unknown.empty? and return
|
|
88
|
+
warn "[isodoc] plurimath number-format options not classified by " \
|
|
89
|
+
"metanorma (treated as string passthrough): #{unknown.join(', ')}. " \
|
|
90
|
+
"Classify them in IsoDoc numberformat_type."
|
|
91
|
+
end
|
|
92
|
+
|
|
68
93
|
def explicit_number_formatter(num, locale, options)
|
|
69
94
|
ret = numberformat_type(csv_attribute_extract(options))
|
|
70
95
|
l = ret[:locale] || locale
|
|
@@ -93,15 +93,17 @@ module IsoDoc
|
|
|
93
93
|
end
|
|
94
94
|
|
|
95
95
|
def toc_metadata(docxml)
|
|
96
|
-
@tocfigures || @toctables || @tocrecommendations or return
|
|
96
|
+
@tocfigures || @toctables || @tocrecommendations || @tocexamples or return
|
|
97
97
|
ins = extension_insert(docxml)
|
|
98
98
|
@tocfigures and
|
|
99
99
|
ins.add_child "<toc type='figure'><title>#{@i18n.toc_figures}</title></toc>"
|
|
100
100
|
@toctables and
|
|
101
101
|
ins << "<toc type='table'><title>#{@i18n.toc_tables}</title></toc>"
|
|
102
|
-
@
|
|
102
|
+
@tocrecommendations and
|
|
103
103
|
ins << "<toc type='recommendation'><title>#{@i18n.toc_recommendations}" \
|
|
104
104
|
"</title></toc>"
|
|
105
|
+
@tocexamples and
|
|
106
|
+
ins << "<toc type='example'><title>#{@i18n.toc_examples}</title></toc>"
|
|
105
107
|
end
|
|
106
108
|
|
|
107
109
|
def fonts_metadata(xmldoc)
|
data/lib/isodoc/version.rb
CHANGED
|
@@ -161,6 +161,7 @@ module IsoDoc
|
|
|
161
161
|
@toctablestitle = xml.at(ns("//#{toc}[@type = 'table']/title"))&.text
|
|
162
162
|
@tocrecommendationstitle =
|
|
163
163
|
xml.at(ns("//#{toc}[@type = 'recommendation']/title"))&.text
|
|
164
|
+
@tocexamplestitle = xml.at(ns("//#{toc}[@type = 'example']/title"))&.text
|
|
164
165
|
end
|
|
165
166
|
|
|
166
167
|
def table_of_contents(clause, out)
|
|
@@ -27,6 +27,7 @@ module IsoDoc
|
|
|
27
27
|
toc += make_table_word_toc(docxml)
|
|
28
28
|
toc += make_figure_word_toc(docxml)
|
|
29
29
|
toc += make_recommendation_word_toc(docxml)
|
|
30
|
+
toc += make_example_word_toc(docxml)
|
|
30
31
|
toc
|
|
31
32
|
end
|
|
32
33
|
|
|
@@ -91,6 +92,10 @@ module IsoDoc
|
|
|
91
92
|
recommendationtitle recommendationtesttitle)
|
|
92
93
|
end
|
|
93
94
|
|
|
95
|
+
def example_toc_class
|
|
96
|
+
%w(example-title)
|
|
97
|
+
end
|
|
98
|
+
|
|
94
99
|
def toc_word_class_list(classes)
|
|
95
100
|
classes.map { |x| "#{x},1" }.join(",")
|
|
96
101
|
end
|
|
@@ -117,6 +122,13 @@ module IsoDoc
|
|
|
117
122
|
TOC
|
|
118
123
|
end
|
|
119
124
|
|
|
125
|
+
def word_toc_example_preface1
|
|
126
|
+
<<~TOC
|
|
127
|
+
<span lang="EN-GB"><span style='mso-element:field-begin'></span><span style='mso-spacerun:yes'> </span>TOC
|
|
128
|
+
\\h \\z \\t "#{toc_word_class_list example_toc_class}" <span style='mso-element:field-separator'></span></span>
|
|
129
|
+
TOC
|
|
130
|
+
end
|
|
131
|
+
|
|
120
132
|
def table_toc_xpath
|
|
121
133
|
attr = table_toc_class.map { |x| "@class = '#{x}'" }
|
|
122
134
|
"//p[#{attr.join(' or ')}]"
|
|
@@ -164,6 +176,21 @@ module IsoDoc
|
|
|
164
176
|
%{\\1#{word_toc_reqt_preface1}}) + WORD_TOC_SUFFIX1
|
|
165
177
|
end
|
|
166
178
|
|
|
179
|
+
def example_toc_xpath
|
|
180
|
+
attr = example_toc_class.map { |x| "@class = '#{x}'" }
|
|
181
|
+
"//p[#{attr.join(' or ')}]"
|
|
182
|
+
end
|
|
183
|
+
|
|
184
|
+
def make_example_word_toc(docxml)
|
|
185
|
+
(docxml.at(example_toc_xpath) && @tocexamplestitle) or return ""
|
|
186
|
+
toc = %{<p class="TOCTitle">#{@tocexamplestitle}</p>}
|
|
187
|
+
docxml.xpath(example_toc_xpath).each do |h|
|
|
188
|
+
toc += word_toc_entry(1, header_strip(h))
|
|
189
|
+
end
|
|
190
|
+
toc.sub(/(<p class="MsoToc1">)/,
|
|
191
|
+
%{\\1#{word_toc_example_preface1}}) + WORD_TOC_SUFFIX1
|
|
192
|
+
end
|
|
193
|
+
|
|
167
194
|
def recommmendation_sort_key(header)
|
|
168
195
|
m = /^([^0-9]+) (\d+)/.match(header) || /^([^:]+)/.match(header)
|
|
169
196
|
m ||= [header, nil]
|
|
@@ -84,12 +84,18 @@ module IsoDoc
|
|
|
84
84
|
super.merge(attr_code(ret))
|
|
85
85
|
end
|
|
86
86
|
|
|
87
|
+
# %plain or an explicit @style still suppresses the default border; a
|
|
88
|
+
# custom @class no longer nulls it. The class is HTML-only and is not
|
|
89
|
+
# emitted to Word output (Word CSS is too inflexible), but a custom-class
|
|
90
|
+
# table must still render as a normal bordered ISO table.
|
|
91
|
+
# Exception: the internal `rouge-line-table` (sourcecode line numbering)
|
|
92
|
+
# takes no ISO border and keeps its own class -- returning nil drops the
|
|
93
|
+
# Word MsoISOTable override (see table_attrs) so the HTML super class
|
|
94
|
+
# survives. metanorma/metanorma-pdfa#33
|
|
87
95
|
def table_border_css(node)
|
|
88
|
-
c = node["class"]
|
|
89
96
|
style = "border-spacing:0;border-width:1px;"
|
|
90
97
|
node["style"] || node["plain"] == "true" and style = ""
|
|
91
|
-
|
|
92
|
-
node["plain"] == "true" and style = ""
|
|
98
|
+
node["class"] == "rouge-line-table" and style = nil
|
|
93
99
|
style
|
|
94
100
|
end
|
|
95
101
|
|
data/lib/isodoc/xslfo_convert.rb
CHANGED
|
@@ -102,6 +102,7 @@ version: Version
|
|
|
102
102
|
toc_figures: Abbildungsverzeichnis
|
|
103
103
|
toc_tables: Tabellenverzeichnis
|
|
104
104
|
toc_recommendations: Empfehlungenverzeichnis
|
|
105
|
+
toc_examples: Beispielverzeichnis
|
|
105
106
|
month_january: Januar
|
|
106
107
|
month_february: Februar
|
|
107
108
|
month_march: März
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
template:
|
|
2
2
|
# skip authoritative identifier, it is inserted in front of formattedref within metanorma
|
|
3
|
-
standard: "{% if creatornames %}{{ creatornames }} ({{ role}}){%else%}{{publisher}}{%endif%} $$$ <em>{{ title }}</em> $$$ {{ medium | capitalize }}$$$ {{ edition | capitalize_first }}$$$ {{date}}$$$ {{place}}: {%if creatornames %}{{publisher}}{% endif %} $$$ {{size}}$$$ {{ extent }}$$$ {{ uri }}$$$ {{ labels['
|
|
3
|
+
standard: "{% if creatornames %}{{ creatornames }} ({{ role}}){%else%}{{publisher}}{%endif%} $$$ <em>{{ title }}</em> $$$ {{ medium | capitalize }}$$$ {{ edition | capitalize_first }}$$$ {{date}}$$$ {{place}}: {%if creatornames %}{{publisher}}{% endif %} $$$ {{size}}$$$ {{ extent }}$$$ {{ uri }}$$$ {{ labels['at_url'] | capitalize}}:_{{ access_location }}$$$ [{{ labels['viewed'] }}:_{{date_accessed}}]"
|
|
4
4
|
|
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: isodoc
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.6.
|
|
4
|
+
version: 3.6.7
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: base64
|
|
@@ -86,14 +85,14 @@ dependencies:
|
|
|
86
85
|
requirements:
|
|
87
86
|
- - "~>"
|
|
88
87
|
- !ruby/object:Gem::Version
|
|
89
|
-
version: 1.
|
|
88
|
+
version: 1.3.0
|
|
90
89
|
type: :runtime
|
|
91
90
|
prerelease: false
|
|
92
91
|
version_requirements: !ruby/object:Gem::Requirement
|
|
93
92
|
requirements:
|
|
94
93
|
- - "~>"
|
|
95
94
|
- !ruby/object:Gem::Version
|
|
96
|
-
version: 1.
|
|
95
|
+
version: 1.3.0
|
|
97
96
|
- !ruby/object:Gem::Dependency
|
|
98
97
|
name: roman-numerals
|
|
99
98
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -324,7 +323,6 @@ homepage: https://github.com/metanorma/isodoc
|
|
|
324
323
|
licenses:
|
|
325
324
|
- BSD-2-Clause
|
|
326
325
|
metadata: {}
|
|
327
|
-
post_install_message:
|
|
328
326
|
rdoc_options: []
|
|
329
327
|
require_paths:
|
|
330
328
|
- lib
|
|
@@ -332,15 +330,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
332
330
|
requirements:
|
|
333
331
|
- - ">="
|
|
334
332
|
- !ruby/object:Gem::Version
|
|
335
|
-
version: 3.
|
|
333
|
+
version: 3.3.0
|
|
336
334
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
337
335
|
requirements:
|
|
338
336
|
- - ">="
|
|
339
337
|
- !ruby/object:Gem::Version
|
|
340
338
|
version: '0'
|
|
341
339
|
requirements: []
|
|
342
|
-
rubygems_version:
|
|
343
|
-
signing_key:
|
|
340
|
+
rubygems_version: 4.0.10
|
|
344
341
|
specification_version: 4
|
|
345
342
|
summary: Convert documents in IsoDoc into Word and HTML in AsciiDoc.
|
|
346
343
|
test_files: []
|