metanorma-iso 2.1.0 → 2.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. data/lib/html2doc/lists.rb +145 -10
  3. data/lib/isodoc/iso/base_convert.rb +11 -1
  4. data/lib/isodoc/iso/html/html_iso_titlepage.html +2 -0
  5. data/lib/isodoc/iso/html/isodoc-dis.css +216 -278
  6. data/lib/isodoc/iso/html/isodoc-dis.scss +294 -288
  7. data/lib/isodoc/iso/html/isodoc.css +38 -13
  8. data/lib/isodoc/iso/html/isodoc.scss +38 -12
  9. data/lib/isodoc/iso/html/style-human.css +14 -1
  10. data/lib/isodoc/iso/html/style-human.scss +10 -1
  11. data/lib/isodoc/iso/html/style-iso.css +35 -23
  12. data/lib/isodoc/iso/html/style-iso.scss +31 -23
  13. data/lib/isodoc/iso/html/word_iso_intro-dis.html +1 -6
  14. data/lib/isodoc/iso/html/word_iso_titlepage-dis.html +24 -13
  15. data/lib/isodoc/iso/html/word_iso_titlepage-prf.html +58 -0
  16. data/lib/isodoc/iso/html/word_iso_titlepage.html +10 -6
  17. data/lib/isodoc/iso/html/wordstyle-dis.css +12 -62
  18. data/lib/isodoc/iso/html/wordstyle-dis.scss +7 -56
  19. data/lib/isodoc/iso/html_convert.rb +7 -2
  20. data/lib/isodoc/iso/i18n-en.yaml +32 -4
  21. data/lib/isodoc/iso/i18n-fr.yaml +29 -3
  22. data/lib/isodoc/iso/i18n-ru.yaml +32 -4
  23. data/lib/isodoc/iso/i18n-zh-Hans.yaml +32 -3
  24. data/lib/isodoc/iso/i18n.rb +1 -1
  25. data/lib/isodoc/iso/iso.amendment.xsl +1570 -246
  26. data/lib/isodoc/iso/iso.international-standard.xsl +1570 -246
  27. data/lib/isodoc/iso/metadata.rb +67 -67
  28. data/lib/isodoc/iso/presentation_bibdata.rb +74 -0
  29. data/lib/isodoc/iso/presentation_xml_convert.rb +16 -5
  30. data/lib/isodoc/iso/presentation_xref.rb +10 -4
  31. data/lib/isodoc/iso/sections.rb +3 -3
  32. data/lib/isodoc/iso/word_cleanup.rb +3 -0
  33. data/lib/isodoc/iso/word_convert.rb +8 -5
  34. data/lib/isodoc/iso/word_dis_cleanup.rb +235 -0
  35. data/lib/isodoc/iso/word_dis_convert.rb +48 -100
  36. data/lib/isodoc/iso/xref.rb +34 -6
  37. data/lib/metanorma/iso/base.rb +20 -1
  38. data/lib/metanorma/iso/biblio.rng +134 -39
  39. data/lib/metanorma/iso/boilerplate-fr.xml +3 -0
  40. data/lib/metanorma/iso/boilerplate-ru.xml +3 -0
  41. data/lib/metanorma/iso/boilerplate.xml +3 -0
  42. data/lib/metanorma/iso/cleanup.rb +49 -11
  43. data/lib/metanorma/iso/front.rb +38 -6
  44. data/lib/metanorma/iso/front_id.rb +2 -0
  45. data/lib/metanorma/iso/isodoc.rng +16 -0
  46. data/lib/metanorma/iso/isostandard.rng +30 -12
  47. data/lib/metanorma/iso/macros.rb +29 -0
  48. data/lib/metanorma/iso/validate_section.rb +0 -12
  49. data/lib/metanorma/iso/version.rb +1 -1
  50. data/spec/isodoc/amd_spec.rb +20 -46
  51. data/spec/isodoc/blocks_spec.rb +499 -2
  52. data/spec/isodoc/i18n_spec.rb +145 -80
  53. data/spec/isodoc/iso_spec.rb +50 -169
  54. data/spec/isodoc/metadata_spec.rb +240 -99
  55. data/spec/isodoc/postproc_spec.rb +43 -7
  56. data/spec/isodoc/section_spec.rb +9 -9
  57. data/spec/isodoc/word_dis_spec.rb +1332 -146
  58. data/spec/isodoc/xref_spec.rb +87 -13
  59. data/spec/metanorma/amd_spec.rb +39 -23
  60. data/spec/metanorma/base_spec.rb +174 -44
  61. data/spec/metanorma/blocks_spec.rb +54 -0
  62. data/spec/metanorma/lists_spec.rb +2 -2
  63. data/spec/metanorma/section_spec.rb +2 -2
  64. data/spec/metanorma/validate_spec.rb +8 -19
  65. data/spec/spec_helper.rb +17 -7
  66. data/spec/vcr_cassettes/withdrawn_iso.yml +30 -30
  67. metadata +7 -8
  68. data/docs/asciiiso-syntax.adoc +0 -307
  69. data/docs/guidance.adoc +0 -487
  70. data/docs/navigation.adoc +0 -23
  71. data/docs/quickstart.adoc +0 -179
  72. data/lib/isodoc/iso/presentation_inline.rb +0 -90
