isodoc 1.2.3 → 1.2.4
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.
- checksums.yaml +4 -4
- data/lib/isodoc-yaml/i18n-fr.yaml +1 -1
- data/lib/isodoc/base_style/metanorma_word.css +6 -0
- data/lib/isodoc/base_style/metanorma_word.scss +6 -0
- data/lib/isodoc/function/blocks.rb +1 -0
- data/lib/isodoc/function/references.rb +4 -2
- data/lib/isodoc/function/table.rb +1 -0
- data/lib/isodoc/function/to_word_html.rb +1 -0
- data/lib/isodoc/function/utils.rb +1 -1
- data/lib/isodoc/i18n.rb +0 -1
- data/lib/isodoc/presentation_function/block.rb +14 -0
- data/lib/isodoc/presentation_xml_convert.rb +1 -0
- data/lib/isodoc/version.rb +1 -1
- data/lib/isodoc/word_function/postprocess.rb +1 -1
- data/lib/isodoc/word_function/table.rb +3 -2
- data/lib/isodoc/xref.rb +1 -0
- data/lib/isodoc/xref/xref_counter.rb +21 -7
- data/lib/isodoc/xref/xref_gen.rb +27 -4
- data/spec/isodoc/blocks_spec.rb +237 -0
- data/spec/isodoc/postproc_spec.rb +39 -3
- data/spec/isodoc/table_spec.rb +305 -206
- data/spec/isodoc/xref_spec.rb +28 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6cd5c7cab435113879315a8de5d3219df7577d057df5adee3a87f7431b9d17f7
|
4
|
+
data.tar.gz: 22f07d9de5b5b8a26c57ca5321a53fafd591e6703615921d9a79d939c0276295
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1ca2bd4cf9b70ea4eb12d118c26e66e90340070453e132db89e7b6748a1a02f8a10f62c5944e2b1ffe6e18d4a69504b08f7b687ec6b8a573983f58d03de12b48
|
7
|
+
data.tar.gz: 1b6702e74e5041ad95509cf1b8655e044f36f27a0fa3cbd12e6ac82684e6b535ed1c3ad9ea6ad938ab2cb42a3880f2e0153ddb0424bf322d4238806616582a54
|
@@ -16,6 +16,12 @@ td {
|
|
16
16
|
tr {
|
17
17
|
page-break-after: avoid; }
|
18
18
|
|
19
|
+
table.MsoISOTableBig tr {
|
20
|
+
page-break-inside: auto; }
|
21
|
+
|
22
|
+
table.MsoISOTableBig td {
|
23
|
+
page-break-inside: auto; }
|
24
|
+
|
19
25
|
span.stem {
|
20
26
|
font-family: "Cambria Math",serif;
|
21
27
|
mso-ascii-font-family: "Cambria Math";
|
@@ -13,6 +13,12 @@ table.MsoISOTable tr
|
|
13
13
|
td { page-break-inside:avoid; }
|
14
14
|
tr { page-break-after:avoid; }
|
15
15
|
|
16
|
+
table.MsoISOTableBig tr
|
17
|
+
{page-break-inside:auto;}
|
18
|
+
|
19
|
+
table.MsoISOTableBig td
|
20
|
+
{page-break-inside:auto;}
|
21
|
+
|
16
22
|
span.stem
|
17
23
|
{font-family:"Cambria Math",serif;
|
18
24
|
mso-ascii-font-family:"Cambria Math";
|
@@ -181,6 +181,7 @@ module IsoDoc::Function
|
|
181
181
|
def quote_attribution(node, out)
|
182
182
|
author = node.at(ns("./author"))
|
183
183
|
source = node.at(ns("./source"))
|
184
|
+
return if author.nil? && source.nil?
|
184
185
|
out.p **{ class: "QuoteAttribution" } do |p|
|
185
186
|
p << "— #{author.text}" if author
|
186
187
|
p << ", " if author && source
|
@@ -54,7 +54,8 @@ module IsoDoc::Function
|
|
54
54
|
def bibitem_ref_code(b)
|
55
55
|
id = b.at(ns("./docidentifier[@type = 'metanorma']"))
|
56
56
|
id1 = pref_ref_code(b)
|
57
|
-
id2 = b.at(ns("./docidentifier[@type = 'DOI' or @type = 'ISSN' or
|
57
|
+
id2 = b.at(ns("./docidentifier[@type = 'DOI' or @type = 'ISSN' or "\
|
58
|
+
"@type = 'ISBN']"))
|
58
59
|
return [id, id1, id2] if id || id1 || id2
|
59
60
|
id = Nokogiri::XML::Node.new("docidentifier", b.document)
|
60
61
|
id << "(NO ID)"
|
@@ -193,7 +194,8 @@ module IsoDoc::Function
|
|
193
194
|
def bibliography_parse(node, out)
|
194
195
|
title = node&.at(ns("./title"))&.text || ""
|
195
196
|
out.div do |div|
|
196
|
-
clause_parse_title(node, div, node.at(ns("./title")), out,
|
197
|
+
clause_parse_title(node, div, node.at(ns("./title")), out,
|
198
|
+
{ class: "Section3" })
|
197
199
|
biblio_list(node, div, true)
|
198
200
|
end
|
199
201
|
end
|
@@ -82,6 +82,7 @@ module IsoDoc::Function
|
|
82
82
|
def make_tr_attr(td, row, totalrows, header)
|
83
83
|
style = td.name == "th" ? "font-weight:bold;" : ""
|
84
84
|
td["align"] and style += "text-align:#{td['align']};"
|
85
|
+
td["valign"] and style += "vertical-align:#{td['valign']};"
|
85
86
|
rowmax = td["rowspan"] ? row + td["rowspan"].to_i - 1 : row
|
86
87
|
style += <<~STYLE
|
87
88
|
border-top:#{row.zero? ? "#{SW} 1.5pt;" : 'none;'}
|
@@ -221,6 +221,7 @@ module IsoDoc::Function
|
|
221
221
|
when "feedback-statement" then feedback_parse(node, out)
|
222
222
|
when "passthrough" then passthrough_parse(node, out)
|
223
223
|
when "variant" then variant_parse(node, out)
|
224
|
+
when "amend" then amend_parse(node, out)
|
224
225
|
when "tab" then clausedelimspace(out) # in Presentation XML only
|
225
226
|
else
|
226
227
|
error_parse(node, out)
|
data/lib/isodoc/i18n.rb
CHANGED
@@ -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
|
data/lib/isodoc/version.rb
CHANGED
@@ -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
|
|
data/lib/isodoc/xref.rb
CHANGED
@@ -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
|
21
|
-
@number_override = @num = n.to_i
|
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
|
-
|
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
|
-
|
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)
|
data/lib/isodoc/xref/xref_gen.rb
CHANGED
@@ -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
|
@@ -27,7 +50,7 @@ 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
55
|
type: "termexample", label: idx,
|
33
56
|
xref: l10n("#{anchor(t['id'], :xref)}, "\
|
@@ -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
|
data/spec/isodoc/blocks_spec.rb
CHANGED
@@ -1,6 +1,243 @@
|
|
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">
|
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
|
+
<sections>
|
103
|
+
<clause id="A" inline-header="false" obligation="normative">
|
104
|
+
<title depth="1">1.<tab/>Change Clause</title>
|
105
|
+
<p id="C">
|
106
|
+
<em>
|
107
|
+
This table contains information on polygon cells which are not
|
108
|
+
included in ISO 10303-52. Remove table 2 completely and replace
|
109
|
+
with:
|
110
|
+
</em>
|
111
|
+
</p>
|
112
|
+
<quote id="D">
|
113
|
+
<table id="E" number="2">
|
114
|
+
<name>Table 2 — Edges of triangle and quadrilateral cells</name>
|
115
|
+
<tbody>
|
116
|
+
<tr>
|
117
|
+
<th colspan="2" valign="middle" align="center">triangle</th>
|
118
|
+
<th colspan="2" valign="middle" align="center">quadrilateral</th>
|
119
|
+
</tr>
|
120
|
+
<tr>
|
121
|
+
<td valign="middle" align="center">edge</td>
|
122
|
+
<td valign="middle" align="center">vertices</td>
|
123
|
+
<td valign="middle" align="center">edge</td>
|
124
|
+
<td valign="middle" align="center">vertices</td>
|
125
|
+
</tr>
|
126
|
+
<tr>
|
127
|
+
<td valign="middle" align="center">1</td>
|
128
|
+
<td valign="middle" align="center">1, 2</td>
|
129
|
+
<td valign="middle" align="center">1</td>
|
130
|
+
<td valign="middle" align="center">1, 2</td>
|
131
|
+
</tr>
|
132
|
+
<tr>
|
133
|
+
<td valign="middle" align="center">2</td>
|
134
|
+
<td valign="middle" align="center">2, 3</td>
|
135
|
+
<td valign="middle" align="center">2</td>
|
136
|
+
<td valign="middle" align="center">2, 3</td>
|
137
|
+
</tr>
|
138
|
+
<tr>
|
139
|
+
<td valign="middle" align="center">3</td>
|
140
|
+
<td valign="middle" align="center">3, 1</td>
|
141
|
+
<td valign="middle" align="center">3</td>
|
142
|
+
<td valign="middle" align="center">3, 4</td>
|
143
|
+
</tr>
|
144
|
+
<tr>
|
145
|
+
<td valign="top" align="left"/>
|
146
|
+
<td valign="top" align="left"/>
|
147
|
+
<td valign="middle" align="center">4</td>
|
148
|
+
<td valign="middle" align="center">4, 1</td>
|
149
|
+
</tr>
|
150
|
+
</tbody>
|
151
|
+
</table>
|
152
|
+
<figure id="H" unnumbered="true"><name>Figure</name></figure>
|
153
|
+
<example id="F" number="7"><name>EXAMPLE 7</name>
|
154
|
+
<p id="G">This is not generalised further.</p>
|
155
|
+
</example>
|
156
|
+
</quote>
|
157
|
+
</clause>
|
158
|
+
</sections>
|
159
|
+
</standard-document>
|
160
|
+
OUTPUT
|
161
|
+
html = <<~OUTPUT
|
162
|
+
<html lang='en'>
|
163
|
+
<head/>
|
164
|
+
<body lang='en'>
|
165
|
+
<div class='title-section'>
|
166
|
+
<p> </p>
|
167
|
+
</div>
|
168
|
+
<br/>
|
169
|
+
<div class='prefatory-section'>
|
170
|
+
<p> </p>
|
171
|
+
</div>
|
172
|
+
<br/>
|
173
|
+
<div class='main-section'>
|
174
|
+
<p class='zzSTDTitle1'>Document title</p>
|
175
|
+
<div id='A'>
|
176
|
+
<h1>1.  Change Clause</h1>
|
177
|
+
<p id='C'>
|
178
|
+
<i>
|
179
|
+
This table contains information on polygon cells which are not
|
180
|
+
included in ISO 10303-52. Remove table 2 completely and replace
|
181
|
+
with:
|
182
|
+
</i>
|
183
|
+
</p>
|
184
|
+
<div class='Quote' id="D">
|
185
|
+
<p class='TableTitle' style='text-align:center;'>Table 2 — Edges of triangle and quadrilateral cells</p>
|
186
|
+
<table id='E' class='MsoISOTable' style='border-width:1px;border-spacing:0;'>
|
187
|
+
<tbody>
|
188
|
+
<tr>
|
189
|
+
<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>
|
190
|
+
<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>
|
191
|
+
</tr>
|
192
|
+
<tr>
|
193
|
+
<td style='text-align:center;vertical-align:middle;border-top:none;border-bottom:solid windowtext 1.0pt;'>edge</td>
|
194
|
+
<td style='text-align:center;vertical-align:middle;border-top:none;border-bottom:solid windowtext 1.0pt;'>vertices</td>
|
195
|
+
<td style='text-align:center;vertical-align:middle;border-top:none;border-bottom:solid windowtext 1.0pt;'>edge</td>
|
196
|
+
<td style='text-align:center;vertical-align:middle;border-top:none;border-bottom:solid windowtext 1.0pt;'>vertices</td>
|
197
|
+
</tr>
|
198
|
+
<tr>
|
199
|
+
<td style='text-align:center;vertical-align:middle;border-top:none;border-bottom:solid windowtext 1.0pt;'>1</td>
|
200
|
+
<td style='text-align:center;vertical-align:middle;border-top:none;border-bottom:solid windowtext 1.0pt;'>1, 2</td>
|
201
|
+
<td style='text-align:center;vertical-align:middle;border-top:none;border-bottom:solid windowtext 1.0pt;'>1</td>
|
202
|
+
<td style='text-align:center;vertical-align:middle;border-top:none;border-bottom:solid windowtext 1.0pt;'>1, 2</td>
|
203
|
+
</tr>
|
204
|
+
<tr>
|
205
|
+
<td style='text-align:center;vertical-align:middle;border-top:none;border-bottom:solid windowtext 1.0pt;'>2</td>
|
206
|
+
<td style='text-align:center;vertical-align:middle;border-top:none;border-bottom:solid windowtext 1.0pt;'>2, 3</td>
|
207
|
+
<td style='text-align:center;vertical-align:middle;border-top:none;border-bottom:solid windowtext 1.0pt;'>2</td>
|
208
|
+
<td style='text-align:center;vertical-align:middle;border-top:none;border-bottom:solid windowtext 1.0pt;'>2, 3</td>
|
209
|
+
</tr>
|
210
|
+
<tr>
|
211
|
+
<td style='text-align:center;vertical-align:middle;border-top:none;border-bottom:solid windowtext 1.0pt;'>3</td>
|
212
|
+
<td style='text-align:center;vertical-align:middle;border-top:none;border-bottom:solid windowtext 1.0pt;'>3, 1</td>
|
213
|
+
<td style='text-align:center;vertical-align:middle;border-top:none;border-bottom:solid windowtext 1.0pt;'>3</td>
|
214
|
+
<td style='text-align:center;vertical-align:middle;border-top:none;border-bottom:solid windowtext 1.0pt;'>3, 4</td>
|
215
|
+
</tr>
|
216
|
+
<tr>
|
217
|
+
<td style='text-align:left;vertical-align:top;border-top:none;border-bottom:solid windowtext 1.5pt;'/>
|
218
|
+
<td style='text-align:left;vertical-align:top;border-top:none;border-bottom:solid windowtext 1.5pt;'/>
|
219
|
+
<td style='text-align:center;vertical-align:middle;border-top:none;border-bottom:solid windowtext 1.5pt;'>4</td>
|
220
|
+
<td style='text-align:center;vertical-align:middle;border-top:none;border-bottom:solid windowtext 1.5pt;'>4, 1</td>
|
221
|
+
</tr>
|
222
|
+
</tbody>
|
223
|
+
</table>
|
224
|
+
<div id='H' class='figure'>
|
225
|
+
<p class='FigureTitle' style='text-align:center;'>Figure</p>
|
226
|
+
</div>
|
227
|
+
<div id='F' class='example'>
|
228
|
+
<p class='example-title'>EXAMPLE 7</p>
|
229
|
+
<p id='G'>This is not generalised further.</p>
|
230
|
+
</div>
|
231
|
+
</div>
|
232
|
+
</div>
|
233
|
+
</div>
|
234
|
+
</body>
|
235
|
+
</html>
|
236
|
+
OUTPUT
|
237
|
+
expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
|
238
|
+
expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
|
239
|
+
end
|
240
|
+
|
4
241
|
it "processes unlabelled notes (Presentation XML)" do
|
5
242
|
expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
6
243
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|