metanorma-itu 2.4.3 → 2.4.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/lib/isodoc/itu/html/header.html +68 -0
  3. data/lib/isodoc/itu/html/html_itu_titlepage.html +7 -4
  4. data/lib/isodoc/itu/html/itu.css +4 -1
  5. data/lib/isodoc/itu/html/itu.scss +4 -1
  6. data/lib/isodoc/itu/html/logo-small.png +0 -0
  7. data/lib/isodoc/itu/html/word_itu_intro.html +2 -0
  8. data/lib/isodoc/itu/html/word_itu_titlepage.html +17 -34
  9. data/lib/isodoc/itu/html/wordstyle.css +2 -0
  10. data/lib/isodoc/itu/html/wordstyle.scss +2 -0
  11. data/lib/isodoc/itu/html_convert.rb +10 -0
  12. data/lib/isodoc/itu/i18n-ar.yaml +10 -0
  13. data/lib/isodoc/itu/i18n-de.yaml +10 -0
  14. data/lib/isodoc/itu/i18n-en.yaml +10 -0
  15. data/lib/isodoc/itu/i18n-es.yaml +10 -0
  16. data/lib/isodoc/itu/i18n-fr.yaml +10 -0
  17. data/lib/isodoc/itu/i18n-ru.yaml +10 -0
  18. data/lib/isodoc/itu/i18n-zh-Hans.yaml +10 -0
  19. data/lib/isodoc/itu/itu.implementers-guide.xsl +145 -116
  20. data/lib/isodoc/itu/itu.in-force.xsl +145 -116
  21. data/lib/isodoc/itu/itu.recommendation-annex.xsl +145 -116
  22. data/lib/isodoc/itu/itu.recommendation-supplement.xsl +145 -116
  23. data/lib/isodoc/itu/itu.recommendation.xsl +145 -116
  24. data/lib/isodoc/itu/itu.resolution.xsl +145 -116
  25. data/lib/isodoc/itu/itu.service-publication.xsl +145 -116
  26. data/lib/isodoc/itu/itu.technical-paper.xsl +145 -116
  27. data/lib/isodoc/itu/itu.technical-report.xsl +145 -116
  28. data/lib/isodoc/itu/metadata.rb +54 -18
  29. data/lib/isodoc/itu/presentation_preface.rb +110 -9
  30. data/lib/isodoc/itu/presentation_ref.rb +18 -13
  31. data/lib/isodoc/itu/presentation_xml_convert.rb +13 -26
  32. data/lib/isodoc/itu/word_cleanup.rb +4 -4
  33. data/lib/isodoc/itu/word_convert.rb +21 -2
  34. data/lib/metanorma/itu/biblio.rng +24 -8
  35. data/lib/metanorma/itu/cleanup.rb +17 -146
  36. data/lib/metanorma/itu/cleanup_section.rb +150 -0
  37. data/lib/metanorma/itu/converter.rb +4 -0
  38. data/lib/metanorma/itu/front.rb +75 -35
  39. data/lib/metanorma/itu/front_id.rb +17 -6
  40. data/lib/metanorma/itu/isodoc.rng +67 -55
  41. data/lib/metanorma/itu/relaton-itu.rng +43 -7
  42. data/lib/metanorma/itu/validate.rb +4 -4
  43. data/lib/metanorma/itu/version.rb +1 -1
  44. metadata +4 -2
@@ -1,4 +1,3 @@
1
- require "isodoc"
2
1
  require "twitter_cldr"
3
2
 
4
3
  module IsoDoc
@@ -11,6 +10,7 @@ module IsoDoc
11
10
  set(:logo_comb, fileloc("itu-document-comb.png"))
12
11
  set(:logo_word, fileloc(n))
13
12
  set(:logo_sp, fileloc("logo-sp.png"))
13
+ set(:logo_small, fileloc("logo-small.png"))
14
14
  @isodoc = IsoDoc::ITU::HtmlConvert.new({})
15
15
  end
16
16
 
@@ -19,21 +19,30 @@ module IsoDoc
19
19
  File.expand_path(File.join(here, "html", file))
20
20
  end
21
21
 
