metanorma-bipm 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -28,11 +28,15 @@
28
28
  </div>
29
29
 
30
30
  <div class="coverpage-title">
31
- {% if appendixtitle %}
31
+ {% if appendixtitle or parttitle or subparttitle %}
32
32
  <span class="title-third">{{ doctitle }}</span>
33
33
  <span class="title-third">{{ docsubtitle }}</span><br/>
34
- <span class="title-first">{% if appendixid %}{{ appendixid}}: {% endif %}{{ appendixtitle }}</span><br/>
35
- <span class="title-second">{% if appendixid_alt %}{{ appendixid_alt}}: {% endif %}{{ appendixsubtitle }}</span>
34
+ {% if partid %}<span class="title-first">{{ partid}}: {{ parttitle }}</span><br/>{% endif %}
35
+ {% if partid_alt %}<span class="title-second">{{ partid_alt}}: {{ partsubtitle }}</span>{% endif %}
36
+ {% if subparttitle %}<span class="title-first">{{ subparttitle }}</span><br/>{% endif %}
37
+ {% if subpartsubtitle %}<span class="title-second">{{ subpartsubtitle }}</span><br/>{% endif %}
38
+ {% if appendixid %}<span class="title-first">{{ appendixid}}: {{ appendixtitle }}</span><br/>{% endif %}
39
+ {% if appendixid_alt %}<span class="title-second">{{ appendixid_alt}}: {{ appendixsubtitle }}</span>{% endif %}
36
40
  {% else %}
37
41
  <span class="title-first">{{ doctitle }}</span><br/>
38
42
  <span class="title-second">{{ docsubtitle }}</span>
@@ -61,6 +65,15 @@
61
65
  <div class="coverpage-tc-name">
62
66
  <span>{{ metadata_extensions["editorialgroup"]["committee_acronym"] }}{% if metadata_extensions["editorialgroup"]["committee_acronym"] and committee %}: {% endif %}{{ committee }}</span>
63
67
  </div>
68
+
69
+ {% if authors %}
70
+ <div class="coverpage-tc-name">
71
+ {% for item in authors %}
72
+ <span>{{item}} {% if authors_affiliations[forloop.index0] %}({{ authors_affiliations[forloop.index0] }}){% endif %}{% if forloop.last == false %}, {% endif %}{% endfor %}.
73
+ </div>
74
+ {% endif %}
75
+
76
+
64
77
  </div>
65
78
 
66
79
  <div class="wrapper-top-bottom"></div>
@@ -450,31 +450,6 @@ p.document-stage {
450
450
  font-weight: 300;
451
451
  height: 160px; }
452
452
 
