metanorma-itu 0.2.4 → 0.2.5

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: '097f0285c22f6f51336c34ad430f66a892dd0dadd7e4414cbcfc5f3d28a66475'
4
- data.tar.gz: 021a5ebb560e1bad15258a86b36f4b4876b5966a09a7cb4b8d6bf52d3bf85cb8
3
+ metadata.gz: c26dd78f21a8922175597c45a4570101e0bc80ea1089f508f1f363a3fc02b440
4
+ data.tar.gz: a061bb4174075cc27f6aaaecbb11f0c5e9db58545d8087885630420ea953c289
5
5
  SHA512:
6
- metadata.gz: d4f096b1352ec9d3ee2186f954cdd662956d8e73e4355bbaa3821b15b2d2c03047dc6825a779fe306546b1f0ebbb434d26f29138f26f672fdc87b5a7884fdfeb
7
- data.tar.gz: 959f94bbf718b055016d8d095f2521715813e20e3d519785f9d626e10627e21488da9a6658030cda83230f522336051832966d168ac2152edd75608961f7e8f7
6
+ metadata.gz: a1445d077b0f147f53a4e3a3a5a69789fcfe20eccc475c482c4131151e2138429bd03809650b637eae8adbaeba74df8f649272b5b0d14cebf722716950f0aa66
7
+ data.tar.gz: dcca5c7362f9777208f13d26c84b4e4cda972d07ac6f25a059a2b792139a0263ad5db217348c69056d2f5cfca863efab3ac3f2e3ff87dd870ebb8a3787b0b38e
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ .DS_Store
2
+ .byebug_history
3
+ .rspec_status
4
+ coverage/
@@ -194,6 +194,14 @@
194
194
  <data type="boolean"/>
195
195
  </attribute>
196
196
  </optional>
197
+ <optional>
198
+ <attribute name="subsequence"/>
199
+ </optional>
200
+ <optional>
201
+ <attribute name="inequality">
202
+ <data type="boolean"/>
203
+ </attribute>
204
+ </optional>
197
205
  <ref name="stem"/>
198
206
  <optional>
199
207
  <ref name="dl"/>
@@ -247,6 +255,9 @@
247
255
  <data type="boolean"/>
248
256
  </attribute>
249
257
  </optional>
258
+ <optional>
259
+ <attribute name="subsequence"/>
260
+ </optional>
250
261
  <optional>
251
262
  <attribute name="lang"/>
252
263
  </optional>
@@ -291,9 +302,15 @@
291
302
  <data type="boolean"/>
292
303
  </attribute>
293
304
  </optional>
305
+ <optional>
306
+ <attribute name="subsequence"/>
307
+ </optional>
294
308
  <optional>
295
309
  <attribute name="alt"/>
296
310
  </optional>
311
+ <optional>
312
+ <attribute name="summary"/>
313
+ </optional>
297
314
  <optional>
298
315
  <attribute name="uri">
299
316
  <data type="anyURI"/>
@@ -423,6 +440,9 @@
423
440
  <data type="boolean"/>
424
441
  </attribute>
425
442
  </optional>
443
+ <optional>
444
+ <attribute name="subsequence"/>
445
+ </optional>
426
446
  <oneOrMore>
427
447
  <choice>
428
448
  <ref name="formula"/>
@@ -486,6 +506,9 @@
486
506
  <data type="boolean"/>
487
507
  </attribute>
488
508
  </optional>
509
+ <optional>
510
+ <attribute name="subsequence"/>
511
+ </optional>
489
512
  <optional>
490
513
  <ref name="source"/>
491
514
  </optional>
@@ -497,6 +520,8 @@
497
520
  </optional>
498
521
  <choice>
499
522
  <ref name="image"/>
523
+ <ref name="video"/>
524
+ <ref name="audio"/>
500
525
  <ref name="pre"/>
501
526
  <zeroOrMore>
502
527
  <ref name="figure"/>
@@ -792,7 +817,7 @@
792
817
  </element>
793
818
  </define>
794
819
  <define name="video">
795
- <element name="image">
820
+ <element name="video">
796
821
  <attribute name="id">