22
- def title(isoxml, _out)
23
- { doctitle: "//bibdata/title[@language='#{@lang}'][@type = 'main']",
24
- docsubtitle: "//bibdata/title[@language='#{@lang}']" \
22
+ TITLE_XPATHS =
23
+ { doctitle: "//bibdata/title[@language='@_lang'][@type = 'main']",
24
+ docsubtitle: "//bibdata/title[@language='@_lang']" \
25
25
  "[@type = 'subtitle']",
26
- amendmenttitle: "//bibdata/title[@language='#{@lang}']" \
26
+ amendmenttitle: "//bibdata/title[@language='@_lang']" \
27
27
  "[@type = 'amendment']",
28
- corrigendumtitle: "//bibdata/title[@language='#{@lang}']" \
28
+ corrigendumtitle: "//bibdata/title[@language='@_lang']" \
29
29
  "[@type = 'corrigendum']",
30
30
  series: "//bibdata/series[@type='main']/title",
31
31
  series1: "//bibdata/series[@type='secondary']/title",
32
32
  series2: "//bibdata/series[@type='tertiary']/title",
33
33
  annextitle: "//bibdata/title[@type='annex']",
34
- positiontitle: "//bibdata/title[@type='position-sp']" }.each do |k, v|
35
- titleset(isoxml, k, v)
34
+ collectiontitle: "//bibdata/title[@type='collection']",
35
+ slogantitle: "//bibdata/title[@type='slogan']",
36
+ positiontitle: "//bibdata/title[@type='position-sp']" }.freeze
37
+
38
+ def title(isoxml, _out)
39
+ TITLE_XPATHS.each do |k, v|
40
+ titleset(isoxml, k, v.sub("@_lang", @lang))
36
41
  end
42
+ titleset(isoxml, :doctitle_en,
43
+ "//bibdata/title[@language='en'][@type = 'main']") or
44
+ titleset(isoxml, :doctitle_en,
45
+ "//bibdata/title[@language='#{@lang}'][@type = 'main']")
37
46
  end
38
47
 
39
48
  def titleset(isoxml, key, xpath)
@@ -44,6 +53,7 @@ module IsoDoc
44
53
  end
45
54
  end.join
46
55
  set(key, out.sub(%r{^<span>}, "").sub(%r{</span>$}, ""))
56
+ true
47
57
  end
48
58
 
49
59
  def subtitle(_isoxml, _out)
@@ -51,12 +61,21 @@ module IsoDoc
51
61
  end
52
62
 
53
63
  def author(xml, _out)
54
- bureau = xml.at(ns("//bibdata/ext/editorialgroup/bureau"))
55
- set(:bureau, bureau.text) if bureau
64
+ sector = xml.at(ns("//bibdata/ext/editorialgroup/sector"))
65
+ set(:sector, sector.text) if sector
66
+ bureau(xml)
56
67
  tc = xml.at(ns("//bibdata/ext/editorialgroup/committee"))
57
68
  set(:tc, tc.text) if tc
58
69
  tc = xml.at(ns("//bibdata/ext/editorialgroup/group/name"))
59
70
  set(:group, tc.text) if tc
71
+ tc = xml.at(ns("//bibdata/ext/editorialgroup/group/acronym"))
72
+ set(:group_acronym, tc.text) if tc
73
+ start1 = xml.at(ns("//bibdata/ext/editorialgroup/group/period/start"))
74
+ end1 = xml.at(ns("//bibdata/ext/editorialgroup/group/period/end"))
75
+ if start1
76
+ set(:study_group_period,
77
+ @i18n.l10n("#{start1.text}–#{end1.text}"))
78
+ end
60
79
  tc = xml.at(ns("//bibdata/ext/editorialgroup/subgroup/name"))
61
80
  set(:subgroup, tc.text) if tc
62
81
  tc = xml.at(ns("//bibdata/ext/editorialgroup/workgroup/name"))
@@ -67,20 +86,34 @@ module IsoDoc
67
86
  person_attributes(authors) unless authors.empty?
68
87
  end
69
88
 
89
+ def bureau(xml)
90
+ if bureau = xml.at(ns("//bibdata/ext/editorialgroup/bureau"))
91
+ set(:bureau, bureau.text)
92
+ case bureau.text
93
+ when "T" then set(:bureau_full, @i18n.tsb_full)
94
+ when "D" then set(:bureau_full, @i18n.bdt_full)
95
+ when "R" then set(:bureau_full, @i18n.br_full)
96
+ end
97
+ end
98
+ end
99
+
70
100
  def append(key, value)
71
101
  @metadata[key] << value
72
102
  end
73
103
 
