isodoc 2.2.3 → 2.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: efcdfcde0ed6b8878845a1b030b1bf7f375dc21f7daae1589ba6b8324e06a333
4
- data.tar.gz: 6498b1dc8efa9f850c2fed954ec9f7067d847fb932d86b4e353125754e780dad
3
+ metadata.gz: b274e56cc3339018a287a638d7aaf4942d0aef0f65462c56dbf597ef44784d16
4
+ data.tar.gz: bd76f31818ce3bb71a669493512fe564034bd1ef509a949d8ecdb78633b413f4
5
5
  SHA512:
6
- metadata.gz: 0b6a7404d5021f2ef2db93b83803a122a842febd05e30fb0fbda876407c8b8673382ef818038f73899376d6ba1b465410d12c4076c782829a8292adefd65e758
7
- data.tar.gz: 251e5f94894578f8d5e365333a1512a1c8bac91d0c6020afa95d409eb1c9299f4bbb73762c94e2103775e85f5bb43e5b6710161c9f79ebee2fa0d29d5d94f0f1
6
+ metadata.gz: e759c0e6f239562fd36f3310493af79e53d38d56b87496be292c04a2134fb3f74cfadeadd6563949c92676f144377f06f92dae7af84cf933ec8a9d90ec302c46
7
+ data.tar.gz: ced123ca8ad422fcd1f62b28b1135018811d41f72fa180aca58f6f7b8fa1d00ae7dfff7b9d8d336bb032f5986c34e77d93c55aac62b7c68421fd68e172f56755
data/isodoc.gemspec CHANGED
@@ -34,16 +34,16 @@ Gem::Specification.new do |spec|
34
34
  spec.add_dependency "asciimath"
35
35
  spec.add_dependency "html2doc", "~> 1.4.1"
36
36
  spec.add_dependency "htmlentities", "~> 4.3.4"
37
- spec.add_dependency "isodoc-i18n", "~> 1.0.7"
37
+ # spec.add_dependency "isodoc-i18n", "~> 1.1.0" # already in relaton-render and mn-requirements
38
38
  spec.add_dependency "liquid", "~> 4"
39
39
  # spec.add_dependency "metanorma", ">= 1.2.0"
40
40
  spec.add_dependency "emf2svg"
41
41
  spec.add_dependency "mathml2asciimath"
42
- spec.add_dependency "metanorma-utils", "~> 1.4.0"
42
+ spec.add_dependency "metanorma-utils", "~> 1.4.3"
43
43
  spec.add_dependency "mn2pdf"
44
- spec.add_dependency "mn-requirements", "~> 0.1.3"
44
+ spec.add_dependency "mn-requirements", "~> 0.1.7"
45
45
  spec.add_dependency "relaton-cli"
46
- spec.add_dependency "relaton-render", "~> 0.4.0"
46
+ spec.add_dependency "relaton-render", "~> 0.5.0"
47
47
  spec.add_dependency "roman-numerals"
48
48
  spec.add_dependency "thread_safe"
49
49
  spec.add_dependency "twitter_cldr", ">= 6.6.0"
@@ -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
@@ -84,6 +84,8 @@ module IsoDoc
84
84
  @i18nyaml = options[:i18nyaml]
85
85
  @lang = options[:language] || "en"
86
86
  @script = options[:script] || "Latn"
87
+ @locale = options[:locale]
88
+ @localizenumber = options[:localizenumber]
87
89
  end
88
90
 
89
91
  def init_locations(options)
@@ -208,11 +210,12 @@ module IsoDoc
208
210
  end
209
211
 
210
212
  def convert_i18n_init(docxml)
211
- lang = docxml&.at(ns("//bibdata/language"))&.text and @lang = lang
212
- script = docxml&.at(ns("//bibdata/script"))&.text and @script = script
213
- i18n_init(@lang, @script)
213
+ lang = docxml.at(ns("//bibdata/language")) and @lang = lang.text
214
+ script = docxml.at(ns("//bibdata/script")) and @script = script.text
215
+ locale = docxml.at(ns("//bibdata/locale")) and @locale = locale.text
216
+ i18n_init(@lang, @script, @locale)
214
217
  @reqt_models = requirements_processor
