isodoc 2.10.0 → 3.0.0

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.
Files changed (83) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +1 -1
  3. data/isodoc.gemspec +9 -4
  4. data/lib/isodoc/base_style/all.css +96 -0
  5. data/lib/isodoc/base_style/reset.css +96 -0
  6. data/lib/isodoc/base_style/reset.scss +75 -0
  7. data/lib/isodoc/base_style/scripts.html +45 -14
  8. data/lib/isodoc/class_utils.rb +4 -2
  9. data/lib/isodoc/convert.rb +0 -21
  10. data/lib/isodoc/css.rb +2 -4
  11. data/lib/isodoc/function/blocks.rb +37 -52
  12. data/lib/isodoc/function/blocks_example_note.rb +75 -29
  13. data/lib/isodoc/function/cleanup.rb +9 -44
  14. data/lib/isodoc/function/inline.rb +67 -13
  15. data/lib/isodoc/function/lists.rb +20 -14
  16. data/lib/isodoc/function/references.rb +9 -126
  17. data/lib/isodoc/function/reqt.rb +4 -3
  18. data/lib/isodoc/function/section.rb +30 -35
  19. data/lib/isodoc/function/section_titles.rb +22 -11
  20. data/lib/isodoc/function/table.rb +3 -3
  21. data/lib/isodoc/function/terms.rb +49 -26
  22. data/lib/isodoc/function/to_word_html.rb +46 -16
  23. data/lib/isodoc/function/utils.rb +11 -12
  24. data/lib/isodoc/gem_tasks.rb +1 -1
  25. data/lib/isodoc/html_function/footnotes.rb +2 -1
  26. data/lib/isodoc/html_function/html.rb +5 -7
  27. data/lib/isodoc/html_function/postprocess.rb +25 -6
  28. data/lib/isodoc/html_function/postprocess_cover.rb +13 -7
  29. data/lib/isodoc/html_function/postprocess_footnotes.rb +52 -47
  30. data/lib/isodoc/init.rb +31 -0
  31. data/lib/isodoc/metadata.rb +20 -13
  32. data/lib/isodoc/metadata_contributor.rb +5 -10
  33. data/lib/isodoc/metadata_date.rb +1 -1
  34. data/lib/isodoc/presentation_function/autonum.rb +153 -0
  35. data/lib/isodoc/presentation_function/bibdata.rb +4 -5
  36. data/lib/isodoc/presentation_function/block.rb +107 -40
  37. data/lib/isodoc/presentation_function/concepts.rb +184 -19
  38. data/lib/isodoc/presentation_function/docid.rb +78 -0
  39. data/lib/isodoc/presentation_function/erefs.rb +55 -31
  40. data/lib/isodoc/presentation_function/image.rb +64 -19
  41. data/lib/isodoc/presentation_function/index.rb +180 -0
  42. data/lib/isodoc/presentation_function/inline.rb +47 -16
  43. data/lib/isodoc/presentation_function/math.rb +128 -71
  44. data/lib/isodoc/presentation_function/metadata.rb +29 -66
  45. data/lib/isodoc/presentation_function/refs.rb +75 -28
  46. data/lib/isodoc/presentation_function/reqt.rb +7 -4
  47. data/lib/isodoc/presentation_function/section.rb +51 -129
  48. data/lib/isodoc/presentation_function/sourcecode.rb +52 -19
  49. data/lib/isodoc/presentation_function/terms.rb +107 -118
  50. data/lib/isodoc/presentation_function/title.rb +107 -0
  51. data/lib/isodoc/presentation_function/xrefs.rb +37 -17
  52. data/lib/isodoc/presentation_xml_convert.rb +24 -10
  53. data/lib/isodoc/version.rb +1 -1
  54. data/lib/isodoc/word_function/body.rb +9 -37
  55. data/lib/isodoc/word_function/comments.rb +0 -1
  56. data/lib/isodoc/word_function/footnotes.rb +1 -1
  57. data/lib/isodoc/word_function/lists.rb +13 -9
  58. data/lib/isodoc/word_function/postprocess.rb +6 -0
  59. data/lib/isodoc/word_function/postprocess_cover.rb +6 -4
  60. data/lib/isodoc/word_function/postprocess_table.rb +1 -1
  61. data/lib/isodoc/word_function/postprocess_toc.rb +10 -6
  62. data/lib/isodoc/word_function/table.rb +2 -2
  63. data/lib/isodoc/xref/clause_order.rb +41 -0
  64. data/lib/isodoc/xref/xref_anchor.rb +31 -16
  65. data/lib/isodoc/xref/xref_counter.rb +18 -3
  66. data/lib/isodoc/xref/xref_counter_types.rb +14 -0
  67. data/lib/isodoc/xref/xref_gen.rb +61 -37
  68. data/lib/isodoc/xref/xref_gen_seq.rb +148 -81
  69. data/lib/isodoc/xref/xref_sect_gen.rb +84 -88
  70. data/lib/isodoc/xref/xref_util.rb +53 -4
  71. data/lib/isodoc/xref.rb +29 -10
  72. data/lib/isodoc/xslfo_convert.rb +14 -9
  73. data/lib/isodoc-yaml/i18n-ar.yaml +17 -13
  74. data/lib/isodoc-yaml/i18n-de.yaml +17 -13
  75. data/lib/isodoc-yaml/i18n-en.yaml +18 -17
  76. data/lib/isodoc-yaml/i18n-es.yaml +17 -13
  77. data/lib/isodoc-yaml/i18n-fr.yaml +17 -13
  78. data/lib/isodoc-yaml/i18n-ja.yaml +56 -52
  79. data/lib/isodoc-yaml/i18n-ru.yaml +17 -16
  80. data/lib/isodoc-yaml/i18n-zh-Hans.yaml +17 -13
  81. data/lib/nokogiri/xml/node.rb +14 -0
  82. data/lib/relaton/render-isodoc/config.yml +1 -1
  83. metadata +90 -13