104
+ PERSON_ATTRS = { affiliations: "./affiliation/organization/name",
105
+ addresses: "./affiliation/organization/address/" \
106
+ "formattedAddress",
107
+ emails: "./email",
108
+ faxes: "./phone[@type = 'fax']",
109
+ phones: "./phone[not(@type = 'fax')]" }.freeze
110
+
74
111
  def person_attributes(authors)
75
- %i(affiliations addresses emails faxes phones).each { |i| set(i, []) }
112
+ PERSON_ATTRS.each_key { |k| set(k, []) }
76
113
  authors.each do |a|
77
- append(:affiliations,
78
- a.at(ns("./affiliation/organization/name"))&.text)
79
- append(:addresses, a.at(ns("./affiliation/organization/address/" \
80
- "formattedAddress"))&.text)
81
- append(:emails, a.at(ns("./email"))&.text)
82
- append(:faxes, a.at(ns("./phone[@type = 'fax']"))&.text)
83
- append(:phones, a.at(ns("./phone[not(@type = 'fax')]"))&.text)
114
+ PERSON_ATTRS.each do |k, v|
115
+ append(k, a.at(ns(v))&.text)
116
+ end
84
117
  end
85
118
  end
86
119
 
@@ -130,6 +163,9 @@ module IsoDoc
130
163
  def keywords(isoxml, _out)
131
164
  super
132
165
  set(:keywords, get[:keywords].sort)
166
+ q = isoxml.xpath(ns("//bibdata/ext/question/identifier"))
167
+ q.empty? or set(:questions,
168
+ q.map { |x| x.text.sub(/^Q/, "") }.join(", "))
133
169
  end
134
170
 
135
171
  def doctype(isoxml, _out)
@@ -2,8 +2,13 @@ module IsoDoc
2
2
  module ITU
3
3
  class PresentationXMLConvert < IsoDoc::PresentationXMLConvert
4
4
  def insert_preface_sections(docxml)
5
- x = insert_editors_clause(docxml) and
6
- editors_insert_pt(docxml).next = x
5
+ if @doctype == "contribution"
6
+ x = contribution_table(docxml) and
7
+ contribution_table_insert_pt(docxml).next = x
8
+ else
9
+ x = insert_editors_clause(docxml) and
10
+ editors_insert_pt(docxml).next = x
11
+ end
7
12
  end
8
13
 
9
14
  def editors_insert_pt(docxml)
@@ -13,6 +18,74 @@ module IsoDoc
13
18
  docxml.at(ns("//preface")).children[-1]
14
19
  end
15
20
 
