isodoc 3.6.11 → 3.7.1
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/isodoc.gemspec +2 -2
- data/lib/isodoc/base_style/all.css +5 -0
- data/lib/isodoc/base_style/reset.css +9 -0
- data/lib/isodoc/base_style/reset.scss +26 -2
- data/lib/isodoc/function/blocks_example_note.rb +6 -3
- data/lib/isodoc/function/setup.rb +1 -0
- data/lib/isodoc/init.rb +5 -3
- data/lib/isodoc/metadata.rb +20 -5
- data/lib/isodoc/metadata_bibdata.rb +121 -0
- data/lib/isodoc/presentation_function/block.rb +10 -1
- data/lib/isodoc/presentation_function/footnotes.rb +6 -1
- data/lib/isodoc/presentation_function/index.rb +1 -1
- data/lib/isodoc/presentation_function/math.rb +2 -1
- data/lib/isodoc/presentation_function/metadata.rb +12 -12
- data/lib/isodoc/presentation_function/sourcecode.rb +13 -1
- data/lib/isodoc/version.rb +1 -1
- data/lib/isodoc/xref/xref_anchor.rb +10 -0
- metadata +18 -4
- data/.hound.yml +0 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a85471023c45913439b8f282b641e3ef150cc8ae85a98abe0175308c4a0f66c7
|
|
4
|
+
data.tar.gz: de812d85b19a63560c65cf1920b25bed1f0bf53a1c94cd63cf45414c37d8b816
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b3c04391ab690ff67d9c2841158feb4c92f8f4f1e35fc62e6bf61daf64abd8fcec08193af1bdbff30d2bc4feec1994d75c1920c461e4ca0e38720ff8cebe1cf6
|
|
7
|
+
data.tar.gz: 77377cce8adc055116f91c972c6204c9aecd15a95df79c66b54ab07e78d7a2c0a1efa2e60262a8a1542b1f3c623da53b7f83631ce6a222e2107602ac6370039f
|
data/isodoc.gemspec
CHANGED
|
@@ -30,9 +30,9 @@ Gem::Specification.new do |spec|
|
|
|
30
30
|
|
|
31
31
|
spec.add_dependency "base64"
|
|
32
32
|
spec.add_dependency "bigdecimal"
|
|
33
|
-
spec.add_dependency "html2doc", "~> 1.
|
|
33
|
+
spec.add_dependency "html2doc", "~> 1.12"
|
|
34
34
|
# spec.add_dependency "isodoc-i18n", "~> 1.1.0" # already in relaton-render and mn-requirements
|
|
35
|
-
|
|
35
|
+
spec.add_dependency "relaton-cli", "~> 2.1.0"
|
|
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"
|
|
@@ -130,6 +130,10 @@ dl dd {
|
|
|
130
130
|
grid-column-start: 2;
|
|
131
131
|
}
|
|
132
132
|
|
|
133
|
+
dl:has(dt .stem) {
|
|
134
|
+
grid-template-columns: fit-content(8em) auto;
|
|
135
|
+
}
|
|
136
|
+
|
|
133
137
|
b, strong {
|
|
134
138
|
font-weight: bold;
|
|
135
139
|
}
|
|
@@ -143,6 +147,11 @@ a.FootnoteRef, span.FootnoteRef {
|
|
|
143
147
|
vertical-align: super;
|
|
144
148
|
}
|
|
145
149
|
|
|
150
|
+
a.TableFootnoteRef, a.FootnoteRef, a.footnote-number,
|
|
151
|
+
sup a, a:has(> sup) {
|
|
152
|
+
vertical-align: baseline;
|
|
153
|
+
}
|
|
154
|
+
|
|
146
155
|
.addition {
|
|
147
156
|
color: blue;
|
|
148
157
|
}
|
|
@@ -137,6 +137,18 @@ dl {
|
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
139
|
|
|
140
|
+
// metanorma-taste#150: a symbols definition list holds the AsciiMath *source*
|
|
141
|
+
// string in its dt (HTML renders math client-side via async MathJax, which never
|
|
142
|
+
// reflows the grid), so a long source blows out the max-content term column and
|
|
143
|
+
// pushes every definition far right. Cap the term column of stem-bearing dls so
|
|
144
|
+
// the term-to-definition gap stays bounded; plain/abbreviation dls keep
|
|
145
|
+
// max-content, which is correct for them. 8em is a crude, tunable ceiling.
|
|
146
|
+
// STOPGAP: remove this rule and restore plain max-content once HTML emits
|
|
147
|
+
// server-side MathML (the term column will then size to the rendered symbol).
|
|
148
|
+
dl:has(dt .stem) {
|
|
149
|
+
grid-template-columns: fit-content(8em) auto;
|
|
150
|
+
}
|
|
151
|
+
|
|
140
152
|
b, strong {
|
|
141
153
|
font-weight: bold;
|
|
142
154
|
}
|
|
@@ -145,9 +157,21 @@ div.document-stage-band, div.document-type-band {
|
|
|
145
157
|
background-color: #333333;
|
|
146
158
|
}
|
|
147
159
|
|
|
148
|
-
a.TableFootnoteRef, span.TableFootnoteRef,
|
|
160
|
+
a.TableFootnoteRef, span.TableFootnoteRef,
|
|
149
161
|
a.FootnoteRef, span.FootnoteRef {
|
|
150
|
-
vertical-align: super;
|
|
162
|
+
vertical-align: super;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
// A footnote-style link superscripts its content through an inner <sup>, but the
|
|
166
|
+
// link's underline rides up with the anchor's own `vertical-align: super`,
|
|
167
|
+
// leaving a raised underline that reads as a stray dash. Keep the *anchor* on
|
|
168
|
+
// the baseline (so the underline stays at the bottom of the line) and let the
|
|
169
|
+
// inner <sup> alone raise the glyph. The anchor classes are named explicitly
|
|
170
|
+
// because the generic `a:has(> sup)` has lower specificity than the rule above;
|
|
171
|
+
// `sup a` covers the inverse nesting. https://github.com/metanorma/iso-10303/issues/717
|
|
172
|
+
a.TableFootnoteRef, a.FootnoteRef, a.footnote-number,
|
|
173
|
+
sup a, a:has(> sup) {
|
|
174
|
+
vertical-align: baseline;
|
|
151
175
|
}
|
|
152
176
|
|
|
153
177
|
.addition {
|
|
@@ -61,10 +61,9 @@ module IsoDoc
|
|
|
61
61
|
|
|
62
62
|
# HTML5 collapsible example: label in <summary>, body in the example div
|
|
63
63
|
def example_collapsible_parse(node, out)
|
|
64
|
-
out.details(
|
|
65
|
-
name = node.at(ns("./fmt-name"))
|
|
64
|
+
out.details(**example_collapsible_parse_attr) do |det|
|
|
66
65
|
det.summary do |s|
|
|
67
|
-
name and children_parse(name, s)
|
|
66
|
+
name = node.at(ns("./fmt-name")) and children_parse(name, s)
|
|
68
67
|
end
|
|
69
68
|
det.div(**example_div_attr(node)) do |div|
|
|
70
69
|
node.children.each do |n|
|
|
@@ -74,6 +73,10 @@ module IsoDoc
|
|
|
74
73
|
end
|
|
75
74
|
end
|
|
76
75
|
|
|
76
|
+
def example_collapsible_parse_attr
|
|
77
|
+
@details_open ? { open: "open" } : {}
|
|
78
|
+
end
|
|
79
|
+
|
|
77
80
|
def block_body_first_elem(node)
|
|
78
81
|
node.elements.each do |n|
|
|
79
82
|
%w(title fmt-title fmt-xref-label fmt-name name)
|
data/lib/isodoc/init.rb
CHANGED
|
@@ -30,9 +30,11 @@ module IsoDoc
|
|
|
30
30
|
.new(language: @lang, script: @script)
|
|
31
31
|
end
|
|
32
32
|
|
|
33
|
-
def docxml_var_init(
|
|
34
|
-
doctype_init(
|
|
35
|
-
toc_init(
|
|
33
|
+
def docxml_var_init(xml)
|
|
34
|
+
doctype_init(xml)
|
|
35
|
+
toc_init(xml)
|
|
36
|
+
@details_open = xml.at(ns("//metanorma-extension/presentation-metadata/" \
|
|
37
|
+
"html-details-open"))&.text != "false"
|
|
36
38
|
end
|
|
37
39
|
|
|
38
40
|
def doctype_init(docxml)
|
data/lib/isodoc/metadata.rb
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
require_relative "metadata_date"
|
|
2
2
|
require_relative "metadata_contributor"
|
|
3
|
+
require_relative "metadata_bibdata"
|
|
3
4
|
|
|
4
5
|
module IsoDoc
|
|
5
6
|
class Metadata
|
|
@@ -72,15 +73,29 @@ module IsoDoc
|
|
|
72
73
|
set(:substage_display, i1)
|
|
73
74
|
(i2 = xml.at(ns("//bibdata/status/iteration"))&.text) and
|
|
74
75
|
set(:iteration, i2)
|
|
75
|
-
|
|
76
|
+
# @abbreviation is authoritative (e.g. supplied by a taste through
|
|
77
|
+
# :docstage-abbrev:); read here rather than in stage_abbr, so that
|
|
78
|
+
# flavour stage_abbr overrides do not mask it
|
|
79
|
+
published or
|
|
80
|
+
set(:stageabbr, s["abbreviation"] || stage_abbr(s.text))
|
|
76
81
|
end
|
|
77
82
|
|
|
78
83
|
def published_default(xml)
|
|
79
84
|
override = xml.at(ns("//semantic-metadata/stage-published"))&.text
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
85
|
+
if override.nil?
|
|
86
|
+
stage = xml.at(ns("//bibdata/status/stage#{NOLANG}"))&.text
|
|
87
|
+
override = draft_stage?(stage) ? "false" : "true"
|
|
88
|
+
end
|
|
89
|
+
set(:unpublished, override == "false")
|
|
90
|
+
override == "true"
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
# Is the stage a draft (unpublished) stage? Overridable seam for
|
|
94
|
+
# documents whose XML does not carry semantic-metadata/
|
|
95
|
+
# stage-published (which is authoritative when present). Base
|
|
96
|
+
# default preserves historical behaviour: absent flag => published.
|
|
97
|
+
def draft_stage?(_stage)
|
|
98
|
+
false
|
|
84
99
|
end
|
|
85
100
|
|
|
86
101
|
def stage_abbr(docstatus)
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
require "relaton-cli"
|
|
2
|
+
|
|
3
|
+
module IsoDoc
|
|
4
|
+
class BibdataConfig < ::Lutaml::Model::Serializable
|
|
5
|
+
class Bibdata < ::Lutaml::Model::Serializable
|
|
6
|
+
model ::Relaton::Bib::ItemData
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
attribute :bibdata, Bibdata
|
|
10
|
+
|
|
11
|
+
xml do
|
|
12
|
+
root "metanorma"
|
|
13
|
+
map_element "bibdata", to: :bibdata, with: { from: :bibdata_from_xml,
|
|
14
|
+
to: :bibdata_to_xml }
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def bibdata_from_xml(model, node)
|
|
18
|
+
node or return
|
|
19
|
+
model.bibdata = Relaton::Cli.parse_xml(node.adapter_node.native)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def bibdata_to_xml(model, parent, doc); end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
class Metadata
|
|
26
|
+
def bibdata(isoxml, _out)
|
|
27
|
+
set(:bibdata, bibdata_hash(isoxml))
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
private
|
|
31
|
+
|
|
32
|
+
def bibdata_hash(isoxml)
|
|
33
|
+
b = isoxml.at("//bibdata") || isoxml.at("//xmlns:bibdata") or return
|
|
34
|
+
key = b.to_xml
|
|
35
|
+
# memoised by content, not unconditionally: after
|
|
36
|
+
# docidentifier_boilerplate_isodoc resolves Liquid docidentifiers,
|
|
37
|
+
# refresh_isodoc_bibdata re-runs this walker on the same Metadata
|
|
38
|
+
# instance and must re-parse the changed bibdata
|
|
39
|
+
@bibdata_hash_cache ||= {}
|
|
40
|
+
@bibdata_hash_cache.key?(key) or
|
|
41
|
+
@bibdata_hash_cache[key] = bibdata_hash_parse(key)
|
|
42
|
+
@bibdata_hash_cache[key]
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def bibdata_hash_parse(bibdata_xml)
|
|
46
|
+
stripped = Nokogiri::XML(bibdata_xml)
|
|
47
|
+
stripped.remove_namespaces!
|
|
48
|
+
# Drop @boilerplate="true" docidentifiers before handing the
|
|
49
|
+
# bibdata to Relaton::Cli.parse_xml: their content is an
|
|
50
|
+
# unresolved Liquid template, and recent relaton-iho /
|
|
51
|
+
# relaton-cc / etc. eagerly call pubid in their docidentifier
|
|
52
|
+
# content= setter, which crashes on raw Liquid syntax. The
|
|
53
|
+
# template variables for substitution come from other bibdata
|
|
54
|
+
# fields (seriesabbr, docnumeric, …), not from the
|
|
55
|
+
# docidentifier itself, so dropping it here does not affect
|
|
56
|
+
# what we feed back into isodoc.meta. Substitution still runs
|
|
57
|
+
# on the original xmldoc via standoc's
|
|
58
|
+
# docidentifier_boilerplate_isodoc; afterwards
|
|
59
|
+
# refresh_isodoc_bibdata re-runs this walker to seed
|
|
60
|
+
# meta[:bibdata] with the resolved docidentifier.
|
|
61
|
+
# See https://github.com/metanorma/metanorma/issues/558.
|
|
62
|
+
stripped.xpath("//docidentifier[@boilerplate = 'true']").each(&:remove)
|
|
63
|
+
bib = BibdataConfig.from_xml(
|
|
64
|
+
"<metanorma>#{stripped.root.to_xml}</metanorma>",
|
|
65
|
+
).bibdata or return nil
|
|
66
|
+
hash = YAML.safe_load(bib.to_yaml, permitted_classes: [Date, Symbol],
|
|
67
|
+
symbolize_names: true)
|
|
68
|
+
hash and fold_in_bibdata_ext(hash, stripped)
|
|
69
|
+
hash
|
|
70
|
+
rescue StandardError => e
|
|
71
|
+
warn "Failed to parse bibdata for Liquid template use: #{e.message}"
|
|
72
|
+
nil
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
# The Liquid `bibdata` object is built by round-tripping //bibdata through
|
|
76
|
+
# the Relaton object model, which represents bibliographic-item fields but
|
|
77
|
+
# not the Metanorma-document extension metadata under bibdata/ext
|
|
78
|
+
# (coverpage-image, innercoverpage-image, ...). Relaton drops those, so
|
|
79
|
+
# fold the raw ext subtree back in, using the same serialisation convention
|
|
80
|
+
# Relaton uses: element text -> :content, attributes -> sibling keys,
|
|
81
|
+
# repeated elements -> arrays, hyphens -> underscores (as in
|
|
82
|
+
# schema-version -> schema_version). Relaton-modelled keys win on collision;
|
|
83
|
+
# :ext is only populated when <ext> is present.
|
|
84
|
+
def fold_in_bibdata_ext(hash, stripped)
|
|
85
|
+
ext = stripped.at("//bibdata/ext") or return
|
|
86
|
+
raw = xml_element_hash(ext)
|
|
87
|
+
raw.is_a?(Hash) or return
|
|
88
|
+
modelled = hash[:ext].is_a?(Hash) ? hash[:ext] : {}
|
|
89
|
+
hash[:ext] = raw.merge(modelled)
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
# Generic Nokogiri element -> nested hash in Relaton's serialisation shape.
|
|
93
|
+
def xml_element_hash(node)
|
|
94
|
+
hash = {}
|
|
95
|
+
node.attribute_nodes.each { |a| hash[ext_hash_key(a.node_name)] = a.value }
|
|
96
|
+
children = node.element_children
|
|
97
|
+
if children.empty?
|
|
98
|
+
text = node.text.strip
|
|
99
|
+
hash[:content] = text unless text.empty?
|
|
100
|
+
else
|
|
101
|
+
children.each do |c|
|
|
102
|
+
add_ext_child(hash, ext_hash_key(c.node_name), xml_element_hash(c))
|
|
103
|
+
end
|
|
104
|
+
end
|
|
105
|
+
hash
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
def add_ext_child(hash, key, value)
|
|
109
|
+
if hash.key?(key)
|
|
110
|
+
hash[key] = [hash[key]] unless hash[key].is_a?(Array)
|
|
111
|
+
hash[key] << value
|
|
112
|
+
else
|
|
113
|
+
hash[key] = value
|
|
114
|
+
end
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
def ext_hash_key(name)
|
|
118
|
+
name.tr("-", "_").to_sym
|
|
119
|
+
end
|
|
120
|
+
end
|
|
121
|
+
end
|
|
@@ -101,9 +101,18 @@ module IsoDoc
|
|
|
101
101
|
labelled_autonum(lbl, elem["id"] || elem["original-id"], num)
|
|
102
102
|
end
|
|
103
103
|
|
|
104
|
+
# The presentation-metadata element is named from the document
|
|
105
|
+
# attribute :presentation-metadata-admonition-icon-{type}:, whose name
|
|
106
|
+
# cannot contain spaces; so spaced admonition types ("safety
|
|
107
|
+
# precautions") address it with spaces replaced by underscores --
|
|
108
|
+
# underscore, not hyphen, to avoid collision with genuinely hyphenated
|
|
109
|
+
# type names. Interpolating the raw type made the XPath invalid and
|
|
110
|
+
# fatal (#760). The i18n lookup keeps the raw type: i18n keys may
|
|
111
|
+
# legitimately contain spaces.
|
|
104
112
|
def admonition_icon(elem)
|
|
113
|
+
type = elem["type"]&.tr(" ", "_")
|
|
105
114
|
icon = elem.document
|
|
106
|
-
.at(ns("//presentation-metadata/admonition-icon-#{
|
|
115
|
+
.at(ns("//presentation-metadata/admonition-icon-#{type}"))&.text
|
|
107
116
|
icon ||= @i18n.labels.dig("admonition-icon", elem["type"])
|
|
108
117
|
icon and return "<span class='fmt-admonition-icon'>#{icon}</span>"
|
|
109
118
|
end
|
|
@@ -41,9 +41,14 @@ module IsoDoc
|
|
|
41
41
|
ins = body.at(ns(".//p")) ||
|
|
42
42
|
body.at(ns("./semx")).children.first.before("<p> </p>").previous
|
|
43
43
|
lbl = fn_body_label(fnote)
|
|
44
|
-
|
|
44
|
+
fnote = <<~FNOTE.strip
|
|
45
45
|
<fmt-fn-label><span class='fmt-caption-label'>#{lbl}</span><span class="fmt-caption-delim"><tab/></fmt-fn-label>
|
|
46
46
|
FNOTE
|
|
47
|
+
if ins.children.first
|
|
48
|
+
ins.children.first.previous = fnote
|
|
49
|
+
else
|
|
50
|
+
ins << fnote
|
|
51
|
+
end
|
|
47
52
|
end
|
|
48
53
|
|
|
49
54
|
def fn_ref_label(fnote)
|
|
@@ -9,7 +9,7 @@ module IsoDoc
|
|
|
9
9
|
i = xml.at(ns("//indexsect")) ||
|
|
10
10
|
xml.root.add_child(
|
|
11
11
|
"<indexsect #{add_id_text}>" \
|
|
12
|
-
|
|
12
|
+
"<fmt-title #{add_id_text}>#{@i18n.index}</fmt-title></indexsect>",
|
|
13
13
|
).first
|
|
14
14
|
index = sort_indexterms(xml.xpath(ns("//index")),
|
|
15
15
|
xml.xpath(ns("//index-xref[@also = 'false']")),
|
|
@@ -59,7 +59,8 @@ module IsoDoc
|
|
|
59
59
|
hex_capital).freeze
|
|
60
60
|
NUMBERFORMAT_NULLABLE = %i(base_prefix base_suffix).freeze
|
|
61
61
|
# plurimath options metanorma deliberately passes through unchanged (string)
|
|
62
|
-
NUMBERFORMAT_PASSTHROUGH = %i(fraction_group decimal group times e
|
|
62
|
+
NUMBERFORMAT_PASSTHROUGH = %i(fraction_group decimal group times e
|
|
63
|
+
padding).freeze
|
|
63
64
|
NUMBERFORMAT_KNOWN = (NUMBERFORMAT_INTEGER + NUMBERFORMAT_SYMBOL +
|
|
64
65
|
NUMBERFORMAT_NULLABLE + NUMBERFORMAT_PASSTHROUGH).freeze
|
|
65
66
|
|
|
@@ -18,14 +18,14 @@ module IsoDoc
|
|
|
18
18
|
def logo_expand_pres_metadata(docxml)
|
|
19
19
|
docxml.xpath(ns("//metanorma-extension/presentation-metadata/*"))
|
|
20
20
|
.each do |x|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
21
|
+
logo_size_pres_metadata_incomplete?(x) or next
|
|
22
|
+
parts = x.name.split("-")
|
|
23
|
+
@output_formats.each_key do |f|
|
|
24
|
+
tagname = "logo-#{parts[1]}-#{f}-#{parts[2..].join('-')}"
|
|
25
|
+
x.parent.next = <<~XML
|
|
26
|
+
<presentation-metadata><#{tagname}>#{x.text}</#{tagname}></presentation-metadata>
|
|
27
|
+
XML
|
|
28
|
+
end
|
|
29
29
|
end
|
|
30
30
|
end
|
|
31
31
|
|
|
@@ -71,7 +71,7 @@ module IsoDoc
|
|
|
71
71
|
def save_attachment(attachment, dir)
|
|
72
72
|
n = File.join(dir, File.basename(attachment["name"]))
|
|
73
73
|
c = attachment.text.sub(%r{^data:[^;]+;(?:charset=[^;]+;)?base64,}, "")
|
|
74
|
-
File.
|
|
74
|
+
File.binwrite(n, Base64.decode64(c))
|
|
75
75
|
end
|
|
76
76
|
|
|
77
77
|
def extension_insert(xml, path = [])
|
|
@@ -94,14 +94,14 @@ module IsoDoc
|
|
|
94
94
|
|
|
95
95
|
def toc_metadata(docxml)
|
|
96
96
|
@tocfigures || @toctables || @tocrecommendations || @tocexamples or return
|
|
97
|
-
ins =
|
|
97
|
+
ins = presmeta_insert_pt(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
105
|
@tocexamples and
|
|
106
106
|
ins << "<toc type='example'><title>#{@i18n.toc_examples}</title></toc>"
|
|
107
107
|
end
|
|
@@ -158,7 +158,7 @@ module IsoDoc
|
|
|
158
158
|
i18n_name(v1, "#{i18n_safe(k)}.#{i}", lang).each { |x| g << x }
|
|
159
159
|
end
|
|
160
160
|
else
|
|
161
|
-
g << i18n_tag("#{pref}#{
|
|
161
|
+
g << i18n_tag("#{pref}#{'.' unless pref.empty?}#{i18n_safe(k)}", v,
|
|
162
162
|
lang)
|
|
163
163
|
end
|
|
164
164
|
end
|
|
@@ -51,7 +51,19 @@ module IsoDoc
|
|
|
51
51
|
|
|
52
52
|
def sourcecode1(elem)
|
|
53
53
|
ret1 = semx_fmt_dup(elem)
|
|
54
|
-
b = ret1.at(ns(".//body"))
|
|
54
|
+
if (b = ret1.at(ns(".//body")))
|
|
55
|
+
# Remove formatting whitespace *preceding* the body (e.g. the newlines
|
|
56
|
+
# standoc emits around a <name> with inline markup). Once the body is
|
|
57
|
+
# unwrapped and the name removed, such stray whitespace would be lexed
|
|
58
|
+
# as leading blank lines of code. Whitespace after the body and the
|
|
59
|
+
# verbatim body content itself are untouched, so genuine code
|
|
60
|
+
# indentation is preserved.
|
|
61
|
+
b.parent.children.each do |c|
|
|
62
|
+
c == b and break
|
|
63
|
+
c.text? && c.text.strip.empty? and c.remove
|
|
64
|
+
end
|
|
65
|
+
b.replace(b.children)
|
|
66
|
+
end
|
|
55
67
|
source_label(elem)
|
|
56
68
|
source_highlight(ret1, elem["linenums"] == "true", elem["lang"])
|
|
57
69
|
callouts(elem)
|
data/lib/isodoc/version.rb
CHANGED
|
@@ -70,9 +70,19 @@ module IsoDoc
|
|
|
70
70
|
elem_name)
|
|
71
71
|
ret[:container] = @klass.get_clause_id(node) if opt[:container]
|
|
72
72
|
ret[:value] = stripsemx(lbl)
|
|
73
|
+
t = asset_title(node) and ret[:title] = t
|
|
73
74
|
ret
|
|
74
75
|
end
|
|
75
76
|
|
|
77
|
+
# Caption of a numbered asset (its <name>, or a modspec requirement's
|
|
78
|
+
# <title>), semx-wrapped, so that xrefstyle=full can render
|
|
79
|
+
# "Table 3, caption" the way clauses render "Clause 6, Title". Returns nil
|
|
80
|
+
# when the asset has no caption, so anchor_xref_full falls back to short.
|
|
81
|
+
def asset_title(node)
|
|
82
|
+
n = node.at(ns("./name")) || node.at(ns("./title")) or return nil
|
|
83
|
+
semx(node, n.children.to_xml, n.name)
|
|
84
|
+
end
|
|
85
|
+
|
|
76
86
|
include ::IsoDoc::XrefGen::Util
|
|
77
87
|
end
|
|
78
88
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: isodoc
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.
|
|
4
|
+
version: 3.7.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
@@ -43,14 +43,28 @@ dependencies:
|
|
|
43
43
|
requirements:
|
|
44
44
|
- - "~>"
|
|
45
45
|
- !ruby/object:Gem::Version
|
|
46
|
-
version: 1.
|
|
46
|
+
version: '1.12'
|
|
47
47
|
type: :runtime
|
|
48
48
|
prerelease: false
|
|
49
49
|
version_requirements: !ruby/object:Gem::Requirement
|
|
50
50
|
requirements:
|
|
51
51
|
- - "~>"
|
|
52
52
|
- !ruby/object:Gem::Version
|
|
53
|
-
version: 1.
|
|
53
|
+
version: '1.12'
|
|
54
|
+
- !ruby/object:Gem::Dependency
|
|
55
|
+
name: relaton-cli
|
|
56
|
+
requirement: !ruby/object:Gem::Requirement
|
|
57
|
+
requirements:
|
|
58
|
+
- - "~>"
|
|
59
|
+
- !ruby/object:Gem::Version
|
|
60
|
+
version: 2.1.0
|
|
61
|
+
type: :runtime
|
|
62
|
+
prerelease: false
|
|
63
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
64
|
+
requirements:
|
|
65
|
+
- - "~>"
|
|
66
|
+
- !ruby/object:Gem::Version
|
|
67
|
+
version: 2.1.0
|
|
54
68
|
- !ruby/object:Gem::Dependency
|
|
55
69
|
name: mn2pdf
|
|
56
70
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -175,7 +189,6 @@ extensions: []
|
|
|
175
189
|
extra_rdoc_files: []
|
|
176
190
|
files:
|
|
177
191
|
- ".gitignore"
|
|
178
|
-
- ".hound.yml"
|
|
179
192
|
- ".oss-guides.rubocop.yml"
|
|
180
193
|
- ".rubocop.yml"
|
|
181
194
|
- CODE_OF_CONDUCT.md
|
|
@@ -252,6 +265,7 @@ files:
|
|
|
252
265
|
- lib/isodoc/i18n.rb
|
|
253
266
|
- lib/isodoc/init.rb
|
|
254
267
|
- lib/isodoc/metadata.rb
|
|
268
|
+
- lib/isodoc/metadata_bibdata.rb
|
|
255
269
|
- lib/isodoc/metadata_contributor.rb
|
|
256
270
|
- lib/isodoc/metadata_date.rb
|
|
257
271
|
- lib/isodoc/pdf_convert.rb
|