metanorma-iso 1.8.0 → 1.8.5
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/.github/workflows/rake.yml +3 -13
- data/.hound.yml +3 -1
- data/.rubocop.yml +4 -8
- data/lib/asciidoctor/iso/base.rb +14 -11
- data/lib/asciidoctor/iso/biblio.rng +1 -0
- data/lib/asciidoctor/iso/cleanup.rb +40 -24
- data/lib/asciidoctor/iso/front.rb +28 -16
- data/lib/asciidoctor/iso/front_id.rb +66 -50
- data/lib/asciidoctor/iso/isodoc.rng +191 -3
- data/lib/asciidoctor/iso/isostandard-amd.rng +3 -0
- data/lib/asciidoctor/iso/isostandard.rng +12 -0
- data/lib/asciidoctor/iso/section.rb +2 -1
- data/lib/asciidoctor/iso/validate.rb +22 -110
- data/lib/asciidoctor/iso/validate_image.rb +97 -0
- data/lib/asciidoctor/iso/validate_requirements.rb +26 -20
- data/lib/asciidoctor/iso/validate_section.rb +55 -29
- data/lib/asciidoctor/iso/validate_style.rb +36 -24
- data/lib/asciidoctor/iso/validate_title.rb +2 -4
- data/lib/isodoc/iso/base_convert.rb +20 -14
- data/lib/isodoc/iso/html/isodoc.css +475 -20
- data/lib/isodoc/iso/html/isodoc.scss +456 -23
- data/lib/isodoc/iso/html/wordstyle.css +202 -31
- data/lib/isodoc/iso/html/wordstyle.scss +194 -32
- data/lib/isodoc/iso/iso.amendment.xsl +666 -193
- data/lib/isodoc/iso/iso.international-standard.xsl +666 -193
- data/lib/isodoc/iso/metadata.rb +3 -2
- data/lib/isodoc/iso/presentation_xml_convert.rb +15 -14
- data/lib/isodoc/iso/sts_convert.rb +10 -13
- data/lib/isodoc/iso/word_convert.rb +153 -39
- data/lib/isodoc/iso/xref.rb +44 -29
- data/lib/metanorma/iso/processor.rb +1 -0
- data/lib/metanorma/iso/version.rb +1 -1
- data/metanorma-iso.gemspec +3 -3
- data/spec/asciidoctor/base_spec.rb +426 -305
- data/spec/asciidoctor/blocks_spec.rb +96 -34
- data/spec/asciidoctor/cleanup_spec.rb +383 -25
- data/spec/asciidoctor/section_spec.rb +0 -14
- data/spec/asciidoctor/validate_spec.rb +218 -83
- data/spec/isodoc/amd_spec.rb +193 -201
- data/spec/isodoc/blocks_spec.rb +100 -88
- data/spec/isodoc/i18n_spec.rb +36 -36
- data/spec/isodoc/inline_spec.rb +2 -2
- data/spec/isodoc/iso_spec.rb +86 -138
- data/spec/isodoc/postproc_spec.rb +492 -442
- data/spec/isodoc/ref_spec.rb +6 -6
- data/spec/isodoc/section_spec.rb +301 -306
- data/spec/isodoc/table_spec.rb +166 -231
- data/spec/isodoc/terms_spec.rb +11 -8
- data/spec/isodoc/xref_spec.rb +147 -118
- data/spec/spec_helper.rb +16 -15
- metadata +8 -7
data/lib/isodoc/iso/metadata.rb
CHANGED
@@ -16,6 +16,7 @@ module IsoDoc
|
|
16
16
|
|
17
17
|
def status_abbrev(stage, substage, iter, draft, doctype)
|
18
18
|
return "" unless stage
|
19
|
+
|
19
20
|
if %w(technical-report technical-specification).include?(doctype)
|
20
21
|
stage = "DTS" if stage == "DIS"
|
21
22
|
stage = "FDTS" if stage == "FDIS"
|
@@ -37,12 +38,12 @@ module IsoDoc
|
|
37
38
|
set(:statusabbr, status_abbrev(docstatus["abbreviation"] || "??",
|
38
39
|
isoxml&.at(ns("//bibdata/status/substage"))&.text,
|
39
40
|
isoxml&.at(ns("//bibdata/status/iteration"))&.text,
|
40
|
-
isoxml&.at(ns("//version/draft"))&.text,
|
41
|
+
isoxml&.at(ns("//bibdata/version/draft"))&.text,
|
41
42
|
isoxml&.at(ns("//bibdata/ext/doctype"))&.text))
|
42
43
|
unpublished(docstatus.text) and
|
43
44
|
set(:stageabbr, docstatus["abbreviation"])
|
44
45
|
end
|
45
|
-
revdate = isoxml.at(ns("//version/revision-date"))
|
46
|
+
revdate = isoxml.at(ns("//bibdata/version/revision-date"))
|
46
47
|
set(:revdate, revdate&.text)
|
47
48
|
end
|
48
49
|
|
@@ -26,23 +26,23 @@ module IsoDoc
|
|
26
26
|
@xrefs = Xref.new(lang, script, klass, labels, options)
|
27
27
|
end
|
28
28
|
|
29
|
-
def figure1(
|
30
|
-
return if labelled_ancestor(
|
29
|
+
def figure1(node)
|
30
|
+
return if labelled_ancestor(node) && node.ancestors("figure").empty?
|
31
31
|
|
32
|
-
lbl = @xrefs.anchor(
|
33
|
-
figname =
|
34
|
-
connective =
|
35
|
-
prefix_name(
|
32
|
+
lbl = @xrefs.anchor(node["id"], :label, false) or return
|
33
|
+
figname = node.parent.name == "figure" ? "" : "#{@i18n.figure} "
|
34
|
+
connective = node.parent.name == "figure" ? " " : " — "
|
35
|
+
prefix_name(node, connective, l10n("#{figname}#{lbl}"), "name")
|
36
36
|
end
|
37
37
|
|
38
|
-
def example1(
|
39
|
-
n = @xrefs.get[
|
38
|
+
def example1(node)
|
39
|
+
n = @xrefs.get[node["id"]]
|
40
40
|
lbl = if n.nil? || n[:label].nil? || n[:label].empty?
|
41
41
|
@i18n.example
|
42
42
|
else
|
43
43
|
l10n("#{@i18n.example} #{n[:label]}")
|
44
44
|
end
|
45
|
-
prefix_name(
|
45
|
+
prefix_name(node, " — ", lbl, "name")
|
46
46
|
end
|
47
47
|
|
48
48
|
def eref_localities1_zh(target, type, from, to, n, delim)
|
@@ -56,7 +56,8 @@ module IsoDoc
|
|
56
56
|
ret += "–#{to.text}" if to
|
57
57
|
loc = (@i18n.locality[type] || type.sub(/^locality:/, "").capitalize)
|
58
58
|
ret += " #{loc}" unless subsection && type == "clause" ||
|
59
|
-
type == "list" || target.match(/^IEV$|^IEC 60050-/) ||
|
59
|
+
type == "list" || target.match(/^IEV$|^IEC 60050-/) ||
|
60
|
+
n["droploc"] == "true"
|
60
61
|
ret += ")" if type == "list"
|
61
62
|
ret
|
62
63
|
end
|
@@ -95,10 +96,10 @@ module IsoDoc
|
|
95
96
|
end
|
96
97
|
end
|
97
98
|
|
98
|
-
def clause1(
|
99
|
-
if !
|
100
|
-
!%w(sections preface bibliography).include?(
|
101
|
-
|
99
|
+
def clause1(node)
|
100
|
+
if !node.at(ns("./title")) &&
|
101
|
+
!%w(sections preface bibliography).include?(node.parent.name)
|
102
|
+
node["inline-header"] = "true"
|
102
103
|
end
|
103
104
|
super
|
104
105
|
end
|
@@ -4,28 +4,25 @@ require "mn2sts"
|
|
4
4
|
module IsoDoc
|
5
5
|
module Iso
|
6
6
|
|
7
|
-
# A {Converter} implementation that generates HTML output, and a document
|
8
|
-
# schema encapsulation of the document for validation
|
9
|
-
#
|
10
7
|
class StsConvert < IsoDoc::XslfoPdfConvert
|
11
|
-
def initialize(
|
8
|
+
def initialize(_options) # rubocop:disable Lint/MissingSuper
|
12
9
|
@libdir = File.dirname(__FILE__)
|
13
10
|
@format = :sts
|
14
11
|
@suffix = "sts.xml"
|
15
12
|
end
|
16
13
|
|
17
|
-
def convert(
|
18
|
-
file = File.read(
|
19
|
-
|
20
|
-
/\.xml$/.match(
|
21
|
-
|
22
|
-
|
23
|
-
|
14
|
+
def convert(in_fname, file = nil, debug = false, out_fname = nil)
|
15
|
+
file = File.read(in_fname, encoding: "utf-8") if file.nil?
|
16
|
+
_docxml, filename, dir = convert_init(file, in_fname, debug)
|
17
|
+
unless /\.xml$/.match?(in_fname)
|
18
|
+
in_fname = Tempfile.open([filename, ".xml"], encoding: "utf-8") do |f|
|
19
|
+
f.write file
|
20
|
+
f.path
|
21
|
+
end
|
24
22
|
end
|
25
23
|
FileUtils.rm_rf dir
|
26
|
-
Mn2sts.convert(
|
24
|
+
Mn2sts.convert(in_fname, out_fname || "#{filename}.#{@suffix}")
|
27
25
|
end
|
28
26
|
end
|
29
27
|
end
|
30
28
|
end
|
31
|
-
|
@@ -14,34 +14,34 @@ module IsoDoc
|
|
14
14
|
@htmlToClevels = 3 if @htmlToClevels.zero?
|
15
15
|
end
|
16
16
|
|
17
|
+
def font_choice(options)
|
18
|
+
if options[:script] == "Hans" then '"Source Han Sans",serif'
|
19
|
+
else '"Cambria",serif'
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
17
23
|
def default_fonts(options)
|
18
|
-
{
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
monospacefontsize: "9.0pt",
|
26
|
-
smallerfontsize: "10.0pt",
|
27
|
-
footnotefontsize: "10.0pt",
|
28
|
-
}
|
24
|
+
{ bodyfont: font_choice(options),
|
25
|
+
headerfont: font_choice(options),
|
26
|
+
monospacefont: '"Courier New",monospace',
|
27
|
+
normalfontsize: "11.0pt",
|
28
|
+
monospacefontsize: "9.0pt",
|
29
|
+
smallerfontsize: "10.0pt",
|
30
|
+
footnotefontsize: "10.0pt" }
|
29
31
|
end
|
30
32
|
|
31
33
|
def default_file_locations(options)
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
olstyle: "l2",
|
44
|
-
}
|
34
|
+
a = options[:alt] ? "style-human.scss" : "style-iso.scss"
|
35
|
+
{ htmlstylesheet: html_doc_path(a),
|
36
|
+
htmlcoverpage: html_doc_path("html_iso_titlepage.html"),
|
37
|
+
htmlintropage: html_doc_path("html_iso_intro.html"),
|
38
|
+
wordstylesheet: html_doc_path("wordstyle.scss"),
|
39
|
+
standardstylesheet: html_doc_path("isodoc.scss"),
|
40
|
+
header: html_doc_path("header.html"),
|
41
|
+
wordcoverpage: html_doc_path("word_iso_titlepage.html"),
|
42
|
+
wordintropage: html_doc_path("word_iso_intro.html"),
|
43
|
+
ulstyle: "l3",
|
44
|
+
olstyle: "l2" }
|
45
45
|
end
|
46
46
|
|
47
47
|
def make_body(xml, docxml)
|
@@ -54,9 +54,10 @@ module IsoDoc
|
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
57
|
-
def colophon(body,
|
58
|
-
stage =
|
57
|
+
def colophon(body, _docxml)
|
58
|
+
stage = @meta.get[:stage_int]
|
59
59
|
return if !stage.nil? && stage < 60
|
60
|
+
|
60
61
|
body.br **{ clear: "all", style: "page-break-before:left;"\
|
61
62
|
"mso-break-type:section-break" }
|
62
63
|
body.div **{ class: "colophon" } do |div|
|
@@ -67,35 +68,55 @@ module IsoDoc
|
|
67
68
|
super
|
68
69
|
xml.xpath("//div[@class = 'figure']//table[@class = 'dl']").each do |t|
|
69
70
|
t["class"] = "figdl"
|
70
|
-
d = t.add_previous_sibling("<div class='figdl'
|
71
|
+
d = t.add_previous_sibling("<div class='figdl' "\
|
72
|
+
"style='page-break-after:avoid;'/>")
|
71
73
|
t.parent = d.first
|
72
74
|
end
|
73
75
|
end
|
74
76
|
|
75
77
|
# force Annex h2 down to be p.h2Annex, so it is not picked up by ToC
|
76
|
-
def word_annex_cleanup1(docxml,
|
77
|
-
docxml.xpath("//h#{
|
78
|
+
def word_annex_cleanup1(docxml, lvl)
|
79
|
+
docxml.xpath("//h#{lvl}[ancestor::*[@class = 'Section3']]").each do |h2|
|
78
80
|
h2.name = "p"
|
79
|
-
h2["class"] = "h#{
|
81
|
+
h2["class"] = "h#{lvl}Annex"
|
80
82
|
end
|
81
83
|
end
|
82
84
|
|
83
85
|
def word_annex_cleanup(docxml)
|
84
|
-
word_annex_cleanup1(docxml,
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
86
|
+
(2..6).each { |i| word_annex_cleanup1(docxml, i) }
|
87
|
+
end
|
88
|
+
|
89
|
+
def word_annex_cleanup_h1(docxml)
|
90
|
+
docxml.xpath("//h1[@class = 'Annex']").each do |h|
|
91
|
+
h.name = "p"
|
92
|
+
h["class"] = "ANNEX"
|
93
|
+
end
|
94
|
+
%w(BiblioTitle ForewordTitle IntroTitle).each do |s|
|
95
|
+
docxml.xpath("//*[@class = '#{s}']").each do |h|
|
96
|
+
h.name = "p"
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
def style_cleanup(docxml)
|
102
|
+
word_annex_cleanup_h1(docxml)
|
103
|
+
style_cleanup1(docxml)
|
104
|
+
end
|
105
|
+
|
106
|
+
def style_cleanup1(docxml)
|
107
|
+
docxml.xpath("//*[@class = 'example']").each do |p|
|
108
|
+
p["class"] = "Example"
|
109
|
+
end
|
89
110
|
end
|
90
111
|
|
91
112
|
def authority_hdr_cleanup(docxml)
|
92
|
-
docxml&.xpath("//div[@class = 'boilerplate-license']")
|
113
|
+
docxml&.xpath("//div[@class = 'boilerplate-license']")&.each do |d|
|
93
114
|
d.xpath(".//h1").each do |p|
|
94
115
|
p.name = "p"
|
95
116
|
p["class"] = "zzWarningHdr"
|
96
117
|
end
|
97
118
|
end
|
98
|
-
docxml&.xpath("//div[@class = 'boilerplate-copyright']")
|
119
|
+
docxml&.xpath("//div[@class = 'boilerplate-copyright']")&.each do |d|
|
99
120
|
d.xpath(".//h1").each do |p|
|
100
121
|
p.name = "p"
|
101
122
|
p["class"] = "zzCopyrightHdr"
|
@@ -120,11 +141,104 @@ module IsoDoc
|
|
120
141
|
def word_cleanup(docxml)
|
121
142
|
authority_hdr_cleanup(docxml)
|
122
143
|
super
|
144
|
+
style_cleanup(docxml)
|
123
145
|
docxml
|
124
146
|
end
|
125
147
|
|
126
|
-
def
|
127
|
-
|
148
|
+
def word_toc_preface(level)
|
149
|
+
<<~TOC.freeze
|
150
|
+
<span lang="EN-GB"><span
|
151
|
+
style='mso-element:field-begin'></span><span
|
152
|
+
style='mso-spacerun:yes'> </span>TOC
|
153
|
+
\\o "1-#{level}" \\h \\z \\t "Heading
|
154
|
+
1;1;ANNEX;1;Biblio Title;1;Foreword Title;1;Intro Title;1" <span
|
155
|
+
style='mso-element:field-separator'></span></span>
|
156
|
+
TOC
|
157
|
+
end
|
158
|
+
|
159
|
+
def footnote_reference_format(link)
|
160
|
+
link.children =
|
161
|
+
"<span class='MsoFootnoteReference'>#{link.children.to_xml}</span>)"
|
162
|
+
end
|
163
|
+
|
164
|
+
def bibliography_attrs
|
165
|
+
{ class: "BiblioTitle" }
|
166
|
+
end
|
167
|
+
|
168
|
+
def bibliography(xml, out)
|
169
|
+
f = xml.at(ns(bibliography_xpath)) and f["hidden"] != "true" or return
|
170
|
+
page_break(out)
|
171
|
+
out.div do |div|
|
172
|
+
div.h1 **bibliography_attrs do |h1|
|
173
|
+
f&.at(ns("./title"))&.children&.each { |c2| parse(c2, h1) }
|
174
|
+
end
|
175
|
+
biblio_list(f, div, true)
|
176
|
+
end
|
177
|
+
end
|
178
|
+
|
179
|
+
def bibliography_parse(node, out)
|
180
|
+
node["hidden"] != true or return
|
181
|
+
out.div do |div|
|
182
|
+
clause_parse_title(node, div, node.at(ns("./title")), out,
|
183
|
+
bibliography_attrs)
|
184
|
+
biblio_list(node, div, true)
|
185
|
+
end
|
186
|
+
end
|
187
|
+
|
188
|
+
def para_class(node)
|
189
|
+
if !node.ancestors("definition").empty? && !@in_footnote
|
190
|
+
"Definition"
|
191
|
+
elsif !node.ancestors("foreword").empty? && !@in_footnote
|
192
|
+
"ForewordText"
|
193
|
+
else
|
194
|
+
super
|
195
|
+
end
|
196
|
+
end
|
197
|
+
|
198
|
+
def termref_attrs
|
199
|
+
{ class: "Source" }
|
200
|
+
end
|
201
|
+
|
202
|
+
def termref_parse(node, out)
|
203
|
+
out.p **termref_attrs do |p|
|
204
|
+
p << "[TERMREF]"
|
205
|
+
node.children.each { |n| parse(n, p) }
|
206
|
+
p << "[/TERMREF]"
|
207
|
+
end
|
208
|
+
end
|
209
|
+
|
210
|
+
def figure_name_attrs(node)
|
211
|
+
s = node.ancestors("annex").empty? ? "FigureTitle" : "AnnexFigureTitle"
|
212
|
+
{ class: s, style: "text-align:center;" }
|
213
|
+
end
|
214
|
+
|
215
|
+
def figure_name_parse(node, div, name)
|
216
|
+
return if name.nil?
|
217
|
+
|
218
|
+
div.p **figure_name_attrs(node) do |p|
|
219
|
+
name.children.each { |n| parse(n, p) }
|
220
|
+
end
|
221
|
+
end
|
222
|
+
|
223
|
+
def table_title_attrs(node)
|
224
|
+
s = node.ancestors("annex").empty? ? "Tabletitle" : "AnnexTableTitle"
|
225
|
+
{ class: s, style: "text-align:center;" }
|
226
|
+
end
|
227
|
+
|
228
|
+
def table_title_parse(node, out)
|
229
|
+
name = node.at(ns("./name")) or return
|
230
|
+
out.p **table_title_attrs(node) do |p|
|
231
|
+
name&.children&.each { |n| parse(n, p) }
|
232
|
+
end
|
233
|
+
end
|
234
|
+
|
235
|
+
def annex_name(_annex, name, div)
|
236
|
+
return if name.nil?
|
237
|
+
|
238
|
+
name&.at(ns("./strong"))&.remove # supplied by CSS list numbering
|
239
|
+
div.h1 **{ class: "Annex" } do |t|
|
240
|
+
name.children.each { |c2| parse(c2, t) }
|
241
|
+
end
|
128
242
|
end
|
129
243
|
|
130
244
|
include BaseConvert
|
data/lib/isodoc/iso/xref.rb
CHANGED
@@ -4,25 +4,35 @@ module IsoDoc
|
|
4
4
|
end
|
5
5
|
|
6
6
|
class Xref < IsoDoc::Xref
|
7
|
-
def initial_anchor_names(
|
8
|
-
if @klass.amd(
|
9
|
-
|
10
|
-
sequential_asset_names(d.xpath(ns("//preface/*")))
|
11
|
-
d.xpath(ns("//sections/clause")).each { |c| c.element? and preface_names(c) }
|
12
|
-
middle_section_asset_names(d)
|
13
|
-
termnote_anchor_names(d)
|
14
|
-
termexample_anchor_names(d)
|
7
|
+
def initial_anchor_names(doc)
|
8
|
+
if @klass.amd(doc)
|
9
|
+
initial_anchor_names_amd(doc)
|
15
10
|
else
|
16
11
|
super
|
17
12
|
end
|
18
|
-
introduction_names(
|
13
|
+
introduction_names(doc.at(ns("//introduction")))
|
14
|
+
end
|
15
|
+
|
16
|
+
def initial_anchor_names_amd(doc)
|
17
|
+
doc.xpath(ns("//preface/*")).each do |c|
|
18
|
+
c.element? and preface_names(c)
|
19
|
+
end
|
20
|
+
sequential_asset_names(doc.xpath(ns("//preface/*")))
|
21
|
+
doc.xpath(ns("//sections/clause")).each do |c|
|
22
|
+
c.element? and preface_names(c)
|
23
|
+
end
|
24
|
+
middle_section_asset_names(doc)
|
25
|
+
termnote_anchor_names(doc)
|
26
|
+
termexample_anchor_names(doc)
|
19
27
|
end
|
20
28
|
|
21
29
|
# we can reference 0-number clauses in introduction
|
22
30
|
def introduction_names(clause)
|
23
31
|
return if clause.nil?
|
24
|
-
|
25
|
-
|
32
|
+
|
33
|
+
clause.at(ns("./clause")) and
|
34
|
+
@anchors[clause["id"]] = { label: "0", level: 1, type: "clause",
|
35
|
+
xref: clause.at(ns("./title"))&.text }
|
26
36
|
i = Counter.new
|
27
37
|
clause.xpath(ns("./clause")).each do |c|
|
28
38
|
i.increment(c)
|
@@ -35,17 +45,19 @@ module IsoDoc
|
|
35
45
|
super
|
36
46
|
end
|
37
47
|
|
38
|
-
def appendix_names(clause,
|
48
|
+
def appendix_names(clause, _num)
|
39
49
|
i = Counter.new
|
40
50
|
clause.xpath(ns("./appendix")).each do |c|
|
41
51
|
i.increment(c)
|
42
|
-
@anchors[c["id"]] = anchor_struct(i.print, nil, @labels["appendix"],
|
52
|
+
@anchors[c["id"]] = anchor_struct(i.print, nil, @labels["appendix"],
|
53
|
+
"clause")
|
43
54
|
@anchors[c["id"]][:level] = 2
|
44
55
|
@anchors[c["id"]][:container] = clause["id"]
|
45
56
|
j = Counter.new
|
46
57
|
c.xpath(ns("./clause | ./references")).each do |c1|
|
47
58
|
j.increment(c1)
|
48
|
-
|
59
|
+
lbl = "#{@labels['appendix']} #{i.print}.#{j.print}"
|
60
|
+
appendix_names1(c1, l10n(lbl), 3, clause["id"])
|
49
61
|
end
|
50
62
|
end
|
51
63
|
end
|
@@ -56,8 +68,8 @@ module IsoDoc
|
|
56
68
|
# subclauses are not prefixed with "Clause"
|
57
69
|
i = Counter.new
|
58
70
|
clause.xpath(ns("./clause | ./terms | ./term | ./definitions | "\
|
59
|
-
"./references"))
|
60
|
-
|
71
|
+
"./references"))
|
72
|
+
.each do |c|
|
61
73
|
i.increment(c)
|
62
74
|
section_names1(c, "#{num}.#{i.print}", level + 1)
|
63
75
|
end
|
@@ -73,7 +85,8 @@ module IsoDoc
|
|
73
85
|
end
|
74
86
|
|
75
87
|
def appendix_names1(clause, num, level, container)
|
76
|
-
@anchors[clause["id"]] = { label: num, xref: num, level: level,
|
88
|
+
@anchors[clause["id"]] = { label: num, xref: num, level: level,
|
89
|
+
container: container }
|
77
90
|
i = Counter.new
|
78
91
|
clause.xpath(ns("./clause | ./references")).each do |c|
|
79
92
|
i.increment(c)
|
@@ -86,28 +99,30 @@ module IsoDoc
|
|
86
99
|
clause.xpath(ns(".//formula")).each do |t|
|
87
100
|
next if t["id"].nil? || t["id"].empty?
|
88
101
|
|
89
|
-
@anchors[t["id"]] =
|
90
|
-
|
91
|
-
|
92
|
-
|
102
|
+
@anchors[t["id"]] = anchor_struct(
|
103
|
+
"#{num}#{hiersep}#{c.increment(t).print}", t,
|
104
|
+
t["inequality"] ? @labels["inequality"] : @labels["formula"],
|
105
|
+
"formula", t["unnumbered"]
|
106
|
+
)
|
93
107
|
end
|
94
108
|
end
|
95
109
|
|
96
|
-
def figure_anchor(
|
97
|
-
@anchors[
|
110
|
+
def figure_anchor(elem, sublabel, label)
|
111
|
+
@anchors[elem["id"]] = anchor_struct(
|
98
112
|
(sublabel ? "#{label} #{sublabel}" : label),
|
99
|
-
nil, @labels["figure"], "figure",
|
100
|
-
|
101
|
-
|
113
|
+
nil, @labels["figure"], "figure", elem["unnumbered"]
|
114
|
+
)
|
115
|
+
sublabel && elem["unnumbered"] != "true" and
|
116
|
+
@anchors[elem["id"]][:label] = sublabel
|
102
117
|
end
|
103
118
|
|
104
119
|
def sequential_figure_names(clause)
|
105
120
|
c = IsoDoc::XrefGen::Counter.new
|
106
121
|
j = 0
|
107
|
-
clause.xpath(ns(".//figure | .//sourcecode[not(ancestor::example)]"))
|
108
|
-
each do |t|
|
122
|
+
clause.xpath(ns(".//figure | .//sourcecode[not(ancestor::example)]"))
|
123
|
+
.each do |t|
|
109
124
|
j = subfigure_increment(j, c, t)
|
110
|
-
sublabel = j.zero? ? nil : "#{(j+96).chr})"
|
125
|
+
sublabel = j.zero? ? nil : "#{(j + 96).chr})"
|
111
126
|
next if t["id"].nil? || t["id"].empty?
|
112
127
|
|
113
128
|
figure_anchor(t, sublabel, c.print)
|