21
+ def contribution_table_insert_pt(docxml)
22
+ docxml.at(ns("//preface")) || docxml.at(ns("//sections"))
23
+ .add_previous_sibling("<preface> </preface>").first
24
+ docxml.at(ns("//preface")).children.first.before(" ").previous
25
+ end
26
+
27
+ def contribution_table(_doc)
28
+ @doctype == "contribution" or return
29
+ bureau = bold_and_upcase(@meta.get[:bureau_full])
30
+ <<~TABLE
31
+ <clause unnumbered="true" type="contribution-metadata">
32
+ <table class="contribution-metadata" unnumbered="true" width="100%">
33
+ <colgroup><col width="11.8%"/><col width="41.2%"/><col width="47.0%"/></colgroup>
34
+ <thead>
35
+ <tr><th rowspan="3"><image height="56" width="56" src="#{@meta.get[:logo_small]}"/></th>
36
+ <td rowspan="3"><p style="font-size:8pt;margin-top:6pt;margin-bottom:0pt;">#{@i18n.international_telecommunication_union.upcase}</p>
37
+ <p class="bureau_big" style="font-size:13pt;margin-top:6pt;margin-bottom:0pt;">#{bureau}</p>
38
+ <p style="font-size:10pt;margin-top:6pt;margin-bottom:0pt;">#{@i18n.studyperiod.sub('%', @meta.get[:study_group_period]).upcase}</p></th>
39
+ <th align="right"><p style="font-size:16pt;">#{@meta.get[:docnumber]}</p></th></tr>
40
+ <tr><th align="right"><p style="font-size:14pt;">#{@meta.get[:group].upcase}</p></th></tr>
41
+ <tr>
42
+ <th align="right"><p style="font-size:14pt;">#{@i18n.l10n("#{@i18n.original}: #{@i18n.current_language}")}</p></th>
43
+ </tr></thead>
44
+ <tbody>
45
+ <tr><th align="left" width="95">#{colon_i18n(@i18n.questions)}</th><td>#{@meta.get[:questions]}</td>
46
+ <td align="right">#{@i18n.l10n("#{@meta.get[:meeting_place]}, #{@meta.get[:meeting_date]}")}</td></tr>
47
+ <tr><th align="center" colspan="3">#{@i18n.get['doctype_dict']['contribution'].upcase}</th></tr>
48
+ <tr><th align="left" width="95">#{colon_i18n(@i18n.document_source)}</th><td colspan="2">#{@meta.get[:source]}</td></tr>
49
+ <tr><th align="left" width="95">#{colon_i18n(@i18n.title)}</th><td colspan="2">#{@meta.get[:doctitle_en]}</td></tr>
50
+ #{contribution_table_contacts}
51
+ </tbody></table>
52
+ </clause>
53
+ TABLE
54
+ end
55
+
56
+ def colon_i18n(text)
57
+ @i18n.l10n("#{text}:")
58
+ end
59
+
60
+ def bold_and_upcase(xml)
61
+ x = Nokogiri::XML("<root>#{xml}</root>")
62
+ x.traverse do |e|
63
+ e.text? or next
64
+ e.replace("<strong>#{e.text.upcase}</strong>")
65
+ end
66
+ x.root.children.to_xml
67
+ end
68
+
69
+ def contribution_table_contacts
70
+ n = (0..@meta.get[:authors]&.size).each_with_object([]) do |i, ret|
71
+ ret << contribution_table_contact(i)
72
+ end
73
+ n.map do |x|
74
+ lbl = colon_i18n(@i18n.contact)
75
+ "<tr><th align='left' width='95'>#{lbl}</th>#{x}</tr>"
76
+ end.join("\n")
77
+ end
78
+
79
+ def contribution_table_contact(idx)
80
+ <<~CELL
81
+ <td>#{@meta.get[:authors][idx]}<br/>
82
+ #{@meta.get[:affiliations][idx]}<br/>
83
+ #{@meta.get[:addresses][idx]}</td>
84
+ <td>#{@i18n.tel_abbrev}<tab/>#{@meta.get[:phones][idx]}<br/>
85
+ #{@i18n.email}<tab/>#{@meta.get[:emails][idx]}</td>
86
+ CELL
87
+ end
88
+
16
89
  def insert_editors_clause(doc)
17
90
  ret = extract_editors(doc) or return
18
91
  eds = ret[:names].each_with_object([]).with_index do |(_x, acc), i|
@@ -57,19 +130,47 @@ module IsoDoc
57
130
 
58
131
  def rearrange_clauses(docxml)
59
132
  super
60
- k = keywords(docxml) or return
61
- if a = docxml.at(ns("//preface/abstract"))
62
- a.next = k
63
- elsif a = docxml.at(ns("//preface"))
64
- a.children.first.previous = k
133
+ insert_preface_sections(docxml)
134
+ a = docxml.at(ns("//preface/abstract"))
135
+ keywords_abstract_swap(a, keywords(docxml), docxml)
136
+ c = docxml.at(ns("//preface/clause[@type='contribution-metadata']")) and
137
+ a and c.next = a
138
+ abstract_render(a)
139
+ end
140
+
141
+ def keywords_abstract_swap(abstract, keywords, docxml)
142
+ @doctype == "contribution" and return
143
+ keywords or return
144
+ if abstract then abstract.next = keywords
145
+ else
146
+ p = contribution_table_insert_pt(docxml)
147
+ p.next = keywords
65
148
  end
66
149
  end
67
150
 
151
+ def abstract_render(abstract)
152
+ @doctype == "contribution" or return
153
+ abstract.at(ns("./title"))&.remove
154
+ abstract.children = <<~TABLE
155
+ <table class="abstract" unnumbered="true" width="100%">
156
+ <colgroup><col width="11.8%"/><col width="78.2%"/></colgroup>
157
+ <tbody>
158
+ <tr><th align="left" width="95"><p>#{colon_i18n(@i18n.abstract)}</p></th>
159
+ <td>#{abstract.children.to_xml}</td></tr>
160
+ </tbody></table>
161
+ TABLE
162
+ end
163
+
68
164
  def keywords(_docxml)
69
165
  kw = @meta.get[:keywords]
70
- kw.nil? || kw.empty? and return
166
+ kw.nil? || kw.empty? || @doctype == "contribution" and return
71
167
  "<clause type='keyword'><title>#{@i18n.keywords}</title>" \
