isodoc 2.0.3 → 2.0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/lib/isodoc/convert.rb +36 -18
  3. data/lib/isodoc/function/inline.rb +24 -13
  4. data/lib/isodoc/function/references.rb +1 -1
  5. data/lib/isodoc/i18n.rb +20 -7
  6. data/lib/isodoc/metadata_contributor.rb +1 -1
  7. data/lib/isodoc/presentation_function/bibdata.rb +26 -9
  8. data/lib/isodoc/presentation_function/image.rb +3 -4
  9. data/lib/isodoc/presentation_function/inline.rb +119 -76
  10. data/lib/isodoc/presentation_function/math.rb +1 -0
  11. data/lib/isodoc/presentation_function/xrefs.rb +100 -0
  12. data/lib/isodoc/version.rb +1 -1
  13. data/lib/isodoc/word_function/body.rb +11 -1
  14. data/lib/isodoc/word_function/postprocess.rb +4 -6
  15. data/lib/isodoc/word_function/postprocess_cover.rb +82 -1
  16. data/lib/isodoc/xref/xref_anchor.rb +1 -0
  17. data/lib/isodoc/xref/xref_gen.rb +2 -1
  18. data/lib/isodoc/xref/xref_sect_gen.rb +14 -8
  19. data/lib/isodoc/xslfo_convert.rb +19 -19
  20. data/lib/isodoc-yaml/i18n-ar.yaml +11 -0
  21. data/lib/isodoc-yaml/i18n-de.yaml +11 -0
  22. data/lib/isodoc-yaml/i18n-en.yaml +11 -0
  23. data/lib/isodoc-yaml/i18n-es.yaml +11 -0
  24. data/lib/isodoc-yaml/i18n-fr.yaml +11 -0
  25. data/lib/isodoc-yaml/i18n-ru.yaml +11 -0
  26. data/lib/isodoc-yaml/i18n-zh-Hans.yaml +11 -0
  27. data/spec/isodoc/blocks_spec.rb +13 -77
  28. data/spec/isodoc/inline_spec.rb +564 -22
  29. data/spec/isodoc/metadata_spec.rb +1 -1
  30. data/spec/isodoc/postproc_spec.rb +466 -2
  31. data/spec/isodoc/presentation_xml_spec.rb +139 -0
  32. data/spec/isodoc/ref_spec.rb +7 -7
  33. data/spec/isodoc/section_spec.rb +1 -2
  34. data/spec/isodoc/terms_spec.rb +8 -8
  35. data/spec/isodoc/xref_spec.rb +60 -1188
  36. data/spec/isodoc/xslfo_convert_spec.rb +12 -7
  37. metadata +3 -2
@@ -233,11 +233,21 @@ module IsoDoc
233
233
  end
234
234
 
235
235
  def suffix_url(url)
