isodoc 1.2.1 → 1.2.6

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 (48) hide show
  1. checksums.yaml +4 -4
  2. data/isodoc.gemspec +1 -0
  3. data/lib/isodoc-yaml/i18n-fr.yaml +1 -1
  4. data/lib/isodoc/base_style/all.css +1 -1
  5. data/lib/isodoc/base_style/metanorma_word.css +6 -0
  6. data/lib/isodoc/base_style/metanorma_word.scss +6 -0
  7. data/lib/isodoc/base_style/reset.css +1 -1
  8. data/lib/isodoc/base_style/reset.scss +1 -1
  9. data/lib/isodoc/convert.rb +1 -1
  10. data/lib/isodoc/function/blocks.rb +1 -0
  11. data/lib/isodoc/function/cleanup.rb +1 -1
  12. data/lib/isodoc/function/references.rb +4 -2
  13. data/lib/isodoc/function/section.rb +13 -1
  14. data/lib/isodoc/function/table.rb +1 -0
  15. data/lib/isodoc/function/to_word_html.rb +3 -0
  16. data/lib/isodoc/function/utils.rb +1 -1
  17. data/lib/isodoc/html_function/html.rb +1 -0
  18. data/lib/isodoc/i18n.rb +8 -50
  19. data/lib/isodoc/metadata.rb +49 -35
  20. data/lib/isodoc/metadata_date.rb +5 -0
  21. data/lib/isodoc/presentation_function/bibdata.rb +24 -0
  22. data/lib/isodoc/presentation_function/block.rb +14 -0
  23. data/lib/isodoc/presentation_function/inline.rb +27 -14
  24. data/lib/isodoc/presentation_xml_convert.rb +4 -0
  25. data/lib/isodoc/version.rb +1 -1
  26. data/lib/isodoc/word_function/body.rb +1 -0
  27. data/lib/isodoc/word_function/postprocess.rb +1 -1
  28. data/lib/isodoc/word_function/table.rb +3 -2
  29. data/lib/isodoc/xref.rb +1 -0
  30. data/lib/isodoc/xref/xref_anchor.rb +8 -3
  31. data/lib/isodoc/xref/xref_counter.rb +21 -7
  32. data/lib/isodoc/xref/xref_gen.rb +29 -6
  33. data/lib/isodoc/xref/xref_sect_gen.rb +1 -1
  34. data/lib/isodoc/xslfo_convert.rb +6 -1
  35. data/spec/assets/i18n.yaml +9 -0
  36. data/spec/isodoc/blocks_spec.rb +281 -13
  37. data/spec/isodoc/cleanup_spec.rb +3 -1
  38. data/spec/isodoc/i18n_spec.rb +43 -5
  39. data/spec/isodoc/inline_spec.rb +47 -5
  40. data/spec/isodoc/metadata_spec.rb +24 -15
  41. data/spec/isodoc/postproc_spec.rb +39 -3
  42. data/spec/isodoc/ref_spec.rb +4 -1
  43. data/spec/isodoc/section_spec.rb +134 -10
  44. data/spec/isodoc/table_spec.rb +306 -207
  45. data/spec/isodoc/terms_spec.rb +1 -1
  46. data/spec/isodoc/xref_spec.rb +46 -18
  47. data/spec/spec_helper.rb +4 -0
  48. metadata +17 -2
@@ -134,5 +134,19 @@ module IsoDoc
134
134
  n = @xrefs.anchor(f['id'], :label, false)
135
135
  prefix_name(f, " — ", l10n("#{@i18n.table} #{n}"), "name")
136
136
  end
137
+
138
+ # we use this to eliminate the semantic amend blocks from rendering
139
+ def amend(docxml)
140
+ docxml.xpath(ns("//amend")).each do |f|
141
+ amend1(f)
142
+ end
143
+ end
144
+
145
+ def amend1(f)
146
+ f.xpath(ns("./autonumber")).each { |a| a.remove }
147
+ f.xpath(ns("./newcontent")).each { |a| a.name = "quote" }
148
+ f.xpath(ns("./description")).each { |a| a.replace(a.children) }
149
+ f.replace(f.children)
150
+ end
137
151
  end
138
152
  end
@@ -7,17 +7,25 @@ module IsoDoc
7
7
  def anchor_linkend(node, linkend)
8
8
  if node["citeas"].nil? && node["bibitemid"]
9
9
  return @xrefs.anchor(node["bibitemid"] ,:xref) || "???"
10
+ elsif node["target"] && node["droploc"]
11
+ return @xrefs.anchor(node["target"], :value) ||
12
+ @xrefs.anchor(node["target"], :label) ||
13
+ @xrefs.anchor(node["target"], :xref) || "???"
10
14
  elsif node["target"] && !/.#./.match(node["target"])
11
- linkend = @xrefs.anchor(node["target"], :xref)
12
- container = @xrefs.anchor(node["target"], :container, false)
13
- (container && get_note_container_id(node) != container &&
14
- @xrefs.get[node["target"]]) &&
15
- linkend = prefix_container(container, linkend, node["target"])
16
- linkend = capitalise_xref(node, linkend)
15
+ linkend = anchor_linkend1(node)
17
16
  end