72
- "<p>#{kw.join(', ')}.</p>"
168
+ "<p>#{@i18n.l10n(kw.join(', '))}.</p>"
169
+ end
170
+
171
+ def toc_title(docxml)
172
+ %w(resolution contribution).include?(@doctype) and return
173
+ super
73
174
  end
74
175
 
75
176
  include Init
@@ -24,29 +24,34 @@ module IsoDoc
24
24
  end
25
25
 
26
26
  def multi_bibitem_ref_code(bib)
27
- skip = IsoDoc::Function::References::SKIP_DOCID
28
- skip1 = "@type = 'metanorma' or @type = 'metanorma-ordinal'"
29
- prim = "[@primary = 'true']"
30
- id = bib.xpath(ns("./docidentifier#{prim}[not(#{skip} or #{skip1})]"))
31
- id.empty? and id = bib.xpath(ns("./docidentifier#{prim}[not(#{skip1})]"))
32
- id.empty? and id = bib.xpath(ns("./docidentifier[not(#{skip} or #{skip1})]"))
33
- id.empty? and id = bib.xpath(ns("./docidentifier[not(#{skip1})]"))
34
- id.empty? and return id
35
- id.sort_by { |i| i["type"] == "ITU" ? 0 : 1 }
27
+ id = pref_ref_code_parse(bib)
28
+ id.nil? and return []
29
+ id.sort_by { |i| /^ITU/.match?(i) ? 0 : 1 }
36
30
  end
37
31
 
38
- def render_multi_identifiers(ids)
32
+ def render_multi_identifiers(ids, bib)
39
33
  ids.map do |id|
40
- if id["type"] == "ITU" then doctype_title(id)
34
+ if /^ITU/.match?(id) then doctype_title(id, bib)
41
35
  else
42
- docid_prefix(id["type"], id.text.sub(/^\[/, "").sub(/\]$/, ""))
36
+ id.sub(/^\[/, "").sub(/\]$/, "")
43
37
  end
44
38
  end.join("&#xA0;| ")
45
39
  end
46
40
 
41
+ def doctype_title(id, bib)
42
+ type = bib.at(ns("./ext/doctype"))&.text || "recommendation"
43
+ if type == "recommendation" &&
44
+ /^(?<prefix>ITU-[A-Z][  ][A-Z])[  .-]Sup[a-z]*\.[  ]?(?<num>\d+)$/ =~ id
45
+ "#{prefix}-series Recommendations – Supplement #{num}"
46
+ else
47
+ d = id.sub(/^\[/, "").sub(/\]$/, "")
48
+ "#{titlecase(type)} #{d}"
49
+ end
50
+ end
51
+
47
52
  def reference_format_start(bib)
48
53
  id = multi_bibitem_ref_code(bib)
49
- id1 = render_multi_identifiers(id)
54
+ id1 = render_multi_identifiers(id, bib)
50
55
  out = id1
51
56
  date = bib.at(ns("./date[@type = 'published']/on | " \
52
57
  "./date[@type = 'published']/from")) and
@@ -25,11 +25,6 @@ module IsoDoc
25
25
  super
26
26
  end
27
27
 
28
- def convert1(docxml, filename, dir)
29
- insert_preface_sections(docxml)
30
- super
31
- end
32
-
33
28
  def eref(docxml)
34
29
  docxml.xpath(ns("//eref")).each { |f| eref1(f) }
35
30
  end
@@ -87,24 +82,12 @@ module IsoDoc
87
82
  str.gsub(/ |_|-/, " ").split(/ /).map(&:capitalize).join(" ")
88
83
  end
89
84
 
90
- def doctype_title(id)
91
- type = id.parent&.at(ns("./ext/doctype"))&.text || "recommendation"
92
- if type == "recommendation" &&
93
- /^(?<prefix>ITU-[A-Z][  ][A-Z])[  .-]Sup[a-z]*\.[  ]?(?<num>\d+)$/ =~ id.text
94
- "#{prefix}-series Recommendations – Supplement #{num}"
95
- else
96
- d = docid_prefix(id["type"], id.text.sub(/^\[/, "").sub(/\]$/, ""))
97
- "#{titlecase(type)} #{d}"
98
- end
99
- end
100
-
101
85
  def twitter_cldr_localiser_symbols
102
86
  { group: "'" }
