metanorma-bipm 2.2.14 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/isodoc/bipm/base_convert.rb +16 -15
- data/lib/isodoc/bipm/bipm.brochure.xsl +64 -41
- data/lib/isodoc/bipm/bipm.guide.xsl +64 -41
- data/lib/isodoc/bipm/bipm.mise-en-pratique.xsl +64 -41
- data/lib/isodoc/bipm/bipm.rapport.xsl +64 -41
- data/lib/isodoc/bipm/doccontrol.rb +4 -4
- data/lib/isodoc/bipm/html/htmlstyle.css +6 -6
- data/lib/isodoc/bipm/html/htmlstyle.scss +6 -6
- data/lib/isodoc/bipm/html_convert.rb +3 -9
- data/lib/isodoc/bipm/jcgm.standard.xsl +87 -33
- data/lib/isodoc/bipm/metadata.rb +4 -4
- data/lib/isodoc/bipm/presentation_blocks.rb +41 -0
- data/lib/isodoc/bipm/presentation_xml_convert.rb +15 -38
- data/lib/isodoc/bipm/xref.rb +14 -11
- data/lib/metanorma/bipm/front.rb +2 -2
- data/lib/metanorma/bipm/isodoc.rng +26 -4
- data/lib/metanorma/bipm/version.rb +1 -1
- data/metanorma-bipm.gemspec +2 -2
- metadata +7 -6
@@ -244,7 +244,7 @@ ul li {
|
|
244
244
|
list-style: none;
|
245
245
|
}
|
246
246
|
|
247
|
-
ul li
|
247
|
+
ul li::before {
|
248
248
|
content: "—";
|
249
249
|
display: inline-block; width: 1em;
|
250
250
|
margin-left: -1.2em;
|
@@ -273,7 +273,7 @@ ol ul > li:first-child {
|
|
273
273
|
list-style-type: none;
|
274
274
|
}
|
275
275
|
|
276
|
-
#toc li
|
276
|
+
#toc li::before {
|
277
277
|
content: " ";
|
278
278
|
display: none;
|
279
279
|
}
|
@@ -296,13 +296,13 @@ ol[class="alphabet"] > li {
|
|
296
296
|
ol[class="alphabet"] ol[class="alphabet"] > li {
|
297
297
|
list-style: inherit;
|
298
298
|
}
|
299
|
-
ol[class="alphabet"] > li
|
299
|
+
ol[class="alphabet"] > li::before {
|
300
300
|
counter-increment: alphabet;
|
301
301
|
content: counter(alphabet, lower-alpha)") ";
|
302
302
|
position: absolute;
|
303
303
|
left: -1.4em;
|
304
304
|
}
|
305
|
-
ol[class="alphabet"] ol[class="alphabet"] > li
|
305
|
+
ol[class="alphabet"] ol[class="alphabet"] > li::before {
|
306
306
|
counter-increment: none;
|
307
307
|
content: initial;
|
308
308
|
}
|
@@ -316,13 +316,13 @@ ol[class="roman"] > li {
|
|
316
316
|
ol[class="roman"] ol[class="roman"] > li {
|
317
317
|
list-style: inherit;
|
318
318
|
}
|
319
|
-
ol[class="roman"] > li
|
319
|
+
ol[class="roman"] > li::before {
|
320
320
|
counter-increment: roman;
|
321
321
|
content: "("counter(roman, lower-roman)") ";
|
322
322
|
position: absolute;
|
323
323
|
left: -2.0em;
|
324
324
|
}
|
325
|
-
ol[class="roman"] ol[class="roman"] > li
|
325
|
+
ol[class="roman"] ol[class="roman"] > li::before {
|
326
326
|
counter-increment: none;
|
327
327
|
content: initial;
|
328
328
|
}
|
@@ -6,16 +6,10 @@ require_relative "base_convert"
|
|
6
6
|
module IsoDoc
|
7
7
|
module BIPM
|
8
8
|
class HtmlConvert < IsoDoc::Generic::HtmlConvert
|
9
|
-
def
|
10
|
-
super
|
11
|
-
doccontrol isoxml, out
|
12
|
-
end
|
13
|
-
|
14
|
-
def doccontrol(isoxml, out)
|
15
|
-
c = isoxml.at(ns("//doccontrol")) or return
|
9
|
+
def doccontrol(elem, out)
|
16
10
|
out.div **attr_code(class: "doccontrol") do |div|
|
17
|
-
clause_parse_title(
|
18
|
-
|
11
|
+
clause_parse_title(elem, div, elem.at(ns("./title")), out)
|
12
|
+
elem.children.reject { |c1| c1.name == "title" }.each do |c1|
|
19
13
|
parse(c1, div)
|
20
14
|
end
|
21
15
|
end
|
@@ -243,13 +243,13 @@
|
|
243
243
|
<xsl:value-of select="(//jcgm:bipm-standard)[1]/jcgm:bibdata/jcgm:copyright/jcgm:from"/>
|
244
244
|
</fo:block>
|
245
245
|
<fo:block font-size="13pt" font-weight="normal" space-after="19.5mm">
|
246
|
-
<xsl:value-of select="(//jcgm:bipm-standard)[1]/jcgm:bibdata/jcgm:title[@type = 'provenance']"/>
|
246
|
+
<xsl:value-of select="(//jcgm:bipm-standard)[1]/jcgm:bibdata/jcgm:title[@type = 'title-provenance']"/>
|
247
247
|
</fo:block>
|
248
248
|
<fo:block border-bottom="1pt solid black"> </fo:block>
|
249
249
|
<fo:block font-size="16.5pt" margin-left="-0.5mm" padding-top="3.5mm" space-after="7mm" margin-right="7mm" line-height="105%" role="H1">
|
250
|
-
<xsl:apply-templates select="(//jcgm:bipm-standard)[1]/jcgm:bibdata/jcgm:title[@language = $lang and @type = 'main']" mode="title"/>
|
250
|
+
<xsl:apply-templates select="(//jcgm:bipm-standard)[1]/jcgm:bibdata/jcgm:title[@language = $lang and @type = 'title-main']" mode="title"/>
|
251
251
|
<xsl:variable name="title_part">
|
252
|
-
<xsl:apply-templates select="(//jcgm:bipm-standard)[1]/jcgm:bibdata/jcgm:title[@language = $lang and @type = 'part']" mode="title"/>
|
252
|
+
<xsl:apply-templates select="(//jcgm:bipm-standard)[1]/jcgm:bibdata/jcgm:title[@language = $lang and @type = 'title-part']" mode="title"/>
|
253
253
|
</xsl:variable>
|
254
254
|
<xsl:if test="normalize-space($title_part) != ''">
|
255
255
|
<xsl:text> — </xsl:text>
|
@@ -258,9 +258,9 @@
|
|
258
258
|
</fo:block>
|
259
259
|
<fo:block font-size="12pt" font-style="italic" line-height="140%" role="H1">
|
260
260
|
<xsl:variable name="secondLang" select="(//jcgm:bipm-standard)[1]/jcgm:bibdata/jcgm:title/@language[. != $lang]"/>
|
261
|
-
<xsl:apply-templates select="(//jcgm:bipm-standard)[1]/jcgm:bibdata/jcgm:title[@language = $secondLang and @type = 'main']" mode="title"/>
|
261
|
+
<xsl:apply-templates select="(//jcgm:bipm-standard)[1]/jcgm:bibdata/jcgm:title[@language = $secondLang and @type = 'title-main']" mode="title"/>
|
262
262
|
<xsl:variable name="title_part">
|
263
|
-
<xsl:apply-templates select="(//jcgm:bipm-standard)[1]/jcgm:bibdata/jcgm:title[@language = $secondLang and @type = 'part']" mode="title"/>
|
263
|
+
<xsl:apply-templates select="(//jcgm:bipm-standard)[1]/jcgm:bibdata/jcgm:title[@language = $secondLang and @type = 'title-part']" mode="title"/>
|
264
264
|
</xsl:variable>
|
265
265
|
<xsl:if test="normalize-space($title_part) != ''">
|
266
266
|
<xsl:text> — </xsl:text>
|
@@ -297,9 +297,9 @@
|
|
297
297
|
</fo:table-body>
|
298
298
|
</fo:table>
|
299
299
|
<fo:block font-size="18pt" space-before="70mm" role="H1">
|
300
|
-
<xsl:apply-templates select="(//jcgm:bipm-standard)[1]/jcgm:bibdata/jcgm:title[@language = $lang and @type = 'main']" mode="title"/>
|
300
|
+
<xsl:apply-templates select="(//jcgm:bipm-standard)[1]/jcgm:bibdata/jcgm:title[@language = $lang and @type = 'title-main']" mode="title"/>
|
301
301
|
<xsl:variable name="title_part">
|
302
|
-
<xsl:apply-templates select="(//jcgm:bipm-standard)[1]/jcgm:bibdata/jcgm:title[@language = $lang and @type = 'part']" mode="title"/>
|
302
|
+
<xsl:apply-templates select="(//jcgm:bipm-standard)[1]/jcgm:bibdata/jcgm:title[@language = $lang and @type = 'title-part']" mode="title"/>
|
303
303
|
</xsl:variable>
|
304
304
|
<xsl:if test="normalize-space($title_part) != ''">
|
305
305
|
<xsl:text> — </xsl:text>
|
@@ -308,9 +308,9 @@
|
|
308
308
|
</fo:block>
|
309
309
|
<fo:block font-size="13pt" space-before="35mm" role="H1">
|
310
310
|
<xsl:variable name="secondLang" select="(//jcgm:bipm-standard)[1]/jcgm:bibdata/jcgm:title/@language[. != $lang]"/>
|
311
|
-
<xsl:apply-templates select="(//jcgm:bipm-standard)[1]/jcgm:bibdata/jcgm:title[@language = $secondLang and @type = 'main']" mode="title"/>
|
311
|
+
<xsl:apply-templates select="(//jcgm:bipm-standard)[1]/jcgm:bibdata/jcgm:title[@language = $secondLang and @type = 'title-main']" mode="title"/>
|
312
312
|
<xsl:variable name="title_part">
|
313
|
-
<xsl:apply-templates select="(//jcgm:bipm-standard)[1]/jcgm:bibdata/jcgm:title[@language = $secondLang and @type = 'part']" mode="title"/>
|
313
|
+
<xsl:apply-templates select="(//jcgm:bipm-standard)[1]/jcgm:bibdata/jcgm:title[@language = $secondLang and @type = 'title-part']" mode="title"/>
|
314
314
|
</xsl:variable>
|
315
315
|
<xsl:if test="normalize-space($title_part) != ''">
|
316
316
|
<xsl:text> — </xsl:text>
|
@@ -397,14 +397,16 @@
|
|
397
397
|
|
398
398
|
<fo:flow flow-name="xsl-region-body" line-height="115%">
|
399
399
|
|
400
|
-
<
|
400
|
+
<xsl:if test="count(//*[local-name() = 'bipm-standard']) != 1 ">
|
401
|
+
<!-- <fo:block-container> -->
|
401
402
|
<!-- Show title -->
|
402
403
|
<!-- Example: Evaluation of measurement data — An introduction to the `Guide to the expression of uncertainty in measurement' and related documents -->
|
403
404
|
|
404
405
|
<xsl:for-each select="//*[local-name() = 'bipm-standard']">
|
405
|
-
<fo:block font-size="20pt" font-weight="bold" margin-bottom="20pt" space-before="36pt" line-height="1.1">
|
406
|
-
<xsl:variable name="curr_lang" select="*[local-name()='bibdata']/*[local-name()='language'][@current = 'true']"/>
|
407
406
|
|
407
|
+
<!-- <fo:block font-size="20pt" font-weight="bold" margin-bottom="20pt" space-before="36pt" line-height="1.1">
|
408
|
+
<xsl:variable name="curr_lang" select="*[local-name()='bibdata']/*[local-name()='language'][@current = 'true']"/>
|
409
|
+
|
408
410
|
<xsl:variable name="title-main">
|
409
411
|
<xsl:apply-templates select="./*[local-name() = 'bibdata']/*[local-name() = 'title'][@language = $curr_lang and @type = 'main']" mode="title"/>
|
410
412
|
</xsl:variable>
|
@@ -412,7 +414,7 @@
|
|
412
414
|
<xsl:variable name="title-part">
|
413
415
|
<xsl:apply-templates select="./*[local-name() = 'bibdata']/*[local-name() = 'title'][@language = $curr_lang and @type = 'part']" mode="title"/>
|
414
416
|
</xsl:variable>
|
415
|
-
|
417
|
+
|
416
418
|
<fo:block role="H1">
|
417
419
|
<xsl:copy-of select="$title-main"/>
|
418
420
|
<xsl:if test="normalize-space($title-main) != '' and normalize-space($title-part) != ''">
|
@@ -420,7 +422,7 @@
|
|
420
422
|
</xsl:if>
|
421
423
|
<xsl:copy-of select="$title-part"/>
|
422
424
|
</fo:block>
|
423
|
-
|
425
|
+
|
424
426
|
<xsl:variable name="edition">
|
425
427
|
<xsl:apply-templates select="./*[local-name() = 'bibdata']/*[local-name() = 'edition'][normalize-space(@language) = '']">
|
426
428
|
<xsl:with-param name="curr_lang" select="$curr_lang"/>
|
@@ -429,11 +431,14 @@
|
|
429
431
|
<xsl:if test="normalize-space($edition) != ''">
|
430
432
|
<fo:block margin-top="12pt"><xsl:copy-of select="$edition"/></fo:block>
|
431
433
|
</xsl:if>
|
434
|
+
|
435
|
+
</fo:block> -->
|
432
436
|
|
433
|
-
|
434
|
-
</xsl:for-each>
|
437
|
+
<xsl:apply-templates select="jcgmsections/jcgm:p[starts-with(@class, 'zzSTDTitle')]"/>
|
435
438
|
|
436
|
-
|
439
|
+
</xsl:for-each>
|
440
|
+
<!-- </fo:block-container> -->
|
441
|
+
</xsl:if>
|
437
442
|
<!-- Clause(s) -->
|
438
443
|
<fo:block>
|
439
444
|
<xsl:choose>
|
@@ -581,6 +586,32 @@
|
|
581
586
|
</fo:block>
|
582
587
|
</xsl:template>
|
583
588
|
|
589
|
+
<xsl:template match="jcgm:sections/jcgm:p[@class = 'zzSTDTitle1']" priority="4">
|
590
|
+
<fo:block font-size="20pt" font-weight="bold" margin-bottom="20pt" space-before="36pt" line-height="1.1" role="H1">
|
591
|
+
<xsl:if test="following-sibling::*[1][self::jcgm:p][starts-with(@class, 'zzSTDTitle')]">
|
592
|
+
<xsl:attribute name="margin-bottom">0</xsl:attribute>
|
593
|
+
</xsl:if>
|
594
|
+
<xsl:apply-templates/>
|
595
|
+
</fo:block>
|
596
|
+
<xsl:variable name="curr_lang" select="ancestor::jcgm:bipm-standard/*[local-name()='bibdata']/*[local-name()='language'][@current = 'true']"/>
|
597
|
+
<xsl:variable name="edition">
|
598
|
+
<xsl:apply-templates select="ancestor::jcgm:bipm-standard/*[local-name() = 'bibdata']/*[local-name() = 'edition'][normalize-space(@language) = '']">
|
599
|
+
<xsl:with-param name="curr_lang" select="$curr_lang"/>
|
600
|
+
</xsl:apply-templates>
|
601
|
+
</xsl:variable>
|
602
|
+
<xsl:if test="normalize-space($edition) != ''">
|
603
|
+
<fo:block font-size="20pt" font-weight="bold" margin-top="12pt" margin-bottom="20pt" line-height="1.1">
|
604
|
+
<xsl:copy-of select="$edition"/>
|
605
|
+
</fo:block>
|
606
|
+
</xsl:if>
|
607
|
+
</xsl:template>
|
608
|
+
|
609
|
+
<xsl:template match="jcgm:sections/jcgm:p[@class = 'zzSTDTitle2']" priority="4">
|
610
|
+
<fo:block font-size="20pt" font-weight="bold" margin-top="12pt" margin-bottom="20pt" line-height="1.1">
|
611
|
+
<xsl:apply-templates/>
|
612
|
+
</fo:block>
|
613
|
+
</xsl:template>
|
614
|
+
|
584
615
|
<xsl:template match="node()">
|
585
616
|
<xsl:apply-templates/>
|
586
617
|
</xsl:template>
|
@@ -5708,6 +5739,9 @@
|
|
5708
5739
|
<!-- END Definition List -->
|
5709
5740
|
<!-- ===================== -->
|
5710
5741
|
|
5742
|
+
<!-- default: ignore title in sections/p -->
|
5743
|
+
<xsl:template match="*[local-name() = 'sections']/*[local-name() = 'p'][starts-with(@class, 'zzSTDTitle')]" priority="3"/>
|
5744
|
+
|
5711
5745
|
<!-- ========================= -->
|
5712
5746
|
<!-- Rich text formatting -->
|
5713
5747
|
<!-- ========================= -->
|
@@ -7798,25 +7832,45 @@
|
|
7798
7832
|
<fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style">
|
7799
7833
|
<xsl:if test="not(@mimetype = 'image/svg+xml') and ../*[local-name() = 'name'] and not(ancestor::*[local-name() = 'table'])">
|
7800
7834
|
|
7801
|
-
<xsl:
|
7802
|
-
<xsl:
|
7803
|
-
<xsl:
|
7804
|
-
|
7805
|
-
|
7806
|
-
|
7835
|
+
<xsl:if test="@width != '' and @width != 'auto'">
|
7836
|
+
<xsl:attribute name="width">
|
7837
|
+
<xsl:value-of select="@width"/>
|
7838
|
+
</xsl:attribute>
|
7839
|
+
</xsl:if>
|
7840
|
+
|
7841
|
+
<xsl:if test="@height != '' and @height != 'auto'">
|
7842
|
+
<xsl:attribute name="height">
|
7843
|
+
<xsl:value-of select="@height"/>
|
7844
|
+
</xsl:attribute>
|
7845
|
+
</xsl:if>
|
7846
|
+
|
7847
|
+
<xsl:choose>
|
7848
|
+
<xsl:when test="@width != '' and @width != 'auto' and @height != '' and @height != 'auto'">
|
7849
|
+
<xsl:attribute name="scaling">non-uniform</xsl:attribute>
|
7850
|
+
</xsl:when>
|
7851
|
+
<xsl:otherwise>
|
7807
7852
|
|
7808
|
-
|
7853
|
+
<xsl:variable name="img_src">
|
7854
|
+
<xsl:choose>
|
7855
|
+
<xsl:when test="not(starts-with(@src, 'data:'))"><xsl:value-of select="concat($basepath, @src)"/></xsl:when>
|
7856
|
+
<xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
|
7857
|
+
</xsl:choose>
|
7858
|
+
</xsl:variable>
|
7809
7859
|
|
7810
|
-
|
7860
|
+
<xsl:variable name="image_width_effective">
|
7811
7861
|
|
7812
|
-
|
7862
|
+
<xsl:value-of select="$width_effective"/>
|
7863
|
+
|
7864
|
+
</xsl:variable>
|
7813
7865
|
|
7814
|
-
|
7815
|
-
|
7866
|
+
<xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $image_width_effective, $height_effective)"/>
|
7867
|
+
<xsl:if test="number($scale) < 100">
|
7816
7868
|
|
7817
|
-
|
7869
|
+
<xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
|
7818
7870
|
|
7819
|
-
|
7871
|
+
</xsl:if>
|
7872
|
+
</xsl:otherwise>
|
7873
|
+
</xsl:choose>
|
7820
7874
|
|
7821
7875
|
</xsl:if>
|
7822
7876
|
|
@@ -11488,7 +11542,7 @@
|
|
11488
11542
|
<xsl:template match="*[local-name() = 'span']" mode="update_xml_step1">
|
11489
11543
|
<xsl:apply-templates mode="update_xml_step1"/>
|
11490
11544
|
</xsl:template>
|
11491
|
-
<xsl:template match="*[local-name() = 'sourcecode']//*[local-name() = 'span'][@class]" mode="update_xml_step1" priority="2">
|
11545
|
+
<xsl:template match="*[local-name() = 'sections']/*[local-name() = 'p'][starts-with(@class, 'zzSTDTitle')]/*[local-name() = 'span'][@class] | *[local-name() = 'sourcecode']//*[local-name() = 'span'][@class]" mode="update_xml_step1" priority="2">
|
11492
11546
|
<xsl:copy>
|
11493
11547
|
<xsl:copy-of select="@*"/>
|
11494
11548
|
<xsl:apply-templates mode="update_xml_step1"/>
|
@@ -12054,7 +12108,7 @@
|
|
12054
12108
|
<xsl:variable name="title">
|
12055
12109
|
<xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
|
12056
12110
|
|
12057
|
-
<xsl:value-of select="*[local-name() = 'title'][@language = $lang and @type = 'part']"/>
|
12111
|
+
<xsl:value-of select="*[local-name() = 'title'][@language = $lang and @type = 'title-part']"/>
|
12058
12112
|
|
12059
12113
|
</xsl:for-each>
|
12060
12114
|
</xsl:variable>
|
@@ -12077,7 +12131,7 @@
|
|
12077
12131
|
<dc:description>
|
12078
12132
|
<xsl:variable name="abstract">
|
12079
12133
|
|
12080
|
-
<xsl:value-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']/*[local-name() = 'title'][@language = $lang and @type = 'main']"/>
|
12134
|
+
<xsl:value-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']/*[local-name() = 'title'][@language = $lang and @type = 'title-main']"/>
|
12081
12135
|
|
12082
12136
|
</xsl:variable>
|
12083
12137
|
<xsl:value-of select="normalize-space($abstract)"/>
|
data/lib/isodoc/bipm/metadata.rb
CHANGED
@@ -27,14 +27,14 @@ module IsoDoc
|
|
27
27
|
def title(isoxml, _out)
|
28
28
|
lang1, lang2 = @lang == "fr" ? %w(fr en) : %w(en fr)
|
29
29
|
set(:doctitle, @c.encode(isoxml.at(
|
30
|
-
ns("#{TITLE}[@type='main'][@language='#{lang1}']"))&.text || ""))
|
30
|
+
ns("#{TITLE}[@type='title-main'][@language='#{lang1}']"))&.text || ""))
|
31
31
|
set(:docsubtitle, @c.encode(isoxml.at(
|
32
|
-
ns("#{TITLE}[@type='main'][@language='#{lang2}']"))&.text || ""))
|
32
|
+
ns("#{TITLE}[@type='title-main'][@language='#{lang2}']"))&.text || ""))
|
33
33
|
%w(appendix annex part subtitle provenance).each do |e|
|
34
34
|
set("#{e}title".to_sym, @c.encode(isoxml.at(
|
35
|
-
ns("#{TITLE}[@type='
|
35
|
+
ns("#{TITLE}[@type='title-#{e}'][@language='#{lang1}']"))&.text || ""))
|
36
36
|
set("#{e}subtitle".to_sym, @c.encode(isoxml.at(
|
37
|
-
ns("#{TITLE}[@type='
|
37
|
+
ns("#{TITLE}[@type='title-#{e}'][@language='#{lang2}']"))&.text || ""))
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
@@ -0,0 +1,41 @@
|
|
1
|
+
module IsoDoc
|
2
|
+
module BIPM
|
3
|
+
class PresentationXMLConvert < IsoDoc::Generic::PresentationXMLConvert
|
4
|
+
def middle_title(docxml)
|
5
|
+
@jcgm or return nil
|
6
|
+
@iso.middle_title(docxml)
|
7
|
+
end
|
8
|
+
|
9
|
+
def table1(elem)
|
10
|
+
labelled_ancestor(elem) || elem["unnumbered"] and return
|
11
|
+
n = @xrefs.anchor(elem["id"], :label, false)
|
12
|
+
prefix_name(elem, ".<tab/>",
|
13
|
+
l10n("#{@i18n.table.capitalize} #{n}"), "name")
|
14
|
+
end
|
15
|
+
|
16
|
+
def figure1(elem)
|
17
|
+
if @jcgm
|
18
|
+
@iso.xrefs = @xrefs
|
19
|
+
@iso.figure1(elem)
|
20
|
+
else super
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
# notes and remarques (list notes) are not numbered
|
25
|
+
def note1(elem)
|
26
|
+
elem.parent.name == "bibitem" || elem["notag"] == "true" and return
|
27
|
+
lbl = l10n(note_label(elem))
|
28
|
+
prefix_name(elem, "", lbl, "name")
|
29
|
+
end
|
30
|
+
|
31
|
+
def note_label(elem)
|
32
|
+
if elem.ancestors("preface").empty?
|
33
|
+
if elem.ancestors("ul, ol, dl").empty?
|
34
|
+
@i18n.note
|
35
|
+
else @i18n.listnote end
|
36
|
+
else @i18n.prefacenote
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -5,6 +5,7 @@ require_relative "init"
|
|
5
5
|
require_relative "index"
|
6
6
|
require_relative "doccontrol"
|
7
7
|
require_relative "../../relaton/render/general"
|
8
|
+
require_relative "presentation_blocks"
|
8
9
|
|
9
10
|
module IsoDoc
|
10
11
|
module BIPM
|
@@ -12,33 +13,25 @@ module IsoDoc
|
|
12
13
|
def convert1(docxml, filename, dir)
|
13
14
|
@jcgm = docxml&.at(ns("//bibdata/ext/editorialgroup/committee/" \
|
14
15
|
"@acronym"))&.value == "JCGM"
|
15
|
-
@
|
16
|
-
|
17
|
-
i18n = @iso.i18n_init(@lang, @script, @locale, nil)
|
18
|
-
@iso.metadata_init(@lang, @script, @locale, i18n)
|
16
|
+
@xrefs.klass.jcgm = @jcgm
|
17
|
+
@jcgm and @iso = iso_processor(docxml)
|
19
18
|
super
|
20
19
|
end
|
21
20
|
|
21
|
+
def iso_processor(docxml)
|
22
|
+
iso = IsoDoc::Iso::PresentationXMLConvert
|
23
|
+
.new({ language: @lang, script: @script })
|
24
|
+
i18n = iso.i18n_init(@lang, @script, @locale, nil)
|
25
|
+
iso.metadata_init(@lang, @script, @locale, i18n)
|
26
|
+
iso.info(docxml, nil)
|
27
|
+
iso
|
28
|
+
end
|
29
|
+
|
22
30
|
def eref_localities1(opt)
|
23
31
|
@jcgm and return @iso.eref_localities1(opt)
|
24
32
|
super
|
25
33
|
end
|
26
34
|
|
27
|
-
def table1(elem)
|
28
|
-
labelled_ancestor(elem) || elem["unnumbered"] and return
|
29
|
-
n = @xrefs.anchor(elem["id"], :label, false)
|
30
|
-
prefix_name(elem, ".<tab/>",
|
31
|
-
l10n("#{@i18n.table.capitalize} #{n}"), "name")
|
32
|
-
end
|
33
|
-
|
34
|
-
def figure1(elem)
|
35
|
-
if @jcgm
|
36
|
-
@iso.xrefs = @xrefs
|
37
|
-
@iso.figure1(elem)
|
38
|
-
else super
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
35
|
def annex1(elem)
|
43
36
|
@jcgm and return super
|
44
37
|
elem["unnumbered"] == "true" and return
|
@@ -77,8 +70,8 @@ module IsoDoc
|
|
77
70
|
end
|
78
71
|
|
79
72
|
def conversions(docxml)
|
80
|
-
super
|
81
73
|
doccontrol docxml
|
74
|
+
super
|
82
75
|
end
|
83
76
|
|
84
77
|
def twitter_cldr_localiser_symbols
|
@@ -115,9 +108,9 @@ module IsoDoc
|
|
115
108
|
def bibdata_titles(bibdata)
|
116
109
|
app = bibdata.at(ns("//bibdata/ext/" \
|
117
110
|
"structuredidentifier/part")) or return
|
118
|
-
bibdata.xpath(ns("//bibdata/title[@type = 'part']")).each do |t|
|
111
|
+
bibdata.xpath(ns("//bibdata/title[@type = 'title-part']")).each do |t|
|
119
112
|
t.previous = t.dup
|
120
|
-
t["type"] = "part-with-numbering"
|
113
|
+
t["type"] = "title-part-with-numbering"
|
121
114
|
part = t["language"] == "en" ? "Part" : "Partie" # not looking up in YAML
|
122
115
|
t.children = l10n("#{part} #{app.text}: #{to_xml(t.children)}",
|
123
116
|
t["language"])
|
@@ -170,22 +163,6 @@ module IsoDoc
|
|
170
163
|
end
|
171
164
|
end
|
172
165
|
|
173
|
-
# notes and remarques (list notes) are not numbered
|
174
|
-
def note1(elem)
|
175
|
-
elem.parent.name == "bibitem" || elem["notag"] == "true" and return
|
176
|
-
lbl = l10n(note_label(elem))
|
177
|
-
prefix_name(elem, "", lbl, "name")
|
178
|
-
end
|
179
|
-
|
180
|
-
def note_label(elem)
|
181
|
-
if elem.ancestors("preface").empty?
|
182
|
-
if elem.ancestors("ul, ol, dl").empty?
|
183
|
-
@i18n.note
|
184
|
-
else @i18n.listnote end
|
185
|
-
else @i18n.prefacenote
|
186
|
-
end
|
187
|
-
end
|
188
|
-
|
189
166
|
def termsource1(elem)
|
190
167
|
# elem["status"] == "modified" and return super
|
191
168
|
while elem&.next_element&.name == "termsource"
|
data/lib/isodoc/bipm/xref.rb
CHANGED
@@ -4,13 +4,15 @@ module IsoDoc
|
|
4
4
|
end
|
5
5
|
|
6
6
|
class Xref < IsoDoc::Xref
|
7
|
+
attr_accessor :jcgm
|
8
|
+
|
7
9
|
def initialize(lang, script, klass, i18n, options = {})
|
8
10
|
@iso = IsoDoc::Iso::Xref.new(lang, script, klass, i18n, options)
|
9
11
|
super
|
10
12
|
end
|
11
13
|
|
12
14
|
def parse(docxml)
|
13
|
-
@jcgm = docxml&.at(ns("//bibdata/ext/editorialgroup/committee/"\
|
15
|
+
@jcgm = docxml&.at(ns("//bibdata/ext/editorialgroup/committee/" \
|
14
16
|
"@acronym"))&.value == "JCGM"
|
15
17
|
@annexlbl =
|
16
18
|
if @jcgm then @labels["iso_annex"]
|
@@ -38,8 +40,9 @@ module IsoDoc
|
|
38
40
|
end
|
39
41
|
|
40
42
|
def clause_names_jcgm(docxml, sect_num)
|
41
|
-
docxml.xpath(ns("//clause[parent::sections][not(@type = 'scope')]"\
|
42
|
-
"[not(descendant::terms)]"))
|
43
|
+
docxml.xpath(ns("//clause[parent::sections][not(@type = 'scope')]" \
|
44
|
+
"[not(descendant::terms)][not(descendant::references)]"))
|
45
|
+
.each do |c|
|
43
46
|
section_names(c, sect_num, 1)
|
44
47
|
end
|
45
48
|
end
|
@@ -48,24 +51,24 @@ module IsoDoc
|
|
48
51
|
|
49
52
|
def clause_names_bipm(docxml, _sect_num)
|
50
53
|
n = Counter.new
|
51
|
-
docxml.xpath(ns("//sections/clause[not(#{UNNUM})] | "\
|
52
|
-
"//sections/terms[not(#{UNNUM})] | "\
|
54
|
+
docxml.xpath(ns("//sections/clause[not(#{UNNUM})] | " \
|
55
|
+
"//sections/terms[not(#{UNNUM})] | " \
|
53
56
|
"//sections/definitions[not(#{UNNUM})]"))
|
54
57
|
.each { |c| section_names(c, n, 1) }
|
55
|
-
docxml.xpath(ns("//sections/clause[#{UNNUM}] | "\
|
56
|
-
"//sections/terms[#{UNNUM}] | "\
|
58
|
+
docxml.xpath(ns("//sections/clause[#{UNNUM}] | " \
|
59
|
+
"//sections/terms[#{UNNUM}] | " \
|
57
60
|
"//sections/definitions[#{UNNUM}]"))
|
58
61
|
.each { |c| unnumbered_section_names(c, 1) }
|
59
62
|
end
|
60
63
|
|
61
64
|
NUMBERED_SUBCLAUSES =
|
62
|
-
"./clause[not(#{UNNUM})] | ./references[not(#{UNNUM})] | "\
|
63
|
-
"./term[not(#{UNNUM})] | ./terms[not(#{UNNUM})] | "\
|
65
|
+
"./clause[not(#{UNNUM})] | ./references[not(#{UNNUM})] | " \
|
66
|
+
"./term[not(#{UNNUM})] | ./terms[not(#{UNNUM})] | " \
|
64
67
|
"./definitions[not(#{UNNUM})]".freeze
|
65
68
|
|
66
69
|
UNNUMBERED_SUBCLAUSES =
|
67
|
-
"./clause[#{UNNUM}] | ./references[#{UNNUM}] | "\
|
68
|
-
"./term[#{UNNUM}] | ./terms[#{UNNUM}] | "\
|
70
|
+
"./clause[#{UNNUM}] | ./references[#{UNNUM}] | " \
|
71
|
+
"./term[#{UNNUM}] | ./terms[#{UNNUM}] | " \
|
69
72
|
"./definitions[#{UNNUM}]".freeze
|
70
73
|
|
71
74
|
def section_name_anchors(clause, num, lvl)
|
data/lib/metanorma/bipm/front.rb
CHANGED
@@ -91,7 +91,7 @@ module Metanorma
|
|
91
91
|
def title(node, xml)
|
92
92
|
["en", "fr"].each do |lang|
|
93
93
|
at = { language: lang, format: "text/plain" }
|
94
|
-
xml.title **attr_code(at.merge(type: "main")) do |t1|
|
94
|
+
xml.title **attr_code(at.merge(type: "title-main")) do |t1|
|
95
95
|
t1 << Metanorma::Utils::asciidoc_sub(node.attr("title-#{lang}"))
|
96
96
|
end
|
97
97
|
%w(cover appendix annex part subpart provenance).each do |w|
|
@@ -104,7 +104,7 @@ module Metanorma
|
|
104
104
|
at = { language: lang, format: "text/plain" }
|
105
105
|
return unless title = node.attr("title-#{type}-#{lang}")
|
106
106
|
|
107
|
-
xml.title **attr_code(at.merge(type: type)) do |t1|
|
107
|
+
xml.title **attr_code(at.merge(type: "title-#{type}")) do |t1|
|
108
108
|
t1 << Metanorma::Utils::asciidoc_sub(title)
|
109
109
|
end
|
110
110
|
end
|
@@ -17,7 +17,7 @@
|
|
17
17
|
these elements; we just want one namespace for any child grammars
|
18
18
|
of this.
|
19
19
|
-->
|
20
|
-
<!-- VERSION v1.2.
|
20
|
+
<!-- VERSION v1.2.3 -->
|
21
21
|
<grammar xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
|
22
22
|
<include href="reqt.rng"/>
|
23
23
|
<include href="basicdoc.rng">
|
@@ -192,9 +192,11 @@
|
|
192
192
|
</attribute>
|
193
193
|
</optional>
|
194
194
|
<attribute name="citeas"/>
|
195
|
-
<
|
196
|
-
<
|
197
|
-
|
195
|
+
<optional>
|
196
|
+
<attribute name="type">
|
197
|
+
<ref name="ReferenceFormat"/>
|
198
|
+
</attribute>
|
199
|
+
</optional>
|
198
200
|
<optional>
|
199
201
|
<attribute name="alt"/>
|
200
202
|
</optional>
|
@@ -836,6 +838,26 @@
|
|
836
838
|
<ref name="paragraph"/>
|
837
839
|
</element>
|
838
840
|
</define>
|
841
|
+
<define name="stem">
|
842
|
+
<element name="stem">
|
843
|
+
<attribute name="type">
|
844
|
+
<choice>
|
845
|
+
<value>MathML</value>
|
846
|
+
<value>AsciiMath</value>
|
847
|
+
<value>LatexMath</value>
|
848
|
+
</choice>
|
849
|
+
</attribute>
|
850
|
+
<attribute name="block">
|
851
|
+
<data type="boolean"/>
|
852
|
+
</attribute>
|
853
|
+
<oneOrMore>
|
854
|
+
<choice>
|
855
|
+
<text/>
|
856
|
+
<ref name="AnyElement"/>
|
857
|
+
</choice>
|
858
|
+
</oneOrMore>
|
859
|
+
</element>
|
860
|
+
</define>
|
839
861
|
<define name="em">
|
840
862
|
<element name="em">
|
841
863
|
<zeroOrMore>
|
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.
|
31
|
-
spec.add_dependency "metanorma-iso", "~> 2.
|
30
|
+
spec.add_dependency "metanorma-generic", "~> 2.5.0"
|
31
|
+
spec.add_dependency "metanorma-iso", "~> 2.5.0"
|
32
32
|
|
33
33
|
spec.add_development_dependency "debug"
|
34
34
|
spec.add_development_dependency "equivalent-xml", "~> 0.6"
|