18
17
  linkend || "???"
19
18
  end
20
19
 
20
+ def anchor_linkend1(node)
21
+ linkend = @xrefs.anchor(node["target"], :xref)
22
+ container = @xrefs.anchor(node["target"], :container, false)
23
+ (container && get_note_container_id(node) != container &&
24
+ @xrefs.get[node["target"]]) &&
25
+ linkend = prefix_container(container, linkend, node["target"])
26
+ capitalise_xref(node, linkend)
27
+ end
28
+
21
29
  def capitalise_xref(node, linkend)
22
30
  return linkend unless %w(Latn Cyrl Grek).include? @script
23
31
  return linkend&.capitalize if node["case"] == "capital"
@@ -59,14 +67,19 @@ module IsoDoc
59
67
  refs.each_with_index do |r, i|
60
68
  delim = ","
61
69
  delim = ";" if r.name == "localityStack" && i>0
62
- if r.name == "localityStack"
63
- r.elements.each_with_index do |rr, j|
64
- ret += eref_localities0(rr, j, target, delim)
65
- delim = ","
66
- end
67
- else
68
- ret += eref_localities0(r, i, target, delim)
70
+ ret = eref_locality_stack(r, i, target, delim, ret)
71
+ end
72
+ ret
73
+ end
74
+
75
+ def eref_locality_stack(r, i, target, delim, ret)
76
+ if r.name == "localityStack"
77
+ r.elements.each_with_index do |rr, j|
78
+ ret += eref_localities0(rr, j, target, delim)
79
+ delim = ","
69
80
  end
81
+ else
82
+ ret += eref_localities0(r, i, target, delim)
70
83
  end
71
84
  ret
72
85
  end
@@ -79,7 +92,7 @@ module IsoDoc
79
92
  end
80
93
  end
81
94
 
82
- # TODO: move to localization file
95
+ # TODO: move to localization file
83
96
  def eref_localities1_zh(target, type, from, to, delim)
84
97
  ret = "#{delim} 第#{from.text}" if from
85
98
  ret += "–#{to.text}" if to
@@ -1,6 +1,7 @@
1
1
  require_relative "presentation_function/block"
2
2
  require_relative "presentation_function/inline"
3
3
  require_relative "presentation_function/section"
4
+ require_relative "presentation_function/bibdata"
4
5
 
5
6
  module IsoDoc
6
7
  class PresentationXMLConvert < ::IsoDoc::Convert
@@ -14,10 +15,12 @@ module IsoDoc
14
15
  @xrefs.parse docxml
15
16
  info docxml, nil
16
17
  conversions(docxml)
18
+ docxml.root["type"] = "presentation"
17
19
  docxml.to_xml
18
20
  end
19
21
 
20
22
  def conversions(docxml)
23
+ bibdata docxml
21
24
  section docxml
22
25
  block docxml
23
26
  inline docxml
@@ -30,6 +33,7 @@ module IsoDoc
30
33
  end
31
34
 
32
35
  def block(docxml)
36
+ amend docxml
33
37
  table docxml
34
38
  figure docxml
35
39
  sourcecode docxml
@@ -1,3 +1,3 @@
1
1
  module IsoDoc
2
- VERSION = "1.2.1".freeze
2
+ VERSION = "1.2.6".freeze
3
3
  end
@@ -27,6 +27,7 @@ module IsoDoc::WordFunction
27
27
  def make_body2(body, docxml)
28
28
  body.div **{ class: "WordSection2" } do |div2|
29
29
  boilerplate docxml, div2
30
+ preface_block docxml, div2
30
31
  abstract docxml, div2
31
32
  foreword docxml, div2
32
33
  introduction docxml, div2
@@ -127,7 +127,7 @@ xmlns:m="http://schemas.microsoft.com/office/2004/12/omml">
127
127
  def list_add(xpath, lvl)
128
128
  xpath.each do |list|
129
129
  (list.xpath(".//li") - list.xpath(".//ol//li | .//ul//li")).each do |l|
130
- l.xpath("./p | ./div").each_with_index do |p, i|
130
+ l.xpath("./p | ./div | ./table").each_with_index do |p, i|
131
131
  next if i == 0
132
132
  p.wrap(%{<div class="ListContLevel#{lvl}"/>})
133
133
  end
@@ -29,7 +29,7 @@ module IsoDoc::WordFunction
29
29
  border-bottom:#{SW1} #{rowmax == totalrows ? '1.5' : '1.0'}pt;
30
30
  mso-border-bottom-alt:#{SW1} #{rowmax == totalrows ? '1.5' : '1.0'}pt;
31
31
  STYLE