103
87
  end
104
88
 
105
89
  def clause1(elem)
106
- @doctype == "resolution" or return super
107
- %w(sections bibliography).include? elem.parent.name or return super
90
+ clause1_super?(elem) and return super
108
91
  @suppressheadingnumbers || elem["unnumbered"] and return
109
92
  t = elem.at(ns("./title")) and t["depth"] = "1"
110
93
  lbl = @xrefs.anchor(elem["id"], :label, false) or return
@@ -113,6 +96,11 @@ module IsoDoc
113
96
  "#{@i18n.get['section'].upcase} #{lbl}</p>"
114
97
  end
115
98
 
99
+ def clause1_super?(elem)
100
+ @doctype != "resolution" ||
101
+ !%w(sections bibliography).include?(elem.parent.name)
102
+ end
103
+
116
104
  def annex1(elem)
117
105
  @doctype == "resolution" or return super
118
106
  elem.elements.first.previous = annex1_supertitle(elem)
@@ -145,16 +133,13 @@ module IsoDoc
145
133
  super
146
134
  end
147
135
 
148
- def toc_title(docxml)
149
- @doctype == "resolution" and return
150
- super
151
- end
152
-
153
136
  def middle_title(isoxml)
154
137
  s = isoxml.at(ns("//sections")) or return
155
138
  titfn = isoxml.at(ns("//note[@type = 'title-footnote']"))
156
- if @meta.get[:doctype] == "Resolution"
139
+ case @doctype
140
+ when "resolution"
157
141
  middle_title_resolution(isoxml, s.children.first)
142
+ when "contribution"
158
143
  else
159
144
  middle_title_recommendation(isoxml, s.children.first)
160
145
  end
@@ -162,7 +147,8 @@ module IsoDoc
162
147
  end
163
148
 
164
149
  def renumber_footnotes(isoxml)
165
- (isoxml.xpath(ns("//fn")) - isoxml.xpath(ns("//table//fn | //figure//fn")))
150
+ (isoxml.xpath(ns("//fn")) -
151
+ isoxml.xpath(ns("//table//fn | //figure//fn")))
166
152
  .each_with_index do |fn, i|
167
153
  fn["reference"] = (i + 1).to_s
168
154
  end
@@ -223,7 +209,8 @@ module IsoDoc
223
209
 
224
210
  def dl1(dlist)
225
211
  ins = dlist.at(ns("./dt"))
226
- ins.previous = '<colgroup><col width="20%"/><col width="80%"/></colgroup>'
212
+ ins.previous =
213
+ '<colgroup><col width="20%"/><col width="80%"/></colgroup>'
227
214
  end
228
215
 
229
216
  include Init
@@ -32,11 +32,11 @@ module IsoDoc
32
32
 
33
33
  def word_title_cleanup(docxml)
34
34
  docxml.xpath("//p[@class = 'annex_obligation']").each do |h|
35
- h&.next_element&.name == "p" or next
35
+ h.next_element&.name == "p" or next
36
36
  h.next_element["class"] ||= "Normalaftertitle"
37
37
  end
38
38
  docxml.xpath("//p[@class = 'FigureTitle']").each do |h|
39
- h&.parent&.next_element&.name == "p" or next
39
+ h.parent&.next_element&.name == "p" or next
40
40
  h.parent.next_element["class"] ||= "Normalaftertitle"
41
41
  end
42
42
  end
@@ -103,8 +103,8 @@ module IsoDoc
103
103
 
104
104
  def authority_hdr_cleanup2(docxml)
105
105
  %w(copyright license legal).each do |t|
106
- docxml&.xpath("//div[@class = 'boilerplate-#{t}']")&.each do |d|
107
- para = d&.at("./descendant::h1[2]") and
106
+ docxml.xpath("//div[@class = 'boilerplate-#{t}']")&.each do |d|
107
+ para = d.at("./descendant::h1[2]") and
108
108
  para.previous = "<p>&#xa0;</p><p>&#xa0;</p><p>&#xa0;</p>"
109
109
  d.xpath(".//h1 | .//h2").each do |p|
110
110
  p.name = "p"
@@ -21,9 +21,24 @@ module IsoDoc
21
21
  end
22
22
  end
23
23
 
