isodoc 2.11.0 → 2.11.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/lib/isodoc/base_style/all.css +40 -0
  3. data/lib/isodoc/base_style/reset.css +40 -0
  4. data/lib/isodoc/base_style/reset.scss +47 -0
  5. data/lib/isodoc/base_style/scripts.html +18 -0
  6. data/lib/isodoc/function/cleanup.rb +2 -1
  7. data/lib/isodoc/function/section.rb +2 -1
  8. data/lib/isodoc/function/utils.rb +8 -8
  9. data/lib/isodoc/gem_tasks.rb +1 -1
  10. data/lib/isodoc/html_function/postprocess.rb +2 -2
  11. data/lib/isodoc/html_function/postprocess_cover.rb +6 -4
  12. data/lib/isodoc/html_function/postprocess_footnotes.rb +52 -47
  13. data/lib/isodoc/presentation_function/block.rb +4 -3
  14. data/lib/isodoc/presentation_function/erefs.rb +25 -20
  15. data/lib/isodoc/presentation_function/image.rb +3 -2
  16. data/lib/isodoc/presentation_function/metadata.rb +1 -1
  17. data/lib/isodoc/presentation_function/reqt.rb +6 -3
  18. data/lib/isodoc/presentation_function/section.rb +12 -5
  19. data/lib/isodoc/presentation_function/terms.rb +2 -1
  20. data/lib/isodoc/presentation_function/xrefs.rb +5 -5
  21. data/lib/isodoc/presentation_xml_convert.rb +2 -1
  22. data/lib/isodoc/version.rb +1 -1
  23. data/lib/isodoc/word_function/postprocess_cover.rb +4 -2
  24. data/lib/isodoc/xref/xref_gen_seq.rb +1 -0
  25. data/lib/isodoc/xref/xref_sect_gen.rb +5 -4
  26. data/lib/isodoc/xref.rb +1 -1
  27. data/lib/isodoc/xslfo_convert.rb +14 -9
  28. data/lib/isodoc-yaml/i18n-ar.yaml +4 -4
  29. data/lib/isodoc-yaml/i18n-de.yaml +4 -4
  30. data/lib/isodoc-yaml/i18n-en.yaml +5 -8
  31. data/lib/isodoc-yaml/i18n-es.yaml +4 -4
  32. data/lib/isodoc-yaml/i18n-fr.yaml +4 -4
  33. data/lib/isodoc-yaml/i18n-ja.yaml +10 -10
  34. data/lib/isodoc-yaml/i18n-ru.yaml +4 -7
  35. data/lib/isodoc-yaml/i18n-zh-Hans.yaml +4 -4
  36. data/lib/nokogiri/xml/node.rb +13 -0
  37. metadata +3 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c38cf2267396e98d1de955feacbd9002b32d6f076593c414d8395eea21f08510
4
- data.tar.gz: 433c3e2d54797e3f22eb693f714163f4c3ac523a7584730872e1f7316b2dec81
3
+ metadata.gz: 806dd6df2ad1f9acfbebcc324d1c2b88b035c3242b9655ee1c82c7a7eb3d40cc
4
+ data.tar.gz: 1bc15cb526e0bbd4f8151facf0c20567ee2776046a325bb4dac96ce9e7eee40b
5
5
  SHA512:
6
- metadata.gz: b36c7d9e7676ba7df00d34bb78797649b683a454776605249861978cf4ec5df3bdf61b7e4f05ec4e6644f62ac15aaa2e840cb5c36afb654e5c3d5457ddbd023e
7
- data.tar.gz: bce31398c2b4b23f8e4b1a3192a73564f69ebfc0859320aff702c8eb3d2eadc9ae84e05275d6be1a54abb2a1be1146786925c2452a9e7ae8caac3d285f10beb6
6
+ metadata.gz: 356559fad5bb12c0bc7e8cfec04f2c7bb625be430f702a21d825d7fc5c03e0ac037e5d7490f7712d1294b9151997fac54125ff751f88a9cd8ae51412ce36e2bc
7
+ data.tar.gz: a8579583084ad8ca0956a927ddd4e4ef1b386bc4979676ee8edd8f866b4031e6411764e5f49f62e2c293f0eadf83f04caccfcfcd0a0d70360bbd31a27999d215
@@ -222,6 +222,46 @@ h6:hover > a.anchor,
222
222
  .inline-header:hover > a.anchor {
223
223
  visibility: visible; }
224
224
 