@@ -5,11 +5,8 @@ module IsoDoc
5
5
  class Metadata < IsoDoc::Metadata
6
6
  def initialize(lang, script, i18n)
7
7
  super
8
- set(:tc, "XXXX")
9
- set(:sc, "XXXX")
10
- set(:wg, "XXXX")
8
+ DATETYPES.each { |w| @metadata["#{w.gsub(/-/, '_')}date".to_sym] = nil }
11
9
  set(:editorialgroup, [])
12
- set(:secretariat, "XXX")
13
10
  set(:obsoletes, nil)
14
11
  set(:obsoletes_part, nil)
15
12
  end
@@ -37,13 +34,14 @@ module IsoDoc
37
34
  def docstatus1(isoxml, docstatus)
38
35
  set(:stage, docstatus.text)
39
36
  set(:stage_int, docstatus.text.to_i)
37
+ set(:substage_int, isoxml.at(ns("//bibdata/status/substage"))&.text)
40
38
  set(:unpublished, unpublished(docstatus.text))
41
39
  set(:statusabbr,
42
40
  status_abbrev(docstatus["abbreviation"] || "??",
43
- isoxml&.at(ns("//bibdata/status/substage"))&.text,
44
- isoxml&.at(ns("//bibdata/status/iteration"))&.text,
45
- isoxml&.at(ns("//bibdata/version/draft"))&.text,
46
- isoxml&.at(ns("//bibdata/ext/doctype"))&.text))
41
+ isoxml.at(ns("//bibdata/status/substage"))&.text,
42
+ isoxml.at(ns("//bibdata/status/iteration"))&.text,
43
+ isoxml.at(ns("//bibdata/version/draft"))&.text,
44
+ isoxml.at(ns("//bibdata/ext/doctype"))&.text))
47
45
  unpublished(docstatus.text) and
48
46
  set(:stageabbr, docstatus["abbreviation"])
49
47
  end
@@ -65,28 +63,11 @@ module IsoDoc
65
63
 
66
64
  # we don't leave this to i18n.rb, because we have both English and
67
65
  # French titles in the same document
68
- def part_label(lang)
69
- case lang
70
- when "en" then "Part"
71
- when "fr" then "Partie"
72
- when "ru" then "Часть"
73
- end
74
- end
75
-
76
- def amd_label(lang)
77
- case lang
78
- when "en", "fr" then "AMENDMENT"
79
- when "ru" then "ПОПРАВКА"
80
- end
81
- end
82
-
83
- def corr_label(lang)
84
- case lang
85
- when "en" then "TECHNICAL CORRIGENDUM"
86
- when "fr" then "RECTIFICATIF TECHNIQUE"
87
- when "ru" then "ТЕХНИЧЕСКОЕ ИСПРАВЛЕНИЕ"
88
- end
89
- end
66
+ PART_LABEL = { en: "Part", fr: "Partie", ru: "Часть" }.freeze
67
+ AMD_LABEL = { en: "AMENDMENT", fr: "AMENDMENT", ru: "ПОПРАВКА" }.freeze
68
+ CORR_LABEL = { en: "TECHNICAL CORRIGENDUM",
69
+ fr: "RECTIFICATIF TECHNIQUE",
70
+ ru: "ТЕХНИЧЕСКОЕ ИСПРАВЛЕНИЕ" }.freeze
90
71
 