32
- { rowspan: td["rowspan"], colspan: td["colspan"],
32
+ { rowspan: td["rowspan"], colspan: td["colspan"], valign: td["valign"],
33
33
  align: td["align"], style: style.gsub(/\n/, "") }
34
34
  end
35
35
 
@@ -38,7 +38,8 @@ module IsoDoc::WordFunction
38
38
  summary: node["summary"],
39
39
  width: node["width"],
40
40
  style: "mso-table-anchor-horizontal:column;"\
41
- "mso-table-overlap:never;border-spacing:0;border-width:1px;#{keep_style(node)}"
41
+ "mso-table-overlap:never;border-spacing:0;border-width:1px;#{keep_style(node)}",
42
+ class: (node.text.length > 4000 ? "MsoISOTableBig" : "MsoISOTable")
42
43
  }))
43
44
  end
44
45
 
@@ -41,6 +41,7 @@ module IsoDoc
41
41
 
42
42
  # extract names for all anchors, xref and label
43
43
  def parse(docxml)
44
+ amend_preprocess(docxml)
44
45
  initial_anchor_names(docxml)
45
46
  back_anchor_names(docxml)
46
47
  # preempt clause notes with all other types of note (ISO default)
@@ -35,11 +35,15 @@ module IsoDoc::XrefGen
35
35
  end
36
36
 
37
37
  def anchor_struct_xref(lbl, elem)
38
+ l10n("#{elem} #{anchor_struct_value(lbl, elem)}")
39
+ end
40
+
41
+ def anchor_struct_value(lbl, elem)
38
42
  case elem
39
- when @labels["formula"] then l10n("#{elem} (#{lbl})")
40
- when @labels["inequality"] then l10n("#{elem} (#{lbl})")
43
+ when @labels["formula"] then "(#{lbl})"
44
+ when @labels["inequality"] then "(#{lbl})"
41
45
  else
42
- l10n("#{elem} #{lbl}")
46
+ lbl
43
47
  end
44
48
  end
45
49
 
@@ -50,6 +54,7 @@ module IsoDoc::XrefGen
50
54
  ret[:xref].gsub!(/ $/, "")
51
55
  ret[:container] = @klass.get_clause_id(container) unless container.nil?
52
56
  ret[:type] = type
57
+ ret[:value] = anchor_struct_value(lbl, elem)
53
58
  ret
54
59
  end
55
60
  end
@@ -8,17 +8,20 @@ module IsoDoc::XrefGen
8
8
  @subseq = ""
9
9
  @letter_override = nil
10
10
  @number_override = nil
11
+ @base = ""
11
12
  end
12
13
 
13
14
  def new_subseq_increment(node)
14
15
  @subseq = node["subsequence"]
15
16
  @num += 1
16
17
  @letter = node["subsequence"] ? "a" : ""
18
+ @base = ""
17
19
  if node["number"]
18
- /^(?<n>\d*)(?<a>[a-z]*)$/ =~ node["number"]
19
- if n || a
20
- @letter_override = @letter = a if a
21
- @number_override = @num = n.to_i if n
20
+ /^(?<b>.*?)(?<n>\d*)(?<a>[a-z]*)$/ =~ node["number"]
21
+ if !n.empty? || !a.empty?
22
+ @letter_override = @letter = a unless a.empty?
23
+ @number_override = @num = n.to_i unless n.empty?
24
+ @base = b
22
25
  else
23
26
  @letter_override = node["number"]
24
27
  @letter = @letter_override if /^[a-z]$/.match(@letter_override)
@@ -28,8 +31,13 @@ module IsoDoc::XrefGen
28
31
 
29
32
  def sequence_increment(node)
30
33
  if node["number"]
34
+ @base = ""
31
35
  @number_override = node["number"]
32
- @num = @number_override.to_i if /^\d+$/.match(@number_override)
36
+ /^(?<b>.*?)(?<n>\d+)$/ =~ node["number"]
37
+ unless n.nil? || n.empty?
38
+ @num = n.to_i
39
+ @base = b
40
+ end
33
41
  else
34
42
  @num += 1
35
43
  end
@@ -37,8 +45,14 @@ module IsoDoc::XrefGen
37
45
 
38
46
  def subsequence_increment(node)
39
47
  if node["number"]
48
+ @base = ""
40
49
  @letter_override = node["number"]
41
- @letter = @letter_override if /^[a-z]$/.match(@letter_override)
50
+ /^(?<b>.*?)(?<n>\d*)(?<a>[a-z]+)$/ =~ node["number"]
51
+ unless a.empty?
52
+ @letter = a
53
+ @base = b
54
+ @number_override = @num = n.to_i unless n.empty?
55
+ end
42
56
  else
43
57
  @letter = (@letter.ord + 1).chr.to_s
44
58
  end
@@ -59,7 +73,7 @@ module IsoDoc::XrefGen
59
73
  end
60
74
 
61
75
  def print
62
- "#{@number_override || @num}#{@letter_override || @letter}"
76
+ "#{@base}#{@number_override || @num}#{@letter_override || @letter}"
63
77
  end
64
78
 
65
79
  def listlabel(depth)
@@ -2,6 +2,29 @@ require_relative "xref_gen_seq.rb"
2
2
 
3
3
  module IsoDoc::XrefGen
4
4
  module Blocks