797
822
  <data type="ID"/>
798
823
  </attribute>
@@ -833,7 +858,7 @@
833
858
  </element>
834
859
  </define>
835
860
  <define name="audio">
836
- <element name="image">
861
+ <element name="audio">
837
862
  <attribute name="id">
838
863
  <data type="ID"/>
839
864
  </attribute>
@@ -13,18 +13,21 @@ module Asciidoctor
13
13
  def title_english(node, xml)
14
14
  ["en"].each do |lang|
15
15
  at = { language: lang, format: "text/plain", type: "main" }
16
- xml.title **attr_code(at) do |t|
17
- t << Asciidoctor::Standoc::Utils::asciidoc_sub(node.attr("title") ||
18
- node.attr("title-en") || node.title)
16
+ a = node.attr("title") || node.attr("title-en") || node.title
17
+ xml.title Asciidoctor::Standoc::Utils::asciidoc_sub(a), **attr_code(at)
18
+ if a = node.attr("annextitle") || node.attr("annextitle-en")
19
+ at[:type] = "annex"
20
+ xml.title Asciidoctor::Standoc::Utils::asciidoc_sub(a), **attr_code(at)
19
21
  end
20
22
  end
21
23
  end
22
24
 
23
25
  def title_otherlangs(node, xml)
24
26
  node.attributes.each do |k, v|
25
- next unless /^title-(?<titlelang>.+)$/ =~ k
27
+ next unless /^(annex)?title-(?<titlelang>.+)$/ =~ k
26
28
  next if titlelang == "en"
27
- xml.title v, { language: titlelang, format: "text/plain", type: "main" }
29
+ xml.title v, { language: titlelang, format: "text/plain",
30
+ type: /^annex/.match(k) ? "annex" : "main" }
28
31
  end
29
32
  end
30
33
 
@@ -154,12 +157,22 @@ module Asciidoctor
154
157
  xml.ip_notice_received (node.attr("ip-notice-received") || "false")
155
158
  end
156
159
 
160
+ def structured_id(node, xml)
161
+ return unless node.attr("docnumber")
162
+ xml.structuredidentifier do |i|
163
+ i.bureau node.attr("bureau") || "T"
164
+ i.docnumber node.attr("docnumber")
165
+ a = node.attr("annexid") and i.annexid a
166
+ end
167
+ end
168
+
157
169
  def metadata_ext(node, xml)
158
170
  metadata_doctype(node, xml)
159
171
  metadata_committee(node, xml)
160
172
  metadata_ics(node, xml)
161
173
  metadata_recommendationstatus(node, xml)
162
174
  metadata_ip_notice(node, xml)
175
+ structured_id(node, xml)
163
176
  end
164
177
  end
165
178
  end
@@ -81,6 +81,19 @@
81
81
  <ref name="ItuGroup"/>
82
82
  </element>
83
83
  </define>
84
+ <define name="structuredidentifier">
85
+ <element name="structuredidentifier">
86
+ <ref name="bureau"/>
87
+ <element name="docnumber">
88
+ <text/>
89
+ </element>
90
+ <optional>
91
+ <element name="annexid">
92
+ <text/>
93
+ </element>
94
+ </optional>
95
+ </element>
96
+ </define>
84
97
  <define name="BibDataExtensionType">
85
98
  <optional>
86
99
  <ref name="doctype"/>
@@ -92,6 +105,9 @@
92
105
  <optional>
93
106
  <ref name="recommendationstatus"/>
94
107
  </optional>
108
+ <optional>
109
+ <ref name="structuredidentifier"/>
110
+ </optional>
95
111
  </define>
96
112
  </include>
97
113
  <define name="recommendationstatus">
@@ -30,6 +30,9 @@
30
30
  <data type="boolean"/>
31
31
  </attribute>
32
32
  </optional>
33
+ <optional>
34
+ <attribute name="subsequence"/>
35
+ </optional>
33
36
  <attribute name="id">
34
37
  <data type="ID"/>
35
38
  </attribute>
@@ -38,9 +38,33 @@ module IsoDoc
38
38
  div.h1 **{ class: "Annex" } do |t|
