isodoc 2.1.0.2 → 2.1.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. checksums.yaml +4 -4
  2. data/isodoc.gemspec +6 -3
  3. data/lib/isodoc/base_style/all.css +227 -0
  4. data/lib/isodoc/base_style/blocks.css +0 -0
  5. data/lib/isodoc/base_style/blocks.scss +7 -0
  6. data/lib/isodoc/base_style/coverpage.css +0 -0
  7. data/lib/isodoc/base_style/defaults.css +0 -0
  8. data/lib/isodoc/base_style/metanorma_word.css +47 -0
  9. data/lib/isodoc/base_style/nav.css +0 -0
  10. data/lib/isodoc/base_style/reset.css +125 -0
  11. data/lib/isodoc/base_style/typography.css +0 -0
  12. data/lib/isodoc/class_utils.rb +1 -1
  13. data/lib/isodoc/function/blocks.rb +1 -1
  14. data/lib/isodoc/function/cleanup.rb +1 -1
  15. data/lib/isodoc/function/inline.rb +4 -2
  16. data/lib/isodoc/function/lists.rb +24 -9
  17. data/lib/isodoc/function/table.rb +1 -1
  18. data/lib/isodoc/function/to_word_html.rb +3 -2
  19. data/lib/isodoc/function/utils.rb +18 -8
  20. data/lib/isodoc/gem_tasks.rb +19 -10
  21. data/lib/isodoc/html_function/html.rb +2 -2
  22. data/lib/isodoc/i18n.rb +19 -0
  23. data/lib/isodoc/metadata.rb +2 -2
  24. data/lib/isodoc/presentation_function/block.rb +3 -3
  25. data/lib/isodoc/presentation_function/image.rb +1 -1
  26. data/lib/isodoc/presentation_function/inline.rb +13 -6
  27. data/lib/isodoc/presentation_function/section.rb +3 -1
  28. data/lib/isodoc/presentation_function/xrefs.rb +22 -6
  29. data/lib/isodoc/presentation_xml_convert.rb +1 -0
  30. data/lib/isodoc/version.rb +1 -1
  31. data/lib/isodoc/word_function/body.rb +9 -6
  32. data/lib/isodoc/word_function/postprocess.rb +1 -1
  33. data/lib/isodoc/word_function/postprocess_cover.rb +5 -5
  34. data/lib/isodoc/xref/xref_gen.rb +6 -6
  35. metadata +16 -69
  36. data/.github/workflows/rake.yml +0 -15
  37. data/.github/workflows/release.yml +0 -24
  38. data/.hound.yml +0 -5
  39. data/.oss-guides.rubocop.yml +0 -1077
  40. data/.rubocop.yml +0 -10
  41. data/Rakefile +0 -8
  42. data/bin/rspec +0 -17
  43. data/spec/assets/header.html +0 -7
  44. data/spec/assets/html.scss +0 -20
  45. data/spec/assets/html_override.css +0 -1
  46. data/spec/assets/htmlcover.html +0 -4
  47. data/spec/assets/htmlintro.html +0 -5
  48. data/spec/assets/i18n.yaml +0 -41
  49. data/spec/assets/iso.xml +0 -8
  50. data/spec/assets/odf.emf +0 -0
  51. data/spec/assets/odf.svg +0 -1
  52. data/spec/assets/odf1.svg +0 -4
  53. data/spec/assets/outputtest/a.xml +0 -66
  54. data/spec/assets/outputtest/iso.international-standard.xsl +0 -3011
  55. data/spec/assets/rice_image1 +0 -0
  56. data/spec/assets/rice_image1.png +0 -0
  57. data/spec/assets/scripts.html +0 -3
  58. data/spec/assets/scripts_override.html +0 -3
  59. data/spec/assets/std.css +0 -2
  60. data/spec/assets/word.css +0 -2
  61. data/spec/assets/word_override.css +0 -1
  62. data/spec/assets/wordcover.html +0 -3
  63. data/spec/assets/wordintro.html +0 -4
  64. data/spec/isodoc/blocks_spec.rb +0 -2934
  65. data/spec/isodoc/cleanup_spec.rb +0 -1056
  66. data/spec/isodoc/footnotes_spec.rb +0 -264
  67. data/spec/isodoc/form_spec.rb +0 -160
  68. data/spec/isodoc/i18n_spec.rb +0 -1201
  69. data/spec/isodoc/inline_spec.rb +0 -2301
  70. data/spec/isodoc/lists_spec.rb +0 -469
  71. data/spec/isodoc/metadata_spec.rb +0 -401
  72. data/spec/isodoc/postproc_spec.rb +0 -2941
  73. data/spec/isodoc/presentation_xml_spec.rb +0 -1476
  74. data/spec/isodoc/ref_spec.rb +0 -955
  75. data/spec/isodoc/section_spec.rb +0 -2123
  76. data/spec/isodoc/table_spec.rb +0 -588
  77. data/spec/isodoc/terms_spec.rb +0 -712
  78. data/spec/isodoc/utils_spec.rb +0 -57
  79. data/spec/isodoc/xref_numbering_spec.rb +0 -378
  80. data/spec/isodoc/xref_spec.rb +0 -1837
  81. data/spec/isodoc/xslfo_convert_spec.rb +0 -103
  82. data/spec/spec_helper.rb +0 -81
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9602bbd1d24d83b9b43f2ac41bd1b01d1fd9edf44c3edf4fbb97c45fb93e1292
4
- data.tar.gz: 5406db3babbfe8d4f7403b22a81e713081ba5de7c72f250c65bfeb08e98316e8
3
+ metadata.gz: 415f9833363761b737893c9c03f3d71c1b765ff06500f16223f12a7dbac27152
4
+ data.tar.gz: dda95049642e7d2743552b4e5249dddeab5a748e6314771ed09c8b2429e02b56
5
5
  SHA512:
6
- metadata.gz: '0928611616ab02c2a0471ddd92c20bd79019a5c21c022d3a9989609919764f17837e1ae724e72de841b5ef31279537498193cb1ba06be3d65e2032f00bd684d6'
7
- data.tar.gz: 6edc16d70239d9106ce0114b92bb0e5f6b85a843fae3abe93456448bc8503d72015c096b12eaaedb3ca9e46cafa135d1b1dcc334781167d9c78a14084f7fe928
6
+ metadata.gz: ac02cacff1a871b347de4b8d5726fcb888d8887923e002f1615dd446203c42d42d66a252caedd48111058f8389d50eec7fc0ca49ce7701fc5a14cac4edcaaad2
7
+ data.tar.gz: e4e62b67708eddf8d38fa2d19e2df91877a5647d6b5b84251f6de85105ed7c44db835c74ffef7e50b6834f1bc411efa7f5cddab0d731b067772198cdaa7e74f3
data/isodoc.gemspec CHANGED
@@ -24,12 +24,15 @@ Gem::Specification.new do |spec|
24
24
 
25
25
  spec.bindir = "bin"
26
26
  spec.require_paths = ["lib"]
27
- spec.files = `git ls-files`.split("\n")
27
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
28
+ f.match(%r{^(test|spec|features|.github)/}) \
29
+ || f.match(%r{\.[a-zA-Z0-9_-]+\.yml|Rakefile|bin/rspec})
30
+ end
28
31
  spec.test_files = `git ls-files -- {spec}/*`.split("\n")
29
32
  spec.required_ruby_version = Gem::Requirement.new(">= 2.5.0")
30
33
 
31
34
  spec.add_dependency "asciimath"
32
- spec.add_dependency "html2doc", "~> 1.4.0"
35
+ spec.add_dependency "html2doc", "~> 1.4.1"
33
36
  spec.add_dependency "htmlentities", "~> 4.3.4"
34
37
  spec.add_dependency "isodoc-i18n", "~> 1.0.0"
35
38
  spec.add_dependency "liquid", "~> 4"
@@ -37,7 +40,7 @@ Gem::Specification.new do |spec|
37
40
  spec.add_dependency "emf2svg"
38
41
  spec.add_dependency "mathml2asciimath"
39
42
  spec.add_dependency "metanorma-utils"
40
- spec.add_dependency "nokogiri", "~> 1.12"
43
+
41
44
  spec.add_dependency "relaton-cli"