5
+ NUMBERED_BLOCKS = %w(termnote termexample note example requirement
6
+ recommendation permission figure table formula admonition sourcecode).freeze
7
+
8
+ def amend_preprocess(xmldoc)
9
+ xmldoc.xpath(ns("//amend[newcontent]")).each do |a|
10
+ autonum = amend_autonums(a)
11
+ NUMBERED_BLOCKS.each do |b|
12
+ a.xpath(ns("./newcontent//#{b}")).each_with_index do |e, i|
13
+ autonum[b] and i == 0 and e["number"] = autonum[b]
14
+ !autonum[b] and e["unnumbered"] = "true"
15
+ end
16
+ end
17
+ end
18
+ end
19
+
20
+ def amend_autonums(a)
21
+ autonum = {}
22
+ a.xpath(ns("./autonumber")).each do |n|
23
+ autonum[n["type"]] = n.text
24
+ end
25
+ autonum
26
+ end
27
+
5
28
  def termnote_label(n)
6
29
  @labels["termnote"].gsub(/%/, n.to_s)
7
30
  end
@@ -13,7 +36,7 @@ module IsoDoc::XrefGen
13
36
  return if n["id"].nil? || n["id"].empty?
14
37
  c.increment(n)
15
38
  @anchors[n["id"]] =
16
- { label: termnote_label(c.print), type: "termnote",
39
+ { label: termnote_label(c.print), type: "termnote", value: c.print,
17
40
  xref: l10n("#{anchor(t['id'], :xref)}, "\
18
41
  "#{@labels["note_xref"]} #{c.print}") }
19
42
  end
@@ -27,9 +50,9 @@ module IsoDoc::XrefGen
27
50
  examples.each do |n|
28
51
  return if n["id"].nil? || n["id"].empty?
29
52
  c.increment(n)
30
- idx = examples.size == 1 ? "" : c.print
53
+ idx = examples.size == 1 && !n["number"] ? "" : c.print
31
54
  @anchors[n["id"]] = {
32
- type: "termexample", label: idx,
55
+ type: "termexample", label: idx, value: c.print,
33
56
  xref: l10n("#{anchor(t['id'], :xref)}, "\
34
57
  "#{@labels["example_xref"]} #{c.print}") }
35
58
  end
@@ -54,7 +77,7 @@ module IsoDoc::XrefGen
54
77
  c = Counter.new
55
78
  notes.each do |n|
56
79
  next if @anchors[n["id"]] || n["id"].nil? || n["id"].empty?
57
- idx = notes.size == 1 ? "" : " #{c.increment(n).print}"
80
+ idx = notes.size == 1 && !n["number"] ? "" : " #{c.increment(n).print}"
58
81
  @anchors[n["id"]] = anchor_struct(idx, n, @labels["note_xref"],
59
82
  "note", false)
60
83
  end
@@ -76,7 +99,7 @@ module IsoDoc::XrefGen
76
99
  notes.each do |n|
77
100
  next if @anchors[n["id"]]
78
101
  next if n["id"].nil? || n["id"].empty?
79
- idx = notes.size == 1 ? "" : " #{c.increment(n).print}"
102
+ idx = notes.size == 1 && !n["number"] ? "" : " #{c.increment(n).print}"
80
103
  @anchors[n["id"]] = anchor_struct(idx, n, @labels["example_xref"],
81
104
  "example", n["unnumbered"])
82
105
  end
@@ -91,7 +114,7 @@ module IsoDoc::XrefGen
91
114
  c = Counter.new
92
115
  notes.each do |n|
93
116
  next if n["id"].nil? || n["id"].empty?
94
- idx = notes.size == 1 ? "" : " #{c.increment(n).print}"
117
+ idx = notes.size == 1 && !n["number"] ? "" : " #{c.increment(n).print}"
95
118
  @anchors[n["id"]] = anchor_struct(idx, n, @labels["list"], "list", false)
96
119
  list_item_anchor_names(n, @anchors[n["id"]], 1, "", notes.size != 1)
97
120
  end
@@ -113,7 +113,7 @@ module IsoDoc::XrefGen
113
113
 
114
114
  def annex_names(clause, num)
115
115
  @anchors[clause["id"]] = { label: annex_name_lbl(clause, num),
116
- type: "clause",
116
+ type: "clause", value: num.to_s,
117
117
  xref: "#{@labels["annex"]} #{num}", level: 1 }
118
118
  if a = single_annex_special_section(clause)
119
119
  annex_names1(a, "#{num}", 1)
@@ -23,6 +23,10 @@ module IsoDoc
23
23
  nil
24
24
  end
25
25
 
26
+ def pdf_options(docxml)
27
+ ""
28
+ end
29
+
26
30
  def convert(input_filename, file = nil, debug = false, output_filename = nil)
27
31
  file = File.read(input_filename, encoding: "utf-8") if file.nil?
28
32
  docxml, filename, dir = convert_init(file, input_filename, debug)
@@ -34,7 +38,8 @@ module IsoDoc
34
38
  FileUtils.rm_rf dir
35
39
  ::Metanorma::Output::XslfoPdf.new.convert(input_filename,
36
40
  output_filename || "#{filename}.#{@suffix}",
37
- File.join(@libdir, pdf_stylesheet(docxml)))
41
+ File.join(@libdir, pdf_stylesheet(docxml)),
42
+ pdf_options(docxml))
38
43
  end