39
39
  t << "#{anchor(annex['id'], :label)} "
40
40
  t.br
41
+ t.br
41
42
  t.b do |b|
42
43
  name&.children&.each { |c2| parse(c2, b) }
43
44
  end
45
+ type = annex&.document&.root&.at("//bibdata/ext/doctype")&.text || "recommendation"
46
+ type = type.split(" ").map {|w| w.capitalize }.join(" ")
47
+ info = annex["obligation"] == "informative"
48
+ t.p { |p| p << (info ? @inform_annex_lbl : @norm_annex_lbl).sub(/%/, type) }
49
+ end
50
+ end
51
+
52
+ def annex_name_lbl(clause, num)
53
+ lbl = clause["obligation"] == "informative" ? @appendix_lbl : @annex_lbl
54
+ l10n("<b>#{lbl} #{num}</b>")
55
+ end
56
+
57
+ def back_anchor_names(docxml)
58
+ super
59
+ if annexid = docxml&.at(ns("//bibdata/ext/structuredidentifier/annexid"))&.text
60
+ docxml.xpath(ns("//annex")).each { |c| annex_names(c, annexid) }
61
+ else
62
+ docxml.xpath(ns("//annex[@obligation = 'informative']")).each_with_index do |c, i|
63
+ annex_names(c, RomanNumerals.to_roman(i + 1))
64
+ end
65
+ docxml.xpath(ns("//annex[not(@obligation = 'informative')]")).each_with_index do |c, i|
66
+ annex_names(c, (65 + i + (i > 7 ? 1 : 0)).chr.to_s)
67
+ end
44
68
  end
45
69
  end
46
70
 
@@ -102,9 +126,7 @@ module IsoDoc
102
126
 
103
127
  def split_bibitems(f)
104
128
  bibitem = []
105
- f.xpath(ns("./bibitem")).each do |x|
106
- bibitem << x
107
- end
129
+ f.xpath(ns("./bibitem")).each { |x| bibitem << x }
108
130
  bibitem
109
131
  end
110
132
 
@@ -30,6 +30,9 @@
30
30
  {% if edition %} <div> Revision {{ edition }}</div> {% endif %}
31
31
  <div> {{ draftinfo }}</div>
32
32
  </div>
33
+ {% if annexid %}
34
+ <div class="doc-identifier">{{annexid}}</div>
35
+ {% endif %}
33
36
  <div class="publication-month">
34
37
  ({{ pubdate_monthyear }})
35
38
  </div>
@@ -50,6 +53,9 @@
50
53
  <span class="doc-title">{{ doctitle }}</span>
51
54
  {% if docsubtitle %}
52
55
  <br/><span class="doc-subtitle">{{ docsubtitle }}</span>
56
+ {% if annextitle %}
57
+ <br/><span class="doctitle">{{ annextitle }}</span>
58
+ {% endif %}
53
59
  {% endif %}
54
60
  </div>
55
61
 
@@ -142,7 +142,11 @@
142
142
  <span style='mso-bookmark:_Hlk526346232'></span>
143
143
  <td width="265" valign="top" style='width:198.55pt;padding:0cm 4.25pt 0cm 4.25pt;
144
144
  height:48.7pt'>
145
- <p class="MsoNormal" align="right" style='margin-top:0cm;text-align:right'><span
145
+ <p class="MsoNormal" align="right" style='margin-top:0cm;text-align:right'>
146
+ {% if annexid %}
147
+ <span style='font-size:18.0pt;font-family:"Arial",sans-serif'><b>{{annexid}}</b></span><br/>
148
+ {% endif %}
149
+ <span
146
150
  style='mso-bookmark:_Hlk526346232'><a name="ddatee"><span lang="EN-US"
147
151
  style='font-size:14.0pt;mso-bidi-font-size:10.0pt;font-family:"Arial",sans-serif;
148
152
  mso-ansi-language:EN-US'>{% if pubdate_monthyear %}({{ pubdate_monthyear }}){% endif %}<span style='mso-spacerun:yes'>   </span><o:p></o:p></span></a></span></p>
