isodoc 2.0.5.3 → 2.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/isodoc.gemspec +1 -0
- data/lib/isodoc/base_style/all.css +227 -0
- data/lib/isodoc/base_style/blocks.css +0 -0
- data/lib/isodoc/base_style/coverpage.css +0 -0
- data/lib/isodoc/base_style/defaults.css +0 -0
- data/lib/isodoc/base_style/metanorma_word.css +47 -0
- data/lib/isodoc/base_style/nav.css +0 -0
- data/lib/isodoc/base_style/reset.css +125 -0
- data/lib/isodoc/base_style/typography.css +0 -0
- data/lib/isodoc/function/to_word_html.rb +1 -1
- data/lib/isodoc/html_convert.rb +1 -1
- data/lib/isodoc/i18n.rb +1 -108
- data/lib/isodoc/presentation_function/image.rb +1 -1
- data/lib/isodoc/presentation_function/section.rb +15 -6
- data/lib/isodoc/version.rb +1 -1
- data/lib/isodoc/word_function/body.rb +1 -1
- data/lib/isodoc/xref/xref_gen.rb +35 -23
- data/spec/isodoc/blocks_spec.rb +43 -0
- data/spec/isodoc/ref_spec.rb +48 -0
- metadata +28 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e038a4b4f203a16e86b716deffc9602d005c305312aebedbaf88231cfe263a60
|
4
|
+
data.tar.gz: 0f873f9ce5847c0a33296714a60917d3112a95ef04f3b2ea7052b18f0fcdab8c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8c146a97d03c932fe72755edf96a9ad26806daf7c7de07814f8afd93714e1a88193b476e972bed1c17820eeca3f9216c6e07931d8fe56e6d036f857d9537339d
|
7
|
+
data.tar.gz: c081e93e7e29fd600f5968550a51a81c29f5663c6d5fb45c6f0a853978a3fdc1bc07d06a4b4e3161a4c67c78c3de7cd3ecc2e5b18999e25fec2d88ce010d9998
|
data/isodoc.gemspec
CHANGED
@@ -31,6 +31,7 @@ Gem::Specification.new do |spec|
|
|
31
31
|
spec.add_dependency "asciimath"
|
32
32
|
spec.add_dependency "html2doc", "~> 1.3.0"
|
33
33
|
spec.add_dependency "htmlentities", "~> 4.3.4"
|
34
|
+
spec.add_dependency "isodoc-i18n", "~> 1.0.0"
|
34
35
|
spec.add_dependency "liquid", "~> 4"
|
35
36
|
# spec.add_dependency "metanorma", ">= 1.2.0"
|
36
37
|
spec.add_dependency "emf2svg", "~> 1"
|
@@ -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
|
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
|
data/lib/isodoc/html_convert.rb
CHANGED
@@ -24,7 +24,7 @@ module IsoDoc
|
|
24
24
|
|
25
25
|
def convert(filename, file = nil, debug = false, output_filename = nil)
|
26
26
|
ret = super
|
27
|
-
Dir.
|
27
|
+
Dir.exist?(tmpimagedir) and Dir["#{tmpimagedir}/*"].empty? and
|
28
28
|
FileUtils.rm_r tmpimagedir
|
29
29
|
ret
|
30
30
|
end
|
data/lib/isodoc/i18n.rb
CHANGED
@@ -1,28 +1,9 @@
|
|
1
1
|
require "yaml"
|
2
|
+
require "isodoc-i18n"
|
2
3
|
require_relative "function/utils"
|
3
4
|
|
4
5
|
module IsoDoc
|
5
6
|
class I18n
|
6
|
-
def load_yaml(lang, script, i18nyaml = nil)
|
7
|
-
ret = load_yaml1(lang, script)
|
8
|
-
return normalise_hash(ret.merge(YAML.load_file(i18nyaml))) if i18nyaml
|
9
|
-
|
10
|
-
normalise_hash(ret)
|
11
|
-
end
|
12
|
-
|
13
|
-
def normalise_hash(ret)
|
14
|
-
case ret
|
15
|
-
when Hash
|
16
|
-
ret.each do |k, v|
|
17
|
-
ret[k] = normalise_hash(v)
|
18
|
-
end
|
19
|
-
ret
|
20
|
-
when Array then ret.map { |n| normalise_hash(n) }
|
21
|
-
when String then cleanup_entities(ret.unicode_normalize(:nfc))
|
22
|
-
else ret
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
7
|
def load_yaml1(lang, script)
|
27
8
|
case lang
|
28
9
|
when "en", "fr", "ru", "de", "es", "ar"
|
@@ -40,93 +21,5 @@ module IsoDoc
|
|
40
21
|
YAML.load_file(File.join(File.dirname(__FILE__),
|
41
22
|
"../isodoc-yaml/i18n-#{str}.yaml"))
|
42
23
|
end
|
43
|
-
|
44
|
-
def get
|
45
|
-
@labels
|
46
|
-
end
|
47
|
-
|
48
|
-
def set(key, val)
|
49
|
-
@labels[key] = val
|
50
|
-
end
|
51
|
-
|
52
|
-
def initialize(lang, script, i18nyaml = nil)
|
53
|
-
@lang = lang
|
54
|
-
@script = script
|
55
|
-
y = load_yaml(lang, script, i18nyaml)
|
56
|
-
@labels = y
|
57
|
-
@labels["language"] = @lang
|
58
|
-
@labels["script"] = @script
|
59
|
-
@labels.each do |k, _v|
|
60
|
-
self.class.send(:define_method, k.downcase) { get[k] }
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
def self.l10n(text, lang = @lang, script = @script)
|
65
|
-
l10n(text, lang, script)
|
66
|
-
end
|
67
|
-
|
68
|
-
# TODO: move to localization file
|
69
|
-
# function localising spaces and punctuation.
|
70
|
-
# Not clear if period needs to be localised for zh
|
71
|
-
def l10n(text, lang = @lang, script = @script)
|
72
|
-
if lang == "zh" && script == "Hans" then l10n_zh(text)
|
73
|
-
else bidiwrap(text, lang, script)
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
def bidiwrap(text, lang, script)
|
78
|
-
my_script, my_rtl, outer_rtl = bidiwrap_vars(lang, script)
|
79
|
-
if my_rtl && !outer_rtl
|
80
|
-
mark = %w(Arab Aran).include?(my_script) ? "؜" : "‏"
|
81
|
-
"#{mark}#{text}#{mark}"
|
82
|
-
elsif !my_rtl && outer_rtl then "‎#{text}‎"
|
83
|
-
else text
|
84
|
-
end
|
85
|
-
end
|
86
|
-
|
87
|
-
def bidiwrap_vars(lang, script)
|
88
|
-
my_script = script || Metanorma::Utils.default_script(lang)
|
89
|
-
[my_script,
|
90
|
-
Metanorma::Utils.rtl_script?(my_script),
|
91
|
-
Metanorma::Utils.rtl_script?(@script || Metanorma::Utils
|
92
|
-
.default_script(@lang))]
|
93
|
-
end
|
94
|
-
|
95
|
-
def l10n_zh(text)
|
96
|
-
xml = Nokogiri::HTML::DocumentFragment.parse(text)
|
97
|
-
xml.traverse do |n|
|
98
|
-
next unless n.text?
|
99
|
-
|
100
|
-
n.replace(cleanup_entities(n.text.gsub(/ /, "").gsub(/:/, ":")
|
101
|
-
.gsub(/,/, "、").gsub(/\(/, "(").gsub(/\)/, ")")
|
102
|
-
.gsub(/\[/, "【").gsub(/\]/, "】"), is_xml: false))
|
103
|
-
end
|
104
|
-
xml.to_xml.gsub(/<b>/, "").gsub("</b>", "").gsub(/<\?[^>]+>/, "")
|
105
|
-
end
|
106
|
-
|
107
|
-
def boolean_conj(list, conn)
|
108
|
-
case list.size
|
109
|
-
when 0 then ""
|
110
|
-
when 1 then list.first
|
111
|
-
when 2 then @labels["binary_#{conn}"].sub(/%1/, list[0])
|
112
|
-
.sub(/%2/, list[1])
|
113
|
-
else
|
114
|
-
@labels["multiple_#{conn}"]
|
115
|
-
.sub(/%1/, l10n(list[0..-2].join(", "), @lang, @script))
|
116
|
-
.sub(/%2/, list[-1])
|
117
|
-
end
|
118
|
-
end
|
119
|
-
|
120
|
-
# def multiple_and(names, andword)
|
121
|
-
# return "" if names.empty?
|
122
|
-
# return names[0] if names.length == 1
|
123
|
-
#
|
124
|
-
# (names.length == 2) &&
|
125
|
-
# (return l10n("#{names[0]} #{andword} #{names[1]}", @lang, @script))
|
126
|
-
# l10n(names[0..-2].join(", ") + " #{andword} #{names[-1]}", @lang, @script)
|
127
|
-
# end
|
128
|
-
|
129
|
-
include Function::Utils
|
130
|
-
# module_function :l10n
|
131
24
|
end
|
132
25
|
end
|
@@ -64,7 +64,7 @@ module IsoDoc
|
|
64
64
|
def svg_to_emf(node)
|
65
65
|
uri = svg_to_emf_uri(node)
|
66
66
|
ret = svg_to_emf_filename(uri)
|
67
|
-
File.
|
67
|
+
File.exist?(ret) and return ret
|
68
68
|
exe = inkscape_installed? or raise "Inkscape missing in PATH, unable" \
|
69
69
|
"to convert EMF to SVG. Aborting."
|
70
70
|
uri = Metanorma::Utils::external_path uri
|
@@ -76,16 +76,25 @@ module IsoDoc
|
|
76
76
|
def bibliography_bibitem_number(docxml)
|
77
77
|
i = 0
|
78
78
|
docxml.xpath(ns("//references[@normative = 'false']/bibitem")).each do |b|
|
79
|
-
|
80
|
-
|
81
|
-
i += 1
|
82
|
-
id = b.at(ns(".//docidentifier"))
|
83
|
-
id.previous =
|
84
|
-
"<docidentifier type='metanorma-ordinal'>[#{i}]</docidentifier>"
|
79
|
+
i = bibliography_bibitem_number1(b, i)
|
85
80
|
end
|
86
81
|
@xrefs.references docxml
|
87
82
|
end
|
88
83
|
|
84
|
+
def bibliography_bibitem_number1(bibitem, idx)
|
85
|
+
if mn = bibitem.at(ns(".//docidentifier[@type = 'metanorma']"))
|
86
|
+
/^\[?\d\]?$/.match?(mn&.text) and
|
87
|
+
idx = mn.text.sub(/^\[/, "").sub(/\]$/, "").to_i
|
88
|
+
end
|
89
|
+
unless bibliography_bibitem_number_skip(bibitem)
|
90
|
+
|
91
|
+
idx += 1
|
92
|
+
bibitem.at(ns(".//docidentifier")).previous =
|
93
|
+
"<docidentifier type='metanorma-ordinal'>[#{idx}]</docidentifier>"
|
94
|
+
end
|
95
|
+
idx
|
96
|
+
end
|
97
|
+
|
89
98
|
def docid_prefixes(docxml)
|
90
99
|
docxml.xpath(ns("//references/bibitem/docidentifier")).each do |i|
|
91
100
|
i.children = @xrefs.klass.docid_prefix(i["type"], i.text)
|
data/lib/isodoc/version.rb
CHANGED
data/lib/isodoc/xref/xref_gen.rb
CHANGED
@@ -87,18 +87,23 @@ module IsoDoc
|
|
87
87
|
|
88
88
|
def note_anchor_names(sections)
|
89
89
|
sections.each do |s|
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
@anchors[n["id"]] =
|
95
|
-
anchor_struct(increment_label(notes, n, c), n,
|
96
|
-
@labels["note_xref"], "note", false)
|
97
|
-
end
|
90
|
+
notes = s.xpath(CHILD_NOTES_XPATH) -
|
91
|
+
s.xpath(ns(".//figure//note | .//table//note"))
|
92
|
+
note_anchor_names1(notes, Counter.new)
|
98
93
|
note_anchor_names(s.xpath(ns(CHILD_SECTIONS)))
|
99
94
|
end
|
100
95
|
end
|
101
96
|
|
97
|
+
def note_anchor_names1(notes, counter)
|
98
|
+
notes.each do |n|
|
99
|
+
next if @anchors[n["id"]] || blank?(n["id"])
|
100
|
+
|
101
|
+
@anchors[n["id"]] =
|
102
|
+
anchor_struct(increment_label(notes, n, counter), n,
|
103
|
+
@labels["note_xref"], "note", false)
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
102
107
|
CHILD_EXAMPLES_XPATH =
|
103
108
|
"./*[not(self::xmlns:clause) and not(self::xmlns:appendix) and "\
|
104
109
|
"not(self::xmlns:terms) and not(self::xmlns:definitions)]//"\
|
@@ -109,18 +114,22 @@ module IsoDoc
|
|
109
114
|
|
110
115
|
def example_anchor_names(sections)
|
111
116
|
sections.each do |s|
|
112
|
-
|
113
|
-
(notes
|
114
|
-
next if @anchors[n["id"]] || n["id"].nil? || n["id"].empty?
|
115
|
-
|
116
|
-
@anchors[n["id"]] =
|
117
|
-
anchor_struct(increment_label(notes, n, c), n,
|
118
|
-
@labels["example_xref"], "example", n["unnumbered"])
|
119
|
-
end
|
117
|
+
notes = s.xpath(CHILD_EXAMPLES_XPATH)
|
118
|
+
example_anchor_names1(notes, Counter.new)
|
120
119
|
example_anchor_names(s.xpath(ns(CHILD_SECTIONS)))
|
121
120
|
end
|
122
121
|
end
|
123
122
|
|
123
|
+
def example_anchor_names1(notes, counter)
|
124
|
+
notes.each do |n|
|
125
|
+
next if @anchors[n["id"]] || blank?(n["id"])
|
126
|
+
|
127
|
+
@anchors[n["id"]] =
|
128
|
+
anchor_struct(increment_label(notes, n, counter), n,
|
129
|
+
@labels["example_xref"], "example", n["unnumbered"])
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
124
133
|
def list_anchor_names(sections)
|
125
134
|
sections.each do |s|
|
126
135
|
notes = s.xpath(ns(".//ol")) - s.xpath(ns(".//clause//ol")) -
|
@@ -154,17 +163,20 @@ module IsoDoc
|
|
154
163
|
sections.each do |s|
|
155
164
|
notes = s.xpath(ns(".//dl")) - s.xpath(ns(".//clause//dl")) -
|
156
165
|
s.xpath(ns(".//appendix//dl")) - s.xpath(ns(".//dl//dl"))
|
157
|
-
|
158
|
-
notes.reject { |n| blank?(n["id"]) }.each do |n|
|
159
|
-
@anchors[n["id"]] =
|
160
|
-
anchor_struct(increment_label(notes, n, c), n,
|
161
|
-
@labels["deflist"], "deflist", false)
|
162
|
-
deflist_term_anchor_names(n, @anchors[n["id"]])
|
163
|
-
end
|
166
|
+
deflist_anchor_names1(notes, Counter.new)
|
164
167
|
deflist_anchor_names(s.xpath(ns(CHILD_SECTIONS)))
|
165
168
|
end
|
166
169
|
end
|
167
170
|
|
171
|
+
def deflist_anchor_names1(notes, counter)
|
172
|
+
notes.reject { |n| blank?(n["id"]) }.each do |n|
|
173
|
+
@anchors[n["id"]] =
|
174
|
+
anchor_struct(increment_label(notes, n, counter), n,
|
175
|
+
@labels["deflist"], "deflist", false)
|
176
|
+
deflist_term_anchor_names(n, @anchors[n["id"]])
|
177
|
+
end
|
178
|
+
end
|
179
|
+
|
168
180
|
def deflist_term_anchor_names(list, list_anchor)
|
169
181
|
list.xpath(ns("./dt")).each do |li|
|
170
182
|
label = l10n("#{list_anchor[:xref]}: #{dt2xreflabel(li)}")
|
data/spec/isodoc/blocks_spec.rb
CHANGED
@@ -558,6 +558,49 @@ RSpec.describe IsoDoc do
|
|
558
558
|
.convert("test", input, true)))).to be_equivalent_to xmlpp(doc)
|
559
559
|
end
|
560
560
|
|
561
|
+
it "numbers notes in tables and figures separately from notes outside them" do
|
562
|
+
input = <<~INPUT
|
563
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
564
|
+
<preface><foreword>
|
565
|
+
<figure id="F"><note id="FB"><p>XYZ</p></note></figure>
|
566
|
+
<table id="T"><note id="TB"><p>XYZ</p></note></table>
|
567
|
+
<p id="A">ABC <note id="B"><p id="C">XYZ</p></note>
|
568
|
+
</foreword></preface>
|
569
|
+
</iso-standard>
|
570
|
+
INPUT
|
571
|
+
output = <<~OUTPUT
|
572
|
+
<iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
|
573
|
+
<preface>
|
574
|
+
<foreword displayorder='1'>
|
575
|
+
<figure id='F'>
|
576
|
+
<name>Figure 1</name>
|
577
|
+
<note id='FB'>
|
578
|
+
<name>NOTE</name>
|
579
|
+
<p>XYZ</p>
|
580
|
+
</note>
|
581
|
+
</figure>
|
582
|
+
<table id='T'>
|
583
|
+
<name>Table 1</name>
|
584
|
+
<note id='TB'>
|
585
|
+
<name>NOTE</name>
|
586
|
+
<p>XYZ</p>
|
587
|
+
</note>
|
588
|
+
</table>
|
589
|
+
<p id='A'>
|
590
|
+
ABC
|
591
|
+
<note id='B'>
|
592
|
+
<name>NOTE</name>
|
593
|
+
<p id='C'>XYZ</p>
|
594
|
+
</note>
|
595
|
+
</p>
|
596
|
+
</foreword>
|
597
|
+
</preface>
|
598
|
+
</iso-standard>
|
599
|
+
OUTPUT
|
600
|
+
expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
|
601
|
+
.convert("test", input, true))).to be_equivalent_to xmlpp(output)
|
602
|
+
end
|
603
|
+
|
561
604
|
it "processes figures" do
|
562
605
|
input = <<~INPUT
|
563
606
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
data/spec/isodoc/ref_spec.rb
CHANGED
@@ -854,4 +854,52 @@ RSpec.describe IsoDoc do
|
|
854
854
|
.to be_equivalent_to xmlpp(presxml)
|
855
855
|
end
|
856
856
|
|
857
|
+
it "enforces consistent metanorma-ordinal numbering" do
|
858
|
+
input = <<~INPUT
|
859
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
860
|
+
<bibdata>
|
861
|
+
<language>en</language>
|
862
|
+
</bibdata>
|
863
|
+
<bibliography><references id="_normative_references" obligation="informative" normative="false"><title>Bibliography</title>
|
864
|
+
<bibitem id="ref1" type="standard">
|
865
|
+
<title format="text/plain">Cereals or cereal products</title>
|
866
|
+
<docidentifier type="IEC">IEC 217</docidentifier>
|
867
|
+
</bibitem>
|
868
|
+
<bibitem id="ref2" type="standard">
|
869
|
+
<title format="text/plain">Cereals or cereal products</title>
|
870
|
+
<docidentifier type="metanorma">[3]</docidentifier>
|
871
|
+
</bibitem>
|
872
|
+
<bibitem id="ref3" type="standard">
|
873
|
+
<title format="text/plain">Cereals or cereal products</title>
|
874
|
+
<docidentifier>ABC</docidentifier>
|
875
|
+
</bibitem>
|
876
|
+
</references></bibliography></iso-standard>
|
877
|
+
INPUT
|
878
|
+
presxml = <<~PRESXML
|
879
|
+
<bibliography>
|
880
|
+
<references id='_normative_references' obligation='informative' normative='false' displayorder='1'>
|
881
|
+
<title depth='1'>Bibliography</title>
|
882
|
+
<bibitem id='ref1' type='standard'>
|
883
|
+
<title format='text/plain'>Cereals or cereal products</title>
|
884
|
+
<docidentifier type='metanorma-ordinal'>[1]</docidentifier>
|
885
|
+
<docidentifier type='IEC'>IEC 217</docidentifier>
|
886
|
+
</bibitem>
|
887
|
+
<bibitem id='ref2' type='standard'>
|
888
|
+
<title format='text/plain'>Cereals or cereal products</title>
|
889
|
+
<docidentifier type='metanorma'>[3]</docidentifier>
|
890
|
+
</bibitem>
|
891
|
+
<bibitem id='ref3' type='standard'>
|
892
|
+
<title format='text/plain'>Cereals or cereal products</title>
|
893
|
+
<docidentifier type='metanorma-ordinal'>[4]</docidentifier>
|
894
|
+
<docidentifier>ABC</docidentifier>
|
895
|
+
</bibitem>
|
896
|
+
</references>
|
897
|
+
</bibliography>
|
898
|
+
PRESXML
|
899
|
+
expect(xmlpp(Nokogiri::XML(
|
900
|
+
IsoDoc::PresentationXMLConvert.new({})
|
901
|
+
.convert("test", input, true),
|
902
|
+
).at("//xmlns:bibliography").to_xml))
|
903
|
+
.to be_equivalent_to xmlpp(presxml)
|
904
|
+
end
|
857
905
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: isodoc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-04-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: asciimath
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 4.3.4
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: isodoc-i18n
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 1.0.0
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 1.0.0
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: liquid
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -391,15 +405,23 @@ files:
|
|
391
405
|
- lib/isodoc-yaml/i18n-ru.yaml
|
392
406
|
- lib/isodoc-yaml/i18n-zh-Hans.yaml
|
393
407
|
- lib/isodoc.rb
|
408
|
+
- lib/isodoc/base_style/all.css
|
394
409
|
- lib/isodoc/base_style/all.scss
|
395
410
|
- lib/isodoc/base_style/bands.scss
|
411
|
+
- lib/isodoc/base_style/blocks.css
|
396
412
|
- lib/isodoc/base_style/blocks.scss
|
413
|
+
- lib/isodoc/base_style/coverpage.css
|
397
414
|
- lib/isodoc/base_style/coverpage.scss
|
415
|
+
- lib/isodoc/base_style/defaults.css
|
398
416
|
- lib/isodoc/base_style/defaults.scss
|
417
|
+
- lib/isodoc/base_style/metanorma_word.css
|
399
418
|
- lib/isodoc/base_style/metanorma_word.scss
|
419
|
+
- lib/isodoc/base_style/nav.css
|
400
420
|
- lib/isodoc/base_style/nav.scss
|
421
|
+
- lib/isodoc/base_style/reset.css
|
401
422
|
- lib/isodoc/base_style/reset.scss
|
402
423
|
- lib/isodoc/base_style/scripts.html
|
424
|
+
- lib/isodoc/base_style/typography.css
|
403
425
|
- lib/isodoc/base_style/typography.scss
|
404
426
|
- lib/isodoc/class_utils.rb
|
405
427
|
- lib/isodoc/common.rb
|
@@ -512,7 +534,7 @@ homepage: https://github.com/metanorma/isodoc
|
|
512
534
|
licenses:
|
513
535
|
- BSD-2-Clause
|
514
536
|
metadata: {}
|
515
|
-
post_install_message:
|
537
|
+
post_install_message:
|
516
538
|
rdoc_options: []
|
517
539
|
require_paths:
|
518
540
|
- lib
|
@@ -527,8 +549,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
527
549
|
- !ruby/object:Gem::Version
|
528
550
|
version: '0'
|
529
551
|
requirements: []
|
530
|
-
rubygems_version: 3.
|
531
|
-
signing_key:
|
552
|
+
rubygems_version: 3.3.9
|
553
|
+
signing_key:
|
532
554
|
specification_version: 4
|
533
555
|
summary: Convert documents in IsoDoc into Word and HTML in AsciiDoc.
|
534
556
|
test_files: []
|