39
44
 
40
45
  def xref_parse(node, out)
@@ -13,4 +13,13 @@ inform_annex: informa
13
13
  all_parts: ĉiuj partoj
14
14
  locality: {
15
15
  table: Tabelo
16
+ }
17
+ doctype_dict: {
18
+ brochure: broŝuro
19
+ }
20
+ stage_dict: {
21
+ published: publikigita
16
22
  }
23
+ substage_dict: {
24
+ withdrawn: fortirita
25
+ }
@@ -1,6 +1,257 @@
1
1
  require "spec_helper"
2
2
 
3
3
  RSpec.describe IsoDoc do
4
+ it "processes amend blocks" do
5
+ input = <<~INPUT
6
+ <standard-document xmlns='https://www.metanorma.org/ns/standoc'>
7
+ <bibdata type='standard'>
8
+ <title language='en' format='text/plain'>Document title</title>
9
+ <language>en</language>
10
+ <script>Latn</script>
11
+ <status>
12
+ <stage>published</stage>
13
+ </status>
14
+ <copyright>
15
+ <from>2020</from>
16
+ </copyright>
17
+ <ext>
18
+ <doctype>article</doctype>
19
+ </ext>
20
+ </bibdata>
21
+ <sections>
22
+ <clause id='A' inline-header='false' obligation='normative'>
23
+ <title>Change Clause</title>
24
+ <amend id='B' change='modify' path='//table[2]' path_end='//table[2]/following-sibling:example[1]' title='Change'>
25
+ <autonumber type='table'>2</autonumber>
26
+ <autonumber type='example'>7</autonumber>
27
+ <description>
28
+ <p id='C'>
29
+ <em>
30
+ This table contains information on polygon cells which are not
31
+ included in ISO 10303-52. Remove table 2 completely and replace
32
+ with:
33
+ </em>
34
+ </p>
35
+ </description>
36
+ <newcontent id='D'>
37
+ <table id='E'>
38
+ <name>Edges of triangle and quadrilateral cells</name>
39
+ <tbody>
40
+ <tr>
41
+ <th colspan='2' valign='middle' align='center'>triangle</th>
42
+ <th colspan='2' valign='middle' align='center'>quadrilateral</th>
43
+ </tr>
44
+ <tr>
45
+ <td valign='middle' align='center'>edge</td>
46
+ <td valign='middle' align='center'>vertices</td>
47
+ <td valign='middle' align='center'>edge</td>
48
+ <td valign='middle' align='center'>vertices</td>
49
+ </tr>
50
+ <tr>
51
+ <td valign='middle' align='center'>1</td>
52
+ <td valign='middle' align='center'>1, 2</td>
53
+ <td valign='middle' align='center'>1</td>
54
+ <td valign='middle' align='center'>1, 2</td>
55
+ </tr>
56
+ <tr>
57
+ <td valign='middle' align='center'>2</td>
58
+ <td valign='middle' align='center'>2, 3</td>
59
+ <td valign='middle' align='center'>2</td>
60
+ <td valign='middle' align='center'>2, 3</td>
61
+ </tr>
62
+ <tr>
63
+ <td valign='middle' align='center'>3</td>
64
+ <td valign='middle' align='center'>3, 1</td>
65
+ <td valign='middle' align='center'>3</td>
66
+ <td valign='middle' align='center'>3, 4</td>
67
+ </tr>
68
+ <tr>
69
+ <td valign='top' align='left'/>
70
+ <td valign='top' align='left'/>
71
+ <td valign='middle' align='center'>4</td>
72
+ <td valign='middle' align='center'>4, 1</td>
73
+ </tr>
74
+ </tbody>
75
+ </table>
76
+ <figure id="H"><name>Figure</name></figure>
77
+ <example id='F'>
78
+ <p id='G'>This is not generalised further.</p>
79
+ </example>
80
+ </newcontent>
81
+ </amend>
82
+ </clause>
83
+ </sections>
84
+ </standard-document>
85
+ INPUT
86
+ presxml = <<~OUTPUT
87
+ <standard-document xmlns="https://www.metanorma.org/ns/standoc" type="presentation">
88
+ <bibdata type="standard">
89
+ <title language="en" format="text/plain">Document title</title>
90
+ <language>en</language>
91
+ <script>Latn</script>
92
+ <status>
93
+ <stage>published</stage>
94
+ </status>
95
+ <copyright>
96
+ <from>2020</from>
97
+ </copyright>
98
+ <ext>
99
+ <doctype>article</doctype>
100
+ </ext>
101
+ </bibdata>
102
+ <local_bibdata type='standard'>
103
+ <title language='en' format='text/plain'>Document title</title>
104
+ <language>en</language>
105
+ <script>Latn</script>
106
+ <status>
107
+ <stage>published</stage>
108
+ </status>
109
+ <copyright>
110
+ <from>2020</from>
111
+ </copyright>
112
+ <ext>
113
+ <doctype>article</doctype>
114
+ </ext>
115
+ </local_bibdata>
116
+ <sections>
117
+ <clause id="A" inline-header="false" obligation="normative">
118
+ <title depth="1">1.<tab/>Change Clause</title>
119
+ <p id="C">
120
+ <em>
121
+ This table contains information on polygon cells which are not
122
+ included in ISO 10303-52. Remove table 2 completely and replace
123
+ with:
124
+ </em>
125
+ </p>
126
+ <quote id="D">
127
+ <table id="E" number="2">
128
+ <name>Table 2&#xA0;&#x2014; Edges of triangle and quadrilateral cells</name>
129
+ <tbody>
130
+ <tr>
131
+ <th colspan="2" valign="middle" align="center">triangle</th>
132
+ <th colspan="2" valign="middle" align="center">quadrilateral</th>
133
+ </tr>
134
+ <tr>
135
+ <td valign="middle" align="center">edge</td>
136
+ <td valign="middle" align="center">vertices</td>
137
+ <td valign="middle" align="center">edge</td>
138
+ <td valign="middle" align="center">vertices</td>
139
+ </tr>
140
+ <tr>
141
+ <td valign="middle" align="center">1</td>
142
+ <td valign="middle" align="center">1, 2</td>
143
+ <td valign="middle" align="center">1</td>
144
+ <td valign="middle" align="center">1, 2</td>
145
+ </tr>
146
+ <tr>
147
+ <td valign="middle" align="center">2</td>
148
+ <td valign="middle" align="center">2, 3</td>
149
+ <td valign="middle" align="center">2</td>
150
+ <td valign="middle" align="center">2, 3</td>
151
+ </tr>
152
+ <tr>
153
+ <td valign="middle" align="center">3</td>
154
+ <td valign="middle" align="center">3, 1</td>
155
+ <td valign="middle" align="center">3</td>
156
+ <td valign="middle" align="center">3, 4</td>
157
+ </tr>
158
+ <tr>
159
+ <td valign="top" align="left"/>
160
+ <td valign="top" align="left"/>
161
+ <td valign="middle" align="center">4</td>
162
+ <td valign="middle" align="center">4, 1</td>
163
+ </tr>
164
+ </tbody>
165
+ </table>
166
+ <figure id="H" unnumbered="true"><name>Figure</name></figure>
167
+ <example id="F" number="7"><name>EXAMPLE 7</name>
168
+ <p id="G">This is not generalised further.</p>
169
+ </example>
170
+ </quote>
171
+ </clause>
172
+ </sections>
173
+ </standard-document>
174
+ OUTPUT
175
+ html = <<~OUTPUT
176
+ <html lang='en'>
177
+ <head/>
178
+ <body lang='en'>
179
+ <div class='title-section'>
180
+ <p>&#160;</p>
181
+ </div>
182
+ <br/>
183
+ <div class='prefatory-section'>
184
+ <p>&#160;</p>
185
+ </div>
186
+ <br/>
187
+ <div class='main-section'>
188
+ <p class='zzSTDTitle1'>Document title</p>
189
+ <div id='A'>
190
+ <h1>1.&#160; Change Clause</h1>
191
+ <p id='C'>
192
+ <i>
193
+ This table contains information on polygon cells which are not
194
+ included in ISO 10303-52. Remove table 2 completely and replace
195
+ with:
196
+ </i>
197
+ </p>
198
+ <div class='Quote' id="D">
199
+ <p class='TableTitle' style='text-align:center;'>Table 2&#160;&#8212; Edges of triangle and quadrilateral cells</p>
200
+ <table id='E' class='MsoISOTable' style='border-width:1px;border-spacing:0;'>
201
+ <tbody>
202
+ <tr>
203
+ <th colspan='2' style='font-weight:bold;text-align:center;vertical-align:middle;border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;' scope='row'>triangle</th>
204
+ <th colspan='2' style='font-weight:bold;text-align:center;vertical-align:middle;border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;' scope='row'>quadrilateral</th>
205
+ </tr>
206
+ <tr>
207
+ <td style='text-align:center;vertical-align:middle;border-top:none;border-bottom:solid windowtext 1.0pt;'>edge</td>
208
+ <td style='text-align:center;vertical-align:middle;border-top:none;border-bottom:solid windowtext 1.0pt;'>vertices</td>
209
+ <td style='text-align:center;vertical-align:middle;border-top:none;border-bottom:solid windowtext 1.0pt;'>edge</td>
210
+ <td style='text-align:center;vertical-align:middle;border-top:none;border-bottom:solid windowtext 1.0pt;'>vertices</td>
211
+ </tr>
212
+ <tr>
213
+ <td style='text-align:center;vertical-align:middle;border-top:none;border-bottom:solid windowtext 1.0pt;'>1</td>
214
+ <td style='text-align:center;vertical-align:middle;border-top:none;border-bottom:solid windowtext 1.0pt;'>1, 2</td>
215
+ <td style='text-align:center;vertical-align:middle;border-top:none;border-bottom:solid windowtext 1.0pt;'>1</td>
216
+ <td style='text-align:center;vertical-align:middle;border-top:none;border-bottom:solid windowtext 1.0pt;'>1, 2</td>
217
+ </tr>
218
+ <tr>
219
+ <td style='text-align:center;vertical-align:middle;border-top:none;border-bottom:solid windowtext 1.0pt;'>2</td>
220
+ <td style='text-align:center;vertical-align:middle;border-top:none;border-bottom:solid windowtext 1.0pt;'>2, 3</td>
221
+ <td style='text-align:center;vertical-align:middle;border-top:none;border-bottom:solid windowtext 1.0pt;'>2</td>
222
+ <td style='text-align:center;vertical-align:middle;border-top:none;border-bottom:solid windowtext 1.0pt;'>2, 3</td>
223
+ </tr>
224
+ <tr>
225
+ <td style='text-align:center;vertical-align:middle;border-top:none;border-bottom:solid windowtext 1.0pt;'>3</td>
226
+ <td style='text-align:center;vertical-align:middle;border-top:none;border-bottom:solid windowtext 1.0pt;'>3, 1</td>
227
+ <td style='text-align:center;vertical-align:middle;border-top:none;border-bottom:solid windowtext 1.0pt;'>3</td>
228
+ <td style='text-align:center;vertical-align:middle;border-top:none;border-bottom:solid windowtext 1.0pt;'>3, 4</td>
229
+ </tr>
230
+ <tr>
231
+ <td style='text-align:left;vertical-align:top;border-top:none;border-bottom:solid windowtext 1.5pt;'/>
232
+ <td style='text-align:left;vertical-align:top;border-top:none;border-bottom:solid windowtext 1.5pt;'/>
233
+ <td style='text-align:center;vertical-align:middle;border-top:none;border-bottom:solid windowtext 1.5pt;'>4</td>
234
+ <td style='text-align:center;vertical-align:middle;border-top:none;border-bottom:solid windowtext 1.5pt;'>4, 1</td>
235
+ </tr>
236
+ </tbody>
237
+ </table>
238
+ <div id='H' class='figure'>
239
+ <p class='FigureTitle' style='text-align:center;'>Figure</p>
240
+ </div>
241
+ <div id='F' class='example'>
242
+ <p class='example-title'>EXAMPLE 7</p>
243
+ <p id='G'>This is not generalised further.</p>
244
+ </div>
245
+ </div>
246
+ </div>
247
+ </div>
248
+ </body>
249
+ </html>
250
+ OUTPUT
251
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
252
+ expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
253
+ end
254
+
4
255
  it "processes unlabelled notes (Presentation XML)" do