@@ -191,9 +195,11 @@
191
195
  <td width="569" colspan="4" valign="top" style='width:426.5pt;padding:0cm 5.4pt 0cm 5.4pt;
192
196
  height:4.0cm;mso-height-rule:exactly'>
193
197
  <p class="MsoNormal" align="left" style='text-align:left;tab-stops:39.7pt 59.55pt 79.4pt 99.25pt right 17.0cm'><span
194
- style='mso-bookmark:_Hlk526346232'><a name="c1tite"><b><span lang="EN-GB"
198
+ style='mso-bookmark:_Hlk526346232'><a name="c1tite">
199
+ <span lang="EN-GB"
195
200
  style='font-size:18.0pt;mso-bidi-font-size:10.0pt;font-family:"Arial",sans-serif;
196
- mso-bidi-font-family:"Times New Roman"'>{{ doctitle }}</span></b></a></span><span
201
+ mso-bidi-font-family:"Times New Roman"'>{% if annextitle %}{{ doctitle }}<br/><b>{{ annextitle }}</b>{% else %}<b>{{ doctitle }}</b>{% endif %}</span>
202
+ </a></span><span
197
203
  style='mso-bookmark:_Hlk526346232'><span style='mso-bookmark:c1tite'><b><span
198
204
  lang="EN-US" style='font-size:18.0pt;mso-bidi-font-size:10.0pt;font-family:
199
205
  "Arial",sans-serif;mso-bidi-font-family:"Times New Roman";mso-ansi-language:
@@ -5,4 +5,7 @@ elsewhere_terms: >-
5
5
  This Recommendation uses the following terms defined elsewhere:
6
6
  here_terms: >-
7
7
  This Recommendation defines the following terms:
8
-
8
+ norm_annex: (This annex forms an integral part of this %.)
9
+ inform_annex: (This appendix does not form an integral part of this %.)
10
+ formula: Equation
11
+ inequality: Inequality
@@ -17,6 +17,8 @@ module IsoDoc
17
17
  set(:series1, series1)
18
18
  series2 = isoxml&.at(ns("//bibdata/series[@type='tertiary']/title"))&.text
19
19
  set(:series2, series2)
20
+ annext = isoxml&.at(ns("//bibdata/title[@type='annex']"))&.text
21
+ set(:annextitle, annext)
20
22
  end
21
23
 
22
24
  def subtitle(_isoxml, _out)
@@ -35,6 +37,10 @@ module IsoDoc
35
37
  set(:docnumber, dn&.text)
36
38
  dn = isoxml.at(ns("//bibdata/docidentifier"))
37
39
  set(:docidentifier, dn&.text)
40
+ dn = isoxml.at(ns("//bibdata/ext/structuredidentifier/annexid"))
41
+ oblig = isoxml&.at(ns("//annex/@obligation"))&.text
42
+ lbl = oblig == "informative" ? @labels["appendix"] : @labels["annex"]
43
+ dn and set(:annexid, IsoDoc::Function::I18n::l10n("#{lbl} #{dn&.text}"))
38
44
  end
39
45
 
40
46
  def unpublished(status)
@@ -81,6 +81,8 @@ module IsoDoc
81
81
  def convert1(docxml, filename, dir)
82
82
  FileUtils.cp html_doc_path('itu-document-comb.png'), File.join(@localdir, "itu-document-comb.png")
83
83
  FileUtils.cp html_doc_path('logo.png'), File.join(@localdir, "logo.png")
84
+ @files_to_delete << File.join(@localdir, "itu-document-comb.png")
85
+ @files_to_delete << File.join(@localdir, "logo.png")
84
86
  super
85
87
  end
86
88
 
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module ITU
3
- VERSION = "0.2.4"
3
+ VERSION = "0.2.5"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-itu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-09-12 00:00:00.000000000 Z
11
+ date: 2019-09-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciidoctor
@@ -243,6 +243,7 @@ executables: []
243
243
  extensions: []
244
244
  extra_rdoc_files: []
245
245
  files:
246
+ - ".gitignore"
246
247
  - ".hound.yml"
247
248
  - ".rubocop.yml"
248
249
  - ".travis.yml"