42
45
  spec.add_dependency "relaton-render", ">= 0.3.1"
43
46
  spec.add_dependency "roman-numerals"
@@ -0,0 +1,227 @@
1
+ html, body, div, span, applet, object, iframe,
2
+ h1, h2, h3, h4, h5, h6, p, blockquote, pre,
3
+ a, abbr, acronym, address, big, cite, code,
4
+ del, dfn, em, img, ins, kbd, q, s, samp,
5
+ small, strike, strong, sub, sup, tt, var,
6
+ b, u, i, center,
7
+ ol, ul, li,
8
+ fieldset, form, label, legend,
9
+ table, caption, tbody, tfoot, thead, tr, th, td,
10
+ article, aside, canvas, details, embed,
11
+ figure, figcaption, footer, header, hgroup,
12
+ menu, output, ruby, section, summary,
13
+ time, mark, audio, video {
14
+ margin: 0;
15
+ padding: 0; }
16
+
17
+ html, body, div, span, applet, object, iframe,
18
+ h1, h2, h3, h4, h5, h6, p, blockquote, pre,
19
+ a, abbr, acronym, address, big, cite, code,
20
+ del, dfn, em, img, ins, kbd, q, s, samp,
21
+ small, strike, strong, sub, sup, tt, var,
22
+ b, u, i, center,
23
+ dl, dt, dd, ol, ul, li,
24
+ fieldset, form, label, legend,
25
+ table, caption, tbody, tfoot, thead, tr, th, td,
26
+ article, aside, canvas, details, embed,
27
+ figure, figcaption, footer, header, hgroup,
28
+ menu, nav, output, ruby, section, summary,
29
+ time, mark, audio, video {
30
+ border: 0;
31
+ font-size: 100%; }
32
+
33
+ html, body, div, span, applet, object, iframe,
34
+ h1, h2, h3, h4, h5, h6, p, blockquote, pre,
35
+ a, abbr, acronym, address, big, cite, code,
36
+ del, dfn, em, img, ins, kbd, q, s, samp,
37
+ small, strike, strong, tt, var,
38
+ b, u, i, center,
39
+ dl, dd, ol, ul, li,
40
+ fieldset, form, label, legend,
41
+ table, caption, tbody, tfoot, thead, tr, th, td,
42
+ article, aside, canvas, details, embed,
43
+ figure, figcaption, footer, header, hgroup,
44
+ menu, nav, output, ruby, section, summary,
45
+ time, mark, audio, video {
46
+ vertical-align: baseline; }
47
+
48
+ html, body, div, span, applet, object, iframe,
49
+ p, blockquote,
50
+ a, abbr, acronym, address, big, cite,
51
+ del, dfn, em, img, ins, q, s,
52
+ small, strike, strong, sub, sup, var,
53
+ b, u, i, center,
54
+ dl, dt, dd, ol, ul, li,
55
+ fieldset, form, label, legend,
56
+ table, caption, tbody, tfoot, thead, tr, th, td,
57
+ article, aside, canvas, details, embed,
58
+ figure, figcaption, footer, header, hgroup,
59
+ menu, nav, output, ruby, section, summary,
60
+ time, mark, audio, video {
61
+ font-family: {{bodyfont}}; }
62
+
63
+ code, pre, tt, kbd, samp {
64
+ font-family: {{monospacefont}};
65
+ font-variant-ligatures: none; }
66
+
67
+ code *, pre *, tt *, kbd *, samp * {
68
+ font-family: {{monospacefont}} !important;
69
+ font-variant-ligatures: none; }
70
+
71
+ p code, dt code, li code, label code, legend code, caption code, th code, td code,
72
+ p tt, dt tt, li tt, label tt, legend tt, caption tt, th tt, td tt,
73
+ p kbd, dt kbd, li kbd, label kbd, legend kbd, caption kbd, th kbd, td kbd,
74
+ p samp, dt samp, li samp, label samp, legend samp, caption samp, th samp, td samp {
75
+ font-size: {{monospacefontsize}}; }
76
+
77
+ article, aside, details, figcaption, figure,
78
+ footer, header, hgroup, menu, nav, section {
79
+ display: block; }
80
+
81
+ table {
82
+ border-collapse: collapse;
83
+ border-spacing: 0; }
84
+
85
+ h1, h2, h3, h4, h5, h6 {
86
+ font-family: {{headerfont}}; }
87
+
88
+ .h1, .h2, .h3, .h4, .h5, .h6 {
89
+ font-family: {{headerfont}}; }
90
+
91
+ blockquote, q {
92
+ quotes: none; }
93
+ blockquote:before, blockquote:after, q:before, q:after {
94
+ content: '';
95
+ content: none; }
96
+
97
+ .h2Annex {
98
+ font-family: {{headerfont}}; }
99
+
100
+ dl {
101
+ display: grid;
102
+ grid-template-columns: max-content auto; }
103
+ dl dt p, dl dd p {
104
+ margin-top: 0; }
105
+ dl dt {
106
+ grid-column-start: 1; }
107
+ dl dd {
108
+ grid-column-start: 2; }
109
+
110
+ b, strong {
111
+ font-weight: bold; }
112
+
113
+ div.document-stage-band, div.document-type-band {
114
+ background-color: #333333; }
115
+
116
+ a.FootnoteRef + a.FootnoteRef:before {
117
+ content: ", ";
118
+ vertical-align: super; }
119
+
120
+ .addition {
121
+ color: blue; }
122
+
123
+ .deletion {
124
+ color: red;
125
+ text-decoration: line-through; }
126
+
127
+ #standard-band {
128
+ background-color: #0AC442; }
129
+
130
+ #standard {
131
+ border-bottom: solid 3px #0AC442; }
132
+
133
+ #directive-band {
134
+ background-color: #540D6E; }
135
+
136
+ #directive {
137
+ border-bottom: solid 3px #540D6E; }
138
+
139
+ #guide-band {
140
+ background-color: #D183C9; }
141
+
142
+ #guide {
143
+ border-bottom: solid 3px #D183C9; }
144
+
145
+ #specification-band {
146
+ background-color: #65AFFF; }
147
+
148
+ #specification {
149
+ border-bottom: solid 3px #65AFFF; }
150
+
151
+ #report-band {
152
+ background-color: #3A405A; }
153
+
154
+ #report {
155
+ border-bottom: solid 3px #3A405A; }
156
+
157
+ #amendment-band {
158
+ background-color: #F26430; }
159
+
160
+ #amendment {
161
+ border-bottom: solid 3px #F26430; }
162
+
163
+ #corrigendum-band {
164
+ background-color: #C84630; }
165
+
166
+ #corrigendum {
167
+ border-bottom: solid 3px #C84630; }
168
+
169
+ #administrative-band {
170
+ background-color: #BFAE48; }
171
+
172
+ #administrative {
173
+ border-bottom: solid 3px #BFAE48; }
174
+
175
+ #advisory-band {
176
+ background-color: #BD9391; }
177
+
178
+ #advisory {
179
+ border-bottom: solid 3px #BD9391; }
180
+
181
+ #proposal-band {
182
+ background-color: #39A0ED; }
183
+
184
+ #proposal {
185
+ border-bottom: solid 3px #39A0ED; }
186
+
187
+ #working-draft-band {
188
+ background-color: #2D7393; }
189
+
190
+ #working-draft {
191
+ border-bottom: solid 3px #2D7393; }
192
+
193
+ #committee-draft-band {
194
+ background-color: #2A6B7C; }
195
+
196
+ #committee-draft {
197
+ border-bottom: solid 3px #2A6B7C; }
198
+
199
+ #draft-standard-band {
200
+ background-color: #1C7F7A; }
201
+
202
+ #draft-standard {
203
+ border-bottom: solid 3px #1C7F7A; }
204
+
205
+ #final-draft-band {
206
+ background-color: #53C170; }
207
+
208
+ #final-draft {
209
+ border-bottom: solid 3px #53C170; }
210
+
211
+ #published-band {
212
+ background-color: #069E2D; }
213
+
214
+ #published {
215
+ border-bottom: solid 3px #069E2D; }
216
+
217
+ #withdrawn-band {
218
+ background-color: #004E64; }
219
+
220
+ #withdrawn {
221
+ border-bottom: solid 3px #004E64; }
222
+
223
+ #cancelled-band {
224
+ background-color: #2E382E; }
225
+
226
+ #cancelled {
227
+ border-bottom: solid 3px #2E382E; }
File without changes
@@ -23,6 +23,13 @@
23
23
  }