236
- return url if %r{^https?://}.match?(url)
236
+ return url if url.nil? || %r{^https?://}.match?(url)
237
237
  return url unless File.extname(url).empty?
238
238
 
239
239
  url.sub(/#{File.extname(url)}$/, ".doc")
240
240
  end
241
+
242
+ def info(isoxml, out)
243
+ @tocfigurestitle =
244
+ isoxml&.at(ns("//misc-container/toc[@type = 'figure']/title"))&.text
245
+ @toctablestitle =
246
+ isoxml&.at(ns("//misc-container/toc[@type = 'table']/title"))&.text
247
+ @tocrecommendationstitle = isoxml
248
+ &.at(ns("//misc-container/toc[@type = 'recommendation']/title"))&.text
249
+ super
250
+ end
241
251
  end
242
252
  end
243
253
  end
@@ -165,9 +165,7 @@ module IsoDoc
165
165
  xpath.each do |list|
166
166
  (list.xpath(".//li") - list.xpath(".//ol//li | .//ul//li")).each do |l|
167
167
  l.xpath("./p | ./div | ./table").each_with_index do |p, i|
168
- next if i.zero?
169
-
170
- p.wrap(%{<div class="ListContLevel#{lvl}"/>})
168
+ i.zero? or p.wrap(%{<div class="ListContLevel#{lvl}"/>})
171
169
  end
172
170
  list_add(l.xpath(".//ul") - l.xpath(".//ul//ul | .//ol//ul"),
173
171
  lvl + 1)
@@ -212,10 +210,10 @@ module IsoDoc
212
210
  def word_remove_pb_before_annex(docxml)
213
211
  docxml.xpath("//div[p/br]").each do |d|
214
212
  /^WordSection\d+_\d+$/.match(d["class"]) or next
215
- d.elements[0].name == "p" && !d.elements[0].elements.empty? or next
216
- d.elements[0].elements[0].name == "br" &&
213
+ (d.elements[0].name == "p" && !d.elements[0].elements.empty?) or next
214
+ (d.elements[0].elements[0].name == "br" &&
217
215
  d.elements[0].elements[0]["style"] ==
218
- "mso-special-character:line-break;page-break-before:always" or next
216
+ "mso-special-character:line-break;page-break-before:always") or next
219
217
  d.elements[0].remove
220
218
  end
221
219
  end
@@ -24,7 +24,12 @@ module IsoDoc
24
24
  end
25
25
 
26
26
  def insert_toc(intro, docxml, level)
27
- intro.sub(/WORDTOC/, make_WordToC(docxml, level))
27
+ toc = ""
28
+ toc += make_WordToC(docxml, level)
29
+ toc += make_TableWordToC(docxml)
30
+ toc += make_FigureWordToC(docxml)
31
+ toc += make_RecommendationWordToC(docxml)
32
+ intro.sub(/WORDTOC/, toc)
28
33
  end
29
34
 
30
35
  def word_toc_entry(toclevel, heading)
@@ -77,6 +82,82 @@ module IsoDoc
77
82
  %{\\1#{word_toc_preface(level)}}) + WORD_TOC_SUFFIX1
78
83
  end
79
84
 
85
+ WORD_TOC_RECOMMENDATION_PREFACE1 = <<~TOC.freeze
86
+ <span lang="EN-GB"><span
87
+ style='mso-element:field-begin'></span><span
88
+ style='mso-spacerun:yes'>&#xA0;</span>TOC
89
+ \\h \\z \\t &quot;RecommendationTitle,RecommendationTestTitle,recommendationtitle,recommendationtesttitle&quot;
90
+ <span style='mso-element:field-separator'></span></span>
91
+ TOC
92
+
93
+ WORD_TOC_TABLE_PREFACE1 = <<~TOC.freeze
94
+ <span lang="EN-GB"><span
95
+ style='mso-element:field-begin'></span><span
96
+ style='mso-spacerun:yes'>&#xA0;</span>TOC
97
+ \\h \\z \\t &quot;TableTitle,tabletitle&quot; <span
98
+ style='mso-element:field-separator'></span></span>
99
+ TOC
100
+
101
+ WORD_TOC_FIGURE_PREFACE1 = <<~TOC.freeze
102
+ <span lang="EN-GB"><span
103
+ style='mso-element:field-begin'></span><span
104
+ style='mso-spacerun:yes'>&#xA0;</span>TOC
105
+ \\h \\z \\t &quot;FigureTitle,figuretitle&quot; <span
106
+ style='mso-element:field-separator'></span></span>
107
+ TOC
108
+
109
+ def make_TableWordToC(docxml)
110
+ (docxml.at("//p[@class = 'TableTitle']") && @toctablestitle) or
111
+ return ""
112
+ toc = %{<p class="TOCTitle">#{@toctablestitle}</p>}
113
+ docxml.xpath("//p[@class = 'TableTitle']").each do |h|
114
+ toc += word_toc_entry(1, header_strip(h))
115
+ end
116
+ toc.sub(/(<p class="MsoToc1">)/,
117
+ %{\\1#{WORD_TOC_TABLE_PREFACE1}}) + WORD_TOC_SUFFIX1
118
+ end
119
+
120
+ def make_FigureWordToC(docxml)
121
+ (docxml.at("//p[@class = 'FigureTitle']") && @tocfigurestitle) or
122
+ return ""
123
+ toc = %{<p class="TOCTitle">#{@tocfigurestitle}</p>}
124
+ docxml.xpath("//p[@class = 'FigureTitle']").each do |h|
125
+ toc += word_toc_entry(1, header_strip(h))
126
+ end
127
+ toc.sub(/(<p class="MsoToc1">)/,
128
+ %{\\1#{WORD_TOC_FIGURE_PREFACE1}}) + WORD_TOC_SUFFIX1
129
+ end
130
+
131
+ def make_RecommendationWordToC(docxml)
132
+ (docxml.at("//p[@class = 'RecommendationTitle']") &&
133
+ @tocrecommendationstitle) or return ""
134
+ toc = %{<p class="TOCTitle">#{@tocrecommendationstitle}</p>}
135
+ docxml.xpath("//p[@class = 'RecommendationTitle' or @class = 'RecommendationTestTitle']").sort_by do |h|
136
+ recommmendation_sort_key(h.text)
137
+ end.each do |h|
138
+ toc += word_toc_entry(1, header_strip(h))
139
+ end
140
+ toc.sub(/(<p class="MsoToc1">)/,
141
+ %{\\1#{WORD_TOC_RECOMMENDATION_PREFACE1}}) + WORD_TOC_SUFFIX1
142
+ end
143
+
144
+ def recommmendation_sort_key(header)
145
+ m = /^([^0-9]+) (\d+)/.match(header) || /^([^:]+)/.match(header)
146
+ m ||= [header, nil]
147
+ ret = "#{recommmendation_sort_key1(m[1])}::"
148
+ m[2] and ret += ("%04d" % m[2].to_i).to_s
149
+ ret
150
+ end
151
+
152
+ def recommmendation_sort_key1(type)
153
+ case type&.downcase
154
+ when "requirement" then "04"
155
+ when "recommendation" then "05"
156
+ when "permission" then "06"
157
+ else type
158
+ end
159
+ end
160
+
80
161
  def authority_cleanup1(docxml, klass)
81
162
  dest = docxml.at("//div[@id = 'boilerplate-#{klass}-destination']")
82
163
  auth = docxml.at("//div[@id = 'boilerplate-#{klass}' "\
@@ -54,6 +54,7 @@ module IsoDoc
54
54
  ret[:xref].gsub!(/ $/, "")
55
55
  ret[:container] = @klass.get_clause_id(container) unless container.nil?
56
56
  ret[:type] = type
57
+ ret[:elem] = elem
57
58
  ret[:value] = anchor_struct_value(lbl, elem)
58
59
  ret
59
60
  end
@@ -48,7 +48,8 @@ module IsoDoc
48
48
  t.xpath(ns("./termnote")).reject { |n| blank?(n["id"]) }.each do |n|
49
49
  c.increment(n)
50
50
  @anchors[n["id"]] =
51
- { label: termnote_label(c.print), type: "termnote", value: c.print,
51
+ { label: termnote_label(c.print), type: "termnote",
52
+ value: c.print, elem: @labels["termnote"],
52
53
  xref: l10n("#{anchor(t['id'], :xref)}, "\
53
54
  "#{@labels['note_xref']} #{c.print}") }
54
55
  end
@@ -49,7 +49,7 @@ module IsoDoc
49
49
 
50
50
  @anchors[clause["id"]] =
51
51
  { label: nil, level: 1, xref: preface_clause_name(clause),
52
- type: "clause" }
52
+ type: "clause", elem: @labels["clause"] }
53
53
  clause.xpath(ns(SUBCLAUSES)).each_with_index do |c, i|
54
54
  preface_names1(c, c.at(ns("./title"))&.text,
55
55
  "#{preface_clause_name(clause)}, #{i + 1}", 2)
@@ -58,8 +58,8 @@ module IsoDoc
58
58
 
59
59
  def preface_names1(clause, title, parent_title, level)
60
60
  label = title || parent_title
61
- @anchors[clause["id"]] =
62
- { label: nil, level: level, xref: label, type: "clause" }
61
+ @anchors[clause["id"]] = { label: nil, level: level, xref: label,
62
+ type: "clause", elem: @labels["clause"] }
63
63
  clause.xpath(ns(SUBCLAUSES)).each_with_index do |c, i|
64
64
  preface_names1(c, c.at(ns("./title"))&.text, "#{label} #{i + 1}",
65
65
  level + 1)
@@ -86,7 +86,7 @@ module IsoDoc
86
86
  num.increment(clause)
87
87
  @anchors[clause["id"]] =
88
88
  { label: num.print, xref: l10n("#{@labels['clause']} #{num.print}"),
89
- level: lvl, type: "clause" }
89
+ level: lvl, type: "clause", elem: @labels["clause"] }
90
90
  i = Counter.new
91
91
  clause.xpath(ns(SUBCLAUSES)).each do |c|
92
92
  section_names1(c, "#{num.print}.#{i.increment(c).print}", lvl + 1)
@@ -97,7 +97,7 @@ module IsoDoc
97
97
  def section_names1(clause, num, level)
98
98
  @anchors[clause["id"]] =
99
99
  { label: num, level: level, xref: l10n("#{@labels['clause']} #{num}"),
100
- type: "clause" }
100
+ type: "clause", elem: @labels["clause"] }
101
101
  i = Counter.new
102
102
  clause.xpath(ns(SUBCLAUSES)).each do |c|
103
103
  section_names1(c, "#{num}.#{i.increment(c).print}", level + 1)
@@ -121,10 +121,15 @@ module IsoDoc
121
121
  a[0]
122
122
  end
123
123
 
124
+ def annex_name_anchors(clause, num)
125
+ { label: annex_name_lbl(clause, num),
126
+ elem: @labels["annex"],
127
+ type: "clause", value: num.to_s, level: 1,
128
+ xref: "#{@labels['annex']} #{num}" }
129
+ end
130
+
124
131
  def annex_names(clause, num)
125
- @anchors[clause["id"]] = { label: annex_name_lbl(clause, num),
126
- type: "clause", value: num.to_s, level: 1,
127
- xref: "#{@labels['annex']} #{num}" }
132
+ @anchors[clause["id"]] = annex_name_anchors(clause, num)
128
133
  if a = single_annex_special_section(clause)
129
134
  annex_names1(a, num.to_s, 1)
130
135
  else
@@ -138,6 +143,7 @@ module IsoDoc
138
143
 
139
144
  def annex_names1(clause, num, level)
140
145
  @anchors[clause["id"]] = { xref: "#{@labels['annex']} #{num}",
146
+ elem: @labels["annex"],
141
147
  label: num, level: level, type: "clause" }
142
148
  i = Counter.new
143
149
  clause.xpath(ns(SUBCLAUSES)).each do |c|
@@ -2,8 +2,21 @@ require "metanorma"
2
2
 
3
3
  module IsoDoc
4
4
  class XslfoPdfConvert < ::IsoDoc::Convert
5
- MN2PDF_OPTIONS = :mn2pdf
5
+ # MN2PDF_OPTIONS = :mn2pdf
6
6
  MN2PDF_FONT_MANIFEST = :font_manifest
7
+ MN2PDF_OPTIONS = { pdfencryptionlength: "--encryption-length",
8
+ pdfownerpassword: "--owner-password",
9
+ pdfuserpassword: "--user-password",
10
+ pdfallowprint: "--allow-print",
11
+ pdfallowcopycontent: "--allow-copy-content",
12
+ pdfalloweditcontent: "--allow-edit-content",
13
+ pdfalloweditannotations: "--allow-edit-annotations",
14
+ pdfallowfillinforms: "--allow-fill-in-forms",
15
+ pdfallowaccesscontent: "--allow-access-content",
16
+ pdfallowassembledocument: "--allow-assemble-document",
17
+ pdfallowprinthq: "--allow-print-hq",
18
+ pdfencryptmetadata: "--encrypt-metadata" }.freeze
19
+ MN2PDF_DEFAULT_ARGS = { "--syntax-highlight": nil }.freeze
7
20
 
8
21
  def initialize(options)
9
22
  @format = :pdf
@@ -13,22 +26,10 @@ module IsoDoc
13
26
  end
14
27
 
15
28
  def extract_cmd_options(options)
16
- ret = {}
17
- a = options[:pdfencryptionlength] and ret["--encryption-length"] = a
18
- a = options[:pdfownerpassword] and ret["--owner-password"] = a
19
- a = options[:pdfuserpassword] and ret["--user-password"] = a
20
- a = options[:pdfallowprint] and ret["--allow-print"] = a
21
- a = options[:pdfallowcopycontent] and ret["--allow-copy-content"] = a
22
- a = options[:pdfalloweditcontent] and ret["--allow-edit-content"] = a
23
- a = options[:pdfalloweditannotations] and
24
- ret["--allow-edit-annotations"] = a
25
- a = options[:pdfallowfillinforms] and ret["--allow-fill-in-forms"] = a
26
- a = options[:pdfallowaccesscontent] and
27
- ret["--allow-access-content"] = a
28
- a = options[:pdfallowassembledocument] and
29
- ret["--allow-assemble-document"] = a
30
- a = options[:pdfallowprinthq] and ret["--allow-print-hq"] = a
31
- a = options[:pdfencryptmetadata] and ret["--encrypt-metadata"] = a
29
+ ret = MN2PDF_DEFAULT_ARGS.dup
30
+ MN2PDF_OPTIONS.each do |key, opt|
31
+ value = options[key] and ret[opt] = value
32
+ end
32
33
  ret
33
34
  end
34
35
 
@@ -42,8 +43,7 @@ module IsoDoc
42
43
 
43
44
  def pdf_options(_docxml)
44
45
  ret = {}
45
- font_manifest = @options.dig(MN2PDF_OPTIONS,
46
- MN2PDF_FONT_MANIFEST) and
46
+ font_manifest = @options[MN2PDF_FONT_MANIFEST] and
47
47
  ret[MN2PDF_FONT_MANIFEST] = font_manifest
48
48
  @aligncrosselements && !@aligncrosselements.empty? and
49
49
  ret["--param align-cross-elements="] =
@@ -30,6 +30,14 @@ external_terms_boilerplate: |
30
30
  internal_external_terms_boilerplate: |
31
31
  <p>لأغراض هذه الوثيقة ،تنطبق المصطلحات والتعاريف الواردة في % وما يلي.</p>
32
32
  term_defined_in: "[المصطلح المحدد في %]"
33
+ binary_and: "%1 و %2"
34
+ multiple_and: "%1, و %2"
35
+ binary_or: "%1 او %2"
36
+ multiple_or: "%1, او %2"
37
+ chain_and: "%1 و %2"
38
+ chain_or: "%1 او %2"
39
+ chain_from: "%1 %من 2"
40
+ chain_to: "من %1 إلى %2"
33
41
  note: ملاحظة
34
42
  note_xref: ملاحظة
35
43
  termnote: ملاحظة % للقيد
@@ -55,6 +63,9 @@ deprecated: مهمل
55
63
  source: مصدر
56
64
  and: و
57
65
  all_parts: كل الأجزاء
66
+ toc_figures: جدول الأرقام
67
+ toc_tables: جدول الجداول
68
+ toc_recommendations: جدول التوصيات
58
69
  month_january: يناير
59
70
  month_february: فبراير
60
71
  month_march: مارس
@@ -32,6 +32,14 @@ external_terms_boilerplate: |
32
32
  internal_external_terms_boilerplate: |
33
33
  <p>Für die Zwecke dieses Dokuments gelten die in % und im Folgenden aufgeführten Begriffe und Definitionen.</p>
34
34
  term_defined_in: "[Begriff definiert in %]"
35
+ binary_and: "%1 und %2"
36
+ multiple_and: "%1, und %2"
37
+ binary_or: "%1 oder %2"
38
+ multiple_or: "%1, oder %2"
39
+ chain_and: "%1 und %2"
40
+ chain_or: "%1 oder %2"
41
+ chain_from: "%1 von %2"
42
+ chain_to: "%1 bis %2"
35
43
  note: HINWEIS
36
44
  note_xref: Hinweis
37
45
  termnote: Hinweis % zum Eintrag
@@ -57,6 +65,9 @@ deprecated: DEPRECATED
57
65
  source: QUELLE
58
66
  and: und
59
67
  all_parts: Alle Teile
68
+ toc_figures: Abbildungsverzeichnis
69
+ toc_tables: Tabellenverzeichnis
70
+ toc_recommendations: Empfehlungenverzeichnis
60
71
  month_january: Januar
61
72
  month_february: Februar
62
73
  month_march: März
@@ -38,6 +38,14 @@ internal_external_terms_boilerplate: |
38
38
  <p>For the purposes of this document, the terms and definitions
39
39
  given in % and the following apply.</p>
40
40
  term_defined_in: "[term defined in %]"
41
+ binary_and: "%1 and %2"
42
+ multiple_and: "%1, and %2"
43
+ binary_or: "%1 or %2"
44
+ multiple_or: "%1, or %2"
45
+ chain_and: "%1 and %2"
46
+ chain_or: "%1 or %2"
47
+ chain_from: "%1 from %2"
48
+ chain_to: "%1 to %2"
41
49
  note: NOTE
42
50
  note_xref: Note
43
51
  termnote: Note % to entry
@@ -63,6 +71,9 @@ deprecated: DEPRECATED
63
71
  source: SOURCE
64
72
  and: and
65
73
  all_parts: All Parts
74
+ toc_figures: List of figures
75
+ toc_tables: List of tables
76
+ toc_recommendations: List of recommendations
66
77
  month_january: January
67
78
  month_february: February
68
79
  month_march: March
@@ -34,6 +34,14 @@ external_terms_boilerplate: |
34
34
  internal_external_terms_boilerplate: |
35
35
  <p>Para los propósitos de este documento, se aplican los términos y definiciones dados en % y los siguientes.</p>
36
36
  term_defined_in: "[término definido en %]"
37
+ binary_and: "%1 y %2"
38
+ multiple_and: "%1, y %2"
39
+ binary_or: "%1 o %2"
40
+ multiple_or: "%1, o %2"
41
+ chain_and: "%1 y %2"
42
+ chain_or: "%1 o %2"
43
+ chain_from: "%1 del %2"
44
+ chain_to: "%1 al %2"
37
45
  note: NOTA
38
46
  note_xref: Nota
39
47
  termnote: Nota % a la entrada
@@ -59,6 +67,9 @@ deprecated: OBSOLETO
59
67
  source: FUENTE
60
68
  and: y
61
69
  all_parts: Todas las partes
70
+ toc_figures: Table de figuras
71
+ toc_tables: Tabla de tablas
72
+ toc_recommendations: Tabla de recomendaciones
62
73
  month_january: Enero
63
74
  month_february: Febrero
64
75
  month_march: Marzo
@@ -31,6 +31,14 @@ external_terms_boilerplate: |
31
31
  internal_external_terms_boilerplate: |
32
32
  <p>Pour les besoins du présent document, les termes et définitions de % ainsi que les suivants, s’appliquent.</p>
33
33
  term_defined_in: "[terme défini dans %]"
34
+ binary_and: "%1 et %2"
35
+ multiple_and: "%1, et %2"
36
+ binary_or: "%1 ou %2"
37
+ multiple_or: "%1, ou %2"
38
+ chain_and: "%1 et %2"
39
+ chain_or: "%1 ou %2"
40
+ chain_from: "%1 de %2"
41
+ chain_to: "%1 à %2"
34
42
  note: NOTE
35
43
  note_xref: Note
36
44
  termnote: Note % à l’article
@@ -56,6 +64,9 @@ deprecated: DÉCONSEILLÉ
56
64
  source: SOURCE
57
65
  and: et
58
66
  all_parts: toutes les parties
67
+ toc_figures: Table des figures
68
+ toc_tables: Table des tableaux
69
+ toc_recommendations: Table de recommandations
59
70
  month_january: Janvier
60
71
  month_february: Février
61
72
  month_march: Mars
@@ -37,6 +37,14 @@ internal_external_terms_boilerplate: |
37
37
  <p>Для целей этого документа применяются
38
38
  термины и определения, данные в % и следующие.</p>
39
39
  term_defined_in: "[термин, определенный в %]"
40
+ binary_and: "%1 и %2"
41
+ multiple_and: "%1, и %2"
42
+ binary_or: "%1 или %2"
43
+ multiple_or: "%1, или %2"
44
+ chain_and: "%1 и %2"
45
+ chain_or: "%1 или %2"
46
+ chain_from: "%1 от %2"
47
+ chain_to: "%1 до %2"
40
48
  note: ПРИМЕЧАНИЕ
41
49
  note_xref: Примечание
42
50
  termnote: Примечание % к определению
@@ -62,6 +70,9 @@ deprecated: НЕ РЕКОМЕНДУЕТСЯ
62
70
  source: ИСТОЧНИК
63
71
  and: и
64
72
  all_parts: Все части
73
+ toc_figures: Таблица фигур
74
+ toc_tables: Таблица таблиц
75
+ toc_recommendations: Таблица рекомендаций
65
76
  month_january: Январь
66
77
  month_february: Февраль
67
78
  month_march: Март
@@ -33,6 +33,14 @@ external_terms_boilerplate: |
33
33
  internal_external_terms_boilerplate: |
34
34
  <p>% 界定的以及下列术语和定义适用于本文件。</p>
35
35
  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"
36
44
  note: 注
37
45
  note_xref: 注
38
46
  termnote: 注%
@@ -58,6 +66,9 @@ deprecated: 被取代
58
66
  source: 定义
59
67
  and: 和
60
68
  all_parts: 所有部分
69
+ toc_figures: 数字列表
70
+ toc_tables: 表列表
71
+ toc_recommendations: 建议清单
61
72
  month_january: 一月
62
73
  month_february: 二月
63
74
  month_march: 三月
@@ -925,87 +925,23 @@ RSpec.describe IsoDoc do
925
925
  .to receive(:inkscape_installed?)
926
926
 
927
927
  input = <<~INPUT
928
- <iso-standard xmlns="http://riboseinc.com/isoxml">
929
- <preface><foreword>
930
- <figure id="figureA-1">
931
- <image src="spec/assets/odf.svg" mimetype="image/svg+xml"/>
932
- <image src="spec/assets/odf1.svg" mimetype="image/svg+xml"/>
933
- <image src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAgMTAwIj4KICA8Y2lyY2xlIGZpbGw9IiMwMDkiIHI9IjQ1IiBjeD0iNTAiIGN5PSI1MCIvPgogIDxwYXRoIGQ9Ik0zMywyNkg3OEEzNywzNywwLDAsMSwzMyw4M1Y1N0g1OVY0M0gzM1oiIGZpbGw9IiNGRkYiLz4KPC9zdmc+Cg==" id="_d3731866-1a07-435a-a6c2-1acd41023a4e" mimetype="image/svg+xml" height="auto" width="auto"/>
934
- </figure>
935
- </foreword></preface>
936
- </iso-standard>
937
- INPUT
938
- presxml = <<~OUTPUT
939
- <iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
928
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
940
929
  <preface>
941
- <foreword displayorder='1'>
942
- <figure id='figureA-1'>
943
- <name>Figure 1</name>
944
- <image src='spec/assets/odf.svg' mimetype='image/svg+xml'>
945
- <emf src='spec/assets/odf.emf'/>
946
- </image>
947
- <image src='spec/assets/odf1.svg' mimetype='image/svg+xml'/>
948
- <image src='' id='_d3731866-1a07-435a-a6c2-1acd41023a4e' mimetype='image/svg+xml' height='auto' width='auto'>
949
- <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'>
950
- <circle fill='#009' r='45' cx='50' cy='50'/>
951
- <path d='M33,26H78A37,37,0,0,1,33,83V57H59V43H33Z' fill='#FFF'/>
952
- </svg>
953
- </image>
930
+ <foreword>
931
+ <figure id="figureA-1">
932
+ <image src="spec/assets/odf.svg" mimetype="image/svg+xml"/>
933
+ <image src="spec/assets/odf1.svg" mimetype="image/svg+xml"/>
934
+ <image src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAgMTAwIj4KICA8Y2lyY2xlIGZpbGw9IiMwMDkiIHI9IjQ1IiBjeD0iNTAiIGN5PSI1MCIvPgogIDxwYXRoIGQ9Ik0zMywyNkg3OEEzNywzNywwLDAsMSwzMyw4M1Y1N0g1OVY0M0gzM1oiIGZpbGw9IiNGRkYiLz4KPC9zdmc+Cg==" id="_d3731866-1a07-435a-a6c2-1acd41023a4e" mimetype="image/svg+xml" height="auto" width="auto"/>
954
935
  </figure>
955
936
  </foreword>
956
937
  </preface>
957
938
  </iso-standard>
958
- OUTPUT
959
- output = <<~OUTPUT
960
- <html xmlns:epub='http://www.idpf.org/2007/ops' lang='en'>
961
- <head>
962
- <style>
963
- </style>
964
- </head>
965
- <body lang='EN-US' link='blue' vlink='#954F72'>
966
- <div class='WordSection1'>
967
- <p>&#160;</p>
968
- </div>
969
- <p>
970
- <br clear='all' class='section'/>
971
- </p>
972
- <div class='WordSection2'>
973
- <p>
974
- <br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
975
- </p>
976
- <div>
977
- <h1 class='ForewordTitle'>Foreword</h1>
978
- <div id='figureA-1' class='figure'>
979
- <img src='spec/assets/odf.emf'/>
980
- <img src='spec/assets/odf1.svg'/>
981
- <img src='' height='auto' width='auto'/>
982
- <p class='FigureTitle' style='text-align:center;'>Figure 1</p>
983
- </div>
984
- </div>
985
- <p>&#160;</p>
986
- </div>
987
- <p>
988
- <br clear='all' class='section'/>
989
- </p>
990
- <div class='WordSection3'>
991
- <p class='zzSTDTitle1'/>
992
- </div>
993
- </body>
994
- </html>
995
- OUTPUT
996
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
997
- .convert("test", input, true)
998
- .gsub(/&lt;/, "&#x3c;")
999
- .gsub(%r{data:application/x-msmetafile[^"']+},
1000
- "data:application/x-msmetafile")))
1001
- .to be_equivalent_to xmlpp(presxml
1002
- .gsub(%r{data:application/x-msmetafile[^"']+},
1003
- "data:application/x-msmetafile"))
1004
- expect(xmlpp(strip_guid(IsoDoc::WordConvert.new({})
1005
- .convert("test", presxml, true)
1006
- .gsub(/['"][^'".]+(?<!odf1)(?<!odf)\.svg['"]/, "'_.svg'")
1007
- .gsub(/mso-bookmark:_Ref\d+/, "mso-bookmark:_Ref"))))
1008
- .to be_equivalent_to xmlpp(output)
939
+ INPUT
940
+ expect do
941
+ IsoDoc::PresentationXMLConvert.new({})
942
+ .convert("test", input, true)
943
+ end.to raise_error("Inkscape missing in PATH, unable" \
944
+ "to convert EMF to SVG. Aborting.")
1009
945
  end
1010
946
  end
1011
947
 
@@ -1593,7 +1529,7 @@ RSpec.describe IsoDoc do
1593
1529
 
1594
1530
 
1595
1531
  <p id="_d4fd0a61-f300-4285-abe6-602707590e53">This International Standard gives the minimum specifications for rice (<i>Oryza sativa</i> L.) which is subject to international trade. It is applicable to the following types: husked rice and milled rice, parboiled or not, intended for direct human consumption. It is neither applicable to other products derived from rice, nor to waxy rice (glutinous rice).</p>
1596
- <p class="QuoteAttribution">&#8212; ISO, <a href="#ISO7301">ISO 7301:2011, Clause 1</a></p></div>
1532
+ <p class="QuoteAttribution">&#8212; ISO, ISO 7301:2011, Clause 1</p></div>
1597
1533
  </div>
1598
1534
  <p class="zzSTDTitle1"/>
1599
1535
  </div>