24
+ def make_body1(body, _docxml)
25
+ @wordcoverpage or return
26
+ super
27
+ end
28
+
29
+ def make_body2(body, docxml)
30
+ body.div class: "WordSection2" do |div2|
31
+ boilerplate docxml, div2
32
+ content(div2, docxml, ns("//preface/*[@displayorder]"))
33
+ div2.p { |p| p << "&#xa0;" } # placeholder
34
+ end
35
+ @doctype == "contribution" or section_break(body)
36
+ end
37
+
24
38
  def abstract(clause, out)
25
39
  out.div **attr_code(id: clause["id"], class: "Abstract") do |s|
26
- clause_name(clause, "Summary", s, class: "AbstractTitle")
40
+ @doctype == "contribution" or
41
+ clause_name(clause, "Summary", s, class: "AbstractTitle")
27
42
  clause.elements.each { |e| parse(e, s) unless e.name == "title" }
28
43
  end
29
44
  end
@@ -42,10 +57,14 @@ module IsoDoc
42
57
  end
43
58
 
44
59
  def convert1(docxml, filename, dir)
45
- if @doctype == "service-publication"
60
+ case @doctype
61
+ when "service-publication"
46
62
  @wordcoverpage = html_doc_path("word_itu_titlepage_sp.html")
47
63
  options[:bodyfont] = "Arial"
48
64
  options[:headerfont] = "Arial"
65
+ when "contribution"
66
+ @wordcoverpage = nil
67
+ @wordintropage = nil
49
68
  end
50
69
  super
51
70
  end
@@ -208,7 +208,9 @@
208
208
  </define>
209
209
  <define name="roledescription">
210
210
  <element name="description">
211
- <ref name="FormattedString"/>
211
+ <oneOrMore>
212
+ <ref name="TextElement"/>
213
+ </oneOrMore>
212
214
  </element>
213
215
  </define>
214
216
  <define name="person">
@@ -333,7 +335,9 @@
333
335
  </define>
334
336
  <define name="affiliationdescription">
335
337
  <element name="description">
336
- <ref name="FormattedString"/>
338
+ <oneOrMore>
339
+ <ref name="TextElement"/>
340
+ </oneOrMore>
337
341
  </element>
338
342
  </define>
339
343
  <define name="organization">
@@ -897,7 +901,9 @@
897
901
  </define>
898
902
  <define name="formattedref">
899
903
  <element name="formattedref">
900
- <ref name="FormattedString"/>
904
+ <oneOrMore>
905
+ <ref name="TextElement"/>
906
+ </oneOrMore>
901
907
  </element>
902
908
  </define>
903
909
  <define name="license">
@@ -942,7 +948,9 @@
942
948
  <optional>
943
949
  <attribute name="type"/>
944
950
  </optional>
945
- <ref name="FormattedString"/>
951
+ <zeroOrMore>
952
+ <ref name="TextElement"/>
953
+ </zeroOrMore>
946
954
  </define>
947
955
  <!-- TitleType = ( "alternative" | "original" | "unofficial" | "subtitle" | "main" ) -->
948
956
  <define name="TypedUri">
@@ -1042,7 +1050,9 @@
1042
1050
  <optional>
1043
1051
  <attribute name="script"/>
1044
1052
  </optional>
1045
- <text/>
1053
+ <oneOrMore>
1054
+ <ref name="TextElement"/>
1055
+ </oneOrMore>
1046
1056
  </element>
1047
1057
  </define>
1048
1058
  <define name="docnumber">
@@ -1267,12 +1277,16 @@
1267
1277
  <optional>
1268
1278
  <attribute name="type"/>
1269
1279
  </optional>
1270
- <ref name="FormattedString"/>
1280
+ <oneOrMore>
1281
+ <ref name="TextElement"/>
1282
+ </oneOrMore>
1271
1283
  </element>
1272
1284
  </define>
1273
1285
  <define name="bibabstract">
1274
1286
  <element name="abstract">
1275
- <ref name="FormattedString"/>
1287
+ <oneOrMore>
1288
+ <ref name="TextElement"/>
1289
+ </oneOrMore>
1276
1290
  </element>
1277
1291
  </define>
1278
1292
  <define name="copyright">
@@ -1377,7 +1391,9 @@
1377
1391
  </attribute>
1378
1392
  <optional>
1379
1393
  <element name="description">
1380
- <ref name="FormattedString"/>
1394
+ <oneOrMore>
1395
+ <ref name="TextElement"/>
1396
+ </oneOrMore>
1381
1397
  </element>
1382
1398
  </optional>
1383
1399
  <element name="bibitem">