5
256
  expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
6
257
  <iso-standard xmlns="http://riboseinc.com/isoxml">
@@ -12,7 +263,7 @@ RSpec.describe IsoDoc do
12
263
  </iso-standard>
13
264
  INPUT
14
265
  <?xml version='1.0'?>
15
- <iso-standard xmlns='http://riboseinc.com/isoxml'>
266
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
16
267
  <preface>
17
268
  <foreword>
18
269
  <note id='A' keep-with-next='true' keep-lines-together='true'>
@@ -115,7 +366,7 @@ OUTPUT
115
366
  </iso-standard>
116
367
  INPUT
117
368
  <?xml version='1.0'?>
118
- <iso-standard xmlns='http://riboseinc.com/isoxml'>
369
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
119
370
  <preface>
120
371
  <foreword>
121
372
  <note id='note1'>
@@ -403,7 +654,7 @@ B</pre>
403
654
  </iso-standard>
404
655
  INPUT
405
656
  <?xml version='1.0'?>
406
- <iso-standard xmlns="http://riboseinc.com/isoxml">
657
+ <iso-standard xmlns="http://riboseinc.com/isoxml" type="presentation">
407
658
  <preface><foreword>
408
659
  <figure id="figureA-1" keep-with-next="true" keep-lines-together="true">