@@ -1,56 +1,20 @@
1
+ require_relative "clause_order"
2
+
1
3
  module IsoDoc
2
4
  module XrefGen
3
5
  module Sections
4
- def clause_order(docxml)
5
- { preface: clause_order_preface(docxml),
6
- main: clause_order_main(docxml),
7
- annex: clause_order_annex(docxml),
8
- back: clause_order_back(docxml) }
9
- end
10
-
11
- def clause_order_preface(_docxml)
12
- [{ path: "//preface/*", multi: true }]
13
- end
14
-
15
- def clause_order_main(docxml)
16
- [
17
- { path: "//sections/clause[@type = 'scope']" },
18
- { path: @klass.norm_ref_xpath },
19
- { path: "//sections/terms | " \
20
- "//sections/clause[descendant::terms]" },
21
- { path: "//sections/definitions | " \
22
- "//sections/clause[descendant::definitions]" \
23
- "[not(descendant::terms)]" },
24
- { path: @klass.middle_clause(docxml), multi: true },
25
- ]
26
- end
27
-
28
- def clause_order_annex(_docxml)
29
- [{ path: "//annex", multi: true }]
30
- end
31
-
32
- def clause_order_back(_docxml)
33
- [
34
- { path: @klass.bibliography_xpath },
35
- { path: "//indexsect", multi: true },
36
- { path: "//colophon/*", multi: true },
37
- ]
38
- end
39
-
40
6
  def back_anchor_names(xml)
41
7
  if @parse_settings.empty? || @parse_settings[:clauses]
42
8
  annex_anchor_names(xml)
43
9
  back_clauses_anchor_names(xml)
44
10
  end
45
- if @klass.bibrender && (@parse_settings.empty? || @parse_settings[:refs])
46
- references(xml)
47
- end
48
11
  end
49
12
 
50
13
  def annex_anchor_names(xml)
51
14
  i = Counter.new("@")
52
15
  clause_order_annex(xml).each do |a|
53
16
  xml.xpath(ns(a[:path])).each do |c|
17
+ unnumbered_section_name?(c) and next
54
18
  annex_names(c, i.increment(c).print)
55
19
  a[:multi] or break
56
20
  end
@@ -66,11 +30,7 @@ module IsoDoc
66
30
  end
67
31
  end
68
32
 
69
- def references(docxml)
70
- docxml.xpath(ns("//bibitem[not(ancestor::bibitem)]")).each do |ref|
71
- reference_names(ref)
72
- end
73
- end
33
+ # NOTE: references processing has moved to Presentation XML
74
34
 
75
35
  def initial_anchor_names(xml)
76
36
  if @parse_settings.empty? || @parse_settings[:clauses]
@@ -89,7 +49,7 @@ module IsoDoc
89
49
  end
90
50
 
91
51
  def main_anchor_names(xml)
92
- n = Counter.new
52
+ n = clause_counter
93
53
  clause_order_main(xml).each do |a|
94
54
  xml.xpath(ns(a[:path])).each do |c|