215
- .new({ default: "default", lang: lang, script: script,
218
+ .new({ default: "default", lang: @lang, script: @script, locale: @locale,
216
219
  labels: @i18n.get })
217
220
  end
218
221
 
@@ -14,7 +14,7 @@ module IsoDoc
14
14
  end
15
15
 
16
16
  def cleanup(docxml)
17
- @i18n ||= i18n_init(@lang, @script)
17
+ @i18n ||= i18n_init(@lang, @script, @locale)
18
18
  comment_cleanup(docxml)
19
19
  footnote_cleanup(docxml)
20
20
  inline_header_cleanup(docxml)
@@ -1,5 +1,3 @@
1
- # frozen_string_literal: true
2
-
3
1
  module IsoDoc
4
2
  module Function
5
3
  module Utils
@@ -21,7 +19,7 @@ module IsoDoc
21
19
  end
22
20
 
23
21
  # add namespaces for Word fragments
24
- NOKOHEAD = <<~HERE
22
+ NOKOHEAD = <<~HERE.freeze
25
23
  <!DOCTYPE html SYSTEM
26
24
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
27
25
  <html xmlns="http://www.w3.org/1999/xhtml">
@@ -47,7 +45,7 @@ module IsoDoc
47
45
  end
48
46
 
49
47
  DOCTYPE_HDR = "<!DOCTYPE html SYSTEM "\
50
- '"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'
48
+ '"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'.freeze
51
49
 
52
50
  def to_xhtml(xml)
53
51
  xml = to_xhtml_prep(xml)
@@ -94,11 +92,10 @@ module IsoDoc
94
92
  "local-name() = 'acknowledgements' or local-name() = 'term' or "\
95
93
  "local-name() = 'appendix' or local-name() = 'foreword' or "\
96
94
  "local-name() = 'introduction' or local-name() = 'terms' or "\
97
- "local-name() = 'clause' or local-name() = 'references']/@id"
95
+ "local-name() = 'clause' or local-name() = 'references']/@id".freeze
98
96
 
99
97
  def get_clause_id(node)
100
- clause = node.xpath(CLAUSE_ANCESTOR)
101
- clause&.last&.text || nil
98
+ node.xpath(CLAUSE_ANCESTOR)&.last&.text || nil
102
99
  end
103
100
 
104
101
  NOTE_CONTAINER_ANCESTOR =
@@ -108,7 +105,7 @@ module IsoDoc
108
105
  "local-name() = 'acknowledgements' or local-name() = 'term' or "\
109
106
  "local-name() = 'clause' or local-name() = 'references' or "\
110
107
  "local-name() = 'figure' or local-name() = 'formula' or "\
111
- "local-name() = 'table' or local-name() = 'example']/@id"
108
+ "local-name() = 'table' or local-name() = 'example']/@id".freeze
112
109
 
113
110
  # no recursion on references
114
111
  def get_note_container_id(node, type)
@@ -172,8 +169,7 @@ module IsoDoc
172
169
  end
173
170
 
174
171
  def empty2nil(str)
175
- return nil if !str.nil? && str.is_a?(String) && str.empty?
176
-
172
+ !str.nil? && str.is_a?(String) && str.empty? and return nil
177
173
  str
178
174
  end
179
175
 
@@ -189,7 +185,7 @@ module IsoDoc
189
185
  end
190
186
 
191
187
  def save_dataimage(uri, _relative_dir = true)
192
- %r{^data:(?<imgclass>image|application)/(?<imgtype>[^;]+);(charset=[^;]+;)?base64,(?<imgdata>.+)$} =~ uri
188
+ %r{^data:(?<imgclass>image|application)/(?<imgtype>[^;]+);(?:charset=[^;]+;)?base64,(?<imgdata>.+)$} =~ uri
193
189
  imgtype = "emf" if emf?("#{imgclass}/#{imgtype}")
194
190
  imgtype = imgtype.sub(/\+[a-z0-9]+$/, "") # svg+xml
195
191
  imgtype = "png" unless /^[a-z0-9]+$/.match? imgtype
@@ -203,12 +199,9 @@ module IsoDoc
203
199
 
204
200
  def image_localfile(img)
205
201
  case img["src"]
206
- when /^data:/
207
- save_dataimage(img["src"], false)
208
- when %r{^([A-Z]:)?/}
209
- img["src"]
210
- else
211
- File.join(@localdir, img["src"])
202
+ when /^data:/ then save_dataimage(img["src"], false)
203
+ when %r{^([A-Z]:)?/} then img["src"]
204
+ else File.join(@localdir, img["src"])
212
205
  end
213
206
  end
214
207
 
@@ -219,7 +212,7 @@ module IsoDoc
219
212
 
220
213
  def emf?(type)
221
214
  %w(application/emf application/x-emf image/x-emf image/x-mgx-emf
222
- application/x-msmetafile image/x-xbitmap).include? type
215
+ application/x-msmetafile image/x-xbitmap image/emf).include? type
223
216
  end
224
217
 
225
218
  def eps?(type)
@@ -244,8 +237,7 @@ module IsoDoc
244
237
  if win
245
238
  path.gsub!(%{/}, "\\")
246
239
  path[/\s/] ? "\"#{path}\"" : path
247
- else
248
- path
240
+ else path
249
241
  end
250
242
  end
251
243
  end
data/lib/isodoc/init.rb CHANGED
@@ -9,12 +9,13 @@ module IsoDoc
9
9
  @xrefs = Xref.new(lang, script, html, i18n, options)
10
10
  end
11
11
 
12
- def i18n_init(lang, script, i18nyaml = nil)
13
- @i18n = I18n.new(lang, script, i18nyaml: i18nyaml || @i18nyaml)
12
+ def i18n_init(lang, script, locale, i18nyaml = nil)
13
+ @i18n = I18n.new(lang, script, locale: locale,
14
+ i18nyaml: i18nyaml || @i18nyaml)
14
15
  end
15
16
 
16
- def l10n(expr, lang = @lang, script = @script)
17
- @i18n.l10n(expr, lang, script)
17
+ def l10n(expr, lang = @lang, script = @script, locale = @locale)
18
+ @i18n.l10n(expr, lang, script, locale)
18
19
  end
19
20
  end
20
21
  end
@@ -11,8 +11,8 @@ module IsoDoc
11
11
  Common::ns(xpath)
12
12
  end
13
13
 
14
- def l10n(expr, lang, script)
15
- @i18n.l10n(expr, lang, script)
14
+ def l10n(expr, lang = @lang, script = @script, locale = @locale)
15
+ @i18n.l10n(expr, lang, script, locale)
16
16
  end
17
17
 
18
18
  def initialize(lang, script, i18n, fonts_options = {})
@@ -103,7 +103,7 @@ module IsoDoc
103
103
  draftinfo = " (#{@labels['draft_label']} #{draft}"
104
104
  draftinfo += ", #{revdate}" if revdate
105
105
  draftinfo += ")"
106
- l10n(draftinfo, @lang, @script)
106
+ l10n(draftinfo, @lang, @script, @locale)
107
107
  end
108
108
 
109
109
  def version(isoxml, _out)
@@ -17,10 +17,10 @@ module IsoDoc
17
17
  name = a&.at(ns("./affiliation/organization/name"))&.text
18
18
  subdivs = a&.xpath(ns("./affiliation/organization/subdivision"))&.map(&:text)&.join(", ")
19
19
  name and subdivs and !subdivs.empty? and
20
- name = l10n("#{name}, #{subdivs}", @lang, @script)
20
+ name = l10n("#{name}, #{subdivs}")
21
21
  location = a&.at(ns("./affiliation/organization/address/formattedAddress"))&.text
22
22
  m << (if !name.nil? && !location.nil?
23
- l10n("#{name}, #{location}", @lang, @script)
23
+ l10n("#{name}, #{location}")
24
24
  else
25
25
  (name || location || "")
26
26
  end)
@@ -26,21 +26,18 @@ module IsoDoc
26
26
  m = /(?<yr>\d\d\d\d)-(?<mo>\d\d)/.match isodate
27
27
  return isodate unless m && m[:yr] && m[:mo]
28
28
 
29
- l10n("#{months[m[:mo].to_sym]} #{m[:yr]}",
30
- @lang, @script)
29
+ l10n("#{months[m[:mo].to_sym]} #{m[:yr]}")
31
30
  end
32
31
 
33
32
  def MMMddyyyy(isodate)
34
- return nil if isodate.nil?
33
+ isodate.nil? and return nil
35
34
 
36
35
  arr = isodate.split("-")
37
- if arr.size == 1 && (/^\d+$/.match isodate)
38
- Date.new(*arr.map(&:to_i)).strftime("%Y")
39
- elsif arr.size == 2
40
- Date.new(*arr.map(&:to_i)).strftime("%B %Y")
41
- else
42
- Date.parse(isodate).strftime("%B %d, %Y")
43
- end
36
+ arr.size == 1 && (/^\d+$/.match isodate) and
37
+ return Date.new(*arr.map(&:to_i)).strftime("%Y")
38
+ arr.size == 2 and
39
+ return Date.new(*arr.map(&:to_i)).strftime("%B %Y")
40
+ Date.parse(isodate).strftime("%B %d, %Y")
44
41
  end
45
42
 
46
43
  def bibdate(isoxml, _out)
@@ -3,17 +3,29 @@ require "emf2svg"
3
3
 
4
4
  module IsoDoc
5
5
  class PresentationXMLConvert < ::IsoDoc::Convert
6
+ SVG = { "m" => "http://www.w3.org/2000/svg" }.freeze
7
+
6
8
  def figure(docxml)
9
+ docxml.xpath("//m:svg", SVG).each { |f| svg_wrap(f) }
7
10
  docxml.xpath(ns("//image")).each { |f| svg_extract(f) }
8
11
  docxml.xpath(ns("//figure")).each { |f| figure1(f) }
9
- docxml.xpath(ns("//svgmap")).each do |s|
10
- if f = s.at(ns("./figure")) then s.replace(f)
11
- else s.remove
12
- end
13
- end
12
+ docxml.xpath(ns("//svgmap")).each { |s| svgmap_extract(s) }
14
13
  imageconvert(docxml)
15
14
  end
16
15
 
16
+ def svg_wrap(elem)
17
+ return if elem.parent.name == "image"
18
+
19
+ elem.replace("<image src='' mimetype='image/svg+xml' height='auto' "\
20
+ "width='auto'>#{elem.to_xml}</image>")
21
+ end
22
+
23
+ def svgmap_extract(elem)
24
+ if f = elem.at(ns("./figure")) then elem.replace(f)
25
+ else elem.remove
26
+ end
27
+ end
28
+
17
29
  def imageconvert(docxml)
18
30
  docxml.xpath(ns("//image")).each do |f|
19
31
  eps2svg(f)
@@ -23,6 +35,7 @@ module IsoDoc
23
35
 
24
36
  def svg_extract(elem)
25
37
  return unless %r{^data:image/svg\+xml;}.match?(elem["src"])
38
+ return if elem.at("./m:svg", SVG)
26
39
 
27
40
  svg = Base64.strict_decode64(elem["src"]
28
41
  .sub(%r{^data:image/svg\+xml;(charset=[^;]+;)?base64,}, ""))
@@ -62,8 +62,12 @@ module IsoDoc
62
62
  end
63
63
 
64
64
  def twitter_cldr_reader(locale)
65
+ return @twitter_cldr_reader if @twitter_cldr_reader
66
+
65
67
  num = TwitterCldr::DataReaders::NumberDataReader.new(locale)
66
- num.symbols.merge!(twitter_cldr_localiser_symbols)
68
+ @twitter_cldr_reader = num.symbols.merge!(twitter_cldr_localiser_symbols)
69
+ .merge!(parse_localize_number)
70
+ @twitter_cldr_reader
67
71
  end
68
72
 
69
73
  def twitter_cldr_localiser
@@ -72,6 +76,19 @@ module IsoDoc
72
76
  locale
73
77
  end
74
78
 
79
+ def parse_localize_number
80
+ return {} unless @localizenumber
81
+
82
+ m = %r{(?<group>[^#])?(?<groupdigits>#+0)(?<decimal>.)(?<fractdigits>#+)(?<fractgroup>[^#])?}
83
+ .match(@localizenumber) or return {}
84
+ ret = { decimal: m[:decimal], group_digits: m[:groupdigits].size,
85
+ fraction_group_digits: m[:fractdigits].size,
86
+ group: m[:group] || "",
87
+ fraction_group: m[:fractgroup] || "" }.compact
88
+ %i(group fraction_group).each { |x| ret[x] == " " and ret[x] = "\u00A0" }
89
+ ret
90
+ end
91
+
75
92
  def asciimath_dup(node)
76
93
  return if @suppressasciimathdup
77
94
 
@@ -81,7 +81,7 @@ module IsoDoc
81
81
  end
82
82
 
83
83
  def bibliography_bibitem_number1(bibitem, idx)
84
- ins = bibitem.at(ns(".//docidentifier")).previous_element
84
+ ins = bibliography_bibitem_number_insert_pt(bibitem)
85
85
  mn = bibitem.at(ns(".//docidentifier[@type = 'metanorma']")) and
86
86
  /^\[?\d+\]?$/.match?(mn.text) and
87
87
  mn.remove # ignore numbers already inserted
@@ -93,6 +93,14 @@ module IsoDoc
93
93
  idx
94
94
  end
95
95
 
96
+ def bibliography_bibitem_number_insert_pt(bibitem)
97
+ unless ins = bibitem.at(ns(".//docidentifier")).previous_element
98
+ bibitem.at(ns(".//docidentifier")).previous = " "
99
+ ins = bibitem.at(ns(".//docidentifier")).previous
100
+ end
101
+ ins
102
+ end
103
+
96
104
  def docid_prefixes(docxml)
97
105
  docxml.xpath(ns("//references/bibitem/docidentifier")).each do |i|
98
106
  i.children = @xrefs.klass.docid_prefix(i["type"], i.text)
@@ -1,3 +1,3 @@
1
1
  module IsoDoc
2
- VERSION = "2.2.3".freeze
2
+ VERSION = "2.3.0".freeze
3
3
  end
@@ -1,73 +1,74 @@
1
- module IsoDoc::WordFunction
2
- module Body
3
- def remove_bottom_border(td)
4
- td["style"] =
5
- td["style"].gsub(/border-bottom:[^;]+;/, "border-bottom:0pt;")
6
- .gsub(/mso-border-bottom-alt:[^;]+;/, "mso-border-bottom-alt:0pt;")
7
- end
1
+ module IsoDoc
2
+ module WordFunction
3
+ module Body
4
+ def remove_bottom_border(cell)
5
+ cell["style"] =
6
+ cell["style"].gsub(/border-bottom:[^;]+;/, "border-bottom:0pt;")
7
+ .gsub(/mso-border-bottom-alt:[^;]+;/, "mso-border-bottom-alt:0pt;")
8
+ end
8
9
 
9
- SW1 = "solid windowtext".freeze
10
+ SW1 = "solid windowtext".freeze
10
11
 
11
- def new_fullcolspan_row(t, tfoot)
12
- # how many columns in the table?
13
- cols = 0
14
- t.at(".//tr").xpath("./td | ./th").each do |td|
15
- cols += (td["colspan"] ? td["colspan"].to_i : 1)
12
+ def new_fullcolspan_row(table, tfoot)
13
+ # how many columns in the table?
14
+ cols = 0
15
+ table.at(".//tr").xpath("./td | ./th").each do |td|
16
+ cols += (td["colspan"] ? td["colspan"].to_i : 1)
17
+ end
18
+ style = "border-top:0pt;mso-border-top-alt:0pt;"\
19
+ "border-bottom:#{SW1} 1.5pt;mso-border-bottom-alt:#{SW1} 1.5pt;"
20
+ tfoot.add_child("<tr><td colspan='#{cols}' style='#{style}'/></tr>")
21
+ tfoot.xpath(".//td").last
16
22
  end
17
- style = "border-top:0pt;mso-border-top-alt:0pt;"\
18
- "border-bottom:#{SW1} 1.5pt;mso-border-bottom-alt:#{SW1} 1.5pt;"
19
- tfoot.add_child("<tr><td colspan='#{cols}' style='#{style}'/></tr>")
20
- tfoot.xpath(".//td").last
21
- end
22
23
 
23
- def make_tr_attr(td, row, totalrows, _header)
24
- style = td.name == "th" ? "font-weight:bold;" : ""
25
- rowmax = td["rowspan"] ? row + td["rowspan"].to_i - 1 : row
26
- style += <<~STYLE
27
- border-top:#{row.zero? ? "#{SW1} 1.5pt;" : 'none;'}
28
- mso-border-top-alt:#{row.zero? ? "#{SW1} 1.5pt;" : 'none;'}
29
- border-bottom:#{SW1} #{rowmax == totalrows ? '1.5' : '1.0'}pt;
30
- mso-border-bottom-alt:#{SW1} #{rowmax == totalrows ? '1.5' : '1.0'}pt;
31
- STYLE
32
- { rowspan: td["rowspan"], colspan: td["colspan"], valign: td["valign"],
33
- align: td["align"], style: style.gsub(/\n/, "") }
34
- end
24
+ def make_tr_attr(td, row, totalrows, _header)
25
+ style = td.name == "th" ? "font-weight:bold;" : ""
26
+ rowmax = td["rowspan"] ? row + td["rowspan"].to_i - 1 : row
27
+ style += <<~STYLE
28
+ border-top:#{row.zero? ? "#{SW1} 1.5pt;" : 'none;'}
29
+ mso-border-top-alt:#{row.zero? ? "#{SW1} 1.5pt;" : 'none;'}
30
+ border-bottom:#{SW1} #{rowmax == totalrows ? '1.5' : '1.0'}pt;
31
+ mso-border-bottom-alt:#{SW1} #{rowmax == totalrows ? '1.5' : '1.0'}pt;
32
+ STYLE
33
+ { rowspan: td["rowspan"], colspan: td["colspan"], valign: td["valign"],
34
+ align: td["align"], style: style.gsub(/\n/, "") }
35
+ end
35
36
 
36
- def table_attrs(node)
37
- super.merge(attr_code(
38
- {
39
- summary: node["summary"],
40
- width: node["width"],
41
- style: "mso-table-anchor-horizontal:column;"\
42
- "mso-table-overlap:never;border-spacing:0;border-width:1px;#{keep_style(node)}",
43
- class: (node.text.length > 4000 ? "MsoISOTableBig" : "MsoISOTable"),
44
- },
45
- ))
46
- end
37
+ def table_attrs(node)
38
+ ret = {
39
+ summary: node["summary"],
40
+ width: node["width"],
41
+ style: "mso-table-anchor-horizontal:column;mso-table-overlap:never;"\
42
+ "border-spacing:0;border-width:1px;#{keep_style(node)}",
43
+ class: (node.text.length > 4000 ? "MsoISOTableBig" : "MsoISOTable"),
44
+ }
45
+ super.merge(attr_code(ret))
46
+ end
47
47
 
48
- def colgroup(node, t)
49
- colgroup = node.at(ns("./colgroup")) or return
50
- t.colgroup do |cg|
51
- colgroup.xpath(ns("./col")).each do |c|
52
- cg.col **{ width: c["width"] }
48
+ def colgroup(node, t)
49
+ colgroup = node.at(ns("./colgroup")) or return
50
+ t.colgroup do |cg|
51
+ colgroup.xpath(ns("./col")).each do |c|
52
+ cg.col **{ width: c["width"] }
53
+ end
53
54
  end
54
55
  end
55
- end
56
56
 
57
- def table_parse(node, out)
58
- @in_table = true
59
- table_title_parse(node, out)
60
- out.div **{ align: "center", class: "table_container" } do |div|
61
- div.table **table_attrs(node) do |t|
62
- colgroup(node, t)
63
- thead_parse(node, t)
64
- tbody_parse(node, t)
65
- tfoot_parse(node, t)
66
- (dl = node.at(ns("./dl"))) && parse(dl, out)
67
- node.xpath(ns("./note")).each { |n| parse(n, out) }
57
+ def table_parse(node, out)
58
+ @in_table = true
59
+ table_title_parse(node, out)
60
+ out.div **{ align: "center", class: "table_container" } do |div|
61
+ div.table **table_attrs(node) do |t|
62
+ colgroup(node, t)
63
+ thead_parse(node, t)
64
+ tbody_parse(node, t)
65
+ tfoot_parse(node, t)
66
+ (dl = node.at(ns("./dl"))) && parse(dl, out)
67
+ node.xpath(ns("./note")).each { |n| parse(n, out) }
68
+ end
68
69
  end
70
+ @in_table = false
69
71
  end
70
- @in_table = false
71
72
  end
72
73
  end
73
74
  end
@@ -35,11 +35,20 @@ module IsoDoc
35
35
  n = section_names(doc.at(ns("//sections/definitions")), n, 1)
36
36
  clause_names(doc, n)
37
37
  end
38
- if @parse_settings.empty?
39
- middle_section_asset_names(doc)
40
- termnote_anchor_names(doc)
41
- termexample_anchor_names(doc)
42
- end
38
+ end
39
+
40
+ # preempt clause notes with all other types of note (ISO default)
41
+ def asset_anchor_names(doc)
42
+ @parse_settings.empty? or return
43
+ middle_section_asset_names(doc)
44
+ termnote_anchor_names(doc)
45
+ termexample_anchor_names(doc)
46
+ note_anchor_names(doc.xpath(ns("//table | //figure")))
47
+ note_anchor_names(doc.xpath(ns(sections_xpath)))
48
+ example_anchor_names(doc.xpath(ns(sections_xpath)))
49
+ list_anchor_names(doc.xpath(ns(sections_xpath)))
50
+ deflist_anchor_names(doc.xpath(ns(sections_xpath)))
51
+ bookmark_anchor_names(doc)
43
52
  end
44
53
 
45
54
  def preface_clause_name(clause)
data/lib/isodoc/xref.rb CHANGED
@@ -61,15 +61,7 @@ module IsoDoc
61
61
  amend_preprocess(docxml) if @parse_settings.empty?
62
62
  initial_anchor_names(docxml)
63
63
  back_anchor_names(docxml)
64
- # preempt clause notes with all other types of note (ISO default)
65
- if @parse_settings.empty?
66
- note_anchor_names(docxml.xpath(ns("//table | //figure")))
67
- note_anchor_names(docxml.xpath(ns(SECTIONS_XPATH)))
68
- example_anchor_names(docxml.xpath(ns(SECTIONS_XPATH)))
69
- list_anchor_names(docxml.xpath(ns(SECTIONS_XPATH)))
70
- deflist_anchor_names(docxml.xpath(ns(SECTIONS_XPATH)))
71
- bookmark_anchor_names(docxml)
72
- end
64
+ asset_anchor_names(docxml)
73
65
  @parse_settings = {}
74
66
  end
75
67
 
@@ -77,8 +69,8 @@ module IsoDoc
77
69
  Common::ns(xpath)
78
70
  end
79
71
 
80
- def l10n(text, lang = @lang, script = @script)
81
- @i18n.l10n(text, lang, script)
72
+ def l10n(text, lang = @lang, script = @script, locale = @locale)
73
+ @i18n.l10n(text, lang, script, locale)
82
74
  end
83
75
  end
84
76
  end
@@ -1,4 +1,4 @@
1
1
  template:
2
- # skip standardidentifier, it is inserted in front of formattedref within metanorma
3
- standard: "{{ creatornames }} ({{ role}}) . <em>{{ title }}</em> . {{ labels['in'] | capitalize }}:_{{ series_title }}. {{ medium | capitalize }}. {{ edition | capitalize_first }}. {{date}}. {{place}} : {%if creatornames == publisher %}{% else %}{{publisher}}{% endif %} . {{size}}. {{ extent }}. {{ uri }}. {{ labels['at'] | capitalize}}:_{{ access_location }}. [{{ labels['viewed'] }}:_{{date_accessed}}]."
2
+ # skip authoritative identifier, it is inserted in front of formattedref within metanorma
3
+ standard: "{% if creatornames %}{{ creatornames }} ({{ role}}){%else%}{{publisher}}{%endif%} . <em>{{ title }}</em> . {{ labels['in'] | capitalize }}:_{{ series_title }}. {{ medium | capitalize }}. {{ edition | capitalize_first }}. {{date}}. {{place}}: {%if creatornames %}{{publisher}}{% endif %} . {{size}}. {{ extent }}. {{ uri }}. {{ labels['at'] | capitalize}}:_{{ access_location }}. [{{ labels['viewed'] }}:_{{date_accessed}}]."
4
4
 
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.2.3
4
+ version: 2.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-09-05 00:00:00.000000000 Z
11
+ date: 2022-09-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciimath
@@ -52,20 +52,6 @@ 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.7
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.7
69
55
  - !ruby/object:Gem::Dependency
70
56
  name: liquid
71
57
  requirement: !ruby/object:Gem::Requirement
@@ -114,14 +100,14 @@ dependencies:
114
100
  requirements:
115
101
  - - "~>"
116
102
  - !ruby/object:Gem::Version
117
- version: 1.4.0
103
+ version: 1.4.3
118
104
  type: :runtime
119
105
  prerelease: false
120
106
  version_requirements: !ruby/object:Gem::Requirement
121
107
  requirements:
122
108
  - - "~>"
123
109
  - !ruby/object:Gem::Version
124
- version: 1.4.0
110
+ version: 1.4.3
125
111
  - !ruby/object:Gem::Dependency
126
112
  name: mn2pdf
127
113
  requirement: !ruby/object:Gem::Requirement
@@ -142,14 +128,14 @@ dependencies:
142
128
  requirements:
143
129
  - - "~>"
144
130
  - !ruby/object:Gem::Version
145
- version: 0.1.3
131
+ version: 0.1.7
146
132
  type: :runtime
147
133
  prerelease: false
148
134
  version_requirements: !ruby/object:Gem::Requirement
149
135
  requirements:
150
136
  - - "~>"
151
137
  - !ruby/object:Gem::Version
152
- version: 0.1.3
138
+ version: 0.1.7
153
139
  - !ruby/object:Gem::Dependency
154
140
  name: relaton-cli
155
141
  requirement: !ruby/object:Gem::Requirement
@@ -170,14 +156,14 @@ dependencies:
170
156
  requirements:
171
157
  - - "~>"
172
158
  - !ruby/object:Gem::Version
173
- version: 0.4.0
159
+ version: 0.5.0
174
160
  type: :runtime
175
161
  prerelease: false
176
162
  version_requirements: !ruby/object:Gem::Requirement
177
163
  requirements:
178
164
  - - "~>"
179
165
  - !ruby/object:Gem::Version
180
- version: 0.4.0
166
+ version: 0.5.0
181
167
  - !ruby/object:Gem::Dependency
182
168
  name: roman-numerals
183
169
  requirement: !ruby/object:Gem::Requirement
@@ -412,15 +398,23 @@ files:
412
398
  - lib/isodoc-yaml/i18n-ru.yaml
413
399
  - lib/isodoc-yaml/i18n-zh-Hans.yaml
414
400
  - lib/isodoc.rb
401
+ - lib/isodoc/base_style/all.css
415
402
  - lib/isodoc/base_style/all.scss
416
403
  - lib/isodoc/base_style/bands.scss
404
+ - lib/isodoc/base_style/blocks.css
417
405
  - lib/isodoc/base_style/blocks.scss
406
+ - lib/isodoc/base_style/coverpage.css
418
407
  - lib/isodoc/base_style/coverpage.scss
408
+ - lib/isodoc/base_style/defaults.css
419
409
  - lib/isodoc/base_style/defaults.scss
410
+ - lib/isodoc/base_style/metanorma_word.css
420
411
  - lib/isodoc/base_style/metanorma_word.scss
412
+ - lib/isodoc/base_style/nav.css
421
413
  - lib/isodoc/base_style/nav.scss
414
+ - lib/isodoc/base_style/reset.css
422
415
  - lib/isodoc/base_style/reset.scss
423
416
  - lib/isodoc/base_style/scripts.html
417
+ - lib/isodoc/base_style/typography.css
424
418
  - lib/isodoc/base_style/typography.scss
425
419
  - lib/isodoc/class_utils.rb
426
420
  - lib/isodoc/common.rb