409
660
  <name>Figure 1&#xA0;&#x2014; Split-it-right <em>sample</em> divider<fn reference="1"><p>X</p></fn></name>
@@ -703,7 +954,7 @@ OUTPUT
703
954
  </iso-standard>
704
955
  INPUT
705
956
  <?xml version='1.0'?>
706
- <iso-standard xmlns='http://riboseinc.com/isoxml'>
957
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
707
958
  <preface>
708
959
  <foreword>
709
960
  <example id='samplecode' keep-with-next='true' keep-lines-together='true'>
@@ -819,7 +1070,7 @@ OUTPUT
819
1070
  </iso-standard>
820
1071
  INPUT
821
1072
  <?xml version='1.0'?>
822
- <iso-standard xmlns='http://riboseinc.com/isoxml'>
1073
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
823
1074
  <preface>
824
1075
  <foreword>
825
1076
  <example id='samplecode'>
@@ -855,7 +1106,7 @@ Que?
855
1106
  </iso-standard>
856
1107
  INPUT
857
1108
  <?xml version='1.0'?>
858
- <iso-standard xmlns='http://riboseinc.com/isoxml'>
1109
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
859
1110
  <preface>
860
1111
  <foreword>
861
1112
  <sourcecode lang='ruby' id='samplecode'>
