metanorma-jis 0.2.5 → 0.2.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/isodoc/jis/jis.international-standard.xsl +227 -53
- data/lib/isodoc/jis/word_cleanup.rb +12 -15
- data/lib/isodoc/jis/xref.rb +21 -5
- data/lib/isodoc/plateau/html_convert.rb +10 -0
- data/lib/isodoc/plateau/metadata.rb +6 -0
- data/lib/isodoc/plateau/pdf_convert.rb +14 -0
- data/lib/isodoc/plateau/presentation_xml_convert.rb +6 -0
- data/lib/isodoc/plateau/word_convert.rb +11 -0
- data/lib/isodoc/plateau/xref.rb +6 -0
- data/lib/metanorma/jis/biblio.rng +22 -23
- data/lib/metanorma/jis/converter.rb +2 -1
- data/lib/metanorma/jis/isodoc.rng +37 -116
- data/lib/metanorma/jis/version.rb +1 -1
- data/lib/metanorma/plateau/converter.rb +55 -0
- data/lib/metanorma/plateau/processor.rb +57 -0
- data/lib/metanorma/plateau.rb +6 -0
- data/lib/metanorma-jis.rb +9 -0
- data/metanorma-jis.gemspec +1 -1
- metadata +12 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b368234d9277b29aa534c29eea939c9511d9151c7aa759fd9fbf819848c287c1
|
4
|
+
data.tar.gz: b51cccd52045311c34869ec041b5fd18781e2c0b4c0e9c8312e7fc1748d3fc30
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f1e43b3d65c7f723f2562e900a9f4b9dcc8304954d43b65db4fc7591e1949e2c0595965c00e8d2d6f5bd8ae478047501fc05ab7c0c9345e8e3bfb17235631d1b
|
7
|
+
data.tar.gz: f20a68b53311de5a77a38838d4c7805ff0746f18c9fbf450693eed3c74f58bac0d870f573238cb91d4a90beee6022d6457bedb198b4b7aa7562833d5f25fdc35
|
@@ -1583,6 +1583,9 @@
|
|
1583
1583
|
<xsl:param name="copyrightText"/>
|
1584
1584
|
<fo:static-content flow-name="footer">
|
1585
1585
|
<fo:block-container height="24mm" display-align="after">
|
1586
|
+
<xsl:if test="$section = 'commentary'">
|
1587
|
+
<xsl:attribute name="height">24.5mm</xsl:attribute>
|
1588
|
+
</xsl:if>
|
1586
1589
|
<xsl:if test="$section = 'preface'">
|
1587
1590
|
<fo:block font-size="9pt" text-align="center" space-after="10pt">(<fo:inline font-family="Times New Roman"><fo:page-number/></fo:inline>)</fo:block>
|
1588
1591
|
</xsl:if>
|
@@ -1627,17 +1630,30 @@
|
|
1627
1630
|
<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 -->
|
1628
1631
|
|
1629
1632
|
<xsl:param name="table_if">false</xsl:param> <!-- generate extended table in IF for autolayout-algorithm -->
|
1630
|
-
<xsl:param name="table_widths"/> <!-- path to xml with table's widths, generated on 1st pass, based on FOP Intermediate Format -->
|
1633
|
+
<xsl:param name="table_widths"/> <!-- (debug: path to) xml with table's widths, generated on 1st pass, based on FOP Intermediate Format -->
|
1631
1634
|
<!-- Example: <tables>
|
1632
|
-
|
1633
|
-
|
1634
|
-
|
1635
|
-
|
1636
|
-
|
1637
|
-
|
1638
|
-
|
1639
|
-
|
1640
|
-
|
1635
|
+
<table page-width="509103" id="table1" width_max="223561" width_min="223560">
|
1636
|
+
<column width_max="39354" width_min="39354"/>
|
1637
|
+
<column width_max="75394" width_min="75394"/>
|
1638
|
+
<column width_max="108813" width_min="108813"/>
|
1639
|
+
<tbody>
|
1640
|
+
<tr>
|
1641
|
+
<td width_max="39354" width_min="39354">
|
1642
|
+
<p_len>39354</p_len>
|
1643
|
+
<word_len>39354</word_len>
|
1644
|
+
</td>
|
1645
|
+
|
1646
|
+
OLD:
|
1647
|
+
<tables>
|
1648
|
+
<table id="table_if_tab-symdu" page-width="75"> - table id prefixed by 'table_if_' to simple search in IF
|
1649
|
+
<tbody>
|
1650
|
+
<tr>
|
1651
|
+
<td id="tab-symdu_1_1">
|
1652
|
+
<p_len>6</p_len>
|
1653
|
+
<p_len>100</p_len> for 2nd paragraph
|
1654
|
+
<word_len>6</word_len>
|
1655
|
+
<word_len>20</word_len>
|
1656
|
+
...
|
1641
1657
|
-->
|
1642
1658
|
|
1643
1659
|
<!-- for command line debug: <xsl:variable name="table_widths_from_if" select="document($table_widths)"/> -->
|
@@ -1857,6 +1873,9 @@
|
|
1857
1873
|
<xsl:variable name="hair_space"> </xsl:variable>
|
1858
1874
|
<xsl:variable name="en_dash">–</xsl:variable>
|
1859
1875
|
<xsl:variable name="em_dash">—</xsl:variable>
|
1876
|
+
<xsl:variable name="cr"> </xsl:variable>
|
1877
|
+
<xsl:variable name="lf">
|
1878
|
+
</xsl:variable>
|
1860
1879
|
|
1861
1880
|
<xsl:template name="getTitle">
|
1862
1881
|
<xsl:param name="name"/>
|
@@ -2631,6 +2650,10 @@
|
|
2631
2650
|
|
2632
2651
|
<xsl:template name="refine_figure-block-style">
|
2633
2652
|
|
2653
|
+
<xsl:if test="ancestor::*[local-name() = 'example'] or ancestor::*[local-name() = 'note']">
|
2654
|
+
<xsl:attribute name="margin-left">0mm</xsl:attribute>
|
2655
|
+
</xsl:if>
|
2656
|
+
|
2634
2657
|
</xsl:template>
|
2635
2658
|
|
2636
2659
|
<xsl:attribute-set name="figure-style">
|
@@ -3509,6 +3532,20 @@
|
|
3509
3532
|
</xsl:for-each>
|
3510
3533
|
</xsl:template>
|
3511
3534
|
|
3535
|
+
<xsl:param name="table_only_with_id"/><!-- Example: table1, for table auto-layout algorithm -->
|
3536
|
+
|
3537
|
+
<xsl:template match="*[local-name()='table']" priority="2">
|
3538
|
+
<xsl:choose>
|
3539
|
+
<xsl:when test="$table_only_with_id != '' and @id = $table_only_with_id">
|
3540
|
+
<xsl:call-template name="table"/>
|
3541
|
+
</xsl:when>
|
3542
|
+
<xsl:when test="$table_only_with_id != ''"><fo:block/><!-- to prevent empty fo:block-container --></xsl:when>
|
3543
|
+
<xsl:otherwise>
|
3544
|
+
<xsl:call-template name="table"/>
|
3545
|
+
</xsl:otherwise>
|
3546
|
+
</xsl:choose>
|
3547
|
+
</xsl:template>
|
3548
|
+
|
3512
3549
|
<xsl:template match="*[local-name()='table']" name="table">
|
3513
3550
|
|
3514
3551
|
<xsl:variable name="table-preamble">
|
@@ -3518,9 +3555,11 @@
|
|
3518
3555
|
<xsl:variable name="table">
|
3519
3556
|
|
3520
3557
|
<xsl:variable name="simple-table">
|
3521
|
-
<xsl:
|
3522
|
-
<xsl:
|
3523
|
-
|
3558
|
+
<xsl:if test="$isGenerateTableIF = 'true' and $isApplyAutolayoutAlgorithm = 'true'">
|
3559
|
+
<xsl:call-template name="getSimpleTable">
|
3560
|
+
<xsl:with-param name="id" select="@id"/>
|
3561
|
+
</xsl:call-template>
|
3562
|
+
</xsl:if>
|
3524
3563
|
</xsl:variable>
|
3525
3564
|
<!-- <xsl:variable name="simple-table" select="xalan:nodeset($simple-table_)"/> -->
|
3526
3565
|
|
@@ -3616,9 +3655,9 @@
|
|
3616
3655
|
</xsl:attribute>
|
3617
3656
|
</xsl:for-each>
|
3618
3657
|
|
3619
|
-
<xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or ./*[local-name()='example'] or .//*[local-name()='fn'][local-name(..) != 'name'] or ./*[local-name()='source']"/>
|
3658
|
+
<xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'][not(@type = 'units')] or ./*[local-name()='example'] or .//*[local-name()='fn'][local-name(..) != 'name'] or ./*[local-name()='source']"/>
|
3620
3659
|
<xsl:if test="$isNoteOrFnExist = 'true'">
|
3621
|
-
<xsl:attribute name="border-bottom">0pt solid black</xsl:attribute
|
3660
|
+
<xsl:attribute name="border-bottom">0pt solid black</xsl:attribute><!-- set 0pt border, because there is a separete table below for footer -->
|
3622
3661
|
</xsl:if>
|
3623
3662
|
|
3624
3663
|
<xsl:choose>
|
@@ -3750,9 +3789,28 @@
|
|
3750
3789
|
|
3751
3790
|
</fo:block>
|
3752
3791
|
|
3792
|
+
<!-- <xsl:if test="$namespace = 'bsi' or $namespace = 'iec' or $namespace = 'iso'"> -->
|
3793
|
+
<xsl:if test="$continued = 'true'">
|
3794
|
+
<fo:block text-align="right">
|
3795
|
+
<xsl:apply-templates select="../*[local-name() = 'note'][@type = 'units']/node()"/>
|
3796
|
+
</fo:block>
|
3797
|
+
</xsl:if>
|
3798
|
+
<!-- </xsl:if> -->
|
3799
|
+
|
3753
3800
|
</xsl:if>
|
3754
3801
|
</xsl:template> <!-- table/name -->
|
3755
3802
|
|
3803
|
+
<!-- workaround solution for https://github.com/metanorma/metanorma-iso/issues/1151#issuecomment-2033087938 -->
|
3804
|
+
<xsl:template match="*[local-name()='table']/*[local-name() = 'note'][@type = 'units']/*[local-name() = 'p']/text()" priority="4">
|
3805
|
+
<xsl:choose>
|
3806
|
+
<xsl:when test="preceding-sibling::*[local-name() = 'br']">
|
3807
|
+
<!-- remove CR or LF at start -->
|
3808
|
+
<xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'^( | | )', '')"/>
|
3809
|
+
</xsl:when>
|
3810
|
+
<xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
|
3811
|
+
</xsl:choose>
|
3812
|
+
</xsl:template>
|
3813
|
+
|
3756
3814
|
<!-- SOURCE: ... -->
|
3757
3815
|
<xsl:template match="*[local-name()='table']/*[local-name() = 'source']" priority="2">
|
3758
3816
|
<xsl:call-template name="termsource"/>
|
@@ -4163,7 +4221,7 @@
|
|
4163
4221
|
<xsl:param name="colwidths"/>
|
4164
4222
|
<xsl:param name="colgroup"/>
|
4165
4223
|
|
4166
|
-
<xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ../*[local-name()='example'] or ../*[local-name()='dl'] or ..//*[local-name()='fn'][local-name(..) != 'name'] or ../*[local-name()='source'] or ../*[local-name()='p']"/>
|
4224
|
+
<xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'][not(@type = 'units')] or ../*[local-name()='example'] or ../*[local-name()='dl'] or ..//*[local-name()='fn'][local-name(..) != 'name'] or ../*[local-name()='source'] or ../*[local-name()='p']"/>
|
4167
4225
|
|
4168
4226
|
<xsl:variable name="isNoteOrFnExistShowAfterTable">
|
4169
4227
|
|
@@ -4233,7 +4291,7 @@
|
|
4233
4291
|
|
4234
4292
|
<!-- except gb and bsi -->
|
4235
4293
|
|
4236
|
-
<xsl:apply-templates select="../*[local-name()='p' or local-name()='dl' or local-name()='note' or local-name()='example' or local-name()='source']"/>
|
4294
|
+
<xsl:apply-templates select="../*[local-name()='p' or local-name()='dl' or (local-name()='note' and not(@type = 'units')) or local-name()='example' or local-name()='source']"/>
|
4237
4295
|
|
4238
4296
|
<xsl:variable name="isDisplayRowSeparator">
|
4239
4297
|
|
@@ -4241,7 +4299,7 @@
|
|
4241
4299
|
|
4242
4300
|
<!-- horizontal row separator -->
|
4243
4301
|
<xsl:if test="normalize-space($isDisplayRowSeparator) = 'true'">
|
4244
|
-
<xsl:if test="(../*[local-name()='note'] or ../*[local-name()='example']) and normalize-space($table_fn_block) != ''">
|
4302
|
+
<xsl:if test="(../*[local-name()='note'][not(@type = 'units')] or ../*[local-name()='example']) and normalize-space($table_fn_block) != ''">
|
4245
4303
|
<fo:block-container border-top="0.5pt solid black" padding-left="1mm" padding-right="1mm">
|
4246
4304
|
|
4247
4305
|
<xsl:call-template name="setBordersTableArray"/>
|
@@ -4921,7 +4979,20 @@
|
|
4921
4979
|
<!-- Definition List -->
|
4922
4980
|
<!-- ===================== -->
|
4923
4981
|
|
4924
|
-
|
4982
|
+
<!-- for table auto-layout algorithm -->
|
4983
|
+
<xsl:template match="*[local-name()='dl']" priority="2">
|
4984
|
+
<xsl:choose>
|
4985
|
+
<xsl:when test="$table_only_with_id != '' and @id = $table_only_with_id">
|
4986
|
+
<xsl:call-template name="dl"/>
|
4987
|
+
</xsl:when>
|
4988
|
+
<xsl:when test="$table_only_with_id != ''"><fo:block/><!-- to prevent empty fo:block-container --></xsl:when>
|
4989
|
+
<xsl:otherwise>
|
4990
|
+
<xsl:call-template name="dl"/>
|
4991
|
+
</xsl:otherwise>
|
4992
|
+
</xsl:choose>
|
4993
|
+
</xsl:template>
|
4994
|
+
|
4995
|
+
<xsl:template match="*[local-name()='dl']" name="dl">
|
4925
4996
|
<xsl:variable name="isAdded" select="@added"/>
|
4926
4997
|
<xsl:variable name="isDeleted" select="@deleted"/>
|
4927
4998
|
<!-- <dl><xsl:copy-of select="."/></dl> -->
|
@@ -6856,7 +6927,13 @@
|
|
6856
6927
|
<xsl:value-of select="$language_current_2"/>
|
6857
6928
|
</xsl:when>
|
6858
6929
|
<xsl:otherwise>
|
6859
|
-
<xsl:
|
6930
|
+
<xsl:variable name="language_current_3" select="normalize-space(//*[local-name()='bibdata']//*[local-name()='language'])"/>
|
6931
|
+
<xsl:choose>
|
6932
|
+
<xsl:when test="$language_current_3 != ''">
|
6933
|
+
<xsl:value-of select="$language_current_3"/>
|
6934
|
+
</xsl:when>
|
6935
|
+
<xsl:otherwise>en</xsl:otherwise>
|
6936
|
+
</xsl:choose>
|
6860
6937
|
</xsl:otherwise>
|
6861
6938
|
</xsl:choose>
|
6862
6939
|
</xsl:otherwise>
|
@@ -7713,10 +7790,11 @@
|
|
7713
7790
|
</xsl:template>
|
7714
7791
|
|
7715
7792
|
<xsl:template match="*[local-name() = 'image']">
|
7793
|
+
<xsl:param name="indent">0</xsl:param>
|
7716
7794
|
<xsl:variable name="isAdded" select="../@added"/>
|
7717
7795
|
<xsl:variable name="isDeleted" select="../@deleted"/>
|
7718
7796
|
<xsl:choose>
|
7719
|
-
<xsl:when test="ancestor::*[local-name() = 'title'] or not(parent::*[local-name() = 'figure']) or parent::*[local-name() = 'p']">
|
7797
|
+
<xsl:when test="ancestor::*[local-name() = 'title'] or not(parent::*[local-name() = 'figure']) or parent::*[local-name() = 'p']"> <!-- inline image ( 'image:path' in adoc, with one colon after image) -->
|
7720
7798
|
<fo:inline padding-left="1mm" padding-right="1mm">
|
7721
7799
|
<xsl:if test="not(parent::*[local-name() = 'figure']) or parent::*[local-name() = 'p']">
|
7722
7800
|
<xsl:attribute name="padding-left">0mm</xsl:attribute>
|
@@ -7725,7 +7803,43 @@
|
|
7725
7803
|
<xsl:variable name="src">
|
7726
7804
|
<xsl:call-template name="image_src"/>
|
7727
7805
|
</xsl:variable>
|
7728
|
-
|
7806
|
+
|
7807
|
+
<xsl:variable name="scale">
|
7808
|
+
<xsl:call-template name="getImageScale">
|
7809
|
+
<xsl:with-param name="indent" select="$indent"/>
|
7810
|
+
</xsl:call-template>
|
7811
|
+
</xsl:variable>
|
7812
|
+
|
7813
|
+
<!-- debug scale='<xsl:value-of select="$scale"/>', indent='<xsl:value-of select="$indent"/>' -->
|
7814
|
+
|
7815
|
+
<!-- <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" vertical-align="middle"/> -->
|
7816
|
+
<fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" vertical-align="middle">
|
7817
|
+
|
7818
|
+
<xsl:variable name="width">
|
7819
|
+
<xsl:call-template name="setImageWidth"/>
|
7820
|
+
</xsl:variable>
|
7821
|
+
<xsl:if test="$width != ''">
|
7822
|
+
<xsl:attribute name="width"><xsl:value-of select="$width"/></xsl:attribute>
|
7823
|
+
</xsl:if>
|
7824
|
+
<xsl:variable name="height">
|
7825
|
+
<xsl:call-template name="setImageHeight"/>
|
7826
|
+
</xsl:variable>
|
7827
|
+
<xsl:if test="$height != ''">
|
7828
|
+
<xsl:attribute name="height"><xsl:value-of select="$height"/></xsl:attribute>
|
7829
|
+
</xsl:if>
|
7830
|
+
|
7831
|
+
<xsl:if test="$width = '' and $height = ''">
|
7832
|
+
<xsl:if test="number($scale) < 100">
|
7833
|
+
<xsl:attribute name="content-width"><xsl:value-of select="number($scale)"/>%</xsl:attribute>
|
7834
|
+
<!-- <xsl:attribute name="content-width">scale-to-fit</xsl:attribute>
|
7835
|
+
<xsl:attribute name="content-height">100%</xsl:attribute>
|
7836
|
+
<xsl:attribute name="width">100%</xsl:attribute>
|
7837
|
+
<xsl:attribute name="scaling">uniform</xsl:attribute> -->
|
7838
|
+
</xsl:if>
|
7839
|
+
</xsl:if>
|
7840
|
+
|
7841
|
+
</fo:external-graphic>
|
7842
|
+
|
7729
7843
|
</fo:inline>
|
7730
7844
|
</xsl:when>
|
7731
7845
|
<xsl:otherwise>
|
@@ -7746,25 +7860,23 @@
|
|
7746
7860
|
<xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
|
7747
7861
|
<xsl:attribute name="scaling">uniform</xsl:attribute>
|
7748
7862
|
|
7749
|
-
|
7863
|
+
<xsl:apply-templates select="." mode="cross_image"/>
|
7750
7864
|
|
7751
7865
|
</fo:instream-foreign-object>
|
7752
7866
|
</xsl:when>
|
7753
7867
|
<xsl:otherwise>
|
7868
|
+
<!-- <fo:block>debug block image:
|
7869
|
+
<xsl:variable name="scale">
|
7870
|
+
<xsl:call-template name="getImageScale">
|
7871
|
+
<xsl:with-param name="indent" select="$indent"/>
|
7872
|
+
</xsl:call-template>
|
7873
|
+
</xsl:variable>
|
7874
|
+
<xsl:value-of select="concat('scale=', $scale,', indent=', $indent)"/>
|
7875
|
+
</fo:block> -->
|
7754
7876
|
<fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style">
|
7755
|
-
<xsl:if test="not(@mimetype = 'image/svg+xml') and ../*[local-name() = 'name'] and not(ancestor::*[local-name() = 'table'])">
|
7877
|
+
<xsl:if test="not(@mimetype = 'image/svg+xml') and (../*[local-name() = 'name'] or parent::*[local-name() = 'figure'][@unnumbered = 'true']) and not(ancestor::*[local-name() = 'table'])">
|
7756
7878
|
|
7757
|
-
<xsl:
|
7758
|
-
<xsl:attribute name="width">
|
7759
|
-
<xsl:value-of select="@width"/>
|
7760
|
-
</xsl:attribute>
|
7761
|
-
</xsl:if>
|
7762
|
-
|
7763
|
-
<xsl:if test="@height != '' and @height != 'auto'">
|
7764
|
-
<xsl:attribute name="height">
|
7765
|
-
<xsl:value-of select="@height"/>
|
7766
|
-
</xsl:attribute>
|
7767
|
-
</xsl:if>
|
7879
|
+
<xsl:call-template name="setImageWidthHeight"/>
|
7768
7880
|
|
7769
7881
|
<xsl:choose>
|
7770
7882
|
<xsl:when test="@width != '' and @width != 'auto' and @height != '' and @height != 'auto'">
|
@@ -7772,24 +7884,18 @@
|
|
7772
7884
|
</xsl:when>
|
7773
7885
|
<xsl:otherwise>
|
7774
7886
|
|
7775
|
-
<xsl:variable name="
|
7776
|
-
<xsl:
|
7777
|
-
<xsl:
|
7778
|
-
|
7779
|
-
</xsl:choose>
|
7887
|
+
<xsl:variable name="scale">
|
7888
|
+
<xsl:call-template name="getImageScale">
|
7889
|
+
<xsl:with-param name="indent" select="$indent"/>
|
7890
|
+
</xsl:call-template>
|
7780
7891
|
</xsl:variable>
|
7781
7892
|
|
7782
|
-
<xsl:variable name="
|
7783
|
-
|
7784
|
-
<xsl:value-of select="$width_effective"/>
|
7785
|
-
|
7893
|
+
<xsl:variable name="scaleRatio">
|
7894
|
+
1
|
7786
7895
|
</xsl:variable>
|
7787
7896
|
|
7788
|
-
<xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $image_width_effective, $height_effective)"/>
|
7789
7897
|
<xsl:if test="number($scale) < 100">
|
7790
|
-
|
7791
|
-
<xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
|
7792
|
-
|
7898
|
+
<xsl:attribute name="content-width"><xsl:value-of select="number($scale) * number($scaleRatio)"/>%</xsl:attribute>
|
7793
7899
|
</xsl:if>
|
7794
7900
|
</xsl:otherwise>
|
7795
7901
|
</xsl:choose>
|
@@ -7805,6 +7911,62 @@
|
|
7805
7911
|
</xsl:choose>
|
7806
7912
|
</xsl:template>
|
7807
7913
|
|
7914
|
+
<xsl:template name="setImageWidth">
|
7915
|
+
<xsl:if test="@width != '' and @width != 'auto' and @width != 'text-width' and @width != 'full-page-width' and @width != 'narrow'">
|
7916
|
+
<xsl:value-of select="@width"/>
|
7917
|
+
</xsl:if>
|
7918
|
+
</xsl:template>
|
7919
|
+
<xsl:template name="setImageHeight">
|
7920
|
+
<xsl:if test="@height != '' and @height != 'auto'">
|
7921
|
+
<xsl:value-of select="@height"/>
|
7922
|
+
</xsl:if>
|
7923
|
+
</xsl:template>
|
7924
|
+
<xsl:template name="setImageWidthHeight">
|
7925
|
+
<xsl:variable name="width">
|
7926
|
+
<xsl:call-template name="setImageWidth"/>
|
7927
|
+
</xsl:variable>
|
7928
|
+
<xsl:if test="$width != ''">
|
7929
|
+
<xsl:attribute name="width">
|
7930
|
+
<xsl:value-of select="$width"/>
|
7931
|
+
</xsl:attribute>
|
7932
|
+
</xsl:if>
|
7933
|
+
<xsl:variable name="height">
|
7934
|
+
<xsl:call-template name="setImageHeight"/>
|
7935
|
+
</xsl:variable>
|
7936
|
+
<xsl:if test="$height != ''">
|
7937
|
+
<xsl:attribute name="height">
|
7938
|
+
<xsl:value-of select="$height"/>
|
7939
|
+
</xsl:attribute>
|
7940
|
+
</xsl:if>
|
7941
|
+
</xsl:template>
|
7942
|
+
|
7943
|
+
<xsl:template name="getImageScale">
|
7944
|
+
<xsl:param name="indent"/>
|
7945
|
+
<xsl:variable name="indent_left">
|
7946
|
+
<xsl:choose>
|
7947
|
+
<xsl:when test="$indent != ''"><xsl:value-of select="$indent"/></xsl:when>
|
7948
|
+
<xsl:otherwise>0</xsl:otherwise>
|
7949
|
+
</xsl:choose>
|
7950
|
+
</xsl:variable>
|
7951
|
+
<xsl:variable name="img_src">
|
7952
|
+
<xsl:choose>
|
7953
|
+
<xsl:when test="not(starts-with(@src, 'data:'))"><xsl:value-of select="concat($basepath, @src)"/></xsl:when>
|
7954
|
+
<xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
|
7955
|
+
</xsl:choose>
|
7956
|
+
</xsl:variable>
|
7957
|
+
|
7958
|
+
<xsl:variable name="image_width_effective">
|
7959
|
+
|
7960
|
+
<xsl:value-of select="$width_effective - number($indent_left)"/>
|
7961
|
+
|
7962
|
+
</xsl:variable>
|
7963
|
+
<!-- <xsl:message>width_effective=<xsl:value-of select="$width_effective"/></xsl:message>
|
7964
|
+
<xsl:message>indent_left=<xsl:value-of select="$indent_left"/></xsl:message>
|
7965
|
+
<xsl:message>image_width_effective=<xsl:value-of select="$image_width_effective"/> for <xsl:value-of select="ancestor::ogc:p[1]/@id"/></xsl:message> -->
|
7966
|
+
<xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $image_width_effective, $height_effective)"/>
|
7967
|
+
<xsl:value-of select="$scale"/>
|
7968
|
+
</xsl:template>
|
7969
|
+
|
7808
7970
|
<xsl:template name="image_src">
|
7809
7971
|
<xsl:choose>
|
7810
7972
|
<xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
|
@@ -10473,6 +10635,7 @@
|
|
10473
10635
|
</xsl:template>
|
10474
10636
|
|
10475
10637
|
<xsl:template match="*[local-name() = 'ul'] | *[local-name() = 'ol']">
|
10638
|
+
<xsl:param name="indent">0</xsl:param>
|
10476
10639
|
<xsl:choose>
|
10477
10640
|
<xsl:when test="parent::*[local-name() = 'note'] or parent::*[local-name() = 'termnote']">
|
10478
10641
|
<fo:block-container role="SKIP">
|
@@ -10487,7 +10650,9 @@
|
|
10487
10650
|
|
10488
10651
|
<fo:block-container margin-left="0mm" role="SKIP">
|
10489
10652
|
<fo:block>
|
10490
|
-
<xsl:apply-templates select="." mode="list"
|
10653
|
+
<xsl:apply-templates select="." mode="list">
|
10654
|
+
<xsl:with-param name="indent" select="$indent"/>
|
10655
|
+
</xsl:apply-templates>
|
10491
10656
|
</fo:block>
|
10492
10657
|
</fo:block-container>
|
10493
10658
|
</fo:block-container>
|
@@ -10500,7 +10665,9 @@
|
|
10500
10665
|
</xsl:if>
|
10501
10666
|
<fo:block-container margin-left="0mm" role="SKIP">
|
10502
10667
|
<fo:block>
|
10503
|
-
<xsl:apply-templates select="." mode="list"
|
10668
|
+
<xsl:apply-templates select="." mode="list">
|
10669
|
+
<xsl:with-param name="indent" select="$indent"/>
|
10670
|
+
</xsl:apply-templates>
|
10504
10671
|
</fo:block>
|
10505
10672
|
</fo:block-container>
|
10506
10673
|
</fo:block-container>
|
@@ -10587,6 +10754,13 @@
|
|
10587
10754
|
</xsl:template>
|
10588
10755
|
|
10589
10756
|
<xsl:template match="*[local-name()='li']">
|
10757
|
+
<xsl:param name="indent">0</xsl:param>
|
10758
|
+
<!-- <fo:list-item xsl:use-attribute-sets="list-item-style">
|
10759
|
+
<fo:list-item-label end-indent="label-end()"><fo:block>x</fo:block></fo:list-item-label>
|
10760
|
+
<fo:list-item-body start-indent="body-start()" xsl:use-attribute-sets="list-item-body-style">
|
10761
|
+
<fo:block>debug li indent=<xsl:value-of select="$indent"/></fo:block>
|
10762
|
+
</fo:list-item-body>
|
10763
|
+
</fo:list-item> -->
|
10590
10764
|
<fo:list-item xsl:use-attribute-sets="list-item-style">
|
10591
10765
|
<xsl:copy-of select="@id"/>
|
10592
10766
|
|
@@ -10611,7 +10785,9 @@
|
|
10611
10785
|
|
10612
10786
|
<xsl:call-template name="refine_list-item-body-style"/>
|
10613
10787
|
|
10614
|
-
<xsl:apply-templates
|
10788
|
+
<xsl:apply-templates>
|
10789
|
+
<xsl:with-param name="indent" select="$indent"/>
|
10790
|
+
</xsl:apply-templates>
|
10615
10791
|
|
10616
10792
|
<!-- <xsl:apply-templates select="node()[not(local-name() = 'note')]" />
|
10617
10793
|
|
@@ -12888,6 +13064,4 @@
|
|
12888
13064
|
</xsl:if>
|
12889
13065
|
</xsl:template>
|
12890
13066
|
|
12891
|
-
<!-- update -->
|
12892
|
-
|
12893
13067
|
</xsl:stylesheet>
|
@@ -3,14 +3,6 @@ require_relative "../../html2doc/lists"
|
|
3
3
|
module IsoDoc
|
4
4
|
module JIS
|
5
5
|
class WordConvert < IsoDoc::Iso::WordConvert
|
6
|
-
def postprocess(result, filename, dir)
|
7
|
-
filename = filename.sub(/\.doc$/, "")
|
8
|
-
header = generate_header(filename, dir)
|
9
|
-
result = from_xhtml(cleanup(to_xhtml(textcleanup(result))))
|
10
|
-
toWord(result, filename, dir, header)
|
11
|
-
@files_to_delete.each { |f| FileUtils.rm_f f }
|
12
|
-
end
|
13
|
-
|
14
6
|
def word_cleanup(docxml)
|
15
7
|
word_note_cleanup(docxml)
|
16
8
|
boldface(docxml)
|
@@ -53,9 +45,12 @@ module IsoDoc
|
|
53
45
|
end
|
54
46
|
end
|
55
47
|
|
48
|
+
def postprocess_cleanup(result)
|
49
|
+
result = cleanup(to_xhtml(textcleanup(result)))
|
50
|
+
word_split(word_cleanup(result))
|
51
|
+
end
|
52
|
+
|
56
53
|
def toWord(result, filename, dir, header)
|
57
|
-
result = word_split(word_cleanup(to_xhtml(result)))
|
58
|
-
@wordstylesheet = wordstylesheet_update
|
59
54
|
result.each do |k, v|
|
60
55
|
to_word1(v, "#{filename}#{k}", dir, header)
|
61
56
|
end
|
@@ -89,11 +84,13 @@ module IsoDoc
|
|
89
84
|
end
|
90
85
|
|
91
86
|
def main_split(xml)
|
92
|
-
c = xml.at("//div[@class = 'WordSection1']")
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
c.
|
87
|
+
if c = xml.at("//div[@class = 'WordSection1']")
|
88
|
+
c.next_element&.remove
|
89
|
+
c.remove
|
90
|
+
end
|
91
|
+
if c = xml.at("//div[@class = 'WordSection2']")
|
92
|
+
c.elements.first.at("./br") and c.elements.first.remove
|
93
|
+
end
|
97
94
|
xml
|
98
95
|
end
|
99
96
|
|
data/lib/isodoc/jis/xref.rb
CHANGED
@@ -25,6 +25,20 @@ module IsoDoc
|
|
25
25
|
l10n("#{title} #{num}<br/>#{obl}")
|
26
26
|
end
|
27
27
|
|
28
|
+
def annex_name_anchors1(clause, num, level)
|
29
|
+
@anchors[clause["id"]] =
|
30
|
+
{ xref: num, label: num, level: level,
|
31
|
+
subtype: "annex" }
|
32
|
+
end
|
33
|
+
|
34
|
+
def annex_names1(clause, num, level)
|
35
|
+
annex_name_anchors1(clause, num, level)
|
36
|
+
i = ::IsoDoc::XrefGen::Counter.new(0, prefix: "#{num}.")
|
37
|
+
clause.xpath(ns(SUBCLAUSES)).each do |c|
|
38
|
+
annex_names1(c, i.increment(c).print, level + 1)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
28
42
|
def clause_order_main(docxml)
|
29
43
|
[
|
30
44
|
{ path: "//sections/introduction" },
|
@@ -97,14 +111,16 @@ module IsoDoc
|
|
97
111
|
refer_list)
|
98
112
|
c = Counter.new(list["start"] ? list["start"].to_i - 1 : 0)
|
99
113
|
list.xpath(ns("./li")).each do |li|
|
100
|
-
bare_label, label =
|
101
|
-
|
114
|
+
bare_label, label =
|
115
|
+
list_item_value(li, c, depth, { list_anchor: list_anchor,
|
116
|
+
prev_label: prev_label, refer_list: depth == 1 ? refer_list : nil })
|
102
117
|
li["id"] and @anchors[li["id"]] =
|
103
118
|
{ label: bare_label, bare_xref: "#{bare_label})",
|
104
|
-
xref: "#{label})", type: "listitem",
|
105
|
-
|
119
|
+
xref: "#{label})", type: "listitem",
|
120
|
+
refer_list: refer_list, container: list_anchor[:container] }
|
106
121
|
(li.xpath(ns(".//ol")) - li.xpath(ns(".//ol//ol"))).each do |ol|
|
107
|
-
list_item_anchor_names(ol, list_anchor, depth + 1, label,
|
122
|
+
list_item_anchor_names(ol, list_anchor, depth + 1, label,
|
123
|
+
refer_list)
|
108
124
|
end
|
109
125
|
end
|
110
126
|
end
|
@@ -95,7 +95,7 @@
|
|
95
95
|
<text/>
|
96
96
|
</element>
|
97
97
|
</define>
|
98
|
-
<define name="
|
98
|
+
<define name="LocalizedStringAttrs">
|
99
99
|
<optional>
|
100
100
|
<!-- multiple languages and scripts possible: comma delimit them if so -->
|
101
101
|
<attribute name="language"/>
|
@@ -106,6 +106,10 @@
|
|
106
106
|
<optional>
|
107
107
|
<attribute name="script"/>
|
108
108
|
</optional>
|
109
|
+
</define>
|
110
|
+
<define name="LocalizedString1">
|
111
|
+
<!-- multiple languages and scripts possible: comma delimit them if so -->
|
112
|
+
<ref name="LocalizedStringAttrs"/>
|
109
113
|
<text/>
|
110
114
|
</define>
|
111
115
|
<define name="LocalizedString">
|
@@ -142,16 +146,8 @@
|
|
142
146
|
<ref name="LocalizedStringOrXsAny"/>
|
143
147
|
</define>
|
144
148
|
<define name="LocalizedStringOrXsAny1">
|
145
|
-
|
146
|
-
|
147
|
-
<attribute name="language"/>
|
148
|
-
</optional>
|
149
|
-
<optional>
|
150
|
-
<attribute name="locale"/>
|
151
|
-
</optional>
|
152
|
-
<optional>
|
153
|
-
<attribute name="script"/>
|
154
|
-
</optional>
|
149
|
+
<!-- multiple languages and scripts possible: comma delimit them if so -->
|
150
|
+
<ref name="LocalizedStringAttrs"/>
|
155
151
|
<oneOrMore>
|
156
152
|
<choice>
|
157
153
|
<text/>
|
@@ -208,6 +204,7 @@
|
|
208
204
|
</define>
|
209
205
|
<define name="roledescription">
|
210
206
|
<element name="description">
|
207
|
+
<ref name="LocalizedStringAttrs"/>
|
211
208
|
<oneOrMore>
|
212
209
|
<ref name="TextElement"/>
|
213
210
|
</oneOrMore>
|
@@ -335,6 +332,7 @@
|
|
335
332
|
</define>
|
336
333
|
<define name="affiliationdescription">
|
337
334
|
<element name="description">
|
335
|
+
<ref name="LocalizedStringAttrs"/>
|
338
336
|
<oneOrMore>
|
339
337
|
<ref name="TextElement"/>
|
340
338
|
</oneOrMore>
|
@@ -948,6 +946,7 @@
|
|
948
946
|
<optional>
|
949
947
|
<attribute name="type"/>
|
950
948
|
</optional>
|
949
|
+
<ref name="LocalizedStringAttrs"/>
|
951
950
|
<zeroOrMore>
|
952
951
|
<ref name="TextElement"/>
|
953
952
|
</zeroOrMore>
|
@@ -1041,15 +1040,7 @@
|
|
1041
1040
|
<data type="boolean"/>
|
1042
1041
|
</attribute>
|
1043
1042
|
</optional>
|
1044
|
-
<
|
1045
|
-
<attribute name="language"/>
|
1046
|
-
</optional>
|
1047
|
-
<optional>
|
1048
|
-
<attribute name="locale"/>
|
1049
|
-
</optional>
|
1050
|
-
<optional>
|
1051
|
-
<attribute name="script"/>
|
1052
|
-
</optional>
|
1043
|
+
<ref name="LocalizedStringAttrs"/>
|
1053
1044
|
<oneOrMore>
|
1054
1045
|
<ref name="TextElement"/>
|
1055
1046
|
</oneOrMore>
|
@@ -1277,6 +1268,7 @@
|
|
1277
1268
|
<optional>
|
1278
1269
|
<attribute name="type"/>
|
1279
1270
|
</optional>
|
1271
|
+
<ref name="LocalizedStringAttrs"/>
|
1280
1272
|
<oneOrMore>
|
1281
1273
|
<ref name="TextElement"/>
|
1282
1274
|
</oneOrMore>
|
@@ -1284,9 +1276,15 @@
|
|
1284
1276
|
</define>
|
1285
1277
|
<define name="bibabstract">
|
1286
1278
|
<element name="abstract">
|
1287
|
-
<
|
1288
|
-
|
1289
|
-
|
1279
|
+
<ref name="LocalizedStringAttrs"/>
|
1280
|
+
<choice>
|
1281
|
+
<oneOrMore>
|
1282
|
+
<ref name="BasicBlock"/>
|
1283
|
+
</oneOrMore>
|
1284
|
+
<oneOrMore>
|
1285
|
+
<ref name="TextElement"/>
|
1286
|
+
</oneOrMore>
|
1287
|
+
</choice>
|
1290
1288
|
</element>
|
1291
1289
|
</define>
|
1292
1290
|
<define name="copyright">
|
@@ -1391,6 +1389,7 @@
|
|
1391
1389
|
</attribute>
|
1392
1390
|
<optional>
|
1393
1391
|
<element name="description">
|
1392
|
+
<ref name="LocalizedStringAttrs"/>
|
1394
1393
|
<oneOrMore>
|
1395
1394
|
<ref name="TextElement"/>
|
1396
1395
|
</oneOrMore>
|
@@ -80,7 +80,8 @@ module Metanorma
|
|
80
80
|
else
|
81
81
|
IsoDoc::JIS::PresentationXMLConvert
|
82
82
|
.new(doc_extract_attributes(node)
|
83
|
-
.merge(output_formats: ::Metanorma::JIS::Processor.new
|
83
|
+
.merge(output_formats: ::Metanorma::JIS::Processor.new
|
84
|
+
.output_formats))
|
84
85
|
end
|
85
86
|
end
|
86
87
|
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.3.
|
20
|
+
<!-- VERSION v1.3.1 -->
|
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">
|
@@ -1346,38 +1346,41 @@
|
|
1346
1346
|
</oneOrMore>
|
1347
1347
|
</element>
|
1348
1348
|
</define>
|
1349
|
+
<define name="Section-Attributes">
|
1350
|
+
<optional>
|
1351
|
+
<attribute name="id">
|
1352
|
+
<data type="ID"/>
|
1353
|
+
</attribute>
|
1354
|
+
</optional>
|
1355
|
+
<optional>
|
1356
|
+
<attribute name="language"/>
|
1357
|
+
</optional>
|
1358
|
+
<optional>
|
1359
|
+
<attribute name="script"/>
|
1360
|
+
</optional>
|
1361
|
+
<optional>
|
1362
|
+
<attribute name="inline-header">
|
1363
|
+
<data type="boolean"/>
|
1364
|
+
</attribute>
|
1365
|
+
</optional>
|
1366
|
+
<optional>
|
1367
|
+
<attribute name="number"/>
|
1368
|
+
</optional>
|
1369
|
+
<optional>
|
1370
|
+
<attribute name="branch-number"/>
|
1371
|
+
</optional>
|
1372
|
+
<optional>
|
1373
|
+
<attribute name="obligation">
|
1374
|
+
<choice>
|
1375
|
+
<value>normative</value>
|
1376
|
+
<value>informative</value>
|
1377
|
+
</choice>
|
1378
|
+
</attribute>
|
1379
|
+
</optional>
|
1380
|
+
</define>
|
1349
1381
|
<define name="reference-clause">
|
1350
1382
|
<element name="clause">
|
1351
|
-
<
|
1352
|
-
<attribute name="id">
|
1353
|
-
<data type="ID"/>
|
1354
|
-
</attribute>
|
1355
|
-
</optional>
|
1356
|
-
<optional>
|
1357
|
-
<attribute name="language"/>
|
1358
|
-
</optional>
|
1359
|
-
<optional>
|
1360
|
-
<attribute name="script"/>
|
1361
|
-
</optional>
|
1362
|
-
<optional>
|
1363
|
-
<attribute name="inline-header">
|
1364
|
-
<data type="boolean"/>
|
1365
|
-
</attribute>
|
1366
|
-
</optional>
|
1367
|
-
<optional>
|
1368
|
-
<attribute name="number"/>
|
1369
|
-
</optional>
|
1370
|
-
<optional>
|
1371
|
-
<attribute name="branch-number"/>
|
1372
|
-
</optional>
|
1373
|
-
<optional>
|
1374
|
-
<attribute name="obligation">
|
1375
|
-
<choice>
|
1376
|
-
<value>normative</value>
|
1377
|
-
<value>informative</value>
|
1378
|
-
</choice>
|
1379
|
-
</attribute>
|
1380
|
-
</optional>
|
1383
|
+
<ref name="Section-Attributes"/>
|
1381
1384
|
<optional>
|
1382
1385
|
<ref name="section-title"/>
|
1383
1386
|
</optional>
|
@@ -1566,36 +1569,7 @@
|
|
1566
1569
|
</element>
|
1567
1570
|
</define>
|
1568
1571
|
<define name="Content-Section">
|
1569
|
-
<
|
1570
|
-
<attribute name="id">
|
1571
|
-
<data type="ID"/>
|
1572
|
-
</attribute>
|
1573
|
-
</optional>
|
1574
|
-
<optional>
|
1575
|
-
<attribute name="language"/>
|
1576
|
-
</optional>
|
1577
|
-
<optional>
|
1578
|
-
<attribute name="script"/>
|
1579
|
-
</optional>
|
1580
|
-
<optional>
|
1581
|
-
<attribute name="inline-header">
|
1582
|
-
<data type="boolean"/>
|
1583
|
-
</attribute>
|
1584
|
-
</optional>
|
1585
|
-
<optional>
|
1586
|
-
<attribute name="obligation">
|
1587
|
-
<choice>
|
1588
|
-
<value>normative</value>
|
1589
|
-
<value>informative</value>
|
1590
|
-
</choice>
|
1591
|
-
</attribute>
|
1592
|
-
</optional>
|
1593
|
-
<optional>
|
1594
|
-
<attribute name="number"/>
|
1595
|
-
</optional>
|
1596
|
-
<optional>
|
1597
|
-
<attribute name="branch-number"/>
|
1598
|
-
</optional>
|
1572
|
+
<ref name="Section-Attributes"/>
|
1599
1573
|
<optional>
|
1600
1574
|
<attribute name="type"/>
|
1601
1575
|
</optional>
|
@@ -1617,39 +1591,10 @@
|
|
1617
1591
|
</element>
|
1618
1592
|
</define>
|
1619
1593
|
<define name="Clause-Section">
|
1620
|
-
<
|
1621
|
-
<attribute name="id">
|
1622
|
-
<data type="ID"/>
|
1623
|
-
</attribute>
|
1624
|
-
</optional>
|
1625
|
-
<optional>
|
1626
|
-
<attribute name="language"/>
|
1627
|
-
</optional>
|
1628
|
-
<optional>
|
1629
|
-
<attribute name="script"/>
|
1630
|
-
</optional>
|
1631
|
-
<optional>
|
1632
|
-
<attribute name="inline-header">
|
1633
|
-
<data type="boolean"/>
|
1634
|
-
</attribute>
|
1635
|
-
</optional>
|
1636
|
-
<optional>
|
1637
|
-
<attribute name="obligation">
|
1638
|
-
<choice>
|
1639
|
-
<value>normative</value>
|
1640
|
-
<value>informative</value>
|
1641
|
-
</choice>
|
1642
|
-
</attribute>
|
1643
|
-
</optional>
|
1594
|
+
<ref name="Section-Attributes"/>
|
1644
1595
|
<optional>
|
1645
1596
|
<attribute name="type"/>
|
1646
1597
|
</optional>
|
1647
|
-
<optional>
|
1648
|
-
<attribute name="number"/>
|
1649
|
-
</optional>
|
1650
|
-
<optional>
|
1651
|
-
<attribute name="branch-number"/>
|
1652
|
-
</optional>
|
1653
1598
|
<optional>
|
1654
1599
|
<ref name="section-title"/>
|
1655
1600
|
</optional>
|
@@ -1730,34 +1675,10 @@
|
|
1730
1675
|
</define>
|
1731
1676
|
<define name="terms">
|
1732
1677
|
<element name="terms">
|
1733
|
-
<
|
1734
|
-
<attribute name="id">
|
1735
|
-
<data type="ID"/>
|
1736
|
-
</attribute>
|
1737
|
-
</optional>
|
1738
|
-
<optional>
|
1739
|
-
<attribute name="language"/>
|
1740
|
-
</optional>
|
1741
|
-
<optional>
|
1742
|
-
<attribute name="script"/>
|
1743
|
-
</optional>
|
1678
|
+
<ref name="Section-Attributes"/>
|
1744
1679
|
<optional>
|
1745
1680
|
<attribute name="type"/>
|
1746
1681
|
</optional>
|
1747
|
-
<optional>
|
1748
|
-
<attribute name="number"/>
|
1749
|
-
</optional>
|
1750
|
-
<optional>
|
1751
|
-
<attribute name="branch-number"/>
|
1752
|
-
</optional>
|
1753
|
-
<optional>
|
1754
|
-
<attribute name="obligation">
|
1755
|
-
<choice>
|
1756
|
-
<value>normative</value>
|
1757
|
-
<value>informative</value>
|
1758
|
-
</choice>
|
1759
|
-
</attribute>
|
1760
|
-
</optional>
|
1761
1682
|
<optional>
|
1762
1683
|
<ref name="section-title"/>
|
1763
1684
|
</optional>
|
@@ -0,0 +1,55 @@
|
|
1
|
+
module Metanorma
|
2
|
+
module Plateau
|
3
|
+
class Converter < JIS::Converter
|
4
|
+
register_for "plateau"
|
5
|
+
|
6
|
+
def version
|
7
|
+
flavour = "JIS"
|
8
|
+
Metanorma.versioned(Metanorma, flavour)[-1]::VERSION
|
9
|
+
end
|
10
|
+
|
11
|
+
def schema_version
|
12
|
+
f = File.read(File.join(File.dirname(__FILE__), "..", "jis", "isodoc.rng"))
|
13
|
+
m = / VERSION (v\S+)/.match(f)
|
14
|
+
m[1]
|
15
|
+
end
|
16
|
+
|
17
|
+
def html_converter(node)
|
18
|
+
if node.nil?
|
19
|
+
IsoDoc::Plateau::HtmlConvert.new({})
|
20
|
+
else
|
21
|
+
IsoDoc::Plateau::HtmlConvert.new(html_extract_attributes(node))
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def doc_converter(node)
|
26
|
+
if node.nil?
|
27
|
+
IsoDoc::Plateau::WordConvert.new({})
|
28
|
+
else
|
29
|
+
IsoDoc::Plateau::WordConvert.new(doc_extract_attributes(node))
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def pdf_converter(node)
|
34
|
+
return if node.attr("no-pdf")
|
35
|
+
|
36
|
+
if node.nil?
|
37
|
+
IsoDoc::Plateau::PdfConvert.new({})
|
38
|
+
else
|
39
|
+
IsoDoc::Plateau::PdfConvert.new(pdf_extract_attributes(node))
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def presentation_xml_converter(node)
|
44
|
+
if node.nil?
|
45
|
+
IsoDoc::Plateau::PresentationXMLConvert.new({})
|
46
|
+
else
|
47
|
+
IsoDoc::Plateau::PresentationXMLConvert
|
48
|
+
.new(doc_extract_attributes(node)
|
49
|
+
.merge(output_formats: ::Metanorma::Plateau::Processor.new
|
50
|
+
.output_formats))
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
require "metanorma/processor"
|
2
|
+
|
3
|
+
module Metanorma
|
4
|
+
module Plateau
|
5
|
+
class Processor < Metanorma::JIS::Processor
|
6
|
+
def initialize # rubocop:disable Lint/MissingSuper
|
7
|
+
@short = :plateau
|
8
|
+
@input_format = :asciidoc
|
9
|
+
@asciidoctor_backend = :plateau
|
10
|
+
end
|
11
|
+
|
12
|
+
def output_formats
|
13
|
+
super.merge(
|
14
|
+
html: "html",
|
15
|
+
pdf: "pdf",
|
16
|
+
doc: "doc",
|
17
|
+
)
|
18
|
+
end
|
19
|
+
|
20
|
+
def fonts_manifest
|
21
|
+
{
|
22
|
+
"STIX Two Math" => nil,
|
23
|
+
"IPAexGothic" => nil,
|
24
|
+
"IPAexMincho" => nil,
|
25
|
+
"Courier New" => nil,
|
26
|
+
"Cambria Math" => nil,
|
27
|
+
"Times New Roman" => nil,
|
28
|
+
"Arial" => nil,
|
29
|
+
}
|
30
|
+
end
|
31
|
+
|
32
|
+
def version
|
33
|
+
"Metanorma::JIS #{Metanorma::JIS::VERSION}"
|
34
|
+
end
|
35
|
+
|
36
|
+
def output(xml, inname, outname, format, options = {})
|
37
|
+
options_preprocess(options)
|
38
|
+
case format
|
39
|
+
when :html
|
40
|
+
IsoDoc::Plateau::HtmlConvert.new(options).convert(inname, xml, nil,
|
41
|
+
outname)
|
42
|
+
when :doc
|
43
|
+
IsoDoc::Plateau::WordConvert.new(options).convert(inname, xml, nil,
|
44
|
+
outname)
|
45
|
+
when :pdf
|
46
|
+
IsoDoc::Plateau::PdfConvert.new(options).convert(inname, xml, nil,
|
47
|
+
outname)
|
48
|
+
when :presentation
|
49
|
+
IsoDoc::Plateau::PresentationXMLConvert.new(options).convert(inname, xml,
|
50
|
+
nil, outname)
|
51
|
+
else
|
52
|
+
super
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
data/lib/metanorma-jis.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require "asciidoctor" unless defined? Asciidoctor::Converter
|
2
2
|
require_relative "metanorma/jis/converter"
|
3
|
+
require_relative "metanorma/plateau/converter"
|
3
4
|
require_relative "metanorma/jis/version"
|
4
5
|
require "isodoc/jis/html_convert"
|
5
6
|
require "isodoc/jis/word_convert"
|
@@ -7,10 +8,18 @@ require "isodoc/jis/pdf_convert"
|
|
7
8
|
require "isodoc/jis/presentation_xml_convert"
|
8
9
|
require "isodoc/jis/metadata"
|
9
10
|
require "isodoc/jis/xref"
|
11
|
+
require "isodoc/plateau/html_convert"
|
12
|
+
require "isodoc/plateau/word_convert"
|
13
|
+
require "isodoc/plateau/pdf_convert"
|
14
|
+
require "isodoc/plateau/presentation_xml_convert"
|
15
|
+
require "isodoc/plateau/metadata"
|
16
|
+
require "isodoc/plateau/xref"
|
10
17
|
require "metanorma"
|
11
18
|
|
12
19
|
if defined? Metanorma::Registry
|
13
20
|
require_relative "metanorma/jis"
|
14
21
|
Metanorma::Registry.instance.register(Metanorma::JIS::Processor)
|
22
|
+
require_relative "metanorma/plateau"
|
23
|
+
Metanorma::Registry.instance.register(Metanorma::Plateau::Processor)
|
15
24
|
end
|
16
25
|
|
data/metanorma-jis.gemspec
CHANGED
@@ -32,7 +32,7 @@ Gem::Specification.new do |spec|
|
|
32
32
|
|
33
33
|
spec.add_dependency "japanese_calendar", "~> 0"
|
34
34
|
spec.add_dependency "metanorma-iso", "~> 2.7.3"
|
35
|
-
spec.add_dependency "pubid
|
35
|
+
spec.add_dependency "pubid"
|
36
36
|
|
37
37
|
spec.add_development_dependency "debug"
|
38
38
|
spec.add_development_dependency "equivalent-xml", "~> 0.6"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metanorma-jis
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-04-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: japanese_calendar
|
@@ -39,7 +39,7 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 2.7.3
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name: pubid
|
42
|
+
name: pubid
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - ">="
|
@@ -282,6 +282,12 @@ files:
|
|
282
282
|
- lib/isodoc/jis/word_cleanup.rb
|
283
283
|
- lib/isodoc/jis/word_convert.rb
|
284
284
|
- lib/isodoc/jis/xref.rb
|
285
|
+
- lib/isodoc/plateau/html_convert.rb
|
286
|
+
- lib/isodoc/plateau/metadata.rb
|
287
|
+
- lib/isodoc/plateau/pdf_convert.rb
|
288
|
+
- lib/isodoc/plateau/presentation_xml_convert.rb
|
289
|
+
- lib/isodoc/plateau/word_convert.rb
|
290
|
+
- lib/isodoc/plateau/xref.rb
|
285
291
|
- lib/metanorma-jis.rb
|
286
292
|
- lib/metanorma/jis.rb
|
287
293
|
- lib/metanorma/jis/basicdoc.rng
|
@@ -300,6 +306,9 @@ files:
|
|
300
306
|
- lib/metanorma/jis/reqt.rng
|
301
307
|
- lib/metanorma/jis/validate.rb
|
302
308
|
- lib/metanorma/jis/version.rb
|
309
|
+
- lib/metanorma/plateau.rb
|
310
|
+
- lib/metanorma/plateau/converter.rb
|
311
|
+
- lib/metanorma/plateau/processor.rb
|
303
312
|
- metanorma-jis.gemspec
|
304
313
|
homepage: https://github.com/metanorma/metanorma-jis
|
305
314
|
licenses:
|