24
24
  }
25
25
 
26
+ @mixin listBlock() {
27
+ .ListTitle {
28
+ @include blockTitle();
29
+ text-align: left;
30
+ }
31
+ }
32
+
26
33
  @mixin figureBlock() {
27
34
  .FigureTitle, .figure-title {
28
35
  @include blockTitle();
File without changes
File without changes
@@ -0,0 +1,47 @@
1
+ div.table_container {
2
+ margin-bottom: 14pt; }
3
+
4
+ ol {
5
+ margin-bottom: 0cm; }
6
+
7
+ ul {
8
+ margin-bottom: 0cm; }
9
+
10
+ table.MsoISOTable tr {
11
+ page-break-inside: avoid; }
12
+
13
+ td {
14
+ page-break-inside: avoid; }
15
+
16
+ tr {
17
+ page-break-after: avoid; }
18
+
19
+ table.MsoISOTableBig tr {
20
+ page-break-inside: auto; }
21
+
22
+ table.MsoISOTableBig td {
23
+ page-break-inside: auto; }
24
+
25
+ span.stem {
26
+ font-family: "Cambria Math",serif;
27
+ mso-ascii-font-family: "Cambria Math";
28
+ font-style: italic; }
29
+
30
+ dt {
31
+ page-break-inside: avoid;
32
+ page-break-after: avoid; }
33
+
34
+ br.section {
35
+ page-break-before: always;
36
+ mso-break-type: section-break; }
37
+
38
+ br.pagebreak {
39
+ page-break-before: always;
40
+ mso-special-character: line-break; }
41
+
42
+ span.addition {
43
+ color: blue; }
44
+
45
+ span.deletion {
46
+ color: red;
47
+ text-decoration: line-through; }
File without changes
@@ -0,0 +1,125 @@
1
+ html, body, div, span, applet, object, iframe,
2
+ h1, h2, h3, h4, h5, h6, p, blockquote, pre,
3
+ a, abbr, acronym, address, big, cite, code,
4
+ del, dfn, em, img, ins, kbd, q, s, samp,
5
+ small, strike, strong, sub, sup, tt, var,
6
+ b, u, i, center,
7
+ ol, ul, li,
8
+ fieldset, form, label, legend,
9
+ table, caption, tbody, tfoot, thead, tr, th, td,
10
+ article, aside, canvas, details, embed,
11
+ figure, figcaption, footer, header, hgroup,
12
+ menu, output, ruby, section, summary,
13
+ time, mark, audio, video {
14
+ margin: 0;
15
+ padding: 0; }
16
+
17
+ html, body, div, span, applet, object, iframe,
18
+ h1, h2, h3, h4, h5, h6, p, blockquote, pre,
19
+ a, abbr, acronym, address, big, cite, code,
20
+ del, dfn, em, img, ins, kbd, q, s, samp,
21
+ small, strike, strong, sub, sup, tt, var,
22
+ b, u, i, center,
23
+ dl, dt, dd, ol, ul, li,
24
+ fieldset, form, label, legend,
25
+ table, caption, tbody, tfoot, thead, tr, th, td,
26
+ article, aside, canvas, details, embed,
27
+ figure, figcaption, footer, header, hgroup,
28
+ menu, nav, output, ruby, section, summary,
29
+ time, mark, audio, video {
30
+ border: 0;
31
+ font-size: 100%; }
32
+
33
+ html, body, div, span, applet, object, iframe,
34
+ h1, h2, h3, h4, h5, h6, p, blockquote, pre,
35
+ a, abbr, acronym, address, big, cite, code,
36
+ del, dfn, em, img, ins, kbd, q, s, samp,
37
+ small, strike, strong, tt, var,
38
+ b, u, i, center,
39
+ dl, dd, ol, ul, li,
40
+ fieldset, form, label, legend,
41
+ table, caption, tbody, tfoot, thead, tr, th, td,
42
+ article, aside, canvas, details, embed,
43
+ figure, figcaption, footer, header, hgroup,
44
+ menu, nav, output, ruby, section, summary,
45
+ time, mark, audio, video {
46
+ vertical-align: baseline; }
47
+
48
+ html, body, div, span, applet, object, iframe,
49
+ p, blockquote,
50
+ a, abbr, acronym, address, big, cite,
51
+ del, dfn, em, img, ins, q, s,
52
+ small, strike, strong, sub, sup, var,
53
+ b, u, i, center,
54
+ dl, dt, dd, ol, ul, li,
55
+ fieldset, form, label, legend,
56
+ table, caption, tbody, tfoot, thead, tr, th, td,
57
+ article, aside, canvas, details, embed,
58
+ figure, figcaption, footer, header, hgroup,
59
+ menu, nav, output, ruby, section, summary,
60
+ time, mark, audio, video {
61
+ font-family: {{bodyfont}}; }
62
+
63
+ code, pre, tt, kbd, samp {
64
+ font-family: {{monospacefont}};
65
+ font-variant-ligatures: none; }
66
+
67
+ code *, pre *, tt *, kbd *, samp * {
68
+ font-family: {{monospacefont}} !important;
69
+ font-variant-ligatures: none; }
70
+
71
+ p code, dt code, li code, label code, legend code, caption code, th code, td code,
72
+ p tt, dt tt, li tt, label tt, legend tt, caption tt, th tt, td tt,
73
+ p kbd, dt kbd, li kbd, label kbd, legend kbd, caption kbd, th kbd, td kbd,
74
+ p samp, dt samp, li samp, label samp, legend samp, caption samp, th samp, td samp {
75
+ font-size: {{monospacefontsize}}; }
76
+
77
+ article, aside, details, figcaption, figure,
78
+ footer, header, hgroup, menu, nav, section {
79
+ display: block; }
80
+
81
+ table {
82
+ border-collapse: collapse;
83
+ border-spacing: 0; }
84
+
85
+ h1, h2, h3, h4, h5, h6 {
86
+ font-family: {{headerfont}}; }
87
+
88
+ .h1, .h2, .h3, .h4, .h5, .h6 {
89
+ font-family: {{headerfont}}; }
90
+
91
+ blockquote, q {
92
+ quotes: none; }
93
+ blockquote:before, blockquote:after, q:before, q:after {
94
+ content: '';
95
+ content: none; }
96
+
97
+ .h2Annex {
98
+ font-family: {{headerfont}}; }
99
+
100
+ dl {
101
+ display: grid;
102
+ grid-template-columns: max-content auto; }
103
+ dl dt p, dl dd p {
104
+ margin-top: 0; }
105
+ dl dt {
106
+ grid-column-start: 1; }
107
+ dl dd {
108
+ grid-column-start: 2; }
109
+
110
+ b, strong {
111
+ font-weight: bold; }
112
+
113
+ div.document-stage-band, div.document-type-band {
114
+ background-color: #333333; }
115
+
116
+ a.FootnoteRef + a.FootnoteRef:before {
117
+ content: ", ";
118
+ vertical-align: super; }
119
+
120
+ .addition {
121
+ color: blue; }
122
+
123
+ .deletion {
124
+ color: red;
125
+ text-decoration: line-through; }
File without changes
@@ -7,7 +7,7 @@ module IsoDoc
7
7
  return date.text unless from || on || to
8
8
  return on.text if on
9
9
 
10
- ret = "#{from.text}–"
10
+ ret = "#{from.text}–"
11
11
  ret += to.text if to
12
12
  ret
13
13
  end
@@ -169,7 +169,7 @@ module IsoDoc
169
169
  return if author.nil? && source.nil?
170
170
 
171
171
  out.p **{ class: "QuoteAttribution" } do |p|
172
- p << "&mdash; #{author.text}" if author
172
+ p << "&#x2014; #{author.text}" if author
173
173
  p << ", " if author && source
174
174
  eref_parse(source, p) if source
175
175
  end
@@ -66,7 +66,7 @@ module IsoDoc
66
66
  title = d.at("./title")
67
67
  n = title.next_element
68
68
  n&.children&.first
69
- &.add_previous_sibling("#{title.remove.text}&mdash;")
69
+ &.add_previous_sibling("#{title.remove.text}&#x2014;")
70
70
  end
71
71
  docxml
72
72
  end
@@ -14,6 +14,8 @@ module IsoDoc
14
14
  end
15
15
  end
16
16
 
17
+ def location_parse(node, out); end
18
+
17
19
  def span_parse(node, out)
18
20
  node.children.each { |n| parse(n, out) }
19
21
  end
@@ -134,8 +136,8 @@ module IsoDoc
134
136
 
135
137
  text = node.to_s
136
138
  if in_sourcecode
137
- text = text.gsub("\n", "<br/>").gsub("<br/> ", "<br/>&nbsp;")
138
- .gsub(/ (?= )/, "&nbsp;")
139
+ text = text.gsub("\n", "<br/>").gsub("<br/> ", "<br/>&#xa0;")
140
+ .gsub(/ (?= )/, "&#xa0;")
139
141
  end
140
142
  out << text
141
143
  end
@@ -1,13 +1,21 @@
1
1
  module IsoDoc
2
2
  module Function
3
3
  module Lists
4
+ def list_title_parse(node, out)
5
+ name = node.at(ns("./name")) or return
6
+ out.p **{ class: "ListTitle" } do |p|
7
+ name&.children&.each { |n| parse(n, p) }
8
+ end
9
+ end
10
+
4
11
  def ul_attrs(node)
5
12
  { id: node["id"], style: keep_style(node) }
6
13
  end
7
14
 
8
15
  def ul_parse(node, out)
16
+ list_title_parse(node, out)
9
17
  out.ul **attr_code(ul_attrs(node)) do |ul|
10
- node.children.each { |n| parse(n, ul) }
18
+ node.children.each { |n| n.name == "name" or parse(n, ul) }
11
19
  end
12
20
  end
13
21
 
@@ -44,8 +52,9 @@ module IsoDoc
44
52
  end
45
53
 
46
54
  def ol_parse(node, out)
55
+ list_title_parse(node, out)
47
56
  out.ol **attr_code(ol_attrs(node)) do |ol|
48
- node.children.each { |n| parse(n, ol) }
57
+ node.children.each { |n| n.name == "name" or parse(n, ol) }
49
58
  end
50
59
  end
51
60
 
@@ -82,17 +91,23 @@ module IsoDoc
82
91
  end
83
92
 
84
93
  def dl_parse(node, out)
94
+ list_title_parse(node, out)
85
95
  out.dl **dl_attrs(node) do |v|
86
96
  node.elements.select { |n| dt_dd? n }.each_slice(2) do |dt, dd|
87
- v.dt **attr_code(id: dt["id"]) do |term|
88
- dt_parse(dt, term)
89
- end
90
- v.dd **attr_code(id: dd["id"]) do |listitem|
91
- dd.children.each { |n| parse(n, listitem) }
92
- end
97
+ dl_parse1(v, dt, dd)
93
98
  end
94
99
  end
95
- node.elements.reject { |n| dt_dd? n }.each { |n| parse(n, out) }
100
+ node.elements.reject { |n| dt_dd?(n) || n.name == "name" }
101
+ .each { |n| parse(n, out) }
102
+ end
103
+
104
+ def dl_parse1(dlist, dterm, ddef)
105
+ dlist.dt **attr_code(id: dterm["id"]) do |term|
106
+ dt_parse(dterm, term)
107
+ end
108
+ dlist.dd **attr_code(id: ddef["id"]) do |listitem|
109
+ ddef.children.each { |n| parse(n, listitem) }
110
+ end
96
111
  end
97
112
  end
98
113
  end
@@ -82,7 +82,7 @@ module IsoDoc
82
82
  node.xpath(ns("./note")).each { |n| parse(n, out) }
83
83
  end
84
84
  @in_table = false
85
- # out.p { |p| p << "&nbsp;" }
85
+ # out.p { |p| p << "&#xa0;" }
86
86
  end
87
87
 
88
88
  SW = "solid windowtext".freeze
@@ -73,14 +73,14 @@ module IsoDoc
73
73
 
74
74
  def make_body1(body, _docxml)
75
75
  body.div **{ class: "title-section" } do |div1|
76
- div1.p { |p| p << "&nbsp;" } # placeholder
76
+ div1.p { |p| p << "&#xa0;" } # placeholder
77
77
  end
78
78
  section_break(body)
79
79
  end
80
80
 
81
81
  def make_body2(body, _docxml)
82
82
  body.div **{ class: "prefatory-section" } do |div2|
83
- div2.p { |p| p << "&nbsp;" } # placeholder
83
+ div2.p { |p| p << "&#xa0;" } # placeholder
84
84
  end
85
85
  section_break(body)
86
86
  end
@@ -231,6 +231,7 @@ module IsoDoc
231
231
  when "toc" then toc_parse(node, out)
232
232
  when "variant-title" then variant_title(node, out)
233
233
  when "span" then span_parse(node, out)
234
+ when "location" then location_parse(node, out)
234
235
  else error_parse(node, out)
235
236
  end
236
237
  end
@@ -12,7 +12,7 @@ module IsoDoc
12
12
  end
13
13
 
14
14
  def insert_tab(out, count)
15
- tab = %w(Hans Hant).include?(@script) ? "&#x3000;" : "&nbsp; "
15
+ tab = %w(Hans Hant).include?(@script) ? "&#x3000;" : "&#xa0; "
16
16
  [1..count].each { out << tab }
17
17
  end
18
18
 
@@ -58,24 +58,30 @@ module IsoDoc
58
58
  end
59
59
  end
60
60
 
61
- def to_xhtml_prep(xml)
62
- xml.gsub!(/<\?xml[^>]*>/, "")
63
- /<!DOCTYPE /.match(xml) || (xml = DOCTYPE_HDR + xml)
61
+ def numeric_escapes(xml)
62
+ c = HTMLEntities.new
64
63
  xml.split(/(&[^ \r\n\t#;]+;)/).map do |t|
65
64
  if /^(&[^ \t\r\n#;]+;)/.match?(t)
66
- HTMLEntities.new.encode(HTMLEntities.new.decode(t), :hexadecimal)
65
+ c.encode(c.decode(t), :hexadecimal)
67
66
  else t
68
67
  end
69
68
  end.join
70
69
  end
71
70
 
71
+ def to_xhtml_prep(xml)
72
+ xml.gsub!(/<\?xml[^>]*>/, "")
73
+ /<!DOCTYPE /.match(xml) || (xml = DOCTYPE_HDR + xml)
74
+ numeric_escapes(xml)
75
+ end
76
+
72
77
  def to_xhtml_fragment(xml)
73
78
  doc = ::Nokogiri::XML.parse(NOKOHEAD)
74
79
  doc.fragment(xml)
75
80
  end
76
81
 
77
82
  def from_xhtml(xml)
78
- xml.to_xml.sub(%r{ xmlns="http://www.w3.org/1999/xhtml"}, "")
83
+ numeric_escapes(xml.to_xml
84
+ .sub(%r{ xmlns="http://www.w3.org/1999/xhtml"}, ""))
79
85
  end
80
86
 
81
87
  CLAUSE_ANCESTOR =
@@ -100,8 +106,12 @@ module IsoDoc
100
106
  "local-name() = 'figure' or local-name() = 'formula' or "\
101
107
  "local-name() = 'table' or local-name() = 'example']/@id"
102
108
 
103
- def get_note_container_id(node)
104
- container = node.xpath(NOTE_CONTAINER_ANCESTOR)
109
+ # no recursion on references
110
+ def get_note_container_id(node, type)
111
+ xpath = NOTE_CONTAINER_ANCESTOR.dup
112
+ %w(figure table example).include?(type) and
113
+ xpath.sub!(%r[ or local-name\(\) = '#{type}'], "")
114
+ container = node.xpath(xpath)
105
115
  container&.last&.text || nil
106
116
  end
107
117