95
55
  section_names(c, n, 1)
@@ -116,8 +76,9 @@ module IsoDoc
116
76
 
117
77
  def clause_title(clause, use_elem_name: false)
118
78
  ret = clause.at(ns("./title"))&.text
119
- if use_elem_name && !ret
120
- clause.name.capitalize
79
+ if use_elem_name && ret.blank?
80
+ @i18n.labels[clause.name]&.capitalize ||
81
+ clause.name.capitalize
121
82
  else ret
122
83
  end
123
84
  end
@@ -140,11 +101,13 @@ module IsoDoc
140
101
 
141
102
  def unnumbered_names(clause)
142
103
  clause.nil? and return
143
- preface_name_anchors(clause, 1,
144
- clause_title(clause, use_elem_name: true))
104
+ title = clause_title(clause, use_elem_name: true)
105
+ preface_name_anchors(clause, 1, title)
145
106
  clause.xpath(ns(SUBCLAUSES)).each_with_index do |c, i|
146
- preface_names1(c, c.at(ns("./title"))&.text,
147
- "#{clause_title(clause)}, #{i + 1}", 2)
107
+ t = c.at(ns("./title"))
108
+ tt = "#{semx(clause, title, clause.name)}" \
109
+ "<span class='fmt-comma'>,</span> #{semx(c, i + 1)}"
110
+ preface_names1(c, t ? semx(c, t.text, c.name) : nil, tt, 2)
148
111
  end
149
112
  end
150
113
 
@@ -152,15 +115,19 @@ module IsoDoc
152
115
  label = title || parent_title
153
116
  preface_name_anchors(clause, level, title || parent_title)
154
117
  clause.xpath(ns(SUBCLAUSES)).each_with_index do |c, i|