453
- #proposal-band p {
454
- height: 150px; }
455
-
456
- #standard-band,
457
- #published-band {
458
- background-color: #007864; }
459
-
460
- #standard,
461
- #published {
462
- border-bottom: solid 3px #007864; }
463
-
464
- #governance,
465
- #policy-and-procedures {
466
- border-bottom: solid 3px #750697; }
467
-
468
- #governance-band,
469
- #policy-and-procedures-band {
470
- background-color: #750697; }
471
-
472
- #guide {
473
- border-bottom: solid 3px #48a0e7; }
474
-
475
- #guide-band {
476
- background-color: #48a0e7; }
477
-
478
453
  .coverpage-maturity {
479
454
  font-family: {{bodyfont}};
480
455
  font-weight: 400;
@@ -482,38 +457,6 @@ p.document-stage {
482
457
  margin: 0 0 2em 0;
483
458
  text-transform: uppercase; }
484
459
 
485
- #working-draft,
486
- #proposal {
487
- border-bottom: solid 3px #F7803C; }
488
-
489
- #working-draft-band,
490
- #proposal-band {
491
- background-color: #F7803C; }
492
-
493
- #committee-draft {
494
- border-bottom: solid 3px #fd06fd; }
495
-
496
- #committee-draft-band {
497
- background-color: #fd06fd; }
498
-
499
- #draft-standard {
500
- border-bottom: solid 3px #fdf906; }
501
-
502
- #draft-standard-band {
503
- background-color: #fdf906; }
504
-
505
- #standard {
506
- border-bottom: solid 3px #007864; }
507
-
508
- #standard-band {
509
- background-color: #007864; }
510
-
511
- #obsolete {
512
- border-bottom: solid 3px #7e0d13; }
513
-
514
- #obsolete-band {
515
- background-color: #7e0d13; }
516
-
517
460
  /*
518
461
  3. TYPOGRAPHY
519
462
  */
@@ -612,6 +555,53 @@ ul li:first-child {
612
555
  content: " ";
613
556
  display: none; }
614
557
 
558
+ /* https://github.com/metanorma/metanorma-bipm/issues/47 */
559
+ ol[class="alphabet"] {
560
+ counter-reset: alphabet; }
561
+
562
+ ol[class="roman"] {
563
+ counter-reset: roman; }
564
+
565
+ ol[class="alphabet"] ol[class="alphabet"] {
566
+ counter-reset: none; }
567
+
568
+ ol[class="alphabet"] > li {
569
+ list-style: none;
570
+ position: relative; }
571
+
572
+ ol[class="alphabet"] ol[class="alphabet"] > li {
573
+ list-style: inherit; }
574
+
575
+ ol[class="alphabet"] > li:before {
576
+ counter-increment: alphabet;
577
+ content: counter(alphabet, lower-alpha) ") ";
578
+ position: absolute;
579
+ left: -1.4em; }
580
+
581
+ ol[class="alphabet"] ol[class="alphabet"] > li:before {
582
+ counter-increment: none;
583
+ content: initial; }
584
+
585
+ ol[class="roman"] ol[class="roman"] {
586
+ counter-reset: none; }
587
+
588
+ ol[class="roman"] > li {
589
+ list-style: none;
590
+ position: relative; }
591
+
592
+ ol[class="roman"] ol[class="roman"] > li {
593
+ list-style: inherit; }
594
+
595
+ ol[class="roman"] > li:before {
596
+ counter-increment: roman;
597
+ content: "(" counter(roman, lower-roman) ") ";
598
+ position: absolute;
599
+ left: -2.0em; }
600
+
601
+ ol[class="roman"] ol[class="roman"] > li:before {
602
+ counter-increment: none;
603
+ content: initial; }
604
+
615
605
  /*
616
606
  3.4 Rules
617
607
  */
@@ -147,84 +147,10 @@ p.document-stage {
147
147
  height: 160px;
148
148
  }
149
149
 
150
- #proposal-band p {
151
- height: 150px;
152
- }
153
-
154
- #standard-band,
155
- #published-band {
156
- background-color: #007864;
157
- }
158
-
159
- #standard,
160
- #published {
161
- border-bottom: solid 3px #007864;
162
- }
163
-
164
- #governance,
165
- #policy-and-procedures {
166
- border-bottom: solid 3px #750697;
167
- }
168
-
169
- #governance-band,
170
- #policy-and-procedures-band {
171
- background-color: #750697;
172
- }
173
-
174
- #guide {
175
- border-bottom: solid 3px #48a0e7;
176
- }
177
-
178
- #guide-band {
179
- background-color: #48a0e7;
180
- }
181
-
182
150
  .coverpage-maturity {
183
151
  @include coverpageStageBlock();
184
152
  }
185
153
 
186
- #working-draft,
187
- #proposal {
188
- border-bottom: solid 3px #F7803C;
189
- }
190
-
191
- #working-draft-band,
192
- #proposal-band {
193
- background-color: #F7803C;
194
- }
195
-
196
- #committee-draft {
197
- border-bottom: solid 3px #fd06fd;
198
- }
199
-
200
- #committee-draft-band {
201
- background-color: #fd06fd;
202
- }
203
-
204
- #draft-standard {
205
- border-bottom: solid 3px #fdf906;
206
- }
207
-
208
- #draft-standard-band {
209
- background-color: #fdf906;
210
- }
211
-
212
- #standard {
213
- border-bottom: solid 3px #007864;
214
- }
215
-
216
- #standard-band {
217
- background-color: #007864;
218
- }
219
-
220
- #obsolete {
221
- border-bottom: solid 3px #7e0d13;
222
- }
223
-
224
- #obsolete-band {
225
- background-color: #7e0d13;
226
- }
227
-
228
154
  /*
229
155
  3. TYPOGRAPHY
230
156
  */
@@ -330,6 +256,56 @@ ul li:first-child {
330
256
  display: none;
331
257
  }
332
258
 
259
+ /* https://github.com/metanorma/metanorma-bipm/issues/47 */
260
+
261
+ ol[class="alphabet"] {
262
+ counter-reset: alphabet;
263
+ }
264
+ ol[class="roman"] {
265
+ counter-reset: roman;
266
+ }
267
+ ol[class="alphabet"] ol[class="alphabet"] {
268
+ counter-reset: none;
269
+ }
270
+ ol[class="alphabet"] > li {
271
+ list-style: none;
272
+ position: relative;
273
+ }
274
+ ol[class="alphabet"] ol[class="alphabet"] > li {
275
+ list-style: inherit;
276
+ }
277
+ ol[class="alphabet"] > li:before {
278
+ counter-increment: alphabet;
279
+ content: counter(alphabet, lower-alpha)") ";
280
+ position: absolute;
281
+ left: -1.4em;
282
+ }
283
+ ol[class="alphabet"] ol[class="alphabet"] > li:before {
284
+ counter-increment: none;
285
+ content: initial;
286
+ }
287
+ ol[class="roman"] ol[class="roman"] {
288
+ counter-reset: none;
289
+ }
290
+ ol[class="roman"] > li {
291
+ list-style: none;
292
+ position: relative;
293
+ }
294
+ ol[class="roman"] ol[class="roman"] > li {
295
+ list-style: inherit;
296
+ }
297
+ ol[class="roman"] > li:before {
298
+ counter-increment: roman;
299
+ content: "("counter(roman, lower-roman)") ";
300
+ position: absolute;
301
+ left: -2.0em;
302
+ }
303
+ ol[class="roman"] ol[class="roman"] > li:before {
304
+ counter-increment: none;
305
+ content: initial;
306
+ }
307
+
308
+
333
309
 
