isodoc 1.7.6.1 → 1.7.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/isodoc/class_utils.rb +23 -0
- data/lib/isodoc/convert.rb +1 -0
- data/lib/isodoc/presentation_function/inline.rb +14 -10
- data/lib/isodoc/version.rb +1 -1
- data/lib/isodoc/xref/xref_sect_gen.rb +134 -129
- data/lib/isodoc/xslfo_convert.rb +7 -6
- data/spec/assets/i18n.yaml +3 -1
- data/spec/isodoc/i18n_spec.rb +3 -3
- data/spec/isodoc/inline_spec.rb +122 -6
- data/spec/isodoc/xslfo_convert_spec.rb +16 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5df030f2a89267d4acde57361f2c6338b29bf5928b5bb3c7b24a18903adf1531
|
4
|
+
data.tar.gz: 7e1923d7293b6b0703a15799e9bc3334637145adf8219c4230c63809267770cf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 24e8cf7a71167da62d5bdea85b009f982996e1513db82b42d6c01edf031b045dac7f9992a10e29946368df70dc32301e5edfa5937fad11e49e661edf8311058c
|
7
|
+
data.tar.gz: f61bb6a9b3833c0c4080c0804ae12869f15051ebec0f3fa6b3cc7d925b44de41559d472dde0ad737f54b02b040532a0a944e90a563fd1fcec4566965bda26fa4
|
data/lib/isodoc/class_utils.rb
CHANGED
@@ -27,5 +27,28 @@ module IsoDoc
|
|
27
27
|
end.join
|
28
28
|
Liquid::Template.parse(doc)
|
29
29
|
end
|
30
|
+
|
31
|
+
def case_strict(text, casing, script)
|
32
|
+
return text unless %w(Latn Cyrl Grek Armn).include?(script)
|
33
|
+
|
34
|
+
letters = text.chars
|
35
|
+
case casing
|
36
|
+
when "capital" then letters.first.upcase!
|
37
|
+
when "lowercase" then letters.first.downcase!
|
38
|
+
end
|
39
|
+
letters.join
|
40
|
+
end
|
41
|
+
|
42
|
+
def case_with_markup(linkend, casing, script)
|
43
|
+
seen = false
|
44
|
+
xml = Nokogiri::XML("<root>#{linkend}</root>")
|
45
|
+
xml.traverse do |b|
|
46
|
+
next unless b.text? && !seen
|
47
|
+
|
48
|
+
b.replace(Common::case_strict(b.text, casing, script))
|
49
|
+
seen = true
|
50
|
+
end
|
51
|
+
xml.root.children.to_xml
|
52
|
+
end
|
30
53
|
end
|
31
54
|
end
|
data/lib/isodoc/convert.rb
CHANGED
@@ -7,13 +7,16 @@ module IsoDoc
|
|
7
7
|
l10n("#{@xrefs.anchor(container, :xref)}, #{linkend}")
|
8
8
|
end
|
9
9
|
|
10
|
+
def anchor_value(id)
|
11
|
+
@xrefs.anchor(id, :value) || @xrefs.anchor(id, :label) ||
|
12
|
+
@xrefs.anchor(id, :xref)
|
13
|
+
end
|
14
|
+
|
10
15
|
def anchor_linkend(node, linkend)
|
11
16
|
if node["citeas"].nil? && node["bibitemid"]
|
12
17
|
return @xrefs.anchor(node["bibitemid"], :xref) || "???"
|
13
18
|
elsif node["target"] && node["droploc"]
|
14
|
-
return
|
15
|
-
@xrefs.anchor(node["target"], :label) ||
|
16
|
-
@xrefs.anchor(node["target"], :xref) || "???"
|
19
|
+
return anchor_value(node["target"]) || "???"
|
17
20
|
elsif node["target"] && !/.#./.match(node["target"])
|
18
21
|
linkend = anchor_linkend1(node)
|
19
22
|
end
|
@@ -27,14 +30,15 @@ module IsoDoc
|
|
27
30
|
(container && get_note_container_id(node) != container &&
|
28
31
|
@xrefs.get[node["target"]]) and
|
29
32
|
linkend = prefix_container(container, linkend, node["target"])
|
30
|
-
capitalise_xref(node, linkend)
|
33
|
+
capitalise_xref(node, linkend, anchor_value(node["target"]))
|
31
34
|
end
|
32
35
|
|
33
|
-
def capitalise_xref(node, linkend)
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
36
|
+
def capitalise_xref(node, linkend, label)
|
37
|
+
linktext = linkend.gsub(/<[^>]+>/, "")
|
38
|
+
(label && !label.empty? && /^#{Regexp.escape(label)}/.match?(linktext) ||
|
39
|
+
linktext[0, 1].match?(/\p{Upper}/)) and return linkend
|
40
|
+
node["case"] and
|
41
|
+
return Common::case_with_markup(linkend, node["case"], @script)
|
38
42
|
|
39
43
|
capitalise_xref1(node, linkend)
|
40
44
|
end
|
@@ -43,7 +47,7 @@ module IsoDoc
|
|
43
47
|
prec = nearest_block_parent(node).xpath("./descendant-or-self::text()") &
|
44
48
|
node.xpath("./preceding::text()")
|
45
49
|
if prec.empty? || /(?!<[^.].)\.\s+$/.match(prec.map(&:text).join)
|
46
|
-
linkend
|
50
|
+
Common::case_with_markup(linkend, "capital", @script)
|
47
51
|
else linkend
|
48
52
|
end
|
49
53
|
end
|
data/lib/isodoc/version.rb
CHANGED
@@ -1,160 +1,165 @@
|
|
1
|
-
module IsoDoc
|
2
|
-
module
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
1
|
+
module IsoDoc
|
2
|
+
module XrefGen
|
3
|
+
module Sections
|
4
|
+
def back_anchor_names(docxml)
|
5
|
+
i = Counter.new("@")
|
6
|
+
docxml.xpath(ns("//annex")).each do |c|
|
7
|
+
i.increment(c)
|
8
|
+
annex_names(c, i.print)
|
9
|
+
end
|
10
|
+
docxml.xpath(ns(@klass.bibliography_xpath)).each do |b|
|
11
|
+
preface_names(b)
|
12
|
+
end
|
13
|
+
docxml.xpath(ns("//bibitem[not(ancestor::bibitem)]")).each do |ref|
|
14
|
+
reference_names(ref)
|
15
|
+
end
|
8
16
|
end
|
9
|
-
|
10
|
-
|
17
|
+
|
18
|
+
def initial_anchor_names(doc)
|
19
|
+
doc.xpath(ns("//preface/*")).each do |c|
|
20
|
+
c.element? and preface_names(c)
|
21
|
+
end
|
22
|
+
# potentially overridden in middle_section_asset_names()
|
23
|
+
sequential_asset_names(doc.xpath(ns("//preface/*")))
|
24
|
+
n = Counter.new
|
25
|
+
n = section_names(doc.at(ns("//clause[@type = 'scope']")), n, 1)
|
26
|
+
n = section_names(doc.at(ns(@klass.norm_ref_xpath)), n, 1)
|
27
|
+
n = section_names(doc.at(ns("//sections/terms | "\
|
28
|
+
"//sections/clause[descendant::terms]")), n, 1)
|
29
|
+
n = section_names(doc.at(ns("//sections/definitions")), n, 1)
|
30
|
+
clause_names(doc, n)
|
31
|
+
middle_section_asset_names(doc)
|
32
|
+
termnote_anchor_names(doc)
|
33
|
+
termexample_anchor_names(doc)
|
11
34
|
end
|
12
|
-
|
13
|
-
|
35
|
+
|
36
|
+
def preface_clause_name(clause)
|
37
|
+
clause.at(ns("./title"))&.text || clause.name.capitalize
|
14
38
|
end
|
15
|
-
end
|
16
39
|
|
17
|
-
|
18
|
-
|
19
|
-
# potentially overridden in middle_section_asset_names()
|
20
|
-
sequential_asset_names(doc.xpath(ns("//preface/*")))
|
21
|
-
n = Counter.new
|
22
|
-
n = section_names(doc.at(ns("//clause[@type = 'scope']")), n, 1)
|
23
|
-
n = section_names(doc.at(ns(@klass.norm_ref_xpath)), n, 1)
|
24
|
-
n = section_names(doc.at(ns("//sections/terms | "\
|
25
|
-
"//sections/clause[descendant::terms]")), n, 1)
|
26
|
-
n = section_names(doc.at(ns("//sections/definitions")), n, 1)
|
27
|
-
clause_names(doc, n)
|
28
|
-
middle_section_asset_names(doc)
|
29
|
-
termnote_anchor_names(doc)
|
30
|
-
termexample_anchor_names(doc)
|
31
|
-
end
|
40
|
+
SUBCLAUSES =
|
41
|
+
"./clause | ./references | ./term | ./terms | ./definitions".freeze
|
32
42
|
|
33
|
-
|
34
|
-
clause
|
35
|
-
|
43
|
+
# in StanDoc, prefaces have no numbering; they are referenced only by title
|
44
|
+
def preface_names(clause)
|
45
|
+
return if clause.nil?
|
36
46
|
|
37
|
-
|
38
|
-
|
47
|
+
@anchors[clause["id"]] =
|
48
|
+
{ label: nil, level: 1, xref: preface_clause_name(clause),
|
49
|
+
type: "clause" }
|
50
|
+
clause.xpath(ns(SUBCLAUSES)).each_with_index do |c, i|
|
51
|
+
preface_names1(c, c.at(ns("./title"))&.text,
|
52
|
+
"#{preface_clause_name(clause)}, #{i + 1}", 2)
|
53
|
+
end
|
54
|
+
end
|
39
55
|
|
40
|
-
|
41
|
-
|
42
|
-
|
56
|
+
def preface_names1(clause, title, parent_title, level)
|
57
|
+
label = title || parent_title
|
58
|
+
@anchors[clause["id"]] =
|
59
|
+
{ label: nil, level: level, xref: label, type: "clause" }
|
60
|
+
clause.xpath(ns(SUBCLAUSES)).each_with_index do |c, i|
|
61
|
+
preface_names1(c, c.at(ns("./title"))&.text, "#{label} #{i + 1}",
|
62
|
+
level + 1)
|
63
|
+
end
|
64
|
+
end
|
43
65
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
66
|
+
def middle_section_asset_names(doc)
|
67
|
+
middle_sections = "//clause[@type = 'scope'] | "\
|
68
|
+
"#{@klass.norm_ref_xpath} | "\
|
69
|
+
"//sections/terms | //preface/* | "\
|
70
|
+
"//sections/definitions | //clause[parent::sections]"
|
71
|
+
sequential_asset_names(doc.xpath(ns(middle_sections)))
|
50
72
|
end
|
51
|
-
end
|
52
73
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
clause.xpath(ns(SUBCLAUSES)).each_with_index do |c, i|
|
58
|
-
preface_names1(c, c.at(ns("./title"))&.text, "#{label} #{i + 1}",
|
59
|
-
level + 1)
|
74
|
+
def clause_names(docxml, num)
|
75
|
+
docxml.xpath(ns(@klass.middle_clause(docxml))).each_with_index do |c, _i|
|
76
|
+
section_names(c, num, 1)
|
77
|
+
end
|
60
78
|
end
|
61
|
-
end
|
62
79
|
|
63
|
-
|
64
|
-
|
65
|
-
"#{@klass.norm_ref_xpath} | "\
|
66
|
-
"//sections/terms | //preface/* | "\
|
67
|
-
"//sections/definitions | //clause[parent::sections]"
|
68
|
-
sequential_asset_names(doc.xpath(ns(middle_sections)))
|
69
|
-
end
|
80
|
+
def section_names(clause, num, lvl)
|
81
|
+
return num if clause.nil?
|
70
82
|
|
71
|
-
|
72
|
-
|
73
|
-
|
83
|
+
num.increment(clause)
|
84
|
+
@anchors[clause["id"]] =
|
85
|
+
{ label: num.print, xref: l10n("#{@labels['clause']} #{num.print}"),
|
86
|
+
level: lvl, type: "clause" }
|
87
|
+
i = Counter.new
|
88
|
+
clause.xpath(ns(SUBCLAUSES)).each do |c|
|
89
|
+
i.increment(c)
|
90
|
+
section_names1(c, "#{num.print}.#{i.print}", lvl + 1)
|
91
|
+
end
|
92
|
+
num
|
74
93
|
end
|
75
|
-
end
|
76
94
|
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
i.increment(c)
|
87
|
-
section_names1(c, "#{num.print}.#{i.print}", lvl + 1)
|
95
|
+
def section_names1(clause, num, level)
|
96
|
+
@anchors[clause["id"]] =
|
97
|
+
{ label: num, level: level, xref: l10n("#{@labels['clause']} #{num}"),
|
98
|
+
type: "clause" }
|
99
|
+
i = Counter.new
|
100
|
+
clause.xpath(ns(SUBCLAUSES)).each do |c|
|
101
|
+
i.increment(c)
|
102
|
+
section_names1(c, "#{num}.#{i.print}", level + 1)
|
103
|
+
end
|
88
104
|
end
|
89
|
-
num
|
90
|
-
end
|
91
105
|
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
i.increment(c)
|
99
|
-
section_names1(c, "#{num}.#{i.print}", level + 1)
|
106
|
+
def annex_name_lbl(clause, num)
|
107
|
+
obl = l10n("(#{@labels['inform_annex']})")
|
108
|
+
clause["obligation"] == "normative" and
|
109
|
+
obl = l10n("(#{@labels['norm_annex']})")
|
110
|
+
title = Common::case_with_markup(@labels["annex"], "capital", @script)
|
111
|
+
l10n("<strong>#{title} #{num}</strong><br/>#{obl}")
|
100
112
|
end
|
101
|
-
end
|
102
113
|
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
114
|
+
def single_annex_special_section(clause)
|
115
|
+
a = clause.xpath(ns("./references | ./terms | ./definitions"))
|
116
|
+
a.size == 1 or return nil
|
117
|
+
clause.xpath(ns("./clause | ./p | ./table | ./ol | ./ul | ./dl | "\
|
118
|
+
"./note | ./admonition | ./figure")).empty? or
|
119
|
+
return nil
|
120
|
+
a[0]
|
121
|
+
end
|
109
122
|
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
123
|
+
def annex_names(clause, num)
|
124
|
+
@anchors[clause["id"]] = { label: annex_name_lbl(clause, num),
|
125
|
+
type: "clause", value: num.to_s, level: 1,
|
126
|
+
xref: "#{@labels['annex']} #{num}" }
|
127
|
+
if a = single_annex_special_section(clause)
|
128
|
+
annex_names1(a, num.to_s, 1)
|
129
|
+
else
|
130
|
+
i = Counter.new
|
131
|
+
clause.xpath(ns(SUBCLAUSES)).each do |c|
|
132
|
+
i.increment(c)
|
133
|
+
annex_names1(c, "#{num}.#{i.print}", 2)
|
134
|
+
end
|
135
|
+
end
|
136
|
+
hierarchical_asset_names(clause, num)
|
137
|
+
end
|
118
138
|
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
xref: "#{@labels['annex']} #{num}", level: 1 }
|
123
|
-
if a = single_annex_special_section(clause)
|
124
|
-
annex_names1(a, num.to_s, 1)
|
125
|
-
else
|
139
|
+
def annex_names1(clause, num, level)
|
140
|
+
@anchors[clause["id"]] = { xref: "#{@labels['annex']} #{num}",
|
141
|
+
label: num, level: level, type: "clause" }
|
126
142
|
i = Counter.new
|
127
143
|
clause.xpath(ns(SUBCLAUSES)).each do |c|
|
128
144
|
i.increment(c)
|
129
|
-
annex_names1(c, "#{num}.#{i.print}",
|
145
|
+
annex_names1(c, "#{num}.#{i.print}", level + 1)
|
130
146
|
end
|
131
147
|
end
|
132
|
-
hierarchical_asset_names(clause, num)
|
133
|
-
end
|
134
148
|
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
149
|
+
ISO_PUBLISHER_XPATH =
|
150
|
+
"./contributor[xmlns:role/@type = 'publisher']/"\
|
151
|
+
"organization[abbreviation = 'ISO' or xmlns:abbreviation = 'IEC' or "\
|
152
|
+
"xmlns:name = 'International Organization for Standardization' or "\
|
153
|
+
"xmlns:name = 'International Electrotechnical Commission']".freeze
|
154
|
+
|
155
|
+
def reference_names(ref)
|
156
|
+
# isopub = ref.at(ns(ISO_PUBLISHER_XPATH))
|
157
|
+
ids = @klass.bibitem_ref_code(ref)
|
158
|
+
identifiers = @klass.render_identifier(ids)
|
159
|
+
# date = ref.at(ns("./date[@type = 'published']"))
|
160
|
+
reference = @klass.docid_l10n(identifiers[0] || identifiers[1])
|
161
|
+
@anchors[ref["id"]] = { xref: reference }
|
142
162
|
end
|
143
163
|
end
|
144
|
-
|
145
|
-
ISO_PUBLISHER_XPATH =
|
146
|
-
"./contributor[xmlns:role/@type = 'publisher']/"\
|
147
|
-
"organization[abbreviation = 'ISO' or xmlns:abbreviation = 'IEC' or "\
|
148
|
-
"xmlns:name = 'International Organization for Standardization' or "\
|
149
|
-
"xmlns:name = 'International Electrotechnical Commission']".freeze
|
150
|
-
|
151
|
-
def reference_names(ref)
|
152
|
-
# isopub = ref.at(ns(ISO_PUBLISHER_XPATH))
|
153
|
-
ids = @klass.bibitem_ref_code(ref)
|
154
|
-
identifiers = @klass.render_identifier(ids)
|
155
|
-
# date = ref.at(ns("./date[@type = 'published']"))
|
156
|
-
reference = @klass.docid_l10n(identifiers[0] || identifiers[1])
|
157
|
-
@anchors[ref["id"]] = { xref: reference }
|
158
|
-
end
|
159
164
|
end
|
160
165
|
end
|
data/lib/isodoc/xslfo_convert.rb
CHANGED
@@ -20,12 +20,13 @@ module IsoDoc
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def pdf_options(_docxml)
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
23
|
+
ret = ""
|
24
|
+
font_manifest_file = @options.dig(MN2PDF_OPTIONS,
|
25
|
+
MN2PDF_FONT_MANIFEST) and
|
26
|
+
ret += " --font-manifest #{font_manifest_file}"
|
27
|
+
@aligncrosselements && !@aligncrosselements.empty? and
|
28
|
+
ret += %( --param align-cross-elements = "#{@aligncrosselements.gsub(/,/, ' ')}")
|
29
|
+
ret
|
29
30
|
end
|
30
31
|
|
31
32
|
def convert(input_filename, file = nil, debug = false,
|
data/spec/assets/i18n.yaml
CHANGED
@@ -6,12 +6,14 @@ source: SOURCE
|
|
6
6
|
modified: modified
|
7
7
|
scope: Amplekso
|
8
8
|
symbols: Simboloj kai mallongigitaj terminoj
|
9
|
-
annex:
|
9
|
+
annex: <strong>aldono</strong>
|
10
10
|
normref: Normaj citaĵoj
|
11
11
|
bibliography: Bibliografio
|
12
12
|
inform_annex: informa
|
13
13
|
all_parts: ĉiuj partoj
|
14
14
|
norm_annex: normative
|
15
|
+
figure: figur-etikedo duvorta
|
16
|
+
example: Ekzempl-etikedo Duvorta
|
15
17
|
note: NOTO
|
16
18
|
locality: {
|
17
19
|
table: Tabelo
|
data/spec/isodoc/i18n_spec.rb
CHANGED
@@ -877,7 +877,7 @@ RSpec.describe IsoDoc do
|
|
877
877
|
<ext>
|
878
878
|
<doctype language="">brochure</doctype><doctype language="eo">broŝuro</doctype>
|
879
879
|
</ext>
|
880
|
-
</bibdata><localized-strings><localized-string key="foreword" language="eo">Antaŭparolo</localized-string><localized-string key="introduction" language="eo">Enkonduko</localized-string><localized-string key="clause" language="eo">klaŭzo</localized-string><localized-string key="table" language="eo">tabelo</localized-string><localized-string key="source" language="eo">SOURCE</localized-string><localized-string key="modified" language="eo">modified</localized-string><localized-string key="scope" language="eo">Amplekso</localized-string><localized-string key="symbols" language="eo">Simboloj kai mallongigitaj terminoj</localized-string><localized-string key="annex" language="eo">
|
880
|
+
</bibdata><localized-strings><localized-string key="foreword" language="eo">Antaŭparolo</localized-string><localized-string key="introduction" language="eo">Enkonduko</localized-string><localized-string key="clause" language="eo">klaŭzo</localized-string><localized-string key="table" language="eo">tabelo</localized-string><localized-string key="source" language="eo">SOURCE</localized-string><localized-string key="modified" language="eo">modified</localized-string><localized-string key="scope" language="eo">Amplekso</localized-string><localized-string key="symbols" language="eo">Simboloj kai mallongigitaj terminoj</localized-string><localized-string key="annex" language="eo"><strong>aldono</strong></localized-string><localized-string key="normref" language="eo">Normaj citaĵoj</localized-string><localized-string key="bibliography" language="eo">Bibliografio</localized-string><localized-string key="inform_annex" language="eo">informa</localized-string><localized-string key="all_parts" language="eo">ĉiuj partoj</localized-string><localized-string key="norm_annex" language="eo">normative</localized-string><localized-string key='figure' language='eo'>figur-etikedo duvorta</localized-string><localized-string key='example' language='eo'>Ekzempl-etikedo Duvorta</localized-string><localized-string key="note" language="eo">NOTO</localized-string><localized-string key="locality.table" language="eo">Tabelo</localized-string><localized-string key="doctype_dict.brochure" language="eo">broŝuro</localized-string><localized-string key="doctype_dict.conference_proceedings" language="eo">konferencaktoj</localized-string><localized-string key="stage_dict.published" language="eo">publikigita</localized-string><localized-string key="substage_dict.withdrawn" language="eo">fortirita</localized-string><localized-string key="array.0" language="eo">elem1</localized-string><localized-string key="array.1" language="eo">elem2</localized-string><localized-string key="array.2.elem3" language="eo">elem4</localized-string><localized-string key="array.2.elem5" language="eo">elem6</localized-string><localized-string key="language" language="eo">eo</localized-string><localized-string key="script" language="eo">Latn</localized-string></localized-strings>
|
881
881
|
<preface>
|
882
882
|
<foreword obligation="informative" displayorder="1">
|
883
883
|
<title>Foreword</title>
|
@@ -920,7 +920,7 @@ RSpec.describe IsoDoc do
|
|
920
920
|
<title depth="2">5.2.<tab/>Clause 4.2</title>
|
921
921
|
</clause></clause>
|
922
922
|
</sections><annex id="P" inline-header="false" obligation="normative" displayorder="8">
|
923
|
-
<title><strong>Aldono A</strong><br/>(normative)<br/><br/><strong>Annex</strong></title>
|
923
|
+
<title><strong><strong>Aldono</strong> A</strong><br/>(normative)<br/><br/><strong>Annex</strong></title>
|
924
924
|
<clause id="Q" inline-header="false" obligation="normative">
|
925
925
|
<title depth="2">A.1.<tab/>Annex A.1</title>
|
926
926
|
<clause id="Q1" inline-header="false" obligation="normative">
|
@@ -1041,7 +1041,7 @@ RSpec.describe IsoDoc do
|
|
1041
1041
|
<br/>
|
1042
1042
|
<div id='P' class='Section3'>
|
1043
1043
|
<h1 class='Annex'>
|
1044
|
-
<b>Aldono A</b>
|
1044
|
+
<b><b>Aldono</b> A</b>
|
1045
1045
|
<br/>
|
1046
1046
|
(normative)
|
1047
1047
|
<br/>
|
data/spec/isodoc/inline_spec.rb
CHANGED
@@ -1505,6 +1505,122 @@ RSpec.describe IsoDoc do
|
|
1505
1505
|
end
|
1506
1506
|
|
1507
1507
|
it "cases xrefs" do
|
1508
|
+
input = <<~INPUT
|
1509
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
1510
|
+
<preface>
|
1511
|
+
<clause id="CC"><title>Introduction</title></clause>
|
1512
|
+
<sections>
|
1513
|
+
<clause id="A">
|
1514
|
+
<table id="B">
|
1515
|
+
</table>
|
1516
|
+
<figure id="B1"/>
|
1517
|
+
<example id="B2"/>
|
1518
|
+
</clause>
|
1519
|
+
<clause id="C">
|
1520
|
+
<p>This is <xref target="A"/> and <xref target="B"/>.
|
1521
|
+
This is <xref target="A" case="capital"/> and <xref target="B" case="lowercase"/>.
|
1522
|
+
This is <xref target="A" case="lowercase"/> and <xref target="B" case="capital"/>.
|
1523
|
+
Downcasing an xref affects only the first letter: <xref target="B2" case="lowercase"/>.
|
1524
|
+
Capitalising an xref affects only the first letter: <xref target="B1" case="capital"/>.
|
1525
|
+
<xref target="A"/> is clause <em>initial.</em><br/>
|
1526
|
+
<xref target="A"/> is too. </p>
|
1527
|
+
<p><xref target="A"/> is also.</p>
|
1528
|
+
<p>Annex has formatting, and crossreferences ignore it when determining casing. <xref target="AA"/>.</p>
|
1529
|
+
<p>Labels are not subject to casing: <xref target="CC" case="lowercase"/>
|
1530
|
+
</clause>
|
1531
|
+
<annex id="AA">
|
1532
|
+
<clause id="AA1"/>
|
1533
|
+
</annex>
|
1534
|
+
</sections>
|
1535
|
+
</iso-standard>
|
1536
|
+
INPUT
|
1537
|
+
output = <<~OUTPUT
|
1538
|
+
<iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
|
1539
|
+
<preface>
|
1540
|
+
<clause id='CC' displayorder='1'>
|
1541
|
+
<title depth='1'>Introduction</title>
|
1542
|
+
</clause>
|
1543
|
+
<sections displayorder='2'>
|
1544
|
+
<clause id='A' displayorder='3'>
|
1545
|
+
<title>1.</title>
|
1546
|
+
<table id='B'>
|
1547
|
+
<name>Tabelo 1</name>
|
1548
|
+
</table>
|
1549
|
+
<figure id='B1'>
|
1550
|
+
<name>Figur-etikedo duvorta 1</name>
|
1551
|
+
</figure>
|
1552
|
+
<example id='B2'>
|
1553
|
+
<name>Ekzempl-etikedo Duvorta</name>
|
1554
|
+
</example>
|
1555
|
+
</clause>
|
1556
|
+
<clause id='C' displayorder='4'>
|
1557
|
+
<title>2.</title>
|
1558
|
+
<p>
|
1559
|
+
This is
|
1560
|
+
<xref target='A'>klaŭzo 1</xref>
|
1561
|
+
and
|
1562
|
+
<xref target='B'>tabelo 1</xref>
|
1563
|
+
. This is
|
1564
|
+
<xref target='A' case='capital'>Klaŭzo 1</xref>
|
1565
|
+
and
|
1566
|
+
<xref target='B' case='lowercase'>tabelo 1</xref>
|
1567
|
+
. This is
|
1568
|
+
<xref target='A' case='lowercase'>klaŭzo 1</xref>
|
1569
|
+
and
|
1570
|
+
<xref target='B' case='capital'>Tabelo 1</xref>
|
1571
|
+
. Downcasing an xref affects only the first letter:
|
1572
|
+
<xref target='B2' case='lowercase'>klaŭzo 1, Example</xref>
|
1573
|
+
. Capitalising an xref affects only the first letter:
|
1574
|
+
<xref target='B1' case='capital'>Figur-etikedo duvorta 1</xref>
|
1575
|
+
.
|
1576
|
+
<xref target='A'>Klaŭzo 1</xref>
|
1577
|
+
is clause
|
1578
|
+
<em>initial.</em>
|
1579
|
+
<br/>
|
1580
|
+
<xref target='A'>Klaŭzo 1</xref>
|
1581
|
+
is too.
|
1582
|
+
</p>
|
1583
|
+
<p>
|
1584
|
+
<xref target='A'>Klaŭzo 1</xref>
|
1585
|
+
is also.
|
1586
|
+
</p>
|
1587
|
+
<p>
|
1588
|
+
Annex has formatting, and crossreferences ignore it when determining
|
1589
|
+
casing.
|
1590
|
+
<xref target='AA'>
|
1591
|
+
<strong>Aldono</strong>
|
1592
|
+
A
|
1593
|
+
</xref>
|
1594
|
+
.
|
1595
|
+
</p>
|
1596
|
+
<p>
|
1597
|
+
Labels are not subject to casing:
|
1598
|
+
<xref target='CC' case='lowercase'>Introduction</xref>
|
1599
|
+
</p>
|
1600
|
+
<annex id='AA' displayorder='5'>
|
1601
|
+
<title>
|
1602
|
+
<strong>
|
1603
|
+
<strong>Aldono</strong>
|
1604
|
+
A
|
1605
|
+
</strong>
|
1606
|
+
<br/>
|
1607
|
+
(informa)
|
1608
|
+
</title>
|
1609
|
+
<clause id='AA1'>
|
1610
|
+
<title>A.1.</title>
|
1611
|
+
</clause>
|
1612
|
+
</annex>
|
1613
|
+
</clause>
|
1614
|
+
</sections>
|
1615
|
+
</preface>
|
1616
|
+
</iso-standard>
|
1617
|
+
OUTPUT
|
1618
|
+
expect(xmlpp(IsoDoc::PresentationXMLConvert
|
1619
|
+
.new({ i18nyaml: "spec/assets/i18n.yaml" })
|
1620
|
+
.convert("test", input, true))).to be_equivalent_to xmlpp(output)
|
1621
|
+
end
|
1622
|
+
|
1623
|
+
it "ignores casing of xrefs in unicameral scripts" do
|
1508
1624
|
input = <<~INPUT
|
1509
1625
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
1510
1626
|
<sections>
|
@@ -1541,23 +1657,23 @@ RSpec.describe IsoDoc do
|
|
1541
1657
|
and
|
1542
1658
|
<xref target='B'>tabelo 1</xref>
|
1543
1659
|
. This is
|
1544
|
-
<xref target='A' case='capital'>
|
1660
|
+
<xref target='A' case='capital'>klaŭzo 1</xref>
|
1545
1661
|
and
|
1546
1662
|
<xref target='B' case='lowercase'>tabelo 1</xref>
|
1547
1663
|
. This is
|
1548
1664
|
<xref target='A' case='lowercase'>klaŭzo 1</xref>
|
1549
1665
|
and
|
1550
|
-
<xref target='B' case='capital'>
|
1666
|
+
<xref target='B' case='capital'>tabelo 1</xref>
|
1551
1667
|
.
|
1552
|
-
<xref target='A'>
|
1668
|
+
<xref target='A'>klaŭzo 1</xref>
|
1553
1669
|
is clause
|
1554
1670
|
<em>initial.</em>
|
1555
1671
|
<br/>
|
1556
|
-
<xref target='A'>
|
1672
|
+
<xref target='A'>klaŭzo 1</xref>
|
1557
1673
|
is too.
|
1558
1674
|
</p>
|
1559
1675
|
<p>
|
1560
|
-
<xref target='A'>
|
1676
|
+
<xref target='A'>klaŭzo 1</xref>
|
1561
1677
|
is also.
|
1562
1678
|
</p>
|
1563
1679
|
</clause>
|
@@ -1565,7 +1681,7 @@ RSpec.describe IsoDoc do
|
|
1565
1681
|
</iso-standard>
|
1566
1682
|
OUTPUT
|
1567
1683
|
expect(xmlpp(IsoDoc::PresentationXMLConvert
|
1568
|
-
.new({ i18nyaml: "spec/assets/i18n.yaml" })
|
1684
|
+
.new({ i18nyaml: "spec/assets/i18n.yaml", script: "Hans" })
|
1569
1685
|
.convert("test", input, true))).to be_equivalent_to xmlpp(output)
|
1570
1686
|
end
|
1571
1687
|
|
@@ -5,7 +5,7 @@ RSpec.describe IsoDoc do
|
|
5
5
|
convert = IsoDoc::XslfoPdfConvert.new(
|
6
6
|
{
|
7
7
|
datauriimage: false,
|
8
|
-
}
|
8
|
+
},
|
9
9
|
)
|
10
10
|
|
11
11
|
expect(convert.pdf_options(nil)).to eq("")
|
@@ -18,7 +18,7 @@ RSpec.describe IsoDoc do
|
|
18
18
|
IsoDoc::XslfoPdfConvert::MN2PDF_OPTIONS => {
|
19
19
|
IsoDoc::XslfoPdfConvert::MN2PDF_FONT_MANIFEST => nil,
|
20
20
|
},
|
21
|
-
}
|
21
|
+
},
|
22
22
|
)
|
23
23
|
|
24
24
|
expect(convert.pdf_options(nil)).to eq("")
|
@@ -31,9 +31,21 @@ RSpec.describe IsoDoc do
|
|
31
31
|
IsoDoc::XslfoPdfConvert::MN2PDF_OPTIONS => {
|
32
32
|
IsoDoc::XslfoPdfConvert::MN2PDF_FONT_MANIFEST => "/tmp/manifest.yml",
|
33
33
|
},
|
34
|
-
}
|
34
|
+
},
|
35
35
|
)
|
36
36
|
|
37
|
-
expect(convert.pdf_options(nil)).to eq("--font-manifest /tmp/manifest.yml")
|
37
|
+
expect(convert.pdf_options(nil)).to eq(" --font-manifest /tmp/manifest.yml")
|
38
|
+
end
|
39
|
+
|
40
|
+
it "test --param align-cross-elements pdf_options" do
|
41
|
+
convert = IsoDoc::XslfoPdfConvert.new(
|
42
|
+
{
|
43
|
+
datauriimage: false,
|
44
|
+
aligncrosselements: "clause table note",
|
45
|
+
},
|
46
|
+
)
|
47
|
+
|
48
|
+
expect(convert.pdf_options(nil))
|
49
|
+
.to eq(" --param align-cross-elements = \"clause table note\"")
|
38
50
|
end
|
39
51
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: isodoc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.7.
|
4
|
+
version: 1.7.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-10-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: asciimath
|