@@ -1093,7 +1344,7 @@ Que?
1093
1344
  </iso-standard>
1094
1345
  INPUT
1095
1346
  <?xml version='1.0'?>
1096
- <iso-standard xmlns='http://riboseinc.com/isoxml'>
1347
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
1097
1348
  <preface>
1098
1349
  <foreword>
1099
1350
  <formula id='_be9158af-7e93-4ee2-90c5-26d31c181934' unnumbered='true' keep-with-next='true' keep-lines-together='true'>
@@ -1346,7 +1597,7 @@ it "processes blockquotes (Presentation XML)" do
1346
1597
  </iso-standard>
1347
1598
  INPUT
1348
1599
  <?xml version='1.0'?>
1349
- <iso-standard xmlns='http://riboseinc.com/isoxml'>
1600
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
1350
1601
  <preface>
1351
1602
  <foreword>
1352
1603
  <quote id='_044bd364-c832-4b78-8fea-92242402a1d1'>
@@ -1485,7 +1736,7 @@ it "processes blockquotes (Presentation XML)" do
1485
1736
  </iso-standard>
1486
1737
  INPUT
1487
1738
  <?xml version='1.0'?>
1488
- <iso-standard xmlns='http://riboseinc.com/isoxml'>
1739
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
1489
1740
  <preface>
1490
1741
  <foreword>
1491
1742
  <permission id='_' keep-with-next='true' keep-lines-together='true'>
@@ -1845,7 +2096,7 @@ Inherits: <a href='#rfc2616'>RFC 2616 (HTTP/1.1)</a>
1845
2096
  </iso-standard>
1846
2097
  INPUT
1847
2098
  <?xml version='1.0'?>
1848
- <iso-standard xmlns='http://riboseinc.com/isoxml'>
2099
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
1849
2100
  <preface>
1850
2101
  <foreword>
1851
2102
  <requirement id='A' unnumbered='true' keep-with-next='true' keep-lines-together='true'>
@@ -2045,11 +2296,15 @@ end
2045
2296
  </iso-standard>
2046
2297
  INPUT
2047
2298
  <?xml version='1.0'?>
2048
- <iso-standard xmlns='http://riboseinc.com/isoxml'>
2299
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
2049
2300
  <bibdata>
2050
2301
  <language>fr</language>
2051
2302
  <script>Latn</script>
2052
2303
  </bibdata>
2304
+ <local_bibdata>
2305
+ <language>fr</language>
2306
+ <script>Latn</script>
2307
+ </local_bibdata>
2053
2308
  <preface>
2054
2309
  <foreword>
2055
2310
  <requirement id='A' unnumbered='true'>
@@ -2114,6 +2369,10 @@ end
2114
2369
  <language>fr</language>
2115
2370
  <script>Latn</script>
2116
2371
  </bibdata>
2372
+ <local_bibdata>
2373
+ <language>fr</language>
2374
+ <script>Latn</script>
2375
+ </local_bibdata>
2117
2376
  <preface><foreword>
2118
2377
  <requirement id="A" unnumbered="true">
2119
2378
  <name>Exigence</name>
@@ -2276,7 +2535,7 @@ end
2276
2535
  </iso-standard>
2277
2536
  INPUT
2278
2537
  <?xml version='1.0'?>
2279
- <iso-standard xmlns='http://riboseinc.com/isoxml'>
2538
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
2280
2539
  <preface>
2281
2540
  <foreword>
2282
2541
  <recommendation id='_' obligation='shall,could' keep-with-next='true' keep-lines-together='true'>
@@ -2440,10 +2699,13 @@ end
2440
2699
  </preface></itu-standard>
2441
2700
  INPUT
2442
2701
  <?xml version='1.0'?>
2443
- <itu-standard xmlns='http://riboseinc.com/isoxml'>
2702
+ <itu-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
2444
2703
  <bibdata>
2445
2704
  <language>en</language>
2446
2705
  </bibdata>
2706
+ <local_bibdata>
2707
+ <language>en</language>
2708
+ </local_bibdata>
2447
2709
  <preface>
2448
2710
  <foreword>
2449
2711
  <figure id='_' class='pseudocode' keep-with-next='true' keep-lines-together='true'>
@@ -2472,6 +2734,9 @@ end
2472
2734
  <bibdata>
2473
2735
  <language>en</language>
2474
2736
  </bibdata>
2737
+ <local_bibdata>
2738
+ <language>en</language>
2739
+ </local_bibdata>
2475
2740
  <preface>
2476
2741
  <foreword>
2477
2742
  <figure id='_' class='pseudocode' keep-with-next='true' keep-lines-together='true'>
@@ -2514,6 +2779,9 @@ OUTPUT
2514
2779
  <bibdata>
2515
2780
  <language>en</language>
2516
2781
  </bibdata>
2782
+ <local_bibdata>
2783
+ <language>en</language>
2784
+ </local_bibdata>
2517
2785
  <preface>
2518
2786
  <foreword>
2519
2787
  <figure id='_' class='pseudocode' keep-with-next='true' keep-lines-together='true'>