225
+ /* collapsible snippets: collapsible before hidable */
226
+ .hidable {
227
+ max-height: 0;
228
+ overflow: hidden;
229
+ transition: max-height 0.2s ease-out; }
230
+
231
+ .collapsible {
232
+ background-color: #777;
233
+ color: white;
234
+ cursor: pointer;
235
+ padding: 12px 0;
236
+ margin: 0;
237
+ width: 100%;
238
+ border: none;
239
+ text-align: left;
240
+ outline: none;
241
+ font-size: 15px; }
242
+
243
+ .active, .collapsible:hover {
244
+ background-color: #555; }
245
+
246
+ .collapsible:after {
247
+ content: '\25bc';
248
+ color: white;
249
+ font-weight: bold;
250
+ float: right;
251
+ margin-left: 12px;
252
+ margin-right: 12px; }
253
+
254
+ .active:after {
255
+ content: "\25b2"; }
256
+
257
+ /* collapsible: */
258
+ .collapsible + .hidable {
259
+ margin-top: 0; }
260
+
261
+ .collapsible:not(.active) + .hidable {
262
+ overflow: hidden;
263
+ padding: 0; }
264
+
225
265
  #standard-band {
226
266
  background-color: #0AC442; }
227
267
 
@@ -221,3 +221,43 @@ h5:hover > a.anchor,
221
221
  h6:hover > a.anchor,
222
222
  .inline-header:hover > a.anchor {
223
223
  visibility: visible; }
224
+
225
+ /* collapsible snippets: collapsible before hidable */
226
+ .hidable {
227
+ max-height: 0;
228
+ overflow: hidden;
229
+ transition: max-height 0.2s ease-out; }
230
+
231
+ .collapsible {
232
+ background-color: #777;
233
+ color: white;
234
+ cursor: pointer;
235
+ padding: 12px 0;
236
+ margin: 0;
237
+ width: 100%;
238
+ border: none;
239
+ text-align: left;
240
+ outline: none;
241
+ font-size: 15px; }
242
+
243
+ .active, .collapsible:hover {
244
+ background-color: #555; }
245
+
246
+ .collapsible:after {
247
+ content: '\25bc';
248
+ color: white;
249
+ font-weight: bold;
250
+ float: right;
251
+ margin-left: 12px;
252
+ margin-right: 12px; }
253
+
254
+ .active:after {
255
+ content: "\25b2"; }
256
+
257
+ /* collapsible: */
258
+ .collapsible + .hidable {
259
+ margin-top: 0; }
260
+
261
+ .collapsible:not(.active) + .hidable {
262
+ overflow: hidden;
263
+ padding: 0; }
@@ -223,3 +223,50 @@ h6:hover>a.anchor,
223
223
  .inline-header:hover>a.anchor{
224
224
  visibility:visible;
225
225
  }
226
+
227
+ /* collapsible snippets: collapsible before hidable */
228
+ .hidable {
229
+ max-height: 0;
230
+ overflow: hidden;
231
+ transition: max-height 0.2s ease-out;
232
+ }
233
+
234
+ .collapsible {
235
+ background-color: #777;
236
+ color: white;
237
+ cursor: pointer;
238
+ padding: 12px 0;
239
+ margin: 0;
240
+ width: 100%;
241
+ border: none;
242
+ text-align: left;
243
+ outline: none;
244
+ font-size: 15px;
245
+ }
246
+
247
+ .active, .collapsible:hover {
248
+ background-color: #555;
249
+ }
250
+
251
+ .collapsible:after {
252
+ content: '\25bc';
253
+ color: white;
254
+ font-weight: bold;
255
+ float: right;
256
+ margin-left: 12px;
257
+ margin-right: 12px;
258
+ }
259
+
260
+ .active:after {
261
+ content: "\25b2";
262
+ }
263
+
264
+ /* collapsible: */
265
+ .collapsible + .hidable {
266
+ margin-top: 0;
267
+ }
268
+
269
+ .collapsible:not(.active) + .hidable {
270
+ overflow: hidden;
271
+ padding: 0;
272
+ }
@@ -185,3 +185,21 @@ $('#toggle').on('click', function(){
185
185
  anchors.add('h1, h2, h3, h4');
186
186
  </script>
187
187
 
188
+ <script>
189
+ // use .collapsible element to toggle visibility of element following it
190
+ var coll = document.getElementsByClassName("collapsible");
191
+ var i;
192
+
193
+ for (i = 0; i < coll.length; i++) {
194
+ coll[i].addEventListener("click", function() {
195
+ this.classList.toggle("active");
196
+ var content = this.nextElementSibling;
197
+ if (content.style.maxHeight){
198
+ content.style.maxHeight = null;
199
+ } else {
200
+ content.style.maxHeight = content.scrollHeight + "px";
201
+ }
202
+ });
203
+ }
204
+ </script>
205
+
@@ -89,7 +89,8 @@ module IsoDoc
89
89
  if n.nil?
90
90
  x.name = "p"
91
91
  else
92
- n.children.first.previous = x.remove
92
+ #n.children.first.previous = x.remove
93
+ n.add_first_child(x.remove)
93
94
  end
94
95
  end
95
96
  docxml
@@ -83,7 +83,8 @@ module IsoDoc
83
83
  # subclause
84
84
  def symbols_parse(isoxml, out)
85
85
  isoxml.at(ns("./title")) or
86
- isoxml.children.first.previous = "<title>#{@i18n.symbols}</title>"
86
+ #isoxml.children.first.previous = "<title>#{@i18n.symbols}</title>"
87
+ isoxml.add_first_child "<title>#{@i18n.symbols}</title>"
87
88
  clause_parse(isoxml, out)
88
89
  end
89
90
 
@@ -1,4 +1,5 @@
1
1
  require "metanorma-utils"
2
+ require_relative "../../nokogiri/xml/node"
2
3
 
3
4
  module IsoDoc
4
5
  module Function
@@ -27,8 +28,8 @@ module IsoDoc
27
28
  [1..count].each { out << tab }
28
29
  end
29
30
 
30
- def noko(&block)
31
- Metanorma::Utils::noko_html(&block)
31
+ def noko(&)
32
+ Metanorma::Utils::noko_html(&)
32
33
  end
33
34
 
34
35
  def attr_code(attributes)
@@ -40,8 +41,7 @@ module IsoDoc
40
41
  DOCTYPE_HDR = "<!DOCTYPE html SYSTEM " \
41
42
  '"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'.freeze
42
43
 
43
- HUGESTRICT =
44
- Nokogiri::XML::ParseOptions::HUGE |
44
+ HUGESTRICT = Nokogiri::XML::ParseOptions::HUGE |
45
45
  Nokogiri::XML::ParseOptions::STRICT
46
46
 
47
47
  def to_xhtml(xml)
@@ -62,7 +62,7 @@ module IsoDoc
62
62
  end
63
63
 
64
64
  def to_xhtml_prep(xml)
65
- xml.gsub!(/<\?xml[^>]*>/, "")
65
+ xml.gsub!(/<\?xml[^<>]*>/, "")
66
66
  xml.include?("<!DOCTYPE ") || (xml = DOCTYPE_HDR + xml)
67
67
  numeric_escapes(xml)
68
68
  end
@@ -130,8 +130,8 @@ module IsoDoc
130
130
 
131
131
  def header_strip(hdr)
132
132
  h1 = to_xhtml_fragment(hdr.to_s.gsub(%r{<br\s*/>}, " ")
133
- .gsub(%r{</?p(\s[^>]+)?>}, "")
134
- .gsub(/<\/?h[123456][^>]*>/, "").gsub(/<\/?b[^>]*>/, "").dup)
133
+ .gsub(%r{</?p(\s[^<>]+)?>}, "")
134
+ .gsub(/<\/?h[123456][^<>]*>/, "").gsub(/<\/?b[^<>]*>/, "").dup)
135
135
  h1.traverse do |x|
136
136
  if x.name == "span" && x["style"]&.include?("mso-tab-count")
137
137
  x.replace(" ")
@@ -243,7 +243,7 @@ module IsoDoc
243
243
  win = !!((RUBY_PLATFORM =~ /(win|w)(32|64)$/) ||
244
244
  (RUBY_PLATFORM =~ /mswin|mingw/))
245
245
  if win
246
- path.gsub!(%{/}, "\\")
246
+ path.tr!(%{/}, "\\")
247
247
  path[/\s/] ? "\"#{path}\"" : path
248
248
  else path
249
249
  end
@@ -82,7 +82,7 @@ module IsoDoc
82
82
 
83
83
  def comment_out_liquid(text)
84
84
  text.split("\n").map do |line|
85
- if line.match?(/{({|%).+(}|%)}/)
85
+ if line.match?(/(?<!{){({|%)(?![{%]).+(}|%)}/)
86
86
  "/* LIQUID_COMMENT#{line}LIQUID_COMMENT */"
87
87
  else
88
88
  line
@@ -20,8 +20,8 @@ module IsoDoc
20
20
  end
21
21
 
22
22
  def html5(doc)
23
- doc.sub(%r{<!DOCTYPE html [^>]+>}, "<!DOCTYPE html>")
24
- .sub(%r{<\?xml[^>]+>}, "")
23
+ doc.sub(%r{<!DOCTYPE html [^<>]+>}, "<!DOCTYPE html>")
24
+ .sub(%r{<\?xml[^<>]+>}, "")
25
25
  end
26
26
 
27
27
  def html_cleanup(html)
@@ -6,9 +6,9 @@ module IsoDoc
6
6
  module HtmlFunction
7
7
  module Html
8
8
  def script_cdata(result)
9
- result.gsub(%r{<script([^>]*)>\s*<!\[CDATA\[}m, "<script\\1>")
9
+ result.gsub(%r{<script([^<>]*)>\s*<!\[CDATA\[}m, "<script\\1>")
10
10
  .gsub(%r{\]\]>\s*</script>}, "</script>")
11
- .gsub(%r{<!\[CDATA\[\s*<script([^>]*)>}m, "<script\\1>")
11
+ .gsub(%r{<!\[CDATA\[\s*<script([^<>]*)>}m, "<script\\1>")
12
12
  .gsub(%r{</script>\s*\]\]>}, "</script>")
13
13
  end
14
14
 
@@ -82,7 +82,8 @@ module IsoDoc
82
82
  def html_cover(docxml)
83
83
  doc = to_xhtml_fragment(File.read(@htmlcoverpage, encoding: "UTF-8"))
84
84
  d = docxml.at('//div[@class="title-section"]')
85
- d.children.first.add_previous_sibling(
85
+ #d.children.first.add_previous_sibling(
86
+ d.add_first_child(
86
87
  populate_template(doc.to_xml(encoding: "US-ASCII"), :html),
87
88
  )
88
89
  end
@@ -90,7 +91,8 @@ module IsoDoc
90
91
  def html_intro(docxml)
91
92
  doc = to_xhtml_fragment(File.read(@htmlintropage, encoding: "UTF-8"))
92
93
  d = docxml.at('//div[@class="prefatory-section"]')
93
- d.children.first.add_previous_sibling(
94
+ #d.children.first.add_previous_sibling(
95
+ d.add_first_child(
94
96
  populate_template(doc.to_xml(encoding: "US-ASCII"), :html),
95
97
  )
96
98
  end
@@ -1,59 +1,64 @@
1
- module IsoDoc::HtmlFunction
2
- module Html
3
- def update_footnote_filter(fn, x, i, seen)
4
- if seen[fn.text]
5
- x.at("./sup").content = seen[fn.text][:num].to_s
6
- fn.remove unless x["href"] == seen[fn.text][:href]
7
- x["href"] = seen[fn.text][:href]
8
- else
9
- seen[fn.text] = { num: i, href: x["href"] }
10
- x.at("./sup").content = i.to_s
11
- i += 1
1
+ module IsoDoc
2
+ module HtmlFunction
3
+ module Html
4
+ def update_footnote_filter(fnote, xref, idx, seen)
5
+ if seen[fnote.text]
6
+ xref.at("./sup").content = seen[fnote.text][:num].to_s
7
+ fnote.remove unless xref["href"] == seen[fnote.text][:href]
8
+ xref["href"] = seen[fnote.text][:href]
9
+ else
10
+ seen[fnote.text] = { num: idx, href: xref["href"] }
11
+ xref.at("./sup").content = idx.to_s
12
+ idx += 1
13
+ end
14
+ [idx, seen]
12
15
  end
13
- [i, seen]
14
- end
15
16
 
16
- def html_footnote_filter(docxml)
17
- seen = {}
18
- i = 1
19
- docxml.xpath('//a[@class = "FootnoteRef"]').each do |x|
20
- fn = docxml.at(%<//*[@id = '#{x['href'].sub(/^#/, '')}']>) || next
21
- i, seen = update_footnote_filter(fn, x, i, seen)
17
+ def html_footnote_filter(docxml)
18
+ seen = {}
19
+ i = 1
20
+ docxml.xpath('//a[@class = "FootnoteRef"]').each do |x|
21
+ fn = docxml.at(%<//*[@id = '#{x['href'].sub(/^#/, '')}']>) || next
22
+ i, seen = update_footnote_filter(fn, x, i, seen)
23
+ end
24
+ docxml
22
25
  end
23
- docxml
24
- end
25
26
 
26
- def footnote_backlinks1(x, fn)
27
- xdup = x.dup
28
- xdup.remove["id"]
29
- if fn.elements.empty?
30
- fn.children.first.previous = xdup
31
- else
32
- fn.elements.first.children.first.previous = xdup
27
+ def footnote_backlinks1(xref, footnote)
28
+ xdup = xref.dup
29
+ xdup.remove["id"]
30
+ if footnote.elements.empty?
31
+ #footnote.children.empty? and footnote << " "
32
+ #footnote.children.first.previous = xdup
33
+ footnote.add_first_child xdup
34
+ else
35
+ #footnote.elements.first.children.first.previous = xdup
36
+ footnote.elements.first.add_first_child xdup
37
+ end
33
38
  end
34
- end
35
39
 
36
- def footnote_backlinks(docxml)
37
- seen = {}
38
- docxml.xpath('//a[@class = "FootnoteRef"]').each_with_index do |x, i|
39
- (seen[x["href"]] and next) or seen[x["href"]] = true
40
- fn = docxml.at(%<//*[@id = '#{x['href'].sub(/^#/, '')}']>) || next
41
- footnote_backlinks1(x, fn)
42
- x["id"] ||= "fnref:#{i + 1}"
43
- fn.add_child "<a href='##{x['id']}'>&#x21A9;</a>"
40
+ def footnote_backlinks(docxml)
41
+ seen = {}
42
+ docxml.xpath('//a[@class = "FootnoteRef"]').each_with_index do |x, i|
43
+ (seen[x["href"]] and next) or seen[x["href"]] = true
44
+ fn = docxml.at(%<//*[@id = '#{x['href'].sub(/^#/, '')}']>) || next
45
+ footnote_backlinks1(x, fn)
46
+ x["id"] ||= "fnref:#{i + 1}"
47
+ fn.add_child "<a href='##{x['id']}'>&#x21A9;</a>"
48
+ end
49
+ docxml
44
50
  end
45
- docxml
46
- end
47
51
 
48
- def footnote_format(docxml)
49
- docxml.xpath("//a[@class = 'FootnoteRef']/sup").each do |x|
50
- footnote_reference_format(x)
51
- end
52
- docxml.xpath("//a[@class = 'TableFootnoteRef'] | "\
53
- "//span[@class = 'TableFootnoteRef']").each do |x|
54
- table_footnote_reference_format(x)
52
+ def footnote_format(docxml)
53
+ docxml.xpath("//a[@class = 'FootnoteRef']/sup").each do |x|
54
+ footnote_reference_format(x)
55
+ end
56
+ docxml.xpath("//a[@class = 'TableFootnoteRef'] | "\
57
+ "//span[@class = 'TableFootnoteRef']").each do |x|
58
+ table_footnote_reference_format(x)
59
+ end
60
+ docxml
55
61
  end
56
- docxml
57
62
  end
58
63
  end
59
64
  end
@@ -6,7 +6,7 @@ module IsoDoc
6
6
  class PresentationXMLConvert < ::IsoDoc::Convert
7
7
  def lower2cap(text)
8
8
  /^[[:upper:]][[:upper:]]/.match?(text) and return text
9
- text.capitalize
9
+ text&.capitalize
10
10
  end
11
11
 
12
12
  def block_delim
@@ -16,8 +16,9 @@ module IsoDoc
16
16
  def prefix_name(node, delim, number, elem)
17
17
  number.nil? || number.empty? and return
18
18
  unless name = node.at(ns("./#{elem}"))
19
- (node.children.empty? and node.add_child("<#{elem}></#{elem}>")) or
20
- node.children.first.previous = "<#{elem}></#{elem}>"
19
+ #(node.children.empty? and node.add_child("<#{elem}></#{elem}>")) or
20
+ # node.children.first.previous = "<#{elem}></#{elem}>"
21
+ node.add_first_child "<#{elem}></#{elem}>"
21
22
  name = node.children.first
22
23
  end
23
24
  if name.children.empty? then name.add_child(cleanup_entities(number.strip))
@@ -40,7 +40,7 @@ module IsoDoc
40
40
  node.delete("droploc") unless droploc
41
41
  eref_localities1({ target:, number: "pl",
42
42
  type: refs.first.at(ns("./locality/@type")).text,
43
- from: l10n(ret[1..-1].join), node:, lang: @lang })
43
+ from: l10n(ret[1..].join), node:, lang: @lang })
44
44
  end
45
45
 
46
46
  def can_conflate_eref_rendering?(refs)
@@ -48,16 +48,13 @@ module IsoDoc
48
48
  refs.all? { |r| r.name == "localityStack" } &&
49
49
  refs.all? { |r| r.xpath(ns("./locality")).size == 1 }) or return false
50
50
  first = refs.first.at(ns("./locality/@type")).text
51
- refs.all? do |r|
52
- r.at(ns("./locality/@type")).text == first
53
- end
51
+ refs.all? { |r| r.at(ns("./locality/@type")).text == first }
54
52
  end
55
53
 
56
54
  def resolve_eref_connectives(locs)
57
55
  locs = resolve_comma_connectives(locs)
58
56
  locs = resolve_to_connectives(locs)
59
- return locs if locs.size < 3
60
-
57
+ locs.size < 3 and return locs
61
58
  locs = locs.each_slice(2).with_object([]) do |a, m|
62
59
  m << { conn: a[0], label: a[1] }
63
60
  end
@@ -150,7 +147,6 @@ module IsoDoc
150
147
  end
151
148
  end
152
149
 
153
- # def eref_localities1_zh(_target, type, from, upto, node)
154
150
  def eref_localities1_zh(opt)
155
151
  ret = "第#{opt[:from]}" if opt[:from]
156
152
  ret += "&#x2013;#{opt[:upto]}" if opt[:upto]
@@ -159,11 +155,9 @@ module IsoDoc
159
155
  ret
160
156
  end
161
157
 
162
- # def eref_localities1(target, type, from, upto, node, lang = "en")
163
158
  def eref_localities1(opt)
164
159
  opt[:type] == "anchor" and return nil
165
160
  opt[:lang] == "zh" and
166
- # return l10n(eref_localities1_zh(target, type, from, upto, node))
167
161
  return l10n(eref_localities1_zh(opt))
168
162
  ret = eref_locality_populate(opt[:type], opt[:node], opt[:number])
169
163
  ret += " #{opt[:from]}" if opt[:from]
@@ -188,7 +182,7 @@ module IsoDoc
188
182
  .each do |e|
189
183
  href = eref_target(e) or next
190
184
  e.xpath(ns("./locality | ./localityStack")).each(&:remove)
191
- if /^#/.match?(href) then eref2xref(e)
185
+ if href[:type] == :anchor then eref2xref(e)
192
186
  else eref2link1(e, href)
193
187
  end
194
188
  end
@@ -203,7 +197,9 @@ module IsoDoc
203
197
  end
204
198
 
205
199
  def eref2link1(node, href)
206
- repl = "<link target='#{href}'>#{node.children}</link>"
200
+ url = href[:link]
201
+ att = href[:type] == :attachment ? "attachment='true'" : ""
202
+ repl = "<link #{att} target='#{url}'>#{node.children}</link>"
207
203
  node["type"] == "footnote" and repl = "<sup>#{repl}</sup>"
208
204
  node.replace(repl)
209
205
  end
@@ -215,20 +211,29 @@ module IsoDoc
215
211
  end
216
212
 
217
213
  def eref_target(node)
218
- url = suffix_url(eref_url(node["bibitemid"]))
214
+ u = eref_url(node["bibitemid"]) or return nil
215
+ url = suffix_url(u[:link])
219
216
  anchor = node.at(ns(".//locality[@type = 'anchor']"))
220
- return url if url.nil? || /^#/.match?(url) || !anchor
217
+ /^#/.match?(url) || !anchor and return { link: url, type: u[:type] }
218
+ { link: "#{url}##{anchor.text.strip}", type: u[:type] }
219
+ end
221
220
 
222
- "#{url}##{anchor.text.strip}"
221
+ def eref_url_prep(id)
222
+ @bibitem_lookup.nil? and return nil
223
+ @bibitem_lookup[id]
223
224
  end
224
225
 
225
226
  def eref_url(id)
226
- @bibitem_lookup.nil? and return nil
227
- b = @bibitem_lookup[id] or return nil
228
- url = b.at(ns("./uri[@type = 'citation'][@language = '#{@lang}']")) ||
229
- b.at(ns("./uri[@type = 'citation']")) and return url.text
230
- b["hidden"] == "true" and return b.at(ns("./uri"))&.text
231
- "##{id}"
227
+ b = eref_url_prep(id) or return nil
228
+ %i(attachment citation).each do |x|
229
+ u = b.at(ns("./uri[@type = '#{x}'][@language = '#{@lang}']")) ||
230
+ b.at(ns("./uri[@type = '#{x}']")) and return { link: u.text, type: x }
231
+ end
232
+ if b["hidden"] == "true"
233
+ u = b.at(ns("./uri")) or return nil
234
+ { link: u.text, type: :citation }
235
+ else { link: "##{id}", type: :anchor }
236
+ end
232
237
  end
233
238
  end
234
239
  end
@@ -38,7 +38,7 @@ module IsoDoc
38
38
 
39
39
  svg = Base64.strict_decode64(elem["src"]
40
40
  .sub(%r{^data:image/svg\+xml;(charset=[^;]+;)?base64,}, ""))
41
- x = Nokogiri::XML.fragment(svg.sub(/<\?xml[^>]*>/, ""), &:huge)
41
+ x = Nokogiri::XML.fragment(svg.sub(/<\?xml[^<>]*>/, ""), &:huge)
42
42
  elem["src"] = ""
43
43
  elem.children = x
44
44
  end
@@ -77,7 +77,8 @@ module IsoDoc
77
77
  def svg_emf_double(img)
78
78
  if emf?(img["mimetype"])
79
79
  img = emf_encode(img)
80
- img.children.first.previous = emf_to_svg(img)
80
+ #img.children.first.previous = emf_to_svg(img)
81
+ img.add_first_child emf_to_svg(img)
81
82
  elsif img["mimetype"] == "image/svg+xml"
82
83
  src = svg_to_emf(img) or return
83
84
  img.add_child("<emf/>")
@@ -24,7 +24,7 @@ module IsoDoc
24
24
  def save_attachment(attachment, dir)
25
25
  n = File.join(dir, File.basename(attachment["name"]))
26
26
  c = attachment.text.sub(%r{^data:[^;]+;(?:charset=[^;]+;)?base64,}, "")
27
- File.open(n, "wb") { |f| f.write(Base64.strict_decode64(c)) }
27
+ File.open(n, "wb") { |f| f.write(Base64.decode64(c)) }
28
28
  end
29
29
 
30
30
  def extension_insert(xml, path = [])
@@ -2,19 +2,22 @@ module IsoDoc
2
2
  class PresentationXMLConvert < ::IsoDoc::Convert
3
3
  def recommendation(docxml)
4
4
  docxml.xpath(ns("//recommendation")).each do |f|
5
- recommendation1(f, lower2cap(@i18n.recommendation))
5
+ recommendation1(f, lower2cap(f["class"]) ||
6
+ lower2cap(@i18n.recommendation))
6
7
  end
7
8
  end
8
9
 
9
10
  def requirement(docxml)
10
11
  docxml.xpath(ns("//requirement")).each do |f|
11
- recommendation1(f, lower2cap(@i18n.requirement))
12
+ recommendation1(f, lower2cap(f["class"]) ||
13
+ lower2cap(@i18n.requirement))
12
14
  end
13
15
  end
14
16
 
15
17
  def permission(docxml)
16
18
  docxml.xpath(ns("//permission")).each do |f|
17
- recommendation1(f, lower2cap(@i18n.permission))
19
+ recommendation1(f, lower2cap(f["class"]) ||
20
+ lower2cap(@i18n.permission))
18
21
  end
19
22
  end
20
23
 
@@ -6,8 +6,8 @@ module IsoDoc
6
6
  s = docxml.at(ns("//sections")) or return
7
7
  t = @meta.get[:doctitle]
8
8
  t.nil? || t.empty? and return
9
- s.children.first.previous =
10
- "<p class='zzSTDTitle1'>#{t}</p>"
9
+ #s.children.first.previous =
10
+ s.add_first_child "<p class='zzSTDTitle1'>#{t}</p>"
11
11
  end
12
12
 
13
13
  def clause(docxml)
@@ -21,12 +21,17 @@ module IsoDoc
21
21
  end
22
22
  end
23
23
 
24
+ def unnumbered_clause?(elem)
25
+ !elem.ancestors("boilerplate, metanorma-extension").empty? ||
26
+ @suppressheadingnumbers || elem["unnumbered"] ||
27
+ elem.at("./ancestor::*[@unnumbered = 'true']")
28
+ end
29
+
24
30
  def clause1(elem)
25
31
  level = @xrefs.anchor(elem["id"], :level, false) ||
26
32
  (elem.ancestors("clause, annex").size + 1)
27
33
  t = elem.at(ns("./title")) and t["depth"] = level
28
- !elem.ancestors("boilerplate, metanorma-extension").empty? ||
29
- @suppressheadingnumbers || elem["unnumbered"] and return
34
+ unnumbered_clause?(elem) and return
30
35
  lbl = @xrefs.anchor(elem["id"], :label,
31
36
  elem.parent.name != "sections") or return
32
37
  prefix_name(elem, "<tab/>", "#{lbl}#{clausedelim}", "title")
@@ -65,6 +70,7 @@ module IsoDoc
65
70
  if t = elem.at(ns("./title"))
66
71
  t.children = "<strong>#{to_xml(t.children)}</strong>"
67
72
  end
73
+ unnumbered_clause?(elem) and return
68
74
  prefix_name(elem, "<br/><br/>", lbl, "title")
69
75
  end
70
76
 
@@ -242,7 +248,8 @@ module IsoDoc
242
248
  def toc_refs(docxml)
243
249
  docxml.xpath(ns("//toc//xref[text()]")).each do |x|
244
250
  lbl = @xrefs.anchor(x["target"], :label) or next
245
- x.children.first.previous = "#{lbl}<tab/>"
251
+ #x.children.first.previous = "#{lbl}<tab/>"
252
+ x.add_first_child "#{lbl}<tab/>"
246
253
  end
247
254
  end
248
255
  end
@@ -9,7 +9,8 @@ module IsoDoc
9
9
  end
10
10
 
11
11
  def deprecates(elem)
12
- elem.children.first.previous = @i18n.l10n("#{@i18n.deprecated}: ")
12
+ #elem.children.first.previous = @i18n.l10n("#{@i18n.deprecated}: ")
13
+ elem.add_first_child @i18n.l10n("#{@i18n.deprecated}: ")
13
14
  end
14
15
 
15
16
  def admits(elem); end
@@ -116,7 +116,7 @@ module IsoDoc
116
116
  node.xpath(ns("./location")).each_with_object([]) do |l, m|
117
117
  type = @xrefs.anchor(l["target"], :type)
118
118
  m << { conn: l["connective"], target: l["target"],
119
- type: type, node: l, elem: @xrefs.anchor(l["target"], :elem),
119
+ type:, node: l, elem: @xrefs.anchor(l["target"], :elem),
120
120
  container: @xrefs.anchor(l["target"], :container, false) ||
121
121
  %w(termnote).include?(type) }
122
122
  end
@@ -132,13 +132,13 @@ module IsoDoc
132
132
 
133
133
  def combine_conn(list)
134
134
  list.size == 1 and list.first[:label]
135
- if list[1..-1].all? { |l| l[:conn] == "and" }
135
+ if list[1..].all? { |l| l[:conn] == "and" }
136
136
  @i18n.boolean_conj(list.map { |l| loc2xref(l) }, "and")
137
- elsif list[1..-1].all? { |l| l[:conn] == "or" }
137
+ elsif list[1..].all? { |l| l[:conn] == "or" }
138
138
  @i18n.boolean_conj(list.map { |l| loc2xref(l) }, "or")
139
139
  else
140
140
  ret = loc2xref(list[0])
141
- list[1..-1].each { |l| ret = i18n_chain_boolean(ret, l) }
141
+ list[1..].each { |l| ret = i18n_chain_boolean(ret, l) }
142
142
  ret
143
143
  end
144
144
  end
@@ -156,7 +156,7 @@ module IsoDoc
156
156
  end
157
157
 
158
158
  def capitalise_xref(node, linkend, label)
159
- linktext = linkend.gsub(/<[^>]+>/, "")
159
+ linktext = linkend.gsub(/<[^<>]+>/, "")
160
160
  (label && !label.empty? && /^#{Regexp.escape(label)}/.match?(linktext)) ||
161
161
  linktext[0, 1].match?(/\p{Upper}/) and return linkend
162
162
  node["case"] and
@@ -55,7 +55,8 @@ module IsoDoc
55
55
  # feeds middle_title
56
56
  # triggers xrefs reparse, so put references before all other sections,
57
57
  # which alter titles and thus can alter xrefs
58
- rearrange_clauses docxml # feeds toc, display_order, clausetitle, clause, middle_title
58
+ rearrange_clauses docxml # feeds toc, display_order, clausetitle,
59
+ # clause, middle_title
59
60
  middle_title docxml
60
61
  annex docxml
61
62
  clause docxml # feeds clausetitle
@@ -1,3 +1,3 @@
1
1
  module IsoDoc
2
- VERSION = "2.11.0".freeze
2
+ VERSION = "2.11.2".freeze
3
3
  end
@@ -22,7 +22,8 @@ module IsoDoc
22
22
  cover = File.read(@wordcoverpage, encoding: "UTF-8")
23
23
  cover = populate_template(cover, :word)
24
24
  coverxml = to_word_xhtml_fragment(cover)
25
- ins.children.first.previous = coverxml.to_xml(encoding: "US-ASCII")
25
+ #ins.children.first.previous = coverxml.to_xml(encoding: "US-ASCII")
26
+ ins.add_first_child coverxml.to_xml(encoding: "US-ASCII")
26
27
  end
27
28
 
28
29
  def word_intro(docxml, level)
@@ -31,7 +32,8 @@ module IsoDoc
31
32
  docxml, level)
32
33
  intro = populate_template(intro, :word)
33
34
  introxml = to_word_xhtml_fragment(intro)
34
- ins.children.first.previous = introxml.to_xml(encoding: "US-ASCII")
35
+ #ins.children.first.previous = introxml.to_xml(encoding: "US-ASCII")
36
+ ins.add_first_child introxml.to_xml(encoding: "US-ASCII")
35
37
  end
36
38
 
37
39
  # add namespaces for Word fragments
@@ -132,6 +132,7 @@ container: false)
132
132
  end
133
133
 
134
134
  def reqt2class_label(elem, model)
135
+ elem["class"] and return [elem["class"], elem["class"]]
135
136
  model.req_class_paths.each do |n|
136
137
  v1 = ns("/#{n[:xpath]}").sub(%r{^/}, "")
137
138
  elem.at("./self::#{v1}") and return [n[:klass], n[:label]]
@@ -17,6 +17,7 @@ module IsoDoc
17
17
  i = Counter.new("@")
18
18
  clause_order_annex(xml).each do |a|
19
19
  xml.xpath(ns(a[:path])).each do |c|
20
+ unnumbered_section_name?(c) and next
20
21
  annex_names(c, i.increment(c).print)
21
22
  a[:multi] or break
22
23
  end
@@ -125,7 +126,7 @@ module IsoDoc
125
126
 
126
127
  def preface_name_anchors(clause, level, title)
127
128
  @anchors[clause["id"]] =
128
- { label: nil, level: level,
129
+ { label: nil, level:,
129
130
  xref: title, title: nil,
130
131
  type: "clause", elem: @labels["clause"] }
131
132
  end
@@ -170,7 +171,7 @@ module IsoDoc
170
171
  def section_name_anchors(clause, num, level)
171
172
  @anchors[clause["id"]] =
172
173
  { label: num, xref: l10n("#{@labels['clause']} #{num}"),
173
- title: clause_title(clause), level: level, type: "clause",
174
+ title: clause_title(clause), level:, type: "clause",
174
175
  elem: @labels["clause"] }
175
176
  end
176
177
 
@@ -188,9 +189,9 @@ module IsoDoc
188
189
  level == 1 && clause.name == "annex" and
189
190
  label = annex_name_lbl(clause, num)
190
191
  @anchors[clause["id"]] =
191
- { label: label,
192
+ { label:,
192
193
  elem: @labels["annex"], type: "clause",
193
- subtype: "annex", value: num.to_s, level: level,
194
+ subtype: "annex", value: num.to_s, level:,
194
195
  title: clause_title(clause),
195
196
  xref: "#{@labels['annex']} #{num}" }
196
197
  end
data/lib/isodoc/xref.rb CHANGED
@@ -29,7 +29,7 @@ module IsoDoc
29
29
  @locale = options[:locale]
30
30
  @reqt_models = @klass.requirements_processor
31
31
  .new({
32
- default: "default", lang: lang, script: script,
32
+ default: "default", lang:, script:,
33
33
  labels: @i18n.get
34
34
  })
35
35
  @i18n
@@ -39,13 +39,19 @@ module IsoDoc
39
39
  nil
40
40
  end
41
41
 
42
- def pdf_options(_docxml)
42
+ def baseassetpath(filename)
43
+ !@baseassetpath && filename and
44
+ @baseassetpath = File.expand_path(Pathname.new(filename).parent.to_s)
45
+ end
46
+
47
+ def pdf_options(_docxml, filename)
48
+ baseassetpath(filename)
43
49
  ret = {}
44
50
  font_manifest = @options.dig(MN_OPTIONS_KEY, MN2PDF_FONT_MANIFEST) and
45
51
  ret[MN2PDF_FONT_MANIFEST] = font_manifest
46
52
  @aligncrosselements && !@aligncrosselements.empty? and
47
53
  ret["--param align-cross-elements="] =
48
- @aligncrosselements.gsub(/,/, " ")
54
+ @aligncrosselements.tr(",", " ")
49
55
  @baseassetpath and
50
56
  ret["--param baseassetpath="] = @baseassetpath
51
57
  ret.merge(@pdf_cmd_options)
@@ -54,15 +60,14 @@ module IsoDoc
54
60
  # input_file: keep-alive tempfile
55
61
  def convert(input_fname, file = nil, debug = false,
56
62
  output_fname = nil)
57
- file = File.read(input_fname, encoding: "utf-8") if file.nil?
58
- input_file, docxml, filename =
59
- input_xml_path(input_fname, file, debug)
63
+ file ||= File.read(input_fname, encoding: "utf-8")
64
+ _, docxml, filename = input_xml_path(input_fname, file, debug)
65
+ xsl = pdf_stylesheet(docxml) or return
66
+ Pathname.new(xsl).absolute? or xsl = File.join(@libdir, xsl)
60
67
  @doctype = Nokogiri::XML(file).at(ns("//bibdata/ext/doctype"))&.text
61
68
  ::Metanorma::Output::XslfoPdf.new.convert(
62
- filename,
63
- output_fname || output_filename(input_fname),
64
- File.join(@libdir, pdf_stylesheet(docxml)),
65
- pdf_options(docxml),
69
+ filename, output_fname || output_filename(input_fname),
70
+ xsl, pdf_options(docxml, input_fname)
66
71
  )
67
72
  end
68
73
 
@@ -20,17 +20,17 @@ annex: ملحق
20
20
  appendix: تذييل
21
21
  continued: واصلت
22
22
  no_terms_boilerplate: |
23
- <p>لم يتم سرد أي مصطلحات وتعريفات في هذا المستند.</p>
23
+ لم يتم سرد أي مصطلحات وتعريفات في هذا المستند.
24
24
  internal_terms_boilerplate: |
25
- <p>لأغراض هذا المستند، تنطبق المصطلحات والتعريفات التالية.</p>
25
+ لأغراض هذا المستند، تنطبق المصطلحات والتعريفات التالية.
26
26
  norm_with_refs_pref:
27
27
  تتم الإشارة إلى المستندات التالية في النص بحيث يشكل بعض أو كل محتوياتها متطلبات هذا المستند. للحصول على مراجع مؤرخة، تطبق النسخة المشار إليها فقط. بالنسبة للمراجع غير المؤرخة ، تنطبق أحدث طبعة من الوثيقة المشار إليها (بما في ذلك أي تعديلات).
28
28
  norm_empty_pref:
29
29
  لا توجد مراجع معيارية في هذه الوثيقة.
30
30
  external_terms_boilerplate: |
31
- <p> لأغراض هذا المستند ، تنطبق المصطلحات والتعريفات الواردة في%. </ p>
31
+ لأغراض هذا المستند ، تنطبق المصطلحات والتعريفات الواردة في%.
32
32
  internal_external_terms_boilerplate: |
33
- <p>لأغراض هذه الوثيقة ،تنطبق المصطلحات والتعاريف الواردة في % وما يلي.</p>
33
+ لأغراض هذه الوثيقة ،تنطبق المصطلحات والتعاريف الواردة في % وما يلي.
34
34
  no_information_available: "[لا توجد معلومات متاحة]"
35
35
  term_defined_in: "(%)"
36
36
  binary_and: "%1 و %2"
@@ -20,9 +20,9 @@ annex: Anhang
20
20
  appendix: Appendix
21
21
  continued: Fortsetzung
22
22
  no_terms_boilerplate: |
23
- <p>In diesem Dokument sind keine Begriffe und Definitionen aufgeführt.</p>
23
+ In diesem Dokument sind keine Begriffe und Definitionen aufgeführt.
24
24
  internal_terms_boilerplate: |
25
- <p>Für die Zwecke dieses Dokuments gelten die folgenden Begriffe und Definitionen</p>
25
+ Für die Zwecke dieses Dokuments gelten die folgenden Begriffe und Definitionen.
26
26
  norm_with_refs_pref:
27
27
  Auf die folgenden Dokumente wird im Text so verwiesen, dass ihr Inhalt ganz oder
28
28
  teilweise Anforderungen dieses Dokuments darstellt. Bei datierten Verweisen gilt
@@ -30,9 +30,9 @@ norm_with_refs_pref:
30
30
  referenzierten Dokuments (einschließlich eventueller Änderungen).
31
31
  norm_empty_pref: In diesem Dokument sind keine normativen Verweise enthalten.
32
32
  external_terms_boilerplate: |
33
- <p>Für die Zwecke dieses Dokuments gelten die in % angegebenen Begriffe und Definitionen.</p>
33
+ Für die Zwecke dieses Dokuments gelten die in % angegebenen Begriffe und Definitionen.
34
34
  internal_external_terms_boilerplate: |
35
- <p>Für die Zwecke dieses Dokuments gelten die in % und im Folgenden aufgeführten Begriffe und Definitionen.</p>
35
+ Für die Zwecke dieses Dokuments gelten die in % und im Folgenden aufgeführten Begriffe und Definitionen.
36
36
  no_information_available: "[KEINE INFORMATION VERFÜGBAR]"
37
37
  term_defined_in: "(%)"
38
38
  binary_and: "%1 und %2"
@@ -21,10 +21,9 @@ annex: Annex
21
21
  appendix: Appendix
22
22
  continued: continued
23
23
  no_terms_boilerplate: |
24
- <p>No terms and definitions are listed in this document.</p>
24
+ No terms and definitions are listed in this document.
25
25
  internal_terms_boilerplate: |
26
- <p>For the purposes of this document,
27
- the following terms and definitions apply.</p>
26
+ For the purposes of this document, the following terms and definitions apply.
28
27
  norm_with_refs_pref:
29
28
  The following documents are referred to in the text in such a way
30
29
  that some or all of their content constitutes requirements of this
@@ -32,13 +31,11 @@ norm_with_refs_pref:
32
31
  For undated references, the latest edition of the referenced
33
32
  document (including any amendments) applies.
34
33
  norm_empty_pref:
35
- There are no normative references in this document.
34
+ There are no normative references in this document.
36
35
  external_terms_boilerplate: |
37
- <p>For the purposes of this document,
38
- the terms and definitions given in % apply.</p>
36
+ For the purposes of this document, the terms and definitions given in % apply.
39
37
  internal_external_terms_boilerplate: |
40
- <p>For the purposes of this document, the terms and definitions
41
- given in % and the following apply.</p>
38
+ For the purposes of this document, the terms and definitions given in % and the following apply.
42
39
  no_information_available: "[NO INFORMATION AVAILABLE]"
43
40
  term_defined_in: "(%)"
44
41
  binary_and: "%1 and %2"
@@ -20,9 +20,9 @@ annex: Anexo
20
20
  appendix: Apéndice
21
21
  continued: continuación
22
22
  no_terms_boilerplate: |
23
- <p>En este documento no se enumeran términos ni definiciones.</p>
23
+ En este documento no se enumeran términos ni definiciones.
24
24
  internal_terms_boilerplate: |
25
- <p>Para los propósitos de este documento, se aplican los siguientes términos y definiciones.</p>
25
+ Para los propósitos de este documento, se aplican los siguientes términos y definiciones.
26
26
  norm_with_refs_pref:
27
27
  Los siguientes documentos se mencionan en el texto de tal manera que
28
28
  parte o todo su contenido constituye requisitos de este documento.
@@ -32,9 +32,9 @@ norm_with_refs_pref:
32
32
  norm_empty_pref:
33
33
  No hay referencias normativas en este documento.
34
34
  external_terms_boilerplate: |
35
- <p>Para los propósitos de este documento, se aplican los términos y definiciones dados en %.</p>
35
+ Para los propósitos de este documento, se aplican los términos y definiciones dados en %.
36
36
  internal_external_terms_boilerplate: |
37
- <p>Para los propósitos de este documento, se aplican los términos y definiciones dados en % y los siguientes.</p>
37
+ Para los propósitos de este documento, se aplican los términos y definiciones dados en % y los siguientes.
38
38
  no_information_available: "[NO HAY INFORMACIÓN DISPONIBLE]"
39
39
  term_defined_in: "(%)"
40
40
  binary_and: "%1 y %2"
@@ -21,17 +21,17 @@ annex: Annexe
21
21
  appendix: Appendice
22
22
  continued: continué
23
23
  no_terms_boilerplate: |
24
- <p>Aucun terme n’est défini dans le présent document.</p>
24
+ Aucun terme n’est défini dans le présent document.
25
25
  internal_terms_boilerplate: |
26
- <p>Pour les besoins du présent document, les termes et définitions suivants s’appliquent.</p>
26
+ Pour les besoins du présent document, les termes et définitions suivants s’appliquent.
27
27
  norm_with_refs_pref:
28
28
  Les documents suivants cités dans le texte constituent, pour tout ou partie de leur contenu, des exigences du présent document. Pour les références datées, seule l’édition citée s’applique. Pour les références non datées, la dernière édition du document de référence s’applique (y compris les éventuels amendements).
29
29
  norm_empty_pref:
30
30
  Le présent document ne contient aucune référence normative.
31
31
  external_terms_boilerplate: |
32
- <p>Pour les besoins du présent document, les termes et définitions de % s’appliquent.</p>
32
+ Pour les besoins du présent document, les termes et définitions de % s’appliquent.
33
33
  internal_external_terms_boilerplate: |
34
- <p>Pour les besoins du présent document, les termes et définitions de % ainsi que les suivants, s’appliquent.</p>
34
+ Pour les besoins du présent document, les termes et définitions de % ainsi que les suivants, s’appliquent.
35
35
  no_information_available: "[PAS D’INFORMATION DISPONIBLE]"
36
36
  term_defined_in: "(%)"
37
37
  binary_and: "%1 et %2"
@@ -6,32 +6,32 @@ symbols: 記号
6
6
  table_of_contents: 目次
7
7
  introduction: 序文
8
8
  foreword: まえがき
9
- abstract: Abstract
10
- acknowledgements: Acknowledgements
9
+ abstract: はじめに
10
+ acknowledgements: 謝辞
11
11
  termsdef: 用語及び定義
12
12
  termsdefsymbolsabbrev: 用語及び定義並びに記号及び略語
13
13
  termsdefsymbols: 用語及び定義並びに記号
14
14
  termsdefabbrev: 用語及び定義並びに略語
15
15
  normref: 引用規格
16
16
  bibliography: 参考文献
17
- preface: Preface
18
- section: Section
17
+ preface: 序文
18
+ section: セクション
19
19
  clause: 箇条
20
20
  annex: 附属書
21
21
  appendix: Appendix
22
22
  continued: 続き
23
23
  no_terms_boilerplate: |
24
- <p>この規格には,定義する用語はない。</p>
24
+ この規格には,定義する用語はない。
25
25
  internal_terms_boilerplate: |
26
- <p>この規格で用いる主な用語及び定義は,次による。</p>
26
+ この規格で用いる主な用語及び定義は,次による。
27
27
  norm_with_refs_pref:
28
28
  次に掲げる引用規格は,この規格に引用されることによって,その一部又は全部がこの規格の要 求事項を構成している。これらの引用規格のうち,西暦年を付記してあるものは,記載の年の版を適 用し,その後の改正版(追補を含む。)は適用しない。西暦年の付記がない引用規格は,その最新版(追 補を含む。)を適用する。
29
29
  norm_empty_pref:
30
30
  この規格には,引用規格はない。
31
31
  external_terms_boilerplate: |
32
- <p>この規格で用いる主な用語及び定義は,% による。</p>
32
+ この規格で用いる主な用語及び定義は,% による。
33
33
  internal_external_terms_boilerplate: |
34
- <p>この規格で用いる主な用語及び定義は,次によるほか,% による。</p>
34
+ この規格で用いる主な用語及び定義は,次によるほか,% による。
35
35
  no_information_available: "[情報はありません]"
36
36
  term_defined_in: "(%)"
37
37
  binary_and: "%1 and %2"
@@ -123,7 +123,7 @@ locality: {
123
123
  subclause: 細分箇条,
124
124
  part: 部,
125
125
  paragraph: 段落,
126
- chapter: Chapter,
126
+ chapter: 第章,
127
127
  page: ページ,
128
128
  table: 表,
129
129
  annex: 附属書,
@@ -154,7 +154,7 @@ relatedterms:
154
154
  equivalent: equivalent
155
155
  compare: compare
156
156
  contrast: contrast
157
- see: see
157
+ see: 参照
158
158
  seealso: see also
159
159
  inflection:
160
160
  Clause:
@@ -20,10 +20,9 @@ annex: Дополнение
20
20
  appendix: Приложение
21
21
  continued: продолжение
22
22
  no_terms_boilerplate: |
23
- <p>Термины и определения не перечислены в этом документе.</p>
23
+ Термины и определения не перечислены в этом документе.
24
24
  internal_terms_boilerplate: |
25
- <p>Для целей этого документа
26
- применяются следующие термины и определения.</p>
25
+ Для целей этого документа применяются следующие термины и определения.
27
26
  norm_with_refs_pref:
28
27
  Следующие документы упоминаются в тексте таким образом,
29
28
  что некоторая часть или все их содержание являются требованиями
@@ -33,11 +32,9 @@ norm_with_refs_pref:
33
32
  norm_empty_pref:
34
33
  Нет нормативных ссылок в этом документе.
35
34
  external_terms_boilerplate: |
36
- <p>Для целей этого документа применяются
37
- термины и определения, данные в %.</p>
35
+ Для целей этого документа применяются термины и определения, данные в %.
38
36
  internal_external_terms_boilerplate: |
39
- <p>Для целей этого документа применяются
40
- термины и определения, данные в % и следующие.</p>
37
+ Для целей этого документа применяются термины и определения, данные в % и следующие.
41
38
  no_information_available: "[ИНФОРМАЦИЯ ОТСУТСТВУЕТ]"
42
39
  term_defined_in: "(%)"
43
40
  binary_and: "%1 и %2"
@@ -21,9 +21,9 @@ annex: 附件
21
21
  appendix: 附录
22
22
  continued: 继续
23
23
  no_terms_boilerplate: |
24
- <p>本文件不提供术语和定义。</p>
24
+ 本文件不提供术语和定义。
25
25
  internal_terms_boilerplate: |
26
- <p>下列术语和定义适用于本文件。</p>
26
+ 下列术语和定义适用于本文件。
27
27
  norm_with_refs_pref:
28
28
  下列文件对于本文件的应用是必不可少的。
29
29
  凡是注日期的引用文件,仅注日期的版本适用于本文件。
@@ -31,9 +31,9 @@ norm_with_refs_pref:
31
31
  norm_empty_pref:
32
32
  本文件并没有规范性引用文件。
33
33
  external_terms_boilerplate: |
34
- <p>% 界定的术语和定义适用于本文件。</p>
34
+ % 界定的术语和定义适用于本文件。
35
35
  internal_external_terms_boilerplate: |
36
- <p>% 界定的以及下列术语和定义适用于本文件。</p>
36
+ % 界定的以及下列术语和定义适用于本文件。
37
37
  no_information_available: "[无资料]"
38
38
  term_defined_in: "(%)"
39
39
  binary_and: "%1和%2"
@@ -0,0 +1,13 @@
1
+ module Nokogiri
2
+ module XML
3
+ class Node
4
+ def add_first_child(content)
5
+ if children.empty?
6
+ add_child(content)
7
+ else
8
+ children.first.previous = content
9
+ end
10
+ end
11
+ end
12
+ end
13
+ 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: 2.11.0
4
+ version: 2.11.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-08-06 00:00:00.000000000 Z
11
+ date: 2024-09-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: base64
@@ -460,6 +460,7 @@ files:
460
460
  - lib/metanorma/output/base.rb
461
461
  - lib/metanorma/output/utils.rb
462
462
  - lib/metanorma/output/xslfo.rb
463
+ - lib/nokogiri/xml/node.rb
463
464
  - lib/relaton/render-isodoc/config.yml
464
465
  - lib/relaton/render-isodoc/general.rb
465
466
  homepage: https://github.com/metanorma/isodoc