metanorma-bipm 2.4.2 → 2.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/isodoc/bipm/bipm.brochure.xsl +70 -13
- data/lib/isodoc/bipm/bipm.guide.xsl +70 -13
- data/lib/isodoc/bipm/bipm.mise-en-pratique.xsl +70 -13
- data/lib/isodoc/bipm/bipm.rapport.xsl +70 -13
- data/lib/isodoc/bipm/html/html_bipm_titlepage.html +15 -1
- data/lib/isodoc/bipm/html/htmlstyle.css +6 -0
- data/lib/isodoc/bipm/html/htmlstyle.scss +1 -0
- data/lib/isodoc/bipm/i18n-en.yaml +2 -0
- data/lib/isodoc/bipm/i18n-fr.yaml +2 -0
- data/lib/isodoc/bipm/init.rb +5 -0
- data/lib/isodoc/bipm/jcgm.standard.xsl +66 -9
- data/lib/isodoc/bipm/metadata.rb +27 -15
- data/lib/isodoc/bipm/presentation_xml_convert.rb +14 -16
- data/lib/metanorma/bipm/biblio.rng +28 -25
- data/lib/metanorma/bipm/cleanup.rb +89 -0
- data/lib/metanorma/bipm/converter.rb +4 -42
- data/lib/metanorma/bipm/relaton-bipm.rng +1 -0
- data/lib/metanorma/bipm/version.rb +1 -1
- data/metanorma-bipm.gemspec +2 -2
- data/metanorma.yml +1 -0
- metadata +7 -6
@@ -21,6 +21,12 @@
|
|
21
21
|
<span class="docnumber">{{ docnumber }}</span>
|
22
22
|
<span class="docnumber-separator">:</span>
|
23
23
|
<span class="docyear">{{ docyear }} {{ draftinfo }}</span>
|
24
|
+
{% if version %}
|
25
|
+
<br/>{{ labels["version"] }}: {{ version }}
|
26
|
+
{% endif %}
|
27
|
+
{% if revdate %}
|
28
|
+
<br/>{{ labels["date"] }}: {{ revdate }}
|
29
|
+
{% endif %}
|
24
30
|
</div>
|
25
31
|
|
26
32
|
<div class="coverpage-logo">
|
@@ -73,10 +79,18 @@
|
|
73
79
|
{% if authors %}
|
74
80
|
<div class="coverpage-tc-name">
|
75
81
|
{% for item in authors %}
|
76
|
-
<span>{{item}}
|
82
|
+
<span>{{item}}{% if authors_affiliations[forloop.index0] != "" %} ({{ authors_affiliations[forloop.index0] }}){% endif %}{% if forloop.last == false %}, {% endif %}</span>{% endfor %}.
|
77
83
|
</div>
|
78
84
|
{% endif %}
|
79
85
|
|
86
|
+
{% if authorizer %}
|
87
|
+
<div class="coverpage-tc-name">
|
88
|
+
{{ labels["authorized"] }}:
|
89
|
+
{% for item in authorizer %}
|
90
|
+
<span>{{item}}{% if forloop.last == false %}, {% endif %}</span>{% endfor %}
|
91
|
+
</div>
|
92
|
+
{% endif %}
|
93
|
+
|
80
94
|
<div class="coverpage-warning" id="coverpage-note-destination"/>
|
81
95
|
|
82
96
|
</div>
|
@@ -231,6 +231,12 @@ table.rouge-line-table pre {
|
|
231
231
|
#strategy {
|
232
232
|
border-bottom: solid 3px #BD9391; }
|
233
233
|
|
234
|
+
#policy-band {
|
235
|
+
background-color: #BD9391; }
|
236
|
+
|
237
|
+
#policy {
|
238
|
+
border-bottom: solid 3px #BD9391; }
|
239
|
+
|
234
240
|
#cipm-mra-band {
|
235
241
|
background-color: #004E64; }
|
236
242
|
|
data/lib/isodoc/bipm/init.rb
CHANGED
@@ -20,6 +20,11 @@ module IsoDoc
|
|
20
20
|
i18nyaml: i18nyaml || @i18nyaml)
|
21
21
|
end
|
22
22
|
|
23
|
+
def bibrenderer(options = {})
|
24
|
+
::Relaton::Render::BIPM::General.new(options.merge(language: @lang,
|
25
|
+
i18nhash: @i18n.get))
|
26
|
+
end
|
27
|
+
|
23
28
|
def omit_docid_prefix(prefix)
|
24
29
|
%w(BIPM BIPM-long).include? prefix and return true
|
25
30
|
super
|
@@ -1737,6 +1737,8 @@
|
|
1737
1737
|
<xsl:param name="svg_images"/> <!-- svg images array -->
|
1738
1738
|
<xsl:variable name="images" select="document($svg_images)"/>
|
1739
1739
|
<xsl:param name="basepath"/> <!-- base path for images -->
|
1740
|
+
<xsl:param name="inputxml_basepath"/> <!-- input xml file path -->
|
1741
|
+
<xsl:param name="inputxml_filename"/> <!-- input xml file name -->
|
1740
1742
|
<xsl:param name="external_index"/><!-- path to index xml, generated on 1st pass, based on FOP Intermediate Format -->
|
1741
1743
|
<xsl:param name="syntax-highlight">false</xsl:param> <!-- syntax highlighting feature, default - off -->
|
1742
1744
|
<xsl:param name="add_math_as_text">true</xsl:param> <!-- add math in text behind svg formula, to copy-paste formula from PDF as text -->
|
@@ -1789,6 +1791,20 @@
|
|
1789
1791
|
<xsl:call-template name="getLang"/>
|
1790
1792
|
</xsl:variable>
|
1791
1793
|
|
1794
|
+
<xsl:variable name="inputxml_filename_prefix">
|
1795
|
+
<xsl:choose>
|
1796
|
+
<xsl:when test="contains($inputxml_filename, '.presentation.xml')">
|
1797
|
+
<xsl:value-of select="substring-before($inputxml_filename, '.presentation.xml')"/>
|
1798
|
+
</xsl:when>
|
1799
|
+
<xsl:when test="contains($inputxml_filename, '.xml')">
|
1800
|
+
<xsl:value-of select="substring-before($inputxml_filename, '.xml')"/>
|
1801
|
+
</xsl:when>
|
1802
|
+
<xsl:otherwise>
|
1803
|
+
<xsl:value-of select="$inputxml_filename"/>
|
1804
|
+
</xsl:otherwise>
|
1805
|
+
</xsl:choose>
|
1806
|
+
</xsl:variable>
|
1807
|
+
|
1792
1808
|
<!-- Note 1: Each xslt has declated variable `namespace` that allows to set some properties, processing logic, etc. for concrete xslt.
|
1793
1809
|
You can put such conditions by using xslt construction `xsl:if test="..."` or <xsl:choose><xsl:when test=""></xsl:when><xsl:otherwiste></xsl:otherwiste></xsl:choose>,
|
1794
1810
|
BUT DON'T put any another conditions together with $namespace = '...' (such conditions will be ignored). For another conditions, please use nested xsl:if or xsl:choose -->
|
@@ -2739,6 +2755,10 @@
|
|
2739
2755
|
|
2740
2756
|
</xsl:attribute-set>
|
2741
2757
|
|
2758
|
+
<xsl:template name="refine_figure-block-style">
|
2759
|
+
|
2760
|
+
</xsl:template>
|
2761
|
+
|
2742
2762
|
<xsl:attribute-set name="figure-style">
|
2743
2763
|
|
2744
2764
|
</xsl:attribute-set>
|
@@ -3654,7 +3674,7 @@
|
|
3654
3674
|
<xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)/*/tr[1]/td)"/>
|
3655
3675
|
|
3656
3676
|
<xsl:variable name="colwidths">
|
3657
|
-
<xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
|
3677
|
+
<xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col']) and not(@class = 'dl')">
|
3658
3678
|
<xsl:call-template name="calculate-column-widths">
|
3659
3679
|
<xsl:with-param name="cols-count" select="$cols-count"/>
|
3660
3680
|
<xsl:with-param name="table" select="$simple-table"/>
|
@@ -3766,6 +3786,11 @@
|
|
3766
3786
|
<fo:table-column column-width="{@width}"/>
|
3767
3787
|
</xsl:for-each>
|
3768
3788
|
</xsl:when>
|
3789
|
+
<xsl:when test="@class = 'dl'">
|
3790
|
+
<xsl:for-each select=".//*[local-name()='tr'][1]/*">
|
3791
|
+
<fo:table-column column-width="{@width}"/>
|
3792
|
+
</xsl:for-each>
|
3793
|
+
</xsl:when>
|
3769
3794
|
<xsl:otherwise>
|
3770
3795
|
<xsl:call-template name="insertTableColumnWidth">
|
3771
3796
|
<xsl:with-param name="colwidths" select="$colwidths"/>
|
@@ -5097,6 +5122,7 @@
|
|
5097
5122
|
<!-- ===================== -->
|
5098
5123
|
<!-- Definition List -->
|
5099
5124
|
<!-- ===================== -->
|
5125
|
+
|
5100
5126
|
<xsl:template match="*[local-name()='dl']">
|
5101
5127
|
<xsl:variable name="isAdded" select="@added"/>
|
5102
5128
|
<xsl:variable name="isDeleted" select="@deleted"/>
|
@@ -5313,10 +5339,21 @@
|
|
5313
5339
|
</xsl:variable>
|
5314
5340
|
|
5315
5341
|
<xsl:variable name="colwidths">
|
5316
|
-
<xsl:
|
5317
|
-
|
5318
|
-
<xsl:
|
5319
|
-
|
5342
|
+
<xsl:choose>
|
5343
|
+
<!-- dl from table[@class='dl'] -->
|
5344
|
+
<xsl:when test="*[local-name() = 'colgroup']">
|
5345
|
+
<autolayout/>
|
5346
|
+
<xsl:for-each select="*[local-name() = 'colgroup']/*[local-name() = 'col']">
|
5347
|
+
<column><xsl:value-of select="translate(@width,'%m','')"/></column>
|
5348
|
+
</xsl:for-each>
|
5349
|
+
</xsl:when>
|
5350
|
+
<xsl:otherwise>
|
5351
|
+
<xsl:call-template name="calculate-column-widths">
|
5352
|
+
<xsl:with-param name="cols-count" select="2"/>
|
5353
|
+
<xsl:with-param name="table" select="$simple-table"/>
|
5354
|
+
</xsl:call-template>
|
5355
|
+
</xsl:otherwise>
|
5356
|
+
</xsl:choose>
|
5320
5357
|
</xsl:variable>
|
5321
5358
|
|
5322
5359
|
<!-- <xsl:text disable-output-escaping="yes"><!- -</xsl:text>
|
@@ -7430,6 +7467,12 @@
|
|
7430
7467
|
<xsl:when test="@updatetype = 'true'">
|
7431
7468
|
<xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
|
7432
7469
|
</xsl:when>
|
7470
|
+
<xsl:when test="contains(@target, concat('_', $inputxml_filename_prefix, '_attachments'))">
|
7471
|
+
<!-- link to the PDF attachment -->
|
7472
|
+
<xsl:variable name="target_" select="translate(@target, '\', '/')"/>
|
7473
|
+
<xsl:variable name="target__" select="substring-after($target_, concat('_', $inputxml_filename_prefix, '_attachments', '/'))"/>
|
7474
|
+
<xsl:value-of select="concat('url(embedded-file:', $target__, ')')"/>
|
7475
|
+
</xsl:when>
|
7433
7476
|
<xsl:otherwise>
|
7434
7477
|
<xsl:value-of select="normalize-space(@target)"/>
|
7435
7478
|
</xsl:otherwise>
|
@@ -7837,6 +7880,7 @@
|
|
7837
7880
|
<xsl:variable name="isAdded" select="@added"/>
|
7838
7881
|
<xsl:variable name="isDeleted" select="@deleted"/>
|
7839
7882
|
<fo:block-container id="{@id}" xsl:use-attribute-sets="figure-block-style">
|
7883
|
+
<xsl:call-template name="refine_figure-block-style"/>
|
7840
7884
|
|
7841
7885
|
<xsl:call-template name="setTrackChangesStyles">
|
7842
7886
|
<xsl:with-param name="isAdded" select="$isAdded"/>
|
@@ -12215,10 +12259,10 @@
|
|
12215
12259
|
|
12216
12260
|
<xsl:template name="addPDFUAmeta">
|
12217
12261
|
<pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
|
12218
|
-
|
12219
|
-
|
12220
|
-
|
12221
|
-
|
12262
|
+
<pdf:dictionary type="normal" key="ViewerPreferences">
|
12263
|
+
<pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
|
12264
|
+
</pdf:dictionary>
|
12265
|
+
</pdf:catalog>
|
12222
12266
|
<x:xmpmeta xmlns:x="adobe:ns:meta/">
|
12223
12267
|
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
|
12224
12268
|
<rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
|
@@ -12267,6 +12311,19 @@
|
|
12267
12311
|
</rdf:Description>
|
12268
12312
|
</rdf:RDF>
|
12269
12313
|
</x:xmpmeta>
|
12314
|
+
<!-- add attachments -->
|
12315
|
+
<xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']">
|
12316
|
+
<xsl:choose>
|
12317
|
+
<xsl:when test="normalize-space() != ''">
|
12318
|
+
<pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{.}" filename="{@name}"/>
|
12319
|
+
</xsl:when>
|
12320
|
+
<xsl:otherwise>
|
12321
|
+
<!-- _{filename}_attachments -->
|
12322
|
+
<xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, '_', $inputxml_filename_prefix, '_attachments', '/', @name, ')')"/>
|
12323
|
+
<pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{$url}" filename="{@name}"/>
|
12324
|
+
</xsl:otherwise>
|
12325
|
+
</xsl:choose>
|
12326
|
+
</xsl:for-each>
|
12270
12327
|
</xsl:template> <!-- addPDFUAmeta -->
|
12271
12328
|
|
12272
12329
|
<xsl:template name="getId">
|
data/lib/isodoc/bipm/metadata.rb
CHANGED
@@ -39,9 +39,8 @@ module IsoDoc
|
|
39
39
|
end
|
40
40
|
|
41
41
|
def status_print(status)
|
42
|
-
|
43
|
-
|
44
|
-
|
42
|
+
status == "procès-verbal" and return "Procès-Verbal"
|
43
|
+
status == "cipm-mra" and return "CIPM-MRA"
|
45
44
|
status.split(/[- ]/).map.with_index do |s, i|
|
46
45
|
%w(en de).include?(s) && i.positive? ? s : s.capitalize
|
47
46
|
end.join(" ")
|
@@ -49,23 +48,22 @@ module IsoDoc
|
|
49
48
|
|
50
49
|
def docid(isoxml, _out)
|
51
50
|
super
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
dn and set(:appendixid_alt, @i18n.l10n("#{label2} #{dn.text}"))
|
56
|
-
label1, label2 = @lang == "fr" ? %w(Appendice Annex) : %w(Annex Appendice)
|
57
|
-
dn = isoxml.at(ns("//bibdata/ext/structuredidentifier/annexid"))
|
58
|
-
dn and set(:annexid, @i18n.l10n("#{label1} #{dn.text}"))
|
59
|
-
dn and set(:annexid_alt, @i18n.l10n("#{label2} #{dn.text}"))
|
60
|
-
label1, label2 = @lang == "fr" ? %w(Partie Part) : %w(Part Partie)
|
61
|
-
dn = isoxml.at(ns("//bibdata/ext/structuredidentifier/part"))
|
62
|
-
dn and set(:partid, @i18n.l10n("#{label1} #{dn.text}"))
|
63
|
-
dn and set(:partid_alt, @i18n.l10n("#{label2} #{dn.text}"))
|
51
|
+
docid_part(isoxml, %w(Appendix Annexe), "appendix", :appendixid)
|
52
|
+
docid_part(isoxml, %w(Annex Appendice), "annexid", :annexid)
|
53
|
+
docid_part(isoxml, %w(Part Partie), "part", :partid)
|
64
54
|
set(:org_abbrev,
|
65
55
|
isoxml.at(ns("//bibdata/ext/editorialgroup/committee"\
|
66
56
|
"[@acronym = 'JCGM']")) ? "JCGM" : "BIPM")
|
67
57
|
end
|
68
58
|
|
59
|
+
def docid_part(isoxml, labels, elem, key)
|
60
|
+
@lang == "fr" and labels.reverse!
|
61
|
+
label1, label2 = labels
|
62
|
+
dn = isoxml.at(ns("//bibdata/ext/structuredidentifier/#{elem}"))
|
63
|
+
dn and set(key, @i18n.l10n("#{label1} #{dn.text}"))
|
64
|
+
dn and set("#{key}_alt".to_sym, @i18n.l10n("#{label2} #{dn.text}"))
|
65
|
+
end
|
66
|
+
|
69
67
|
def extract_person_names_affiliations(authors)
|
70
68
|
extract_person_affiliations(authors)
|
71
69
|
end
|
@@ -75,6 +73,20 @@ module IsoDoc
|
|
75
73
|
.at(ns("//bibdata/date[not(@format)][@type = 'published']"))
|
76
74
|
pubdate and set(:pubdate_monthyear, monthyr(pubdate.text))
|
77
75
|
end
|
76
|
+
|
77
|
+
def author(xml, _out)
|
78
|
+
super
|
79
|
+
authorizer(xml)
|
80
|
+
end
|
81
|
+
|
82
|
+
def authorizer(xml)
|
83
|
+
ret = xml.xpath(ns("//bibdata/contributor[xmlns:role/@type = " \
|
84
|
+
"'authorizer']/organization"))
|
85
|
+
.each_with_object([]) do |org, m|
|
86
|
+
m << extract_variant(org.at(ns("./name")))
|
87
|
+
end
|
88
|
+
ret.empty? or set(:authorizer, ret)
|
89
|
+
end
|
78
90
|
end
|
79
91
|
end
|
80
92
|
end
|
@@ -75,13 +75,16 @@ module IsoDoc
|
|
75
75
|
end
|
76
76
|
|
77
77
|
def twitter_cldr_localiser_symbols
|
78
|
-
{ group: " ", fraction_group: " ",
|
78
|
+
{ group: " ", fraction_group: " ",
|
79
|
+
fraction_group_digits: 3 }
|
79
80
|
end
|
80
81
|
|
81
82
|
def localized_number(num, locale, precision)
|
82
|
-
g = Regexp.quote(
|
83
|
-
f = Regexp.quote(
|
84
|
-
|
83
|
+
g = Regexp.quote(@twitter_cldr_reader[:group])
|
84
|
+
f = Regexp.quote(@twitter_cldr_reader[:fraction_group])
|
85
|
+
d = Regexp.quote(@twitter_cldr_reader[:decimal])
|
86
|
+
super.sub(/^(\d)#{g}(\d) (?= \d\d$ | \d\d#{d} )/x, "\\1\\2")
|
87
|
+
.sub(/(?<= ^\d\d | #{d}\d\d ) (\d)#{f}(\d) $/x, "\\1\\2")
|
85
88
|
end
|
86
89
|
|
87
90
|
def mathml1(elem, locale)
|
@@ -97,8 +100,7 @@ module IsoDoc
|
|
97
100
|
|
98
101
|
def bibdata_dates(bibdata)
|
99
102
|
pubdate = bibdata.at(ns("./date[not(@format)][@type = 'published']"))
|
100
|
-
|
101
|
-
|
103
|
+
pubdate or return
|
102
104
|
meta = metadata_init(@lang, @script, @locale, @i18n)
|
103
105
|
pubdate.next = pubdate.dup
|
104
106
|
pubdate.next["format"] = "ddMMMyyyy"
|
@@ -193,23 +195,23 @@ module IsoDoc
|
|
193
195
|
end
|
194
196
|
|
195
197
|
def termsource_modification(elem)
|
196
|
-
if elem["status"] == "modified"
|
197
|
-
|
198
|
-
|
199
|
-
end
|
198
|
+
# if elem["status"] == "modified"
|
199
|
+
# origin = elem.at(ns("./origin"))
|
200
|
+
# s = termsource_status(elem["status"]) and origin.next = l10n(", #{s}")
|
201
|
+
# end
|
200
202
|
termsource_add_modification_text(elem.at(ns("./modification")))
|
201
203
|
end
|
202
204
|
|
203
205
|
def norm_ref_entry_code(_ordinal, identifiers, _ids, _standard, datefn,
|
204
206
|
_bib)
|
205
|
-
ret =
|
207
|
+
ret = identifiers[0] || identifiers[1]
|
206
208
|
ret += " #{identifiers[1]}" if identifiers[0] && identifiers[1]
|
207
209
|
"#{ret}#{datefn} "
|
208
210
|
end
|
209
211
|
|
210
212
|
def biblio_ref_entry_code(ordinal, ids, _id, _standard, datefn, _bib)
|
211
213
|
# standard and id = nil
|
212
|
-
ret =
|
214
|
+
ret = ids[:ordinal] || ids[:metanorma] || "[#{ordinal}]"
|
213
215
|
if ids[:sdo]
|
214
216
|
ret = prefix_bracketed_ref(ret)
|
215
217
|
ret += "#{ids[:sdo]}#{datefn} "
|
@@ -219,10 +221,6 @@ _bib)
|
|
219
221
|
ret
|
220
222
|
end
|
221
223
|
|
222
|
-
def bibrenderer
|
223
|
-
::Relaton::Render::BIPM::General.new(language: @lang)
|
224
|
-
end
|
225
|
-
|
226
224
|
include Init
|
227
225
|
end
|
228
226
|
end
|
@@ -338,29 +338,32 @@
|
|
338
338
|
</define>
|
339
339
|
<define name="organization">
|
340
340
|
<element name="organization">
|
341
|
-
<
|
342
|
-
<ref name="orgname"/>
|
343
|
-
</oneOrMore>
|
344
|
-
<zeroOrMore>
|
345
|
-
<ref name="subdivision"/>
|
346
|
-
</zeroOrMore>
|
347
|
-
<optional>
|
348
|
-
<ref name="abbreviation"/>
|
349
|
-
</optional>
|
350
|
-
<zeroOrMore>
|
351
|
-
<ref name="uri"/>
|
352
|
-
</zeroOrMore>
|
353
|
-
<zeroOrMore>
|
354
|
-
<ref name="org-identifier"/>
|
355
|
-
</zeroOrMore>
|
356
|
-
<zeroOrMore>
|
357
|
-
<ref name="contact"/>
|
358
|
-
</zeroOrMore>
|
359
|
-
<optional>
|
360
|
-
<ref name="logo"/>
|
361
|
-
</optional>
|
341
|
+
<ref name="OrganizationType"/>
|
362
342
|
</element>
|
363
343
|
</define>
|
344
|
+
<define name="OrganizationType">
|
345
|
+
<oneOrMore>
|
346
|
+
<ref name="orgname"/>
|
347
|
+
</oneOrMore>
|
348
|
+
<zeroOrMore>
|
349
|
+
<ref name="subdivision"/>
|
350
|
+
</zeroOrMore>
|
351
|
+
<optional>
|
352
|
+
<ref name="abbreviation"/>
|
353
|
+
</optional>
|
354
|
+
<zeroOrMore>
|
355
|
+
<ref name="uri"/>
|
356
|
+
</zeroOrMore>
|
357
|
+
<zeroOrMore>
|
358
|
+
<ref name="org-identifier"/>
|
359
|
+
</zeroOrMore>
|
360
|
+
<zeroOrMore>
|
361
|
+
<ref name="contact"/>
|
362
|
+
</zeroOrMore>
|
363
|
+
<optional>
|
364
|
+
<ref name="logo"/>
|
365
|
+
</optional>
|
366
|
+
</define>
|
364
367
|
<define name="orgname">
|
365
368
|
<element name="name">
|
366
369
|
<choice>
|
@@ -371,10 +374,10 @@
|
|
371
374
|
</define>
|
372
375
|
<define name="subdivision">
|
373
376
|
<element name="subdivision">
|
374
|
-
<
|
375
|
-
<
|
376
|
-
|
377
|
-
|
377
|
+
<optional>
|
378
|
+
<attribute name="type"/>
|
379
|
+
</optional>
|
380
|
+
<ref name="OrganizationType"/>
|
378
381
|
</element>
|
379
382
|
</define>
|
380
383
|
<define name="logo">
|
@@ -0,0 +1,89 @@
|
|
1
|
+
module Metanorma
|
2
|
+
module BIPM
|
3
|
+
class Converter < Metanorma::Generic::Converter
|
4
|
+
def boilerplate_file(_xmldoc)
|
5
|
+
if @jcgm
|
6
|
+
File.join(File.dirname(__FILE__), "boilerplate-jcgm-en.adoc")
|
7
|
+
else
|
8
|
+
File.join(File.dirname(__FILE__), "boilerplate-#{@lang}.adoc")
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def sections_cleanup(xml)
|
13
|
+
super
|
14
|
+
jcgm_untitled_sections_cleanup(xml) if @jcgm
|
15
|
+
end
|
16
|
+
|
17
|
+
def jcgm_untitled_sections_cleanup(xml)
|
18
|
+
xml.xpath("//clause//clause | //annex//clause | //introduction/clause")
|
19
|
+
.each do |c|
|
20
|
+
next if !c&.at("./title")&.text&.empty?
|
21
|
+
|
22
|
+
c["inline-header"] = true
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def section_names_terms_cleanup(xml); end
|
27
|
+
|
28
|
+
def section_names_refs_cleanup(xml); end
|
29
|
+
|
30
|
+
def mathml_mi_italics
|
31
|
+
{ uppergreek: false, upperroman: false,
|
32
|
+
lowergreek: false, lowerroman: true }
|
33
|
+
end
|
34
|
+
|
35
|
+
def xref_to_eref(elem, name)
|
36
|
+
if elem.at("//bibitem[@id = '#{elem['target']}']/" \
|
37
|
+
"docidentifier[@type = 'BIPM-long']")
|
38
|
+
elem["style"] = "BIPM-long"
|
39
|
+
end
|
40
|
+
super
|
41
|
+
end
|
42
|
+
|
43
|
+
ID_LABELS = {
|
44
|
+
"en" => {
|
45
|
+
"appendix" => "Appendix",
|
46
|
+
"annexid" => "Annex",
|
47
|
+
"part" => "Part",
|
48
|
+
},
|
49
|
+
"fr" => {
|
50
|
+
"appendix" => "Annexe",
|
51
|
+
"annexid" => "Appendice",
|
52
|
+
"part" => "Partie",
|
53
|
+
},
|
54
|
+
}.freeze
|
55
|
+
|
56
|
+
def bibdata_docidentifier_cleanup(isoxml)
|
57
|
+
bibdata_docidentifier_i18n(isoxml)
|
58
|
+
super
|
59
|
+
end
|
60
|
+
|
61
|
+
def bibdata_docidentifier_i18n(isoxml)
|
62
|
+
id, parts = bibdata_docidentifier_i18n_prep(isoxml)
|
63
|
+
parts.empty? and return
|
64
|
+
id_alt = id.dup
|
65
|
+
id.next = id_alt
|
66
|
+
bibdata_docidentifier_enhance(id, @lang, parts)
|
67
|
+
bibdata_docidentifier_enhance(id_alt, @lang == "en" ? "fr" : "en",
|
68
|
+
parts)
|
69
|
+
end
|
70
|
+
|
71
|
+
def bibdata_docidentifier_i18n_prep(isoxml)
|
72
|
+
id = isoxml.at("//bibdata/docidentifier[@type = 'BIPM']")
|
73
|
+
parts = %w(appendix annexid part).each_with_object({}) do |w, m|
|
74
|
+
dn = isoxml.at("//bibdata/ext/structuredidentifier/#{w}") and
|
75
|
+
m[w] = dn.text
|
76
|
+
end
|
77
|
+
[id, parts]
|
78
|
+
end
|
79
|
+
|
80
|
+
def bibdata_docidentifier_enhance(id, lang, parts)
|
81
|
+
id["language"] = lang
|
82
|
+
ret = %w(appendix annexid part).each_with_object([]) do |w, m|
|
83
|
+
p = parts[w] and m << "#{ID_LABELS[lang][w]} #{p}"
|
84
|
+
end
|
85
|
+
id.children = "#{id.text} #{ret.join(' ')}"
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
require "metanorma/standoc/converter"
|
2
2
|
require "metanorma/generic/converter"
|
3
3
|
require_relative "front"
|
4
|
+
require_relative "cleanup"
|
4
5
|
|
5
6
|
module Metanorma
|
6
7
|
module BIPM
|
@@ -96,45 +97,6 @@ module Metanorma
|
|
96
97
|
end
|
97
98
|
end
|
98
99
|
|
99
|
-
def boilerplate_file(_xmldoc)
|
100
|
-
if @jcgm
|
101
|
-
File.join(File.dirname(__FILE__), "boilerplate-jcgm-en.adoc")
|
102
|
-
else
|
103
|
-
File.join(File.dirname(__FILE__), "boilerplate-#{@lang}.adoc")
|
104
|
-
end
|
105
|
-
end
|
106
|
-
|
107
|
-
def sections_cleanup(xml)
|
108
|
-
super
|
109
|
-
jcgm_untitled_sections_cleanup(xml) if @jcgm
|
110
|
-
end
|
111
|
-
|
112
|
-
def jcgm_untitled_sections_cleanup(xml)
|
113
|
-
xml.xpath("//clause//clause | //annex//clause | //introduction/clause")
|
114
|
-
.each do |c|
|
115
|
-
next if !c&.at("./title")&.text&.empty?
|
116
|
-
|
117
|
-
c["inline-header"] = true
|
118
|
-
end
|
119
|
-
end
|
120
|
-
|
121
|
-
def section_names_terms_cleanup(xml); end
|
122
|
-
|
123
|
-
def section_names_refs_cleanup(xml); end
|
124
|
-
|
125
|
-
def mathml_mi_italics
|
126
|
-
{ uppergreek: false, upperroman: false,
|
127
|
-
lowergreek: false, lowerroman: true }
|
128
|
-
end
|
129
|
-
|
130
|
-
def xref_to_eref(elem, name)
|
131
|
-
if elem.at("//bibitem[@id = '#{elem['target']}']/" \
|
132
|
-
"docidentifier[@type = 'BIPM-long']")
|
133
|
-
elem["style"] = "BIPM-long"
|
134
|
-
end
|
135
|
-
super
|
136
|
-
end
|
137
|
-
|
138
100
|
def document(node)
|
139
101
|
@jcgm = node.attr("committee-acronym") == "JCGM"
|
140
102
|
super
|
@@ -156,12 +118,12 @@ module Metanorma
|
|
156
118
|
def presentation_xml_converter(node)
|
157
119
|
IsoDoc::BIPM::PresentationXMLConvert
|
158
120
|
.new(html_extract_attributes(node)
|
159
|
-
.merge(output_formats: ::Metanorma::BIPM::Processor.new
|
121
|
+
.merge(output_formats: ::Metanorma::BIPM::Processor.new
|
122
|
+
.output_formats))
|
160
123
|
end
|
161
124
|
|
162
125
|
def pdf_converter(node)
|
163
|
-
|
164
|
-
|
126
|
+
node.attr("no-pdf") and return nil
|
165
127
|
IsoDoc::BIPM::PdfConvert.new(pdf_extract_attributes(node))
|
166
128
|
end
|
167
129
|
end
|
data/metanorma-bipm.gemspec
CHANGED
@@ -27,8 +27,8 @@ Gem::Specification.new do |spec|
|
|
27
27
|
spec.require_paths = ["lib"]
|
28
28
|
spec.required_ruby_version = Gem::Requirement.new(">= 2.7.0")
|
29
29
|
|
30
|
-
spec.add_dependency "metanorma-generic", "~> 2.6.
|
31
|
-
spec.add_dependency "metanorma-iso", "~> 2.7.
|
30
|
+
spec.add_dependency "metanorma-generic", "~> 2.6.2"
|
31
|
+
spec.add_dependency "metanorma-iso", "~> 2.7.3"
|
32
32
|
|
33
33
|
spec.add_development_dependency "debug"
|
34
34
|
spec.add_development_dependency "equivalent-xml", "~> 0.6"
|