155
- preface_names1(c, c.at(ns("./title"))&.text, "#{label} #{i + 1}",
118
+ t = c.at(ns("./title"))
119
+ preface_names1(c, t ? semx(c, t.text, c.name) : nil,
120
+ "#{label} #{semx(c, i + 1)}",
156
121
  level + 1)
157
122
  end
158
123
  end
159
124
 
160
125
  def preface_name_anchors(clause, level, title)
126
+ xref = semx(clause, title, clause.name)
127
+ clause["id"] ||= "_#{UUIDTools::UUID.random_create}"
161
128
  @anchors[clause["id"]] =
162
- { label: nil, level: level,
163
- xref: title, title: nil,
129
+ { label: nil, level:,
130
+ xref:, title: nil,
164
131
  type: "clause", elem: @labels["clause"] }
165
132
  end
166
133
 
@@ -173,81 +140,110 @@ module IsoDoc
173
140
  end
174
141
 
175
142
  def section_names(clause, num, lvl)
176
- clause.nil? and return num
143
+ unnumbered_section_name?(clause) and return num
177
144
  num.increment(clause)
178
- section_name_anchors(clause, num.print, lvl)
145
+ lbl = semx(clause, num.print)
146
+ section_name_anchors(clause, lbl, lvl)
179
147
  clause.xpath(ns(SUBCLAUSES))
180
- .each_with_object(Counter.new(0, prefix: "#{num.print}.")) do |c, i|
181
- section_names1(c, i.increment(c).print, lvl + 1)
148
+ .each_with_object(clause_counter(0)) do |c, i|
149
+ section_names1(c, lbl, i.increment(c).print, lvl + 1)
182
150
  end
183
151
  num
184
152
  end
185
153
 
186
- def section_names1(clause, num, level)
187
- section_name_anchors(clause, num, level)
188
- i = Counter.new(0, prefix: "#{num}.")
154
+ def clause_number_semx(parentnum, clause, num)
155
+ if clause["branch-number"]
156
+ semx(clause, clause["branch-number"])
157
+ elsif parentnum.nil?
158
+ semx(clause, num)
159
+ else
160
+ "#{parentnum}#{delim_wrap(clausesep)}#{semx(clause, num)}"
161
+ end
162
+ end
163
+
164
+ def section_names1(clause, parentnum, num, level)
165
+ unnumbered_section_name?(clause) and return num
166
+ lbl = clause_number_semx(parentnum, clause, num)
167
+ section_name_anchors(clause, lbl, level)
168
+ i = clause_counter(0)
189
169
  clause.xpath(ns(SUBCLAUSES)).each do |c|
190
- section_names1(c, i.increment(c).print, level + 1)
170
+ section_names1(c, lbl, i.increment(c).print, level + 1)
171
+ end
172
+ end
173
+
174
+ def unnumbered_section_name?(clause)
175
+ clause.nil? and return true
176
+ if clause["unnumbered"] == "true"
177
+ unnumbered_names(clause)
178
+ return true
191
179
  end
180
+ false
181
+ end
182
+
183
+ def clausesep
184
+ "."
192
185
  end
193
186
 
194
187
  def section_name_anchors(clause, num, level)
188
+ xref = labelled_autonum(@labels["clause"], num)
189
+ label = num
190
+ c = clause_title(clause) and title = semx(clause, c, "title")
191
+ clause["id"] ||= "_#{UUIDTools::UUID.random_create}"
195
192
  @anchors[clause["id"]] =
196
- { label: num, xref: l10n("#{@labels['clause']} #{num}"),
197
- title: clause_title(clause), level: level, type: "clause",
193
+ { label:, xref:, title:, level:, type: "clause",
198
194
  elem: @labels["clause"] }
199
195
  end
200
196
 
201
197
  def annex_name_lbl(clause, num)
202
- obl = l10n("(#{@labels['inform_annex']})")
198
+ obl = "(#{@labels['inform_annex']})"
203
199
  clause["obligation"] == "normative" and
204
- obl = l10n("(#{@labels['norm_annex']})")
200
+ obl = "(#{@labels['norm_annex']})"
201
+ obl = "<span class='fmt-obligation'>#{l10n obl}</fmt>"
205
202
  title = Common::case_with_markup(@labels["annex"], "capital",
206
203
  @script)
207
- l10n("<strong>#{title} #{num}</strong><br/>#{obl}")
204
+ s = labelled_autonum(title, num)
205
+ "<strong><span class='fmt-caption-label'>#{s}</span></strong><br/>#{obl}"
208
206
  end
209
207
 
210
208
  def annex_name_anchors(clause, num, level)
211
209
  label = num
212
210
  level == 1 && clause.name == "annex" and
213
- label = annex_name_lbl(clause, num)
211
+ label = annex_name_lbl(clause, label)
212
+ c = clause_title(clause) and title = semx(clause, c, "title")
213
+ clause["id"] ||= "_#{UUIDTools::UUID.random_create}"
214
214
  @anchors[clause["id"]] =
215
- { label: label,
215
+ { label:, xref: labelled_autonum(@labels["annex"], num), title:,
216
216
  elem: @labels["annex"], type: "clause",
217
- subtype: "annex", value: num.to_s, level: level,
218
- title: clause_title(clause),
219
- xref: "#{@labels['annex']} #{num}" }
217
+ subtype: "annex", value: num.to_s, level: }
220
218
  end
221
219
 
222
220
  def annex_names(clause, num)
223
- annex_name_anchors(clause, num, 1)
221
+ label = semx(clause, num)
222
+ annex_name_anchors(clause, label, 1)
224
223
  if @klass.single_term_clause?(clause)
225
224
  annex_names1(clause.at(ns("./references | ./terms | ./definitions")),
226
- num.to_s, 1)
225
+ nil, num.to_s, 1)
227
226
  else
228
227
  clause.xpath(ns(SUBCLAUSES))
229
- .each_with_object(Counter.new(0, prefix: "#{num}.")) do |c, i|
230
- annex_names1(c, i.increment(c).print, 2)
228
+ .each_with_object(clause_counter(0)) do |c, i|
229
+ annex_names1(c, label, i.increment(c).print, 2)
231
230
  end
232
231
  end
233
- hierarchical_asset_names(clause, num)
232
+ hierarchical_asset_names(clause, label)
234
233
  end
235
234
 
236
- def annex_names1(clause, num, level)
237
- annex_name_anchors(clause, num, level)
238
- i = Counter.new(0, prefix: "#{num}.")
235
+ def annex_names1(clause, parentnum, num, level)
236
+ lbl = clause_number_semx(parentnum, clause, num)
237
+ annex_name_anchors1(clause, lbl, level)
238
+ i = clause_counter(0)
239
239
  clause.xpath(ns(SUBCLAUSES)).each do |c|
240
- annex_names1(c, i.increment(c).print, level + 1)
240
+ annex_names1(c, lbl, i.increment(c).print, level + 1)
241
241
  end
242
242
  end
243
243
 
244
- def reference_names(ref)
245
- ids = @klass.bibitem_ref_code(ref)
246
- identifiers = @klass.render_identifier(ids)
247
- reference = @klass
248
- .docid_l10n(identifiers[:metanorma] || identifiers[:sdo] ||
249
- identifiers[:ordinal] || identifiers[:doi])
250
- @anchors[ref["id"]] = { xref: reference }
244
+ # subclauses of Annexes
245
+ def annex_name_anchors1(clause, num, level)
246
+ annex_name_anchors(clause, num, level)
251
247
  end
252
248
  end
253
249
  end
@@ -6,9 +6,15 @@ module Enumerable
6
6
  end
7
7
  end
8
8
 
9
+ class Object
10
+ def blank?
11
+ nil? || empty?
12
+ end
13
+ end
14
+
9
15
  module IsoDoc
10
16
  module XrefGen
11
- module Blocks
17
+ module Util
12
18
  def blank?(text)
13
19
  text.nil? || text.empty?
14
20
  end
@@ -19,7 +25,8 @@ module IsoDoc
19
25
 
20
26
  SECTIONS_XPATH =
21
27
  "//foreword | //introduction | //acknowledgements | " \
22
- "//preface/terms | preface/definitions | preface/references | " \
28
+ "//preface/abstract | " \
29
+ "//preface/terms | //preface/definitions | //preface/references | " \
23
30
  "//preface/clause | //sections/terms | //annex | " \
24
31
  "//sections/clause | //sections/definitions | " \
25
32
  "//bibliography/references | //bibliography/clause".freeze
@@ -34,8 +41,50 @@ module IsoDoc
34
41
  "./xmlns:X".gsub("X", asset)
35
42
  end
36
43
 
37
- CHILD_SECTIONS = "./clause | ./appendix | ./terms | ./definitions | " \
38
- "./references".freeze
44
+ CHILD_SECTIONS = "./clause | ./appendix | ./terms | ./definitions | " \
45
+ "./references".freeze
46
+
47
+ def child_sections
48
+ CHILD_SECTIONS
49
+ end
50
+
51
+ # if hierarchically marked up node in label already,
52
+ # leave alone, else wrap in semx
53
+ def semx(node, label, element = "autonum")
54
+ label = label.to_s
55
+ id = node["id"] || node[:id]
56
+ /<semx element='[^']+' source='#{id}'/.match?(label) and return label
57
+ l = stripsemx(label)
58
+ %(<semx element='#{element}' source='#{id}'>#{l}</semx>)
59
+ end
60
+
61
+ # assume parent is already semantically annotated with semx
62
+ def hiersemx(parent, parentlabel, counter, element, sep: nil)
63
+ sep ||= hier_separator(markup: true)
64
+ "#{semx(parent, parentlabel)}#{sep}#{semx(element, counter.print)}"
65
+ end
66
+
67
+ def delim_wrap(delim, klass = "fmt-autonum-delim")
68
+ delim.blank? and return ""
69
+ "<span class='#{klass}'>#{delim}</span>"
70
+ end
71
+
72
+ def stripsemx(elem)
73
+ elem.nil? and return elem
74
+ xml = Nokogiri::XML::DocumentFragment.parse(elem)
75
+ xml.traverse do |x|
76
+ x.name == "semx" ||
77
+ (x.name == "span" && /^fmt-/.match?(x["class"])) and
78
+ x.replace(x.children)
79
+ end
80
+ xml.to_xml(indent: 0, encoding: "UTF-8",
81
+ save_with: Nokogiri::XML::Node::SaveOptions::AS_XML)
82
+ end
83
+
84
+ def labelled_autonum(label, autonum)
85
+ label.blank? and return autonum
86
+ l10n("<span class='fmt-element-name'>#{label}</span> #{autonum}")
87
+ end
39
88
  end
40
89
  end
41
90
  end
data/lib/isodoc/xref.rb CHANGED
@@ -1,8 +1,10 @@
1
1
  require_relative "xref/xref_anchor"
2
2
  require_relative "xref/xref_counter"
3
+ require_relative "xref/xref_counter_types"
3
4
  require_relative "xref/xref_gen_seq"
4
5
  require_relative "xref/xref_gen"
5
6
  require_relative "xref/xref_sect_gen"
7
+ require_relative "xref/xref_util"
6
8
  require_relative "class_utils"
7
9
  require_relative "function/utils"
8
10
 
@@ -17,25 +19,31 @@ module IsoDoc
17
19
 
18
20
  # Note: if bibrender is no passed in, do not parse references
19
21
  def initialize(lang, script, klass, i18n, options = {})
20
- @anchors = {}
22
+ initialize_empty
21
23
  @lang = lang
22
24
  @script = script
23
25
  @klass = klass
24
26
  @options = options
25
- @i18n = i18n
26
- @labels = @i18n.get
27
- @klass.i18n = @i18n
27
+ initialize_i18n(i18n)
28
28
  @klass.bibrender ||= options[:bibrender]
29
- @locale = options[:locale]
30
29
  @reqt_models = @klass.requirements_processor
31
- .new({
32
- default: "default", lang: lang, script: script,
33
- labels: @i18n.get
34
- })
35
- @i18n
30
+ .new({ default: "default", lang:, script:,
31
+ labels: @i18n.get })
32
+ end
33
+
34
+ def initialize_empty
35
+ @c = HTMLEntities.new
36
+ @anchors = {}
36
37
  @parse_settings = {}
37
38
  end
38
39
 
40
+ def initialize_i18n(i18n)
41
+ @i18n = i18n
42
+ @labels = @i18n.get
43
+ @klass.i18n = @i18n
44
+ @locale = @options[:locale]
45
+ end
46
+
39
47
  def get
40
48
  @anchors
41
49
  end
@@ -66,9 +74,18 @@ module IsoDoc
66
74
  initial_anchor_names(docxml)
67
75
  back_anchor_names(docxml)
68
76
  asset_anchor_names(docxml)
77
+ localise_anchors
69
78
  @parse_settings = {}
70
79
  end
71
80
 
81
+ def localise_anchors
82
+ @anchors.each_value do |v|
83
+ v[:label] &&= l10n(v[:label])
84
+ v[:value] &&= l10n(v[:value])
85
+ v[:xref] &&= l10n(v[:xref])
86
+ end
87
+ end
88
+
72
89
  def ns(xpath)
73
90
  Common::ns(xpath)
74
91
  end
@@ -76,5 +93,7 @@ module IsoDoc
76
93
  def l10n(text, lang = @lang, script = @script, locale = @locale)
77
94
  @i18n.l10n(text, lang, script, locale)
78
95
  end
96
+
97
+ include ::IsoDoc::XrefGen::Util
79
98
  end
80
99
  end
@@ -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
 
@@ -15,33 +15,36 @@ termsdefsymbols: المصطلحات والتعريفات والرموز
15
15
  termsdefabbrev: المصطلحات والتعريفات والاختصارات
16
16
  normref: المراجع المعيارية
17
17
  bibliography: بيبليوغرافيا
18
+ index: الفهرس
19
+ see: انظر
20
+ see_also: انظر أيضًا
18
21
  clause: فقرة
19
22
  annex: ملحق
20
23
  appendix: تذييل
21
24
  continued: واصلت
22
25
  no_terms_boilerplate: |
23
- <p>لم يتم سرد أي مصطلحات وتعريفات في هذا المستند.</p>
26
+ لم يتم سرد أي مصطلحات وتعريفات في هذا المستند.
24
27
  internal_terms_boilerplate: |
25
- <p>لأغراض هذا المستند، تنطبق المصطلحات والتعريفات التالية.</p>
28
+ لأغراض هذا المستند، تنطبق المصطلحات والتعريفات التالية.
26
29
  norm_with_refs_pref:
27
30
  تتم الإشارة إلى المستندات التالية في النص بحيث يشكل بعض أو كل محتوياتها متطلبات هذا المستند. للحصول على مراجع مؤرخة، تطبق النسخة المشار إليها فقط. بالنسبة للمراجع غير المؤرخة ، تنطبق أحدث طبعة من الوثيقة المشار إليها (بما في ذلك أي تعديلات).
28
31
  norm_empty_pref:
29
32
  لا توجد مراجع معيارية في هذه الوثيقة.
30
33
  external_terms_boilerplate: |
31
- <p> لأغراض هذا المستند ، تنطبق المصطلحات والتعريفات الواردة في%. </ p>
34
+ لأغراض هذا المستند ، تنطبق المصطلحات والتعريفات الواردة في%.
32
35
  internal_external_terms_boilerplate: |
33
- <p>لأغراض هذه الوثيقة ،تنطبق المصطلحات والتعاريف الواردة في % وما يلي.</p>
36
+ لأغراض هذه الوثيقة ،تنطبق المصطلحات والتعاريف الواردة في % وما يلي.
34
37
  no_information_available: "[لا توجد معلومات متاحة]"
35
38
  term_defined_in: "(%)"
36
- binary_and: "%1 و %2"
37
- multiple_and: "%1, و %2"
38
- binary_or: "%1 او %2"
39
- multiple_or: "%1, او %2"
40
- chain_and: "%1 و %2"
41
- chain_or: "%1 او %2"
42
- chain_from: "%1 %من 2"
43
- chain_to: "من %1 إلى %2"
44
- nested_xref: "%1, %2"
39
+ binary_and: "%1 <conn>ﻭ</conn> %2"
40
+ multiple_and: "%1<enum-comma>,</enum-comma> <conn>ﻭ</conn> %2"
41
+ binary_or: "%1 <conn>ﺍﻭ</conn> %2"
42
+ multiple_or: "%1<enum-comma>,</enum-comma> <conn>ﺍﻭ</conn> %2"
43
+ chain_and: "%1 <conn>ﻭ</conn> %2"
44
+ chain_or: "%1 <conn>ﺍﻭ</conn> %2"
45
+ chain_from: "%1 <conn>%ﻢﻧ</conn> 2"
46
+ chain_to: "<conn>ﻢﻧ</conn> %1 <conn>ﺈﻟﻯ</conn> %2"
47
+ nested_xref: "%1<comma>,</comma> %2"
45
48
  list_nested_xref: "%1 %2"
46
49
  ordinal_keys: [gender]
47
50
  SpelloutRules:
@@ -75,6 +78,7 @@ modified: معدلة
75
78
  adapted: تكيف
76
79
  deprecated: مهمل
77
80
  source: مصدر
81
+ no_identifier: (لا يوجد معرف)
78
82
  and: و
79
83
  all_parts: كل الأجزاء
80
84
  edition_ordinal: "ﺎﻠﻄﺒﻋﺓ؜ {{ var1 | ordinal_word: 'edition', '' }}"
@@ -15,14 +15,17 @@ termsdefsymbols: Begriffe, Definitionen und Symbole
15
15
  termsdefabbrev: Begriffe, Definitionen und abgekürzte Begriffe
16
16
  normref: Normative Verweise
17
17
  bibliography: Bibliographie
18
+ index: Index
19
+ see: schau
20
+ see_also: siehe auch
18
21
  clause: Klausel
19
22
  annex: Anhang
20
23
  appendix: Appendix
21
24
  continued: Fortsetzung
22
25
  no_terms_boilerplate: |
23
- <p>In diesem Dokument sind keine Begriffe und Definitionen aufgeführt.</p>
26
+ In diesem Dokument sind keine Begriffe und Definitionen aufgeführt.
24
27
  internal_terms_boilerplate: |
25
- <p>Für die Zwecke dieses Dokuments gelten die folgenden Begriffe und Definitionen</p>
28
+ Für die Zwecke dieses Dokuments gelten die folgenden Begriffe und Definitionen.
26
29
  norm_with_refs_pref:
27
30
  Auf die folgenden Dokumente wird im Text so verwiesen, dass ihr Inhalt ganz oder
28
31
  teilweise Anforderungen dieses Dokuments darstellt. Bei datierten Verweisen gilt
@@ -30,20 +33,20 @@ norm_with_refs_pref:
30
33
  referenzierten Dokuments (einschließlich eventueller Änderungen).
31
34
  norm_empty_pref: In diesem Dokument sind keine normativen Verweise enthalten.
32
35
  external_terms_boilerplate: |
33
- <p>Für die Zwecke dieses Dokuments gelten die in % angegebenen Begriffe und Definitionen.</p>
36
+ Für die Zwecke dieses Dokuments gelten die in % angegebenen Begriffe und Definitionen.
34
37
  internal_external_terms_boilerplate: |
35
- <p>Für die Zwecke dieses Dokuments gelten die in % und im Folgenden aufgeführten Begriffe und Definitionen.</p>
38
+ Für die Zwecke dieses Dokuments gelten die in % und im Folgenden aufgeführten Begriffe und Definitionen.
36
39
  no_information_available: "[KEINE INFORMATION VERFÜGBAR]"
37
40
  term_defined_in: "(%)"
38
- binary_and: "%1 und %2"
39
- multiple_and: "%1, und %2"
40
- binary_or: "%1 oder %2"
41
- multiple_or: "%1, oder %2"
42
- chain_and: "%1 und %2"
43
- chain_or: "%1 oder %2"
44
- chain_from: "%1 von %2"
45
- chain_to: "%1 bis %2"
46
- nested_xref: "%1, %2"
41
+ binary_and: "%1 <conn>und</conn> %2"
42
+ multiple_and: "%1<enum-comma>,</enum-comma> <conn>und</conn> %2"
43
+ binary_or: "%1 <conn>oder</conn> %2"
44
+ multiple_or: "%1<enum-comma>,</enum-comma> <conn>oder</conn> %2"
45
+ chain_and: "%1 <conn>und</conn> %2"
46
+ chain_or: "%1 <conn>oder</conn> %2"
47
+ chain_from: "%1 <conn>von</conn> %2"
48
+ chain_to: "%1 <conn>bis</conn> %2"
49
+ nested_xref: "%1<comma>,</comma> %2"
47
50
  list_nested_xref: "%1 %2"
48
51
  ordinal_keys: [gender,number]
49
52
  SpelloutRules:
@@ -88,6 +91,7 @@ adapted: angepasst
88
91
  deprecated: VERALTET
89
92
  source: QUELLE
90
93
  and: und
94
+ no_identifier: (KEIN KENNUNG)
91
95
  all_parts: Alle Teile
92
96
  edition_ordinal: "{{ var1 | ordinal_word: 'edition', '' }} Auflage"
93
97
  edition: Auflage
@@ -14,6 +14,9 @@ termsdefsymbols: Terms, definitions and symbols
14
14
  termsdefabbrev: Terms, definitions and abbreviated terms
15
15
  normref: Normative references
16
16
  bibliography: Bibliography
17
+ index: Index
18
+ see: see
19
+ see_also: see also
17
20
  preface: Preface
18
21
  section: Section
19
22
  clause: Clause
@@ -21,10 +24,9 @@ annex: Annex
21
24
  appendix: Appendix
22
25
  continued: continued
23
26
  no_terms_boilerplate: |
24
- <p>No terms and definitions are listed in this document.</p>
27
+ No terms and definitions are listed in this document.
25
28
  internal_terms_boilerplate: |
26
- <p>For the purposes of this document,
27
- the following terms and definitions apply.</p>
29
+ For the purposes of this document, the following terms and definitions apply.
28
30
  norm_with_refs_pref:
29
31
  The following documents are referred to in the text in such a way
30
32
  that some or all of their content constitutes requirements of this
@@ -32,24 +34,22 @@ norm_with_refs_pref:
32
34
  For undated references, the latest edition of the referenced
33
35
  document (including any amendments) applies.
34
36
  norm_empty_pref:
35
- There are no normative references in this document.
37
+ There are no normative references in this document.
36
38
  external_terms_boilerplate: |
37
- <p>For the purposes of this document,
38
- the terms and definitions given in % apply.</p>
39
+ For the purposes of this document, the terms and definitions given in % apply.
39
40
  internal_external_terms_boilerplate: |
40
- <p>For the purposes of this document, the terms and definitions
41
- given in % and the following apply.</p>
41
+ For the purposes of this document, the terms and definitions given in % and the following apply.
42
42
  no_information_available: "[NO INFORMATION AVAILABLE]"
43
43
  term_defined_in: "(%)"
44
- binary_and: "%1 and %2"
45
- multiple_and: "%1, and %2"
46
- binary_or: "%1 or %2"
47
- multiple_or: "%1, or %2"
48
- chain_and: "%1 and %2"
49
- chain_or: "%1 or %2"
50
- chain_from: "%1 from %2"
51
- chain_to: "%1 to %2"
52
- nested_xref: "%1, %2"
44
+ binary_and: "%1 <conn>and</conn> %2"
45
+ multiple_and: "%1<enum-comma>,</enum-comma> <conn>and</conn> %2"
46
+ binary_or: "%1 <conn>or</conn> %2"
47
+ multiple_or: "%1<enum-comma>,</enum-comma> <conn>or</conn> %2"
48
+ chain_and: "%1 <conn>and</conn> %2"
49
+ chain_or: "%1 <conn>or</conn> %2"
50
+ chain_from: "%1 <conn>from</conn> %2"
51
+ chain_to: "%1 <conn>to</conn> %2"
52
+ nested_xref: "%1<comma>,</comma> %2"
53
53
  list_nested_xref: "%1 %2"
54
54
  ordinal_keys: []
55
55
  SpelloutRules: spellout-ordinal
@@ -68,6 +68,7 @@ requirement: Requirement
68
68
  recommendation: Recommendation
69
69
  permission: Permission
70
70
  box: Box
71
+ no_identifier: (NO ID)
71
72
  # Modspec
72
73
  recommendationtest: Recommendation test
73
74
  requirementtest: Requirement test