334
310
  /*
335
311
  3.4 Rules
@@ -22,6 +22,23 @@ module IsoDoc
22
22
  end
23
23
  end
24
24
 
25
+ def counter_reset(node)
26
+ s = node["start"]
27
+ return nil unless s && !s.empty? && !s.to_i.zero?
28
+ "counter-reset: #{node['type']} #{s.to_i - 1};"
29
+ end
30
+
31
+ def ol_attrs(node)
32
+ klass, style = if node["type"] == "roman" &&
33
+ !node.at("./ancestor::xmlns:ol[@type = 'roman']") ||
34
+ node["type"] == "alphabet" &&
35
+ !node.at("./ancestor::xmlns:ol[@type = 'alphabet']")
36
+ [node["type"], counter_reset(node)]
37
+ end
38
+ super.merge(attr_code(type: ol_style((node["type"] || "arabic").to_sym),
39
+ start: node["start"]), style: style, class: klass)
40
+ end
41
+
25
42
  include BaseConvert
26
43
  include Init
27
44
  end
@@ -1,2 +1,16 @@
1
1
  annex: Appendix
2
2
  see: see
3
+ clause: chapter
4
+ subclause: section
5
+ formula: equation
6
+ inequality: inequality
7
+ bibliography: References
8
+ note_xref: note
9
+ termnote: note % to entry
10
+ list: list
11
+ figure: figure
12
+ table: table
13
+ requirement: requirement
14
+ recommendation: recommendation
15
+ permission: permission
16
+ example_xref: example
@@ -1,5 +1,19 @@
1
1
  annex: Annexe
2
2
  see: voir
3
+ clause: chapître
4
+ clause: section
5
+ formula: équation
6
+ inequality: inégalité
7
+ bibliography: Références
8
+ note_xref: note
9
+ termnote: note % à l’article
10
+ list: liste
11
+ figure: figure
12
+ table: tableau
13
+ requirement: exigence
14
+ recommendation: recommandation
15
+ permission: autorisation
16
+ example_xref: exemple
3
17
  doctype_dict:
4
18
  brochure: brochure
5
19
  mise-en-pratique: mise-en-pratique
@@ -24,16 +24,17 @@ module IsoDoc
24
24
  TITLE = "//bibdata/title".freeze
25
25
 
26
26
  def title(isoxml, _out)
27
- lang1 = @lang == "fr" ? "fr" : "en"
28
- lang2 = @lang == "fr" ? "en" : "fr"
27
+ lang1, lang2 = @lang == "fr" ? %w(fr en) : %w(en fr)
29
28
  set(:doctitle, @c.encode(isoxml&.at(
30
29
  ns("#{TITLE}[@type='main'][@language='#{lang1}']"))&.text || ""))
31
30
  set(:docsubtitle, @c.encode(isoxml&.at(
32
31
  ns("#{TITLE}[@type='main'][@language='#{lang2}']"))&.text || ""))
33
- set(:appendixtitle, @c.encode(isoxml&.at(
34
- ns("#{TITLE}[@type='appendix'][@language='#{lang1}']"))&.text || ""))
35
- set(:appendixsubtitle, @c.encode(isoxml&.at(
36
- ns("#{TITLE}[@type='appendix'][@language='#{lang2}']"))&.text || ""))
32
+ %w(appendix part subtitle).each do |e|
33
+ set("#{e}title".to_sym, @c.encode(isoxml&.at(
34
+ ns("#{TITLE}[@type='#{e}'][@language='#{lang1}']"))&.text || ""))
35
+ set("#{e}subtitle".to_sym, @c.encode(isoxml&.at(
36
+ ns("#{TITLE}[@type='#{e}'][@language='#{lang2}']"))&.text || ""))
37
+ end
37
38
  end
38
39
 
39
40
  def status_print(status)
@@ -46,11 +47,18 @@ module IsoDoc
46
47
 
47
48
  def docid(isoxml, _out)
48
49
  super
49
- label1 = @lang == "fr" ? "Annexe" : "Appendix"
50
- label2 = @lang == "fr" ? "Appendix" : "Annexe"
50
+ label1, label2 = @lang == "fr" ? %w(Annexe Appendix) : %w(Appendix Annexe)
51
51
  dn = isoxml.at(ns("//bibdata/ext/structuredidentifier/appendix"))
52
52
  dn and set(:appendixid, @i18n.l10n("#{label1} #{dn&.text}"))
53
53
  dn and set(:appendixid_alt, @i18n.l10n("#{label2} #{dn&.text}"))
54
+ label1, label2 = @lang == "fr" ? %w(Partie Part) : %w(Part Partie)
55
+ dn = isoxml.at(ns("//bibdata/ext/structuredidentifier/part"))
56
+ dn and set(:partid, @i18n.l10n("#{label1} #{dn&.text}"))
57
+ dn and set(:partid_alt, @i18n.l10n("#{label2} #{dn&.text}"))
58
+ end
59
+
60
+ def extract_person_names_affiliations(authors)
61
+ extract_person_affiliations(authors)
54
62
  end
55
63
  end
56
64
  end
@@ -11,7 +11,10 @@ module IsoDoc
11
11
  end
12
12
 
13
13
  def pdf_stylesheet(docxml)
14
- "bipm.brochure.xsl"
14
+ doctype = docxml&.at(ns("//bibdata/ext/doctype"))&.text
15
+ doctype = "brochure" unless %w(guide mise-en-pratique rapport).
16
+ include? doctype
17
+ "bipm.#{doctype}.xsl"
15
18
  end
16
19
 
17
20
  def pdf_options(docxml)
@@ -9,7 +9,7 @@ module IsoDoc
9
9
  return if labelled_ancestor(f)
10
10
  return if f["unnumbered"] && !f.at(ns("./name"))
11
11
  n = @xrefs.anchor(f['id'], :label, false)
12
- prefix_name(f, ".<tab/>", l10n("#{@i18n.table} #{n}"), "name")
12
+ prefix_name(f, ".<tab/>", l10n("#{@i18n.table.capitalize} #{n}"), "name")
13
13
  end
14
14
 
15
15
  def annex1(f)
@@ -72,20 +72,25 @@ module IsoDoc
72
72
  end
73
73
 
74
74
  def list_authors(xml)
75
- ret = list_people(xml, "//bibdata/contributor[xmlns:role/@type = 'author']/person")
75
+ ret = list_people(
76
+ xml, "//bibdata/contributor[xmlns:role/@type = 'author']/person")
76
77
  @i18n.multiple_and(ret, @i18n.get["and"])
77
78
  end
78
79
 
80
+ COCHAIR = "xmlns:role[contains(text(),'co-chair')]".freeze
81
+ CHAIR = "[xmlns:role[contains(text(),'chair')]"\
82
+ "[not(contains(text(),'co-chair'))]]".freeze
83
+
79
84
  def list_cochairs(xml)
80
- ret = list_people(xml, "//bibdata/contributor[xmlns:role[contains(text(),'co-chair')]]/person")
81
- role = xml&.at(ns("//bibdata/contributor[xmlns:role[contains(text(),'co-chair')]]/role"))&.text
85
+ ret = list_people(xml, "//bibdata/contributor[#{COCHAIR}]/person")
86
+ role = xml&.at(ns("//bibdata/contributor[#{COCHAIR}]/role"))&.text
82
87
  label = ret.size > 1 && role ? "#{role}s" : role
83
88
  "#{label}: #{@i18n.multiple_and(ret, @i18n.get["and"])}"
84
89
  end
85
90
 
86
91
  def list_chairs(xml)
87
- ret = list_people(xml, "//bibdata/contributor[xmlns:role[contains(text(),'chair')][not(contains(text(),'co-chair'))]]/person")
88
- role = xml&.at(ns("//bibdata/contributor[xmlns:role[contains(text(),'chair')][not(contains(text(),'co-chair'))]]/role"))&.text
92
+ ret = list_people(xml, "//bibdata/contributor#{CHAIR}/person")
93
+ role = xml&.at(ns("//bibdata/contributor#{CHAIR}/role"))&.text
89
94
  label = ret.size > 1 && role ? "#{role}s" : role
90
95
  "#{label}: #{@i18n.multiple_and(ret, @i18n.get["and"])}"
91
96
  end
@@ -103,6 +108,12 @@ module IsoDoc
103
108
  ret
104
109
  end
105
110
 
111
+ def twitter_cldr_localiser()
112
+ locale = :fr
113
+ twitter_cldr_reader(locale)
114
+ locale
115
+ end
116
+
106
117
  include Init
107
118
  end
108
119
  end