91
72
  def part_title(part, titlenums, lang)
92
73
  return "" unless part
@@ -94,25 +75,25 @@ module IsoDoc
94
75
  suffix = @c.encode(part.text, :hexadecimal)
95
76
  p = titlenums[:part]
96
77
  titlenums[:part] && titlenums[:subpart] and
97
- p = "#{titlenums[:part]}&ndash;#{titlenums[:subpart]}"
78
+ p = "#{titlenums[:part]}&#x2013;#{titlenums[:subpart]}"
98
79
  titlenums[:part] and
99
- suffix = "#{part_label(lang)}&nbsp;#{p}: " + suffix
80
+ suffix = "#{PART_LABEL[lang.to_sym]}&#xa0;#{p}: " + suffix
100
81
  suffix
101
82
  end
102
83
 
103
84
  def part_prefix(titlenums, lang)
104
85
  p = titlenums[:part]
105
86
  titlenums[:part] && titlenums[:subpart] and
106
- p = "#{titlenums[:part]}&ndash;#{titlenums[:subpart]}"
107
- "#{part_label(lang)}&nbsp;#{p}"
87
+ p = "#{titlenums[:part]}&#x2013;#{titlenums[:subpart]}"
88
+ "#{PART_LABEL[lang.to_sym]}&#xa0;#{p}"
108
89
  end
109
90
 
110
91
  def amd_prefix(titlenums, lang)
111
- "#{amd_label(lang)}&nbsp;#{titlenums[:amd]}"
92
+ "#{AMD_LABEL[lang.to_sym]}&#xa0;#{titlenums[:amd]}"
112
93
  end
113
94
 
114
95
  def corr_prefix(titlenums, lang)
115
- "#{corr_label(lang)}&nbsp;#{titlenums[:corr]}"
96
+ "#{CORR_LABEL[lang.to_sym]}&#xa0;#{titlenums[:corr]}"
116
97
  end
117
98
 
118
99
  def compose_title(tparts, tnums, lang)
@@ -121,29 +102,30 @@ module IsoDoc
121
102
  main = @c.encode(tparts[:main].text, :hexadecimal)
122
103
  tparts[:intro] &&
123
104
  main = "#{@c.encode(tparts[:intro].text,
124
- :hexadecimal)}&nbsp;&mdash; #{main}"
105
+ :hexadecimal)}&#xa0;&#x2014; #{main}"
125
106
  if tparts[:part]
126
107
  suffix = part_title(tparts[:part], tnums, lang)
127
- main = "#{main}&nbsp;&mdash; #{suffix}"
108
+ main = "#{main}&#xa0;&#x2014; #{suffix}"
128
109
  end
129
110
  main
130
111
  end
131
112
 
132
113
  def title_nums(isoxml)
133
- { part: isoxml.at(ns("//bibdata//project-number/@part")),
134
- subpart: isoxml.at(ns("//bibdata//project-number/@subpart")),
135
- amd: isoxml.at(ns("//bibdata//project-number/@amendment")),
136
- corr: isoxml.at(ns("//bibdata//project-number/@corrigendum")) }
114
+ prefix = "//bibdata/ext/structuredidentifier/project-number"
115
+ { part: isoxml.at(ns("#{prefix}/@part")),
116
+ subpart: isoxml.at(ns("#{prefix}/@subpart")),
117
+ amd: isoxml.at(ns("#{prefix}/@amendment")),
118
+ corr: isoxml.at(ns("#{prefix}/@corrigendum")) }
137
119
  end
138
120
 
139
121
  def title_parts(isoxml, lang)
140
- { intro: isoxml.at(ns("//bibdata//title[@type='title-intro' and "\
122
+ { intro: isoxml.at(ns("//bibdata/title[@type='title-intro' and "\
141
123
  "@language='#{lang}']")),
142
- main: isoxml.at(ns("//bibdata//title[@type='title-main' and "\
124
+ main: isoxml.at(ns("//bibdata/title[@type='title-main' and "\
143
125
  "@language='#{lang}']")),
144
- part: isoxml.at(ns("//bibdata//title[@type='title-part' and "\
126
+ part: isoxml.at(ns("//bibdata/title[@type='title-part' and "\
145
127
  "@language='#{lang}']")),
146
- amd: isoxml.at(ns("//bibdata//title[@type='title-amd' and "\
128
+ amd: isoxml.at(ns("//bibdata/title[@type='title-amd' and "\
147
129
  "@language='#{lang}']")) }
148
130
  end
149
131
 
@@ -197,40 +179,58 @@ module IsoDoc
197
179
  tc(xml)
198
180
  sc(xml)
199
181
  wg(xml)
182
+ approvalgroup(xml)
200
183
  secretariat(xml)
201
184
  end
202
185
 
203
186
  def tc(xml)
204
- tc_type = xml.at(ns("//bibdata/ext/editorialgroup/technical-committee/"\
187
+ tcid = tc_base(xml, "editorialgroup") or return
188
+ set(:tc, tcid)
189
+ set(:editorialgroup, get[:editorialgroup] << tcid)
190
+ end
191
+
192
+ def tc_base(xml, grouptype)
193
+ tc_num = xml.at(ns("//bibdata/ext/#{grouptype}/"\
194
+ "technical-committee/@number")) or return nil
195
+ tc_type = xml.at(ns("//bibdata/ext/#{grouptype}/technical-committee/"\
205
196
  "@type"))&.text || "TC"
206
- if tc_num = xml.at(ns("//bibdata/ext/editorialgroup/"\
207
- "technical-committee/@number"))
208
- tcid = "#{tc_type} #{tc_num.text}"
209
- set(:tc, tcid)
210
- set(:editorialgroup, get[:editorialgroup] << tcid)
211
- end
197
+ "#{tc_type} #{tc_num.text}"
212
198
  end
213
199
 
214
200
  def sc(xml)
215
- sc_num = xml.at(ns("//bibdata/ext/editorialgroup/subcommittee/@number"))
216
- sc_type = xml.at(ns("//bibdata/ext/editorialgroup/subcommittee/"\
201
+ scid = sc_base(xml, "editorialgroup") or return
202
+ set(:sc, scid)
203
+ set(:editorialgroup, get[:editorialgroup] << scid)
204
+ end
205
+
206
+ def sc_base(xml, grouptype)
207
+ sc_num = xml.at(ns("//bibdata/ext/#{grouptype}/subcommittee/"\
208
+ "@number")) or return nil
209
+ sc_type = xml.at(ns("//bibdata/ext/#{grouptype}/subcommittee/"\
217
210
  "@type"))&.text || "SC"
218
- if sc_num
219
- scid = "#{sc_type} #{sc_num.text}"
220
- set(:sc, scid)
221
- set(:editorialgroup, get[:editorialgroup] << scid)
222
- end
211
+ "#{sc_type} #{sc_num.text}"
223
212
  end
224
213
 
225
214
  def wg(xml)
226
- wg_num = xml.at(ns("//bibdata/ext/editorialgroup/workgroup/@number"))
227
- wg_type = xml.at(ns("//bibdata/ext/editorialgroup/workgroup/"\
215
+ wgid = wg_base(xml, "editorialgroup") or return
216
+ set(:wg, wgid)
217
+ set(:editorialgroup, get[:editorialgroup] << wgid)
218
+ end
219
+
220
+ def wg_base(xml, grouptype)
221
+ wg_num = xml.at(ns("//bibdata/ext/#{grouptype}/workgroup/"\
222
+ "@number")) or return
223
+ wg_type = xml.at(ns("//bibdata/ext/#{grouptype}/workgroup/"\
228
224
  "@type"))&.text || "WG"
229
- if wg_num
230
- wgid = "#{wg_type} #{wg_num.text}"
231
- set(:wg, wgid)
232
- set(:editorialgroup, get[:editorialgroup] << wgid)
233
- end
225
+ "#{wg_type} #{wg_num.text}"
226
+ end
227
+
228
+ def approvalgroup(xml)
229
+ ag = tc_base(xml, "approvalgroup") or return
230
+ ret = [ag]
231
+ ret << sc_base(xml, "approvalgroup")
232
+ ret << wg_base(xml, "approvalgroup")
233
+ set(:approvalgroup, ret)
234
234
  end
235
235
 
236
236
  def secretariat(xml)
@@ -0,0 +1,74 @@
1
+ module IsoDoc
2
+ module Iso
3
+ class PresentationXMLConvert < IsoDoc::PresentationXMLConvert
4
+ def bibdata(docxml)
5
+ super
6
+ editorialgroup_identifier(docxml)
7
+ warning_for_missing_metadata(docxml)
8
+ end
9
+
10
+ def warning_for_missing_metadata(docxml)
11
+ return unless @meta.get[:unpublished]
12
+
13
+ ret = ""
14
+ docxml.at(ns("//bibdata/ext//secretariat")) or
15
+ ret += "<p>Secretariat is missing.</p>"
16
+ docxml.at(ns("//bibdata/ext//editorialgroup")) or
17
+ ret += "<p>Editorial groups are missing.</p>"
18
+ docxml.at(ns("//bibdata/date[@type = 'published' or @type = 'issued' "\
19
+ "or @type = 'created']")) ||
20
+ docxml.at(ns("//bibdata/version/revision-date")) or
21
+ ret += "<p>Document date is missing.</p>"
22
+ return if ret.empty?
23
+
24
+ warning_for_missing_metadata1(docxml, ret)
25
+ end
26
+
27
+ def warning_for_missing_metadata1(docxml, ret)
28
+ id = UUIDTools::UUID.random_create
29
+ ret = "<review date='#{Date.today}' reviewer='Metanorma' id='_#{id}'>"\
30
+ "<p><strong>Metadata warnings:<strong></p> #{ret}</review>"
31
+ ins = docxml.at(ns("//sections//title")) or return
32
+ ins.children.first.previous = ret
33
+ end
34
+
35
+ def editorialgroup_identifier(docxml)
36
+ %w(editorialgroup approvalgroup).each do |v|
37
+ docxml.xpath(ns("//bibdata/ext/#{v}")).each do |a|
38
+ editorialgroup_identifier1(a)
39
+ end
40
+ end
41
+ end
42
+
43
+ def editorialgroup_identifier1(group)
44
+ agency = group.xpath(ns("./agency"))&.map(&:text)
45
+ ret = %w(technical-committee subcommittee workgroup)
46
+ .each_with_object([]) do |v, m|
47
+ a = group.at(ns("./#{v}")) or next
48
+ m << "#{a['type']} #{a['number']}"
49
+ end
50
+ group["identifier"] = (agency + ret).join("/")
51
+ end
52
+
53
+ def bibdata_i18n(bib)
54
+ hash_translate(bib, @i18n.get["doctype_dict"], "./ext/doctype")
55
+ bibdata_i18n_stage(bib, bib.at(ns("./status/stage")),
56
+ bib.at(ns("./ext/doctype")))
57
+ hash_translate(bib, @i18n.get["substage_dict"],
58
+ "./status/substage")
59
+ edition_translate(bib)
60
+ end
61
+
62
+ def bibdata_i18n_stage(bib, stage, type, lang: @lang, i18n: @i18n)
63
+ return unless stage
64
+
65
+ i18n.get["stage_dict"][stage.text].is_a?(Hash) or
66
+ return hash_translate(bib, i18n.get["stage_dict"],
67
+ "./status/stage", lang)
68
+ i18n.get["stage_dict"][stage.text][type&.text] and
69
+ tag_translate(stage, lang,
70
+ i18n.get["stage_dict"][stage.text][type&.text])
71
+ end
72
+ end
73
+ end
74
+ end
@@ -1,8 +1,8 @@
1
1
  require_relative "init"
2
2
  require "isodoc"
3
3
  require_relative "index"
4
- require_relative "presentation_inline"
5
4
  require_relative "presentation_xref"
5
+ require_relative "presentation_bibdata"
6
6
  require_relative "../../relaton/render/general"
7
7
 
8
8
  module IsoDoc
@@ -29,7 +29,7 @@ module IsoDoc
29
29
  def figure1(node)
30
30
  lbl = @xrefs.anchor(node["id"], :label, false) or return
31
31
  figname = node.parent.name == "figure" ? "" : "#{@i18n.figure} "
32
- connective = node.parent.name == "figure" ? "&nbsp; " : "&nbsp;&mdash; "
32
+ connective = node.parent.name == "figure" ? "&#xa0; " : "&#xa0;&#x2014; "
33
33
  prefix_name(node, connective, l10n("#{figname}#{lbl}"), "name")
34
34
  end
35
35
 
@@ -38,7 +38,7 @@ module IsoDoc
38
38
  lbl = if n.nil? || blank?(n[:label]) then @i18n.example
39
39
  else l10n("#{@i18n.example} #{n[:label]}")
40
40
  end
41
- prefix_name(node, "&nbsp;&mdash; ", lbl, "name")
41
+ prefix_name(node, block_delim, lbl, "name")
42
42
  end
43
43
 
44
44
  def example_span_label(_node, div, name)
@@ -172,9 +172,10 @@ module IsoDoc
172
172
  def admonition_name(xml)
173
173
  "#{xml} &#x2014; "
174
174
  end
175
-
175
+
176
176
  def bibrenderer
177
- ::Relaton::Render::Iso::General.new(language: @lang, i18nhash: @i18n.get)
177
+ ::Relaton::Render::Iso::General.new(language: @lang,
178
+ i18nhash: @i18n.get)
178
179
  end
179
180
 
180
181
  def bibrender(xml)
@@ -185,6 +186,16 @@ module IsoDoc
185
186
  end
186
187
  end
187
188
 
189
+ def ol_depth(node)
190
+ depth = node.ancestors(@iso_class ? "ol" : "ul, ol").size + 1
191
+ type = :alphabet
192
+ type = :arabic if [2, 7].include? depth
193
+ type = :roman if [3, 8].include? depth
194
+ type = :alphabet_upper if [4, 9].include? depth
195
+ type = :roman_upper if [5, 10].include? depth
196
+ type
197
+ end
198
+
188
199
  include Init
189
200
  end
190
201
  end
@@ -80,7 +80,7 @@ module IsoDoc
80
80
 
81
81
  def eref_localities1_zh(target, type, from, upto, node)
82
82
  ret = " 第#{from}" if from
83
- ret += "&ndash;#{upto}" if upto
83
+ ret += "&#x2013;#{upto}" if upto
84
84
  node["droploc"] != "true" && !subclause?(target, type, from) and
85
85
  ret += eref_locality_populate(type, node)
86
86
  ret += ")" if type == "list"
@@ -97,15 +97,21 @@ module IsoDoc
97
97
  node["droploc"] != "true" && !subclause?(target, type, from) and
98
98
  ret = eref_locality_populate(type, node)
99
99
  ret += " #{from}" if from
100
- ret += "&ndash;#{upto}" if upto
100
+ ret += "&#x2013;#{upto}" if upto
101
101
  ret += ")" if type == "list"
102
102
  ret = l10n(ret)
103
103
  locality_span_wrap(ret, type)
104
104
  end
105
105
 
106
106
  def prefix_container(container, linkend, target)
107
- delim = @xrefs.anchor(target, :type) == "listitem" ? " " : ", "
108
- l10n(@xrefs.anchor(container, :xref) + delim + linkend)
107
+ delim = ", "
108
+ type = :xref
109
+ if @xrefs.anchor(target, :type) == "listitem" &&
110
+ !@xrefs.anchor(target, :refer_list)
111
+ delim = " "
112
+ type = :label # 7 a) not Clause 7 a), but Clause 7 List 1 a)
113
+ end
114
+ l10n(@xrefs.anchor(container, type) + delim + linkend)
109
115
  end
110
116
 
111
117
  def expand_citeas(text)
@@ -1,7 +1,7 @@
1
1
  module IsoDoc
2
2
  module Iso
3
3
  module BaseConvert
4
- def middle_title(isoxml, out)
4
+ def middle_title(_isoxml, out)
5
5
  middle_title_main(out)
6
6
  middle_title_amd(out)
7
7
  end
@@ -9,9 +9,9 @@ module IsoDoc
9
9
  def middle_title_main(out)
10
10
  out.p(**{ class: "zzSTDTitle1" }) do |p|
11
11
  p << @meta.get[:doctitleintro]
12
- p << " &mdash; " if @meta.get[:doctitleintro] && @meta.get[:doctitlemain]
12
+ p << " &#x2014; " if @meta.get[:doctitleintro] && @meta.get[:doctitlemain]
13
13
  p << @meta.get[:doctitlemain]
14
- p << " &mdash; " if @meta.get[:doctitlemain] && @meta.get[:doctitlepart]
14
+ p << " &#x2014; " if @meta.get[:doctitlemain] && @meta.get[:doctitlepart]
15
15
  end
16
16
  a = @meta.get[:doctitlepart] and out.p(**{ class: "zzSTDTitle2" }) do |p|
17
17
  b = @meta.get[:doctitlepartlabel] and p << "#{b}: "
@@ -44,6 +44,9 @@ module IsoDoc
44
44
  docxml.xpath("//*[@class = 'example']").each do |p|
45
45
  p["class"] = "Example"
46
46
  end
47
+ docxml.xpath("//*[@class = 'zzHelp']/p[not(@class)]").each do |p|
48
+ p["class"] = "zzHelp"
49
+ end
47
50
  end
48
51
 
49
52
  def authority_hdr_cleanup(docxml)
@@ -14,10 +14,11 @@ module IsoDoc
14
14
  @wordToClevels = 3 if @wordToClevels.zero?
15
15
  @htmlToClevels = options[:htmltoclevels].to_i
16
16
  @htmlToClevels = 3 if @htmlToClevels.zero?
17
- init_dis
17
+ init_dis(options)
18
18
  end
19
19
 
20
- def init_dis
20
+ def init_dis(options)
21
+ @wordtemplate = options[:isowordtemplate]
21
22
  @dis = ::IsoDoc::Iso::WordDISConvert.new(options)
22
23
  end
23
24
 
@@ -55,8 +56,10 @@ module IsoDoc
55
56
  output_filename = nil)
56
57
  file = File.read(input_filename, encoding: "utf-8") if file.nil?
57
58
  docxml = Nokogiri::XML(file) { |config| config.huge }
59
+ stage = docxml&.at(ns("//bibdata/status/stage"))&.text
58
60
  if @dis &&
59
- /^[45].$/.match?(docxml&.at(ns("//bibdata/status/stage"))&.text)
61
+ ((/^[4569].$/.match?(stage) && @wordtemplate != "simple") ||
62
+ (/^[0-3].$/.match?(stage) && @wordtemplate == "dis"))
60
63
  @dis.convert(input_filename, file, debug, output_filename)
61
64
  else
62
65
  super
@@ -88,8 +91,8 @@ module IsoDoc
88
91
  <span lang="EN-GB"><span
89
92
  style='mso-element:field-begin'></span><span
90
93
  style='mso-spacerun:yes'>&#xA0;</span>TOC
91
- \\o &quot;1-#{level}&quot; \\h \\z \\t &quot;Heading
92
- 1;1;ANNEX;1;Biblio Title;1;Foreword Title;1;Intro Title;1&quot; <span
94
+ \\o "1-#{level}" \\h \\z \\t "Heading
95
+ 1;1;ANNEX;1;Biblio Title;1;Foreword Title;1;Intro Title;1" <span
93
96
  style='mso-element:field-separator'></span></span>
94
97
  TOC
95
98
  end