metanorma-jis 0.3.4 → 0.3.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 767a090a3aebe22d2d6f00eb901394cc4c03b2e0bd27cc742ed5474234dc3ae7
4
- data.tar.gz: f3bf668006d08059015df61d5970c17cb812f95ab524e403d0be44570e7f6925
3
+ metadata.gz: e0390d5e28376c6e536985c4f658e4e939eb12931602991a787b01fe832c6f8f
4
+ data.tar.gz: 599457fe99595bec1161f38217eca0ef96eab8ba1a401a4b6e6ba3ddda01f5db
5
5
  SHA512:
6
- metadata.gz: 415691142621e73ecad0196c8538ef4ee69a3101fb54273f93493c0ea8bf213f0d2e53b080f04834e39b85d282b043a59270b3332f37bc40e6511eeeebc4e7e1
7
- data.tar.gz: 45c5df4d2172923555dd91a7071a06f113a2d7990608f755ee7cb9d8f7ddee1c00ec9a7b4197d09ad0d0308044ab1573ff65750913b5aedba29265880d1b0985
6
+ metadata.gz: d24345a27eb6dde003eadf90254a267c86ca19bfbd16a9e94093e7389a5ffc843bc05db82389480a01d387456f7e23247efb34fc0c46a2f3095ff7bef1d289ce
7
+ data.tar.gz: bccf625290d0f44d49d024fe409b1d4e1c01849bef810ecbdd5571f3f6753691d5dc6b877327c781e6f10e9516f07c1f1739bca8eb2b658d264594524dad4a9e
@@ -1,5 +1,5 @@
1
1
  class Html2Doc
2
- class JIS < ::Html2Doc
2
+ class Jis < ::Html2Doc
3
3
  def list2para(list)
4
4
  return if list.xpath("./li").empty?
5
5
 
@@ -2,7 +2,7 @@ require "isodoc"
2
2
  require "metanorma-iso"
3
3
 
4
4
  module IsoDoc
5
- module JIS
5
+ module Jis
6
6
  module BaseConvert
7
7
  def termnote_parse(node, out)
8
8
  name = node.at(ns("./name"))&.remove
@@ -1,5 +1,5 @@
1
1
  module IsoDoc
2
- module JIS
2
+ module Jis
3
3
  class WordConvert < IsoDoc::Iso::WordConvert
4
4
  def figure_attrs(node)
5
5
  attr_code(id: node["id"], class: "MsoTableGrid",
@@ -82,6 +82,9 @@ p kbd, dt kbd, li kbd, label kbd, legend kbd, caption kbd, th kbd, td kbd,
82
82
  p samp, dt samp, li samp, label samp, legend samp, caption samp, th samp, td samp {
83
83
  font-size: {{monospacefontsize}}; }
84
84
 
85
+ sub, sup {
86
+ font-size: 0.75em; }
87
+
85
88
  article, aside, details, figcaption, figure,
86
89
  footer, header, hgroup, menu, nav, section {
87
90
  display: block; }
@@ -82,6 +82,9 @@ p kbd, dt kbd, li kbd, label kbd, legend kbd, caption kbd, th kbd, td kbd,
82
82
  p samp, dt samp, li samp, label samp, legend samp, caption samp, th samp, td samp {
83
83
  font-size: {{monospacefontsize}}; }
84
84
 
85
+ sub, sup {
86
+ font-size: 0.75em; }
87
+
85
88
  article, aside, details, figcaption, figure,
86
89
  footer, header, hgroup, menu, nav, section {
87
90
  display: block; }
@@ -4,7 +4,7 @@ require_relative "base_convert"
4
4
  require_relative "init"
5
5
 
6
6
  module IsoDoc
7
- module JIS
7
+ module Jis
8
8
  class HtmlConvert < IsoDoc::Iso::HtmlConvert
9
9
  def initialize(options)
10
10
  super
@@ -2,7 +2,7 @@ require "japanese_calendar"
2
2
  require "twitter_cldr"
3
3
 
4
4
  module IsoDoc
5
- module JIS
5
+ module Jis
6
6
  class I18n < IsoDoc::Iso::I18n
7
7
  def jis_load_file(fname)
8
8
  f = File.join(File.dirname(__FILE__), fname)
@@ -3,7 +3,7 @@ require_relative "metadata"
3
3
  require_relative "i18n"
4
4
 
5
5
  module IsoDoc
6
- module JIS
6
+ module Jis
7
7
  module Init
8
8
  def metadata_init(lang, script, locale, labels)
9
9
  @meta = Metadata.new(lang, script, locale, labels)
@@ -21,7 +21,7 @@ module IsoDoc
21
21
  end
22
22
 
23
23
  def bibrenderer(options = {})
24
- ::Relaton::Render::JIS::General.new(options.merge(language: @lang,
24
+ ::Relaton::Render::Jis::General.new(options.merge(language: @lang,
25
25
  i18nhash: @i18n.get))
26
26
  end
27
27
 
@@ -6,7 +6,10 @@
6
6
 
7
7
  <xsl:variable name="debug">false</xsl:variable>
8
8
 
9
- <xsl:variable name="isIgnoreComplexScripts">true</xsl:variable>
9
+ <!-- <xsl:variable name="isIgnoreComplexScripts">true</xsl:variable> -->
10
+
11
+ <xsl:variable name="vertical_layout" select="normalize-space(/*/jis:metanorma-extension/jis:presentation-metadata/jis:vertical-layout)"/>
12
+ <xsl:variable name="vertical_layout_rotate_clause_numbers" select="normalize-space(/*/jis:metanorma-extension/jis:presentation-metadata/jis:vertical-layout-rotate-clause-numbers)"/>
10
13
 
11
14
  <xsl:variable name="contents_">
12
15
  <xsl:variable name="bundle" select="count(//jis:jis-standard) &gt; 1"/>
@@ -67,21 +70,45 @@
67
70
  </fo:simple-page-master>
68
71
 
69
72
  <fo:simple-page-master master-name="first_page" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
70
- <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm"/>
73
+ <xsl:if test="$vertical_layout = 'true'">
74
+ <xsl:attribute name="page-width"><xsl:value-of select="$pageHeight"/>mm</xsl:attribute>
75
+ <xsl:attribute name="page-height"><xsl:value-of select="$pageWidth"/>mm</xsl:attribute>
76
+ </xsl:if>
77
+ <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm">
78
+ <xsl:if test="$vertical_layout = 'true'">
79
+ <xsl:attribute name="writing-mode">tb-rl</xsl:attribute>
80
+ </xsl:if>
81
+ </fo:region-body>
71
82
  <fo:region-before region-name="header" extent="{$marginTop}mm"/>
72
83
  <fo:region-after region-name="footer" extent="{$marginBottom}mm"/>
73
84
  <fo:region-start region-name="left-region" extent="{$marginLeftRight1}mm"/>
74
85
  <fo:region-end region-name="right-region" extent="{$marginLeftRight2}mm"/>
75
86
  </fo:simple-page-master>
76
87
  <fo:simple-page-master master-name="odd" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
77
- <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm"/>
88
+ <xsl:if test="$vertical_layout = 'true'">
89
+ <xsl:attribute name="page-width"><xsl:value-of select="$pageHeight"/>mm</xsl:attribute>
90
+ <xsl:attribute name="page-height"><xsl:value-of select="$pageWidth"/>mm</xsl:attribute>
91
+ </xsl:if>
92
+ <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm">
93
+ <xsl:if test="$vertical_layout = 'true'">
94
+ <xsl:attribute name="writing-mode">tb-rl</xsl:attribute>
95
+ </xsl:if>
96
+ </fo:region-body>
78
97
  <fo:region-before region-name="header-odd" extent="{$marginTop}mm"/>
79
98
  <fo:region-after region-name="footer" extent="{$marginBottom}mm"/>
80
99
  <fo:region-start region-name="left-region" extent="{$marginLeftRight1}mm"/>
81
100
  <fo:region-end region-name="right-region" extent="{$marginLeftRight2}mm"/>
82
101
  </fo:simple-page-master>
83
102
  <fo:simple-page-master master-name="even" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
84
- <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm"/>
103
+ <xsl:if test="$vertical_layout = 'true'">
104
+ <xsl:attribute name="page-width"><xsl:value-of select="$pageHeight"/>mm</xsl:attribute>
105
+ <xsl:attribute name="page-height"><xsl:value-of select="$pageWidth"/>mm</xsl:attribute>
106
+ </xsl:if>
107
+ <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm">
108
+ <xsl:if test="$vertical_layout = 'true'">
109
+ <xsl:attribute name="writing-mode">tb-rl</xsl:attribute>
110
+ </xsl:if>
111
+ </fo:region-body>
85
112
  <fo:region-before region-name="header-even" extent="{$marginTop}mm"/>
86
113
  <fo:region-after region-name="footer" extent="{$marginBottom}mm"/>
87
114
  <fo:region-start region-name="left-region" extent="{$marginLeftRight1}mm"/>
@@ -89,7 +116,15 @@
89
116
  </fo:simple-page-master>
90
117
 
91
118
  <fo:simple-page-master master-name="first_page_toc" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
92
- <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm"/>
119
+ <xsl:if test="$vertical_layout = 'true'">
120
+ <xsl:attribute name="page-width"><xsl:value-of select="$pageHeight"/>mm</xsl:attribute>
121
+ <xsl:attribute name="page-height"><xsl:value-of select="$pageWidth"/>mm</xsl:attribute>
122
+ </xsl:if>
123
+ <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm">
124
+ <xsl:if test="$vertical_layout = 'true'">
125
+ <xsl:attribute name="writing-mode">tb-rl</xsl:attribute>
126
+ </xsl:if>
127
+ </fo:region-body>
93
128
  <fo:region-before region-name="header-odd-first" extent="{$marginTop}mm"/>
94
129
  <fo:region-after region-name="footer" extent="{$marginBottom}mm"/>
95
130
  <fo:region-start region-name="left-region" extent="{$marginLeftRight1}mm"/>
@@ -127,7 +162,15 @@
127
162
  </fo:page-sequence-master>
128
163
 
129
164
  <fo:simple-page-master master-name="commentary_first_page_even" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
130
- <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm"/>
165
+ <xsl:if test="$vertical_layout = 'true'">
166
+ <xsl:attribute name="page-width"><xsl:value-of select="$pageHeight"/>mm</xsl:attribute>
167
+ <xsl:attribute name="page-height"><xsl:value-of select="$pageWidth"/>mm</xsl:attribute>
168
+ </xsl:if>
169
+ <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm">
170
+ <xsl:if test="$vertical_layout = 'true'">
171
+ <xsl:attribute name="writing-mode">tb-rl</xsl:attribute>
172
+ </xsl:if>
173
+ </fo:region-body>
131
174
  <fo:region-before region-name="header-commentary-even-first" extent="{$marginTop}mm"/>
132
175
  <fo:region-after region-name="footer" extent="{$marginBottom}mm"/>
133
176
  <fo:region-start region-name="left-region" extent="{$marginLeftRight1}mm"/>
@@ -135,7 +178,15 @@
135
178
  </fo:simple-page-master>
136
179
 
137
180
  <fo:simple-page-master master-name="commentary_first_page_odd" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
138
- <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm"/>
181
+ <xsl:if test="$vertical_layout = 'true'">
182
+ <xsl:attribute name="page-width"><xsl:value-of select="$pageHeight"/>mm</xsl:attribute>
183
+ <xsl:attribute name="page-height"><xsl:value-of select="$pageWidth"/>mm</xsl:attribute>
184
+ </xsl:if>
185
+ <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm">
186
+ <xsl:if test="$vertical_layout = 'true'">
187
+ <xsl:attribute name="writing-mode">tb-rl</xsl:attribute>
188
+ </xsl:if>
189
+ </fo:region-body>
139
190
  <fo:region-before region-name="header-commentary-odd-first" extent="{$marginTop}mm"/>
140
191
  <fo:region-after region-name="footer" extent="{$marginBottom}mm"/>
141
192
  <fo:region-start region-name="left-region" extent="{$marginLeftRight1}mm"/>
@@ -592,12 +643,22 @@
592
643
  </xsl:when>
593
644
  <xsl:otherwise>
594
645
  <fo:list-block space-after="5pt">
646
+ <xsl:variable name="provisional-distance-between-starts">
647
+ <xsl:choose>
648
+ <xsl:when test="string-length(@section) = 1">5</xsl:when>
649
+ <xsl:when test="string-length(@section) &gt;= 2"><xsl:value-of select="5 + (string-length(@section) - 1) * 2"/></xsl:when>
650
+ <xsl:when test="@type = 'annex'">16</xsl:when>
651
+ <xsl:otherwise>5</xsl:otherwise>
652
+ </xsl:choose>
653
+ </xsl:variable>
595
654
  <xsl:attribute name="provisional-distance-between-starts">
596
655
  <xsl:choose>
597
- <xsl:when test="string-length(@section) = 1">5mm</xsl:when>
598
- <xsl:when test="string-length(@section) &gt;= 2"><xsl:value-of select="5 + (string-length(@section) - 1) * 2"/>mm</xsl:when>
599
- <xsl:when test="@type = 'annex'">16mm</xsl:when>
600
- <xsl:otherwise>5mm</xsl:otherwise>
656
+ <xsl:when test="$vertical_layout_rotate_clause_numbers = 'true'">
657
+ <xsl:value-of select="concat($provisional-distance-between-starts * 1.5, 'mm')"/>
658
+ </xsl:when>
659
+ <xsl:otherwise>
660
+ <xsl:value-of select="concat($provisional-distance-between-starts, 'mm')"/>
661
+ </xsl:otherwise>
601
662
  </xsl:choose>
602
663
  </xsl:attribute>
603
664
  <fo:list-item>
@@ -1112,10 +1173,24 @@
1112
1173
  <xsl:call-template name="extractSection"/>
1113
1174
  </xsl:variable>
1114
1175
  <xsl:if test="normalize-space($section) != ''">
1115
- <fo:inline font-family="Times New Roman" font-weight="bold">
1116
- <xsl:value-of select="$section"/>
1117
- <fo:inline padding-right="4mm"> </fo:inline>
1118
- </fo:inline>
1176
+
1177
+ <xsl:choose>
1178
+ <xsl:when test="$vertical_layout_rotate_clause_numbers = 'true'">
1179
+ <fo:inline font-family="Times New Roman" font-weight="bold">
1180
+ <xsl:call-template name="insertVerticalChar">
1181
+ <xsl:with-param name="str" select="$section"/>
1182
+ </xsl:call-template>
1183
+ </fo:inline>
1184
+ <fo:inline padding-right="4mm"> </fo:inline>
1185
+ </xsl:when>
1186
+ <xsl:otherwise>
1187
+ <fo:inline font-family="Times New Roman" font-weight="bold">
1188
+ <xsl:value-of select="$section"/>
1189
+ <fo:inline padding-right="4mm"> </fo:inline>
1190
+ </fo:inline>
1191
+ </xsl:otherwise>
1192
+ </xsl:choose>
1193
+
1119
1194
  </xsl:if>
1120
1195
 
1121
1196
  <xsl:call-template name="extractTitle"/>
@@ -1595,6 +1670,9 @@
1595
1670
  <xsl:param name="section_title"/>
1596
1671
  <fo:static-content flow-name="header-odd-first" role="artifact">
1597
1672
  <fo:block-container font-family="Arial" font-size="9pt" height="26mm" display-align="after" text-align="right">
1673
+ <xsl:if test="$vertical_layout = 'true'">
1674
+ <xsl:attribute name="display-align">center</xsl:attribute>
1675
+ </xsl:if>
1598
1676
  <xsl:if test="$section = 'main'"><fo:block><fo:page-number/></fo:block></xsl:if>
1599
1677
  <fo:block>
1600
1678
  <xsl:copy-of select="$docidentifier"/>
@@ -1603,6 +1681,9 @@
1603
1681
  </fo:static-content>
1604
1682
  <fo:static-content flow-name="header-odd" role="artifact">
1605
1683
  <fo:block-container font-family="Arial" font-size="9pt" height="26mm" display-align="after" text-align="right">
1684
+ <xsl:if test="$vertical_layout = 'true'">
1685
+ <xsl:attribute name="display-align">center</xsl:attribute>
1686
+ </xsl:if>
1606
1687
  <xsl:if test="$section = 'main' or $section = 'commentary'"><fo:block><fo:page-number/></fo:block></xsl:if>
1607
1688
  <fo:block>
1608
1689
  <xsl:copy-of select="$docidentifier"/>
@@ -1612,6 +1693,9 @@
1612
1693
  </fo:static-content>
1613
1694
  <fo:static-content flow-name="header-even" role="artifact">
1614
1695
  <fo:block-container font-family="Arial" font-size="9pt" height="26mm" display-align="after">
1696
+ <xsl:if test="$vertical_layout = 'true'">
1697
+ <xsl:attribute name="display-align">center</xsl:attribute>
1698
+ </xsl:if>
1615
1699
  <xsl:if test="$section = 'main' or $section = 'commentary'"><fo:block><fo:page-number/></fo:block></xsl:if>
1616
1700
  <fo:block>
1617
1701
  <xsl:copy-of select="$docidentifier"/>
@@ -1622,6 +1706,9 @@
1622
1706
 
1623
1707
  <fo:static-content flow-name="header-commentary-even-first" role="artifact">
1624
1708
  <fo:block-container font-family="Arial" font-size="9pt" height="26mm" display-align="after" text-align="left">
1709
+ <xsl:if test="$vertical_layout = 'true'">
1710
+ <xsl:attribute name="display-align">center</xsl:attribute>
1711
+ </xsl:if>
1625
1712
  <fo:block><fo:page-number/></fo:block>
1626
1713
  <fo:block> </fo:block>
1627
1714
  </fo:block-container>
@@ -1629,6 +1716,9 @@
1629
1716
 
1630
1717
  <fo:static-content flow-name="header-commentary-odd-first" role="artifact">
1631
1718
  <fo:block-container font-family="Arial" font-size="9pt" height="26mm" display-align="after" text-align="right">
1719
+ <xsl:if test="$vertical_layout = 'true'">
1720
+ <xsl:attribute name="display-align">center</xsl:attribute>
1721
+ </xsl:if>
1632
1722
  <fo:block><fo:page-number/></fo:block>
1633
1723
  <fo:block> </fo:block>
1634
1724
  </fo:block-container>
@@ -1662,7 +1752,12 @@
1662
1752
  </fo:block>
1663
1753
  </xsl:if>
1664
1754
  <!-- copyright restriction -->
1665
- <fo:block font-size="7pt" text-align="center" font-family="IPAexMincho" margin-bottom="13mm"><xsl:value-of select="$copyrightText"/></fo:block>
1755
+ <fo:block font-size="7pt" text-align="center" font-family="IPAexMincho" margin-bottom="13mm">
1756
+ <xsl:if test="$vertical_layout = 'true'">
1757
+ <xsl:attribute name="margin-bottom">5mm</xsl:attribute>
1758
+ </xsl:if>
1759
+ <xsl:value-of select="$copyrightText"/>
1760
+ </fo:block>
1666
1761
  </fo:block-container>
1667
1762
  </fo:static-content>
1668
1763
  </xsl:template>
@@ -4865,6 +4960,7 @@
4865
4960
 
4866
4961
  <fo:block role="SKIP">
4867
4962
  <xsl:apply-templates/>
4963
+ <xsl:if test="$isGenerateTableIF = 'false' and count(node()) = 0"> </xsl:if>
4868
4964
  </fo:block>
4869
4965
  </fo:table-cell>
4870
4966
  </xsl:template> <!-- cell in table header row - 'th' -->
@@ -4928,6 +5024,8 @@
4928
5024
 
4929
5025
  <xsl:if test="$isGenerateTableIF = 'true'"> <fo:inline id="{@id}_end">end</fo:inline></xsl:if> <!-- to determine width of text --> <!-- <xsl:value-of select="$hair_space"/> -->
4930
5026
 
5027
+ <xsl:if test="$isGenerateTableIF = 'false' and count(node()) = 0"> </xsl:if>
5028
+
4931
5029
  </fo:block>
4932
5030
  </fo:table-cell>
4933
5031
  </xsl:template> <!-- td -->
@@ -4998,7 +5096,8 @@
4998
5096
  </xsl:choose>
4999
5097
  </xsl:variable>
5000
5098
  <xsl:variable name="current_fn_number_text">
5001
- <xsl:value-of select="$current_fn_number"/>
5099
+
5100
+ <xsl:value-of select="$current_fn_number"/>
5002
5101
 
5003
5102
  <fo:inline font-weight="normal">)</fo:inline>
5004
5103
 
@@ -5036,8 +5135,10 @@
5036
5135
 
5037
5136
  <xsl:call-template name="insert_basic_link">
5038
5137
  <xsl:with-param name="element">
5039
- <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}" role="Lbl">
5040
- <xsl:copy-of select="$current_fn_number_text"/>
5138
+ <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}"> <!-- note: role="Lbl" removed in https://github.com/metanorma/mn2pdf/issues/291 -->
5139
+ <fo:inline role="Lbl"> <!-- need for https://github.com/metanorma/metanorma-iso/issues/1003 -->
5140
+ <xsl:copy-of select="$current_fn_number_text"/>
5141
+ </fo:inline>
5041
5142
  </fo:basic-link>
5042
5143
  </xsl:with-param>
5043
5144
  </xsl:call-template>
@@ -5329,7 +5430,7 @@
5329
5430
 
5330
5431
  <xsl:call-template name="refine_fn-reference-style"/>
5331
5432
 
5332
- <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="{@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
5433
+ <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="footnote {@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
5333
5434
  <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> <!-- for footnotes in tables -->
5334
5435
  <xsl:attribute name="internal-destination">
5335
5436
  <xsl:value-of select="concat(@reference, '_', ancestor::*[local-name()='table'][1]/@id)"/>
@@ -6338,9 +6439,19 @@
6338
6439
  </fo:inline>
6339
6440
  </xsl:template>
6340
6441
 
6341
- <xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
6442
+ <xsl:template match="text()[ancestor::*[local-name()='smallcap']]" name="smallcaps">
6443
+ <xsl:param name="txt"/>
6342
6444
  <!-- <xsl:variable name="text" select="normalize-space(.)"/> --> <!-- https://github.com/metanorma/metanorma-iso/issues/1115 -->
6343
- <xsl:variable name="text" select="."/>
6445
+ <xsl:variable name="text">
6446
+ <xsl:choose>
6447
+ <xsl:when test="$txt != ''">
6448
+ <xsl:value-of select="$txt"/>
6449
+ </xsl:when>
6450
+ <xsl:otherwise>
6451
+ <xsl:value-of select="."/>
6452
+ </xsl:otherwise>
6453
+ </xsl:choose>
6454
+ </xsl:variable>
6344
6455
  <xsl:variable name="ratio_">
6345
6456
  0.75
6346
6457
  </xsl:variable>
@@ -7738,14 +7849,16 @@
7738
7849
  <xsl:template match="*[local-name()='link']" name="link">
7739
7850
  <xsl:variable name="target_normalized" select="translate(@target, '\', '/')"/>
7740
7851
  <xsl:variable name="target_attachment_name" select="substring-after($target_normalized, '_attachments/')"/>
7852
+ <xsl:variable name="isLinkToEmbeddedFile" select="normalize-space(@attachment = 'true' and $pdfAttachmentsList//attachment[@filename = current()/@target])"/>
7741
7853
  <xsl:variable name="target">
7742
7854
  <xsl:choose>
7743
7855
  <xsl:when test="@updatetype = 'true'">
7744
7856
  <xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
7745
7857
  </xsl:when>
7746
7858
  <!-- link to the PDF attachment -->
7747
- <xsl:when test="@attachment = 'true' and $pdfAttachmentsList//attachment[@filename = current()/@target]">
7748
- <xsl:value-of select="concat('url(embedded-file:', @target, ')')"/>
7859
+ <xsl:when test="$isLinkToEmbeddedFile = 'true'">
7860
+ <xsl:variable name="target_file" select="java:org.metanorma.fop.Util.getFilenameFromPath(@target)"/>
7861
+ <xsl:value-of select="concat('url(embedded-file:', $target_file, ')')"/>
7749
7862
  </xsl:when>
7750
7863
  <!-- <xsl:when test="starts-with($target_normalized, '_') and contains($target_normalized, '_attachments/') and $pdfAttachmentsList//attachment[@filename = $target_attachment_name]">
7751
7864
  <xsl:value-of select="concat('url(embedded-file:', $target_attachment_name, ')')"/>
@@ -7776,6 +7889,11 @@
7776
7889
  <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
7777
7890
  </xsl:if>
7778
7891
 
7892
+ <xsl:if test="$isLinkToEmbeddedFile = 'true'">
7893
+ <xsl:attribute name="color">inherit</xsl:attribute>
7894
+ <xsl:attribute name="text-decoration">none</xsl:attribute>
7895
+ </xsl:if>
7896
+
7779
7897
  <xsl:call-template name="refine_link-style"/>
7780
7898
 
7781
7899
  <xsl:choose>
@@ -7783,9 +7901,15 @@
7783
7901
  <xsl:apply-templates/>
7784
7902
  </xsl:when>
7785
7903
  <xsl:otherwise>
7904
+ <xsl:variable name="alt_text">
7905
+ <xsl:call-template name="getAltText"/>
7906
+ </xsl:variable>
7786
7907
  <xsl:call-template name="insert_basic_link">
7787
7908
  <xsl:with-param name="element">
7788
- <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
7909
+ <fo:basic-link external-destination="{$target}" fox:alt-text="{$alt_text}">
7910
+ <xsl:if test="$isLinkToEmbeddedFile = 'true'">
7911
+ <xsl:attribute name="role">Annot</xsl:attribute>
7912
+ </xsl:if>
7789
7913
  <xsl:choose>
7790
7914
  <xsl:when test="normalize-space(.) = ''">
7791
7915
  <xsl:call-template name="add-zero-spaces-link-java">
@@ -7798,6 +7922,10 @@
7798
7922
  </xsl:otherwise>
7799
7923
  </xsl:choose>
7800
7924
  </fo:basic-link>
7925
+ <xsl:if test="$isLinkToEmbeddedFile = 'true'">
7926
+ <!-- reserve space at right for PaperClip icon -->
7927
+ <fo:inline keep-with-previous.within-line="always">        </fo:inline>
7928
+ </xsl:if>
7801
7929
  </xsl:with-param>
7802
7930
  </xsl:call-template>
7803
7931
  </xsl:otherwise>
@@ -7805,6 +7933,14 @@
7805
7933
  </fo:inline>
7806
7934
  </xsl:template> <!-- link -->
7807
7935
 
7936
+ <xsl:template name="getAltText">
7937
+ <xsl:choose>
7938
+ <xsl:when test="normalize-space(.) = ''"><xsl:value-of select="@target"/></xsl:when>
7939
+ <xsl:otherwise><xsl:value-of select="normalize-space(translate(normalize-space(), ' —', ' -'))"/></xsl:otherwise>
7940
+ <!-- <xsl:otherwise><xsl:value-of select="@target"/></xsl:otherwise> -->
7941
+ </xsl:choose>
7942
+ </xsl:template>
7943
+
7808
7944
  <!-- ======================== -->
7809
7945
  <!-- Appendix processing -->
7810
7946
  <!-- ======================== -->
@@ -7835,7 +7971,7 @@
7835
7971
  <xsl:template match="*[local-name() = 'callout']">
7836
7972
  <xsl:choose>
7837
7973
  <xsl:when test="normalize-space(@target) = ''">&lt;<xsl:apply-templates/>&gt;</xsl:when>
7838
- <xsl:otherwise><fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link></xsl:otherwise>
7974
+ <xsl:otherwise><fo:basic-link internal-destination="{@target}" fox:alt-text="{normalize-space()}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link></xsl:otherwise>
7839
7975
  </xsl:choose>
7840
7976
  </xsl:template>
7841
7977
 
@@ -7864,7 +8000,10 @@
7864
8000
  <xsl:template match="*[local-name() = 'xref']">
7865
8001
  <xsl:call-template name="insert_basic_link">
7866
8002
  <xsl:with-param name="element">
7867
- <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
8003
+ <xsl:variable name="alt_text">
8004
+ <xsl:call-template name="getAltText"/>
8005
+ </xsl:variable>
8006
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="{$alt_text}" xsl:use-attribute-sets="xref-style">
7868
8007
  <xsl:if test="string-length(normalize-space()) &lt; 30 and not(contains(normalize-space(), 'http://')) and not(contains(normalize-space(), 'https://')) and not(ancestor::*[local-name() = 'table' or local-name() = 'dl'])">
7869
8008
  <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
7870
8009
  </xsl:if>
@@ -10337,12 +10476,14 @@
10337
10476
 
10338
10477
  <xsl:when test="contains(normalize-space($fo_element), 'list')">
10339
10478
 
10340
- <xsl:variable name="provisional_distance_between_starts">
10479
+ <xsl:variable name="provisional_distance_between_starts_">
10341
10480
  <xsl:value-of select="10 + $text_indent"/>
10342
10481
  </xsl:variable>
10343
- <xsl:variable name="indent">
10482
+ <xsl:variable name="provisional_distance_between_starts" select="normalize-space($provisional_distance_between_starts_)"/>
10483
+ <xsl:variable name="indent_">
10344
10484
  <xsl:value-of select="$text_indent"/>
10345
10485
  </xsl:variable>
10486
+ <xsl:variable name="indent" select="normalize-space($indent_)"/>
10346
10487
 
10347
10488
  <fo:list-block provisional-distance-between-starts="{$provisional_distance_between_starts}mm">
10348
10489
  <fo:list-item>
@@ -11059,14 +11200,17 @@
11059
11200
  </xsl:when>
11060
11201
  <xsl:when test="local-name(..) = 'ol' and @label"> <!-- for ordered lists 'ol', and if there is @label, for instance label="1.1.2" -->
11061
11202
 
11062
- <xsl:variable name="label">
11203
+ <xsl:variable name="type" select="../@type"/>
11063
11204
 
11064
- <xsl:variable name="type" select="../@type"/>
11205
+ <xsl:variable name="label">
11065
11206
 
11066
11207
  <xsl:variable name="style_prefix_">
11067
11208
  <xsl:if test="$type = 'roman'">
11068
11209
  <!-- Example: (i) -->
11069
11210
  </xsl:if>
11211
+ <xsl:if test="$type = 'alphabet'">
11212
+
11213
+ </xsl:if>
11070
11214
  </xsl:variable>
11071
11215
  <xsl:variable name="style_prefix" select="normalize-space($style_prefix_)"/>
11072
11216
 
@@ -11092,13 +11236,15 @@
11092
11236
  <xsl:if test="$style_prefix != '' and not(starts-with(@label, $style_prefix))">
11093
11237
  <xsl:value-of select="$style_prefix"/>
11094
11238
  </xsl:if>
11239
+
11095
11240
  <xsl:value-of select="@label"/>
11241
+
11096
11242
  <xsl:if test="not(java:endsWith(java:java.lang.String.new(@label),$style_suffix))">
11097
11243
  <xsl:value-of select="$style_suffix"/>
11098
11244
  </xsl:if>
11099
11245
  </xsl:variable>
11100
11246
 
11101
- <xsl:value-of select="normalize-space($label)"/>
11247
+ <xsl:value-of select="normalize-space($label)"/>
11102
11248
 
11103
11249
  </xsl:when>
11104
11250
  <xsl:otherwise> <!-- for ordered lists 'ol' -->
@@ -13416,9 +13562,15 @@
13416
13562
  </x:xmpmeta>
13417
13563
  <!-- add attachments -->
13418
13564
  <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']">
13419
- <xsl:variable name="description" select="normalize-space(//*[local-name() = 'bibitem'][@hidden = 'true'][*[local-name() = 'uri'][@type = 'attachment'] = current()/@name]/*[local-name() = 'formattedref'])"/>
13420
-
13421
- <pdf:embedded-file filename="{@name}">
13565
+ <xsl:variable name="bibitem_attachment_" select="//*[local-name() = 'bibitem'][@hidden = 'true'][*[local-name() = 'uri'][@type = 'attachment'] = current()/@name]"/>
13566
+ <xsl:variable name="bibitem_attachment" select="xalan:nodeset($bibitem_attachment_)"/>
13567
+ <xsl:variable name="description" select="normalize-space($bibitem_attachment/*[local-name() = 'formattedref'])"/>
13568
+ <xsl:variable name="filename" select="java:org.metanorma.fop.Util.getFilenameFromPath(@name)"/>
13569
+ <!-- Todo: need update -->
13570
+ <xsl:variable name="afrelationship" select="normalize-space($bibitem_attachment//*[local-name() = 'classification'][@type = 'pdf-AFRelationship'])"/>
13571
+ <xsl:variable name="volatile" select="normalize-space($bibitem_attachment//*[local-name() = 'classification'][@type = 'pdf-volatile'])"/>
13572
+
13573
+ <pdf:embedded-file filename="{$filename}" link-as-file-annotation="true">
13422
13574
  <xsl:attribute name="src">
13423
13575
  <xsl:choose>
13424
13576
  <xsl:when test="normalize-space() != ''">
@@ -13434,18 +13586,34 @@
13434
13586
  <xsl:if test="$description != ''">
13435
13587
  <xsl:attribute name="description"><xsl:value-of select="$description"/></xsl:attribute>
13436
13588
  </xsl:if>
13589
+ <xsl:if test="$afrelationship != ''">
13590
+ <xsl:attribute name="afrelationship"><xsl:value-of select="$afrelationship"/></xsl:attribute>
13591
+ </xsl:if>
13592
+ <xsl:if test="$volatile != ''">
13593
+ <xsl:attribute name="volatile"><xsl:value-of select="$volatile"/></xsl:attribute>
13594
+ </xsl:if>
13437
13595
  </pdf:embedded-file>
13438
13596
  </xsl:for-each>
13439
13597
  <!-- references to external attachments (no binary-encoded within the Metanorma XML file) -->
13440
13598
  <xsl:if test="not(//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment'])">
13441
13599
  <xsl:for-each select="//*[local-name() = 'bibitem'][@hidden = 'true'][*[local-name() = 'uri'][@type = 'attachment']]">
13442
13600
  <xsl:variable name="attachment_path" select="*[local-name() = 'uri'][@type = 'attachment']"/>
13601
+ <xsl:variable name="attachment_name" select="java:org.metanorma.fop.Util.getFilenameFromPath($attachment_path)"/>
13443
13602
  <xsl:variable name="url" select="concat('url(file:///',$basepath, $attachment_path, ')')"/>
13444
13603
  <xsl:variable name="description" select="normalize-space(*[local-name() = 'formattedref'])"/>
13445
- <pdf:embedded-file src="{$url}" filename="{$attachment_path}">
13604
+ <!-- Todo: need update -->
13605
+ <xsl:variable name="afrelationship" select="normalize-space(.//*[local-name() = 'classification'][@type = 'pdf-AFRelationship'])"/>
13606
+ <xsl:variable name="volatile" select="normalize-space(.//*[local-name() = 'classification'][@type = 'pdf-volatile'])"/>
13607
+ <pdf:embedded-file src="{$url}" filename="{$attachment_name}" link-as-file-annotation="true">
13446
13608
  <xsl:if test="$description != ''">
13447
13609
  <xsl:attribute name="description"><xsl:value-of select="$description"/></xsl:attribute>
13448
13610
  </xsl:if>
13611
+ <xsl:if test="$afrelationship != ''">
13612
+ <xsl:attribute name="afrelationship"><xsl:value-of select="$afrelationship"/></xsl:attribute>
13613
+ </xsl:if>
13614
+ <xsl:if test="$volatile != ''">
13615
+ <xsl:attribute name="volatile"><xsl:value-of select="$volatile"/></xsl:attribute>
13616
+ </xsl:if>
13449
13617
  </pdf:embedded-file>
13450
13618
  </xsl:for-each>
13451
13619
  </xsl:if>
@@ -13465,6 +13633,12 @@
13465
13633
  <!-- Get or calculate depth of the element -->
13466
13634
  <xsl:template name="getLevel">
13467
13635
  <xsl:param name="depth"/>
13636
+ <!-- <xsl:message>
13637
+ <xsl:choose>
13638
+ <xsl:when test="local-name() = 'title'">title=<xsl:value-of select="."/></xsl:when>
13639
+ <xsl:when test="local-name() = 'clause'">clause/title=<xsl:value-of select="*[local-name() = 'title']"/></xsl:when>
13640
+ </xsl:choose>
13641
+ </xsl:message> -->
13468
13642
  <xsl:choose>
13469
13643
  <xsl:when test="normalize-space(@depth) != ''">
13470
13644
  <xsl:value-of select="@depth"/>
@@ -13485,8 +13659,48 @@
13485
13659
  <xsl:when test="ancestor::*[local-name() = 'preface']">
13486
13660
  <xsl:value-of select="$level_total - 2"/>
13487
13661
  </xsl:when>
13662
+ <xsl:when test="ancestor::*[local-name() = 'sections'] and self::*[local-name() = 'title']">
13663
+ <!-- determine 'depth' depends on upper clause with title/@depth -->
13664
+ <!-- <xsl:message>title=<xsl:value-of select="."/></xsl:message> -->
13665
+ <xsl:variable name="clause_with_depth_depth" select="ancestor::*[local-name() = 'clause'][*[local-name() = 'title']/@depth][1]/*[local-name() = 'title']/@depth"/>
13666
+ <!-- <xsl:message>clause_with_depth_depth=<xsl:value-of select="$clause_with_depth_depth"/></xsl:message> -->
13667
+ <xsl:variable name="clause_with_depth_level" select="count(ancestor::*[local-name() = 'clause'][*[local-name() = 'title']/@depth][1]/ancestor::*)"/>
13668
+ <!-- <xsl:message>clause_with_depth_level=<xsl:value-of select="$clause_with_depth_level"/></xsl:message> -->
13669
+ <xsl:variable name="curr_level" select="count(ancestor::*) - 1"/>
13670
+ <!-- <xsl:message>curr_level=<xsl:value-of select="$curr_level"/></xsl:message> -->
13671
+ <!-- <xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause'][2]/*[local-name() = 'title']/@depth)"/> -->
13672
+ <xsl:variable name="curr_clause_depth" select="number($clause_with_depth_depth) + (number($curr_level) - number($clause_with_depth_level)) "/>
13673
+ <!-- <xsl:message>curr_clause_depth=<xsl:value-of select="$curr_clause_depth"/></xsl:message> -->
13674
+ <xsl:choose>
13675
+ <xsl:when test="string(number($curr_clause_depth)) != 'NaN'">
13676
+ <xsl:value-of select="number($curr_clause_depth)"/>
13677
+ </xsl:when>
13678
+ <xsl:otherwise>
13679
+ <xsl:value-of select="$level_total - 2"/>
13680
+ </xsl:otherwise>
13681
+ </xsl:choose>
13682
+ </xsl:when>
13683
+ <xsl:when test="ancestor::*[local-name() = 'sections'] and self::*[local-name() = 'name'] and parent::*[local-name() = 'term']">
13684
+ <xsl:variable name="upper_terms_depth" select="normalize-space(ancestor::*[local-name() = 'terms'][1]/*[local-name() = 'title']/@depth)"/>
13685
+ <xsl:choose>
13686
+ <xsl:when test="string(number($upper_terms_depth)) != 'NaN'">
13687
+ <xsl:value-of select="number($upper_terms_depth + 1)"/>
13688
+ </xsl:when>
13689
+ <xsl:otherwise>
13690
+ <xsl:value-of select="$level_total - 2"/>
13691
+ </xsl:otherwise>
13692
+ </xsl:choose>
13693
+ </xsl:when>
13488
13694
  <xsl:when test="ancestor::*[local-name() = 'sections']">
13489
- <xsl:value-of select="$level_total - 1"/>
13695
+ <xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause' or local-name() = 'terms'][1]/*[local-name() = 'title']/@depth)"/>
13696
+ <xsl:choose>
13697
+ <xsl:when test="string(number($upper_clause_depth)) != 'NaN'">
13698
+ <xsl:value-of select="number($upper_clause_depth + 1)"/>
13699
+ </xsl:when>
13700
+ <xsl:otherwise>
13701
+ <xsl:value-of select="$level_total - 1"/>
13702
+ </xsl:otherwise>
13703
+ </xsl:choose>
13490
13704
  </xsl:when>
13491
13705
  <xsl:when test="ancestor::*[local-name() = 'bibliography']">
13492
13706
  <xsl:value-of select="$level_total - 1"/>
@@ -13494,6 +13708,17 @@
13494
13708
  <xsl:when test="parent::*[local-name() = 'annex']">
13495
13709
  <xsl:value-of select="$level_total - 1"/>
13496
13710
  </xsl:when>
13711
+ <xsl:when test="ancestor::*[local-name() = 'annex'] and self::*[local-name() = 'title']">
13712
+ <xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause'][2]/*[local-name() = 'title']/@depth)"/>
13713
+ <xsl:choose>
13714
+ <xsl:when test="string(number($upper_clause_depth)) != 'NaN'">
13715
+ <xsl:value-of select="number($upper_clause_depth + 1)"/>
13716
+ </xsl:when>
13717
+ <xsl:otherwise>
13718
+ <xsl:value-of select="$level_total - 1"/>
13719
+ </xsl:otherwise>
13720
+ </xsl:choose>
13721
+ </xsl:when>
13497
13722
  <xsl:when test="ancestor::*[local-name() = 'annex']">
13498
13723
  <xsl:value-of select="$level_total"/>
13499
13724
  </xsl:when>
@@ -13850,6 +14075,20 @@
13850
14075
 
13851
14076
  <!-- END: insert cover page image -->
13852
14077
 
14078
+ <xsl:template name="insertVerticalChar">
14079
+ <xsl:param name="str"/>
14080
+ <xsl:if test="string-length($str) &gt; 0">
14081
+ <fo:inline-container writing-mode="lr-tb" text-align="center" alignment-baseline="central" reference-orientation="90" width="1em" margin="0" padding="0" text-indent="0mm" last-line-end-indent="0mm" start-indent="0mm" end-indent="0mm">
14082
+ <fo:block-container width="1em">
14083
+ <fo:block line-height="1em"><xsl:value-of select="substring($str,1,1)"/></fo:block>
14084
+ </fo:block-container>
14085
+ </fo:inline-container>
14086
+ <xsl:call-template name="insertVerticalChar">
14087
+ <xsl:with-param name="str" select="substring($str, 2)"/>
14088
+ </xsl:call-template>
14089
+ </xsl:if>
14090
+ </xsl:template>
14091
+
13853
14092
  <xsl:template name="number-to-words">
13854
14093
  <xsl:param name="number"/>
13855
14094
  <xsl:param name="first"/>
@@ -14137,4 +14376,18 @@
14137
14376
  </xsl:if>
14138
14377
  </xsl:template>
14139
14378
 
14379
+ <xsl:template match="@*|node()" mode="set_table_role_skip">
14380
+ <xsl:copy>
14381
+ <xsl:apply-templates select="@*|node()" mode="set_table_role_skip"/>
14382
+ </xsl:copy>
14383
+ </xsl:template>
14384
+
14385
+ <xsl:template match="*[starts-with(local-name(), 'table')]" mode="set_table_role_skip">
14386
+ <xsl:copy>
14387
+ <xsl:apply-templates select="@*" mode="set_table_role_skip"/>
14388
+ <xsl:attribute name="role">SKIP</xsl:attribute>
14389
+ <xsl:apply-templates select="node()" mode="set_table_role_skip"/>
14390
+ </xsl:copy>
14391
+ </xsl:template>
14392
+
14140
14393
  </xsl:stylesheet>
@@ -2,7 +2,7 @@ require "isodoc"
2
2
  require "metanorma-iso"
3
3
 
4
4
  module IsoDoc
5
- module JIS
5
+ module Jis
6
6
  class Metadata < IsoDoc::Iso::Metadata
7
7
  def title(isoxml, _out)
8
8
  lang = @lang
@@ -2,7 +2,7 @@ require_relative "base_convert"
2
2
  require "isodoc"
3
3
 
4
4
  module IsoDoc
5
- module JIS
5
+ module Jis
6
6
  class PdfConvert < IsoDoc::XslfoPdfConvert
7
7
  def initialize(options)
8
8
  @libdir = File.dirname(__FILE__)
@@ -2,7 +2,7 @@ require_relative "init"
2
2
  require "isodoc"
3
3
 
4
4
  module IsoDoc
5
- module JIS
5
+ module Jis
6
6
  class PresentationXMLConvert < IsoDoc::Iso::PresentationXMLConvert
7
7
  def annex1(elem)
8
8
  elem["commentary"] == "true" and return commentary(elem)
@@ -4,7 +4,7 @@ require_relative "presentation_section"
4
4
  require_relative "../../relaton/render-jis/general"
5
5
 
6
6
  module IsoDoc
7
- module JIS
7
+ module Jis
8
8
  class PresentationXMLConvert < IsoDoc::Iso::PresentationXMLConvert
9
9
  def inline(docxml)
10
10
  super
@@ -1,5 +1,5 @@
1
1
  module IsoDoc
2
- module JIS
2
+ module Jis
3
3
  class WordConvert < IsoDoc::Iso::WordConvert
4
4
  def make_table_footnote_target(out, fnid, fnref)
5
5
  attrs = { id: fnid, class: "TableFootnoteRef" }
@@ -1,7 +1,7 @@
1
1
  require_relative "../../html2doc/lists"
2
2
 
3
3
  module IsoDoc
4
- module JIS
4
+ module Jis
5
5
  class WordConvert < IsoDoc::Iso::WordConvert
6
6
  def word_cleanup(docxml)
7
7
  word_note_cleanup(docxml)
@@ -65,7 +65,7 @@ module IsoDoc
65
65
  def to_word1(result, filename, dir, header)
66
66
  result or return
67
67
  result = from_xhtml(result).gsub(/-DOUBLE_HYPHEN_ESCAPE-/, "--")
68
- ::Html2Doc::JIS.new(
68
+ ::Html2Doc::Jis.new(
69
69
  filename: filename, imagedir: @localdir,
70
70
  stylesheet: @wordstylesheet&.path,
71
71
  header_file: header&.path, dir: dir,
@@ -6,7 +6,7 @@ require_relative "figure"
6
6
  require_relative "table"
7
7
 
8
8
  module IsoDoc
9
- module JIS
9
+ module Jis
10
10
  class WordConvert < IsoDoc::Iso::WordConvert
11
11
  def initialize(options)
12
12
  @libdir = File.dirname(__FILE__)
@@ -1,5 +1,5 @@
1
1
  module IsoDoc
2
- module JIS
2
+ module Jis
3
3
  class Counter < IsoDoc::XrefGen::Counter
4
4
  def ol_type(list, depth)
5
5
  return list["type"].to_sym if list["type"]
@@ -72,6 +72,9 @@ standards defining organization, and that is rendered in a distinct manner</a:do
72
72
  from other documents in the same doctype</a:documentation>
73
73
  </ref>
74
74
  </optional>
75
+ <ref name="flavor">
76
+ <a:documentation>Flavour of Metanorma used to process this document</a:documentation>
77
+ </ref>
75
78
  <optional>
76
79
  <ref name="editorialgroup">
77
80
  <a:documentation>Groups associated with the production of the standards document, typically within
@@ -113,6 +116,16 @@ a standards definition organization</a:documentation>
113
116
  <define name="DocumentSubtype">
114
117
  <text/>
115
118
  </define>
119
+ <define name="flavor">
120
+ <element name="flavor">
121
+ <ref name="MetanormaFlavor"/>
122
+ </element>
123
+ </define>
124
+ <define name="MetanormaFlavor">
125
+ <a:documentation>This is in fact an enum, as of this writing: standoc iso generic ietf ieee itu nist ogc csa cc iho ribose jis iec bsi bipm plateau.
126
+ However we prefer not to hardcode it, given ongoing extension.</a:documentation>
127
+ <text/>
128
+ </define>
116
129
  <define name="editorialgroup">
117
130
  <a:documentation>A group associated with the production of the standards document, typically within
118
131
  a standards definition organization</a:documentation>
@@ -1382,18 +1382,7 @@ Applies whether the resource has already been created or not, and whether it is
1382
1382
  <define name="bdate">
1383
1383
  <a:documentation>Significant date in the lifecycle of the bibliographic item, including its production and its access</a:documentation>
1384
1384
  <element name="date">
1385
- <attribute name="type">
1386
- <a:documentation>The phase of the production of or access to a bibliographic item</a:documentation>
1387
- <choice>
1388
- <ref name="BibliographicDateType"/>
1389
- <text/>
1390
- </choice>
1391
- </attribute>
1392
- <optional>
1393
- <attribute name="text">
1394
- <a:documentation>An optional textual description of the date, especially when a Gregorian date is not applicable</a:documentation>
1395
- </attribute>
1396
- </optional>
1385
+ <ref name="bDateAttributes"/>
1397
1386
  <optional>
1398
1387
  <choice>
1399
1388
  <group>
@@ -1416,6 +1405,20 @@ Applies whether the resource has already been created or not, and whether it is
1416
1405
  </optional>
1417
1406
  </element>
1418
1407
  </define>
1408
+ <define name="bDateAttributes">
1409
+ <attribute name="type">
1410
+ <a:documentation>The phase of the production of or access to a bibliographic item</a:documentation>
1411
+ <choice>
1412
+ <ref name="BibliographicDateType"/>
1413
+ <text/>
1414
+ </choice>
1415
+ </attribute>
1416
+ <optional>
1417
+ <attribute name="text">
1418
+ <a:documentation>An optional textual description of the date, especially when a Gregorian date is not applicable</a:documentation>
1419
+ </attribute>
1420
+ </optional>
1421
+ </define>
1419
1422
  <define name="docidentifier">
1420
1423
  <a:documentation>An identifier of a bibliographic item in an international standard scheme</a:documentation>
1421
1424
  <element name="docidentifier">
@@ -1884,6 +1887,10 @@ Detailed in https://www.relaton.org/model/relations/</a:documentation>
1884
1887
  <value>hasAnnotation</value>
1885
1888
  <value>draftOf</value>
1886
1889
  <value>hasDraft</value>
1890
+ <value>preliminaryDraftOf</value>
1891
+ <value>hasPreliminaryDraft</value>
1892
+ <value>revisionDraftOf</value>
1893
+ <value>hasRevisionDraft</value>
1887
1894
  <value>editionOf</value>
1888
1895
  <value>hasEdition</value>
1889
1896
  <value>updates</value>
@@ -1,6 +1,6 @@
1
1
  module Metanorma
2
- module JIS
3
- class Converter < ISO::Converter
2
+ module Jis
3
+ class Converter < Iso::Converter
4
4
  def norm_ref_preface(ref)
5
5
  if ref.at("./note[@type = 'boilerplate']")
6
6
  unwrap_boilerplate_clauses(ref, ".")
@@ -5,8 +5,8 @@ require_relative "validate"
5
5
  require_relative "cleanup"
6
6
 
7
7
  module Metanorma
8
- module JIS
9
- class Converter < ISO::Converter
8
+ module Jis
9
+ class Converter < Iso::Converter
10
10
  XML_ROOT_TAG = "jis-standard".freeze
11
11
  XML_NAMESPACE = "https://www.metanorma.org/ns/jis".freeze
12
12
 
@@ -48,17 +48,17 @@ module Metanorma
48
48
 
49
49
  def html_converter(node)
50
50
  if node.nil?
51
- IsoDoc::JIS::HtmlConvert.new({})
51
+ IsoDoc::Jis::HtmlConvert.new({})
52
52
  else
53
- IsoDoc::JIS::HtmlConvert.new(html_extract_attributes(node))
53
+ IsoDoc::Jis::HtmlConvert.new(html_extract_attributes(node))
54
54
  end
55
55
  end
56
56
 
57
57
  def doc_converter(node)
58
58
  if node.nil?
59
- IsoDoc::JIS::WordConvert.new({})
59
+ IsoDoc::Jis::WordConvert.new({})
60
60
  else
61
- IsoDoc::JIS::WordConvert.new(doc_extract_attributes(node))
61
+ IsoDoc::Jis::WordConvert.new(doc_extract_attributes(node))
62
62
  end
63
63
  end
64
64
 
@@ -66,19 +66,19 @@ module Metanorma
66
66
  return if node.attr("no-pdf")
67
67
 
68
68
  if node.nil?
69
- IsoDoc::JIS::PdfConvert.new({})
69
+ IsoDoc::Jis::PdfConvert.new({})
70
70
  else
71
- IsoDoc::JIS::PdfConvert.new(pdf_extract_attributes(node))
71
+ IsoDoc::Jis::PdfConvert.new(pdf_extract_attributes(node))
72
72
  end
73
73
  end
74
74
 
75
75
  def presentation_xml_converter(node)
76
76
  if node.nil?
77
- IsoDoc::JIS::PresentationXMLConvert.new({})
77
+ IsoDoc::Jis::PresentationXMLConvert.new({})
78
78
  else
79
- IsoDoc::JIS::PresentationXMLConvert
79
+ IsoDoc::Jis::PresentationXMLConvert
80
80
  .new(doc_extract_attributes(node)
81
- .merge(output_formats: ::Metanorma::JIS::Processor.new
81
+ .merge(output_formats: ::Metanorma::Jis::Processor.new
82
82
  .output_formats))
83
83
  end
84
84
  end
@@ -1,8 +1,8 @@
1
1
  require "pubid-jis"
2
2
 
3
3
  module Metanorma
4
- module JIS
5
- class Converter < ISO::Converter
4
+ module Jis
5
+ class Converter < Iso::Converter
6
6
  def org_abbrev
7
7
  super.merge("Japanese Industrial Standards" => "JIS")
8
8
  end
@@ -1,7 +1,7 @@
1
1
  require "metanorma/processor"
2
2
 
3
3
  module Metanorma
4
- module JIS
4
+ module Jis
5
5
  class Processor < Metanorma::Processor
6
6
 
7
7
  def initialize # rubocop:disable Lint/MissingSuper
@@ -31,20 +31,20 @@ module Metanorma
31
31
  end
32
32
 
33
33
  def version
34
- "Metanorma::JIS #{Metanorma::JIS::VERSION}"
34
+ "Metanorma::Jis #{Metanorma::Jis::VERSION}"
35
35
  end
36
36
 
37
37
  def output(xml, inname, outname, format, options = {})
38
38
  options_preprocess(options)
39
39
  case format
40
40
  when :html
41
- IsoDoc::JIS::HtmlConvert.new(options).convert(inname, xml, nil, outname)
41
+ IsoDoc::Jis::HtmlConvert.new(options).convert(inname, xml, nil, outname)
42
42
  when :doc
43
- IsoDoc::JIS::WordConvert.new(options).convert(inname, xml, nil, outname)
43
+ IsoDoc::Jis::WordConvert.new(options).convert(inname, xml, nil, outname)
44
44
  when :pdf
45
- IsoDoc::JIS::PdfConvert.new(options).convert(inname, xml, nil, outname)
45
+ IsoDoc::Jis::PdfConvert.new(options).convert(inname, xml, nil, outname)
46
46
  when :presentation
47
- IsoDoc::JIS::PresentationXMLConvert.new(options).convert(inname, xml, nil, outname)
47
+ IsoDoc::Jis::PresentationXMLConvert.new(options).convert(inname, xml, nil, outname)
48
48
  else
49
49
  super
50
50
  end
@@ -7,6 +7,7 @@
7
7
  </optional>
8
8
  <ref name="doctype"/>
9
9
  <ref name="editorialgroup"/>
10
+ <ref name="flavor"/>
10
11
  <zeroOrMore>
11
12
  <ref name="ics"/>
12
13
  </zeroOrMore>
@@ -1,6 +1,6 @@
1
1
  module Metanorma
2
- module JIS
3
- class Converter < ISO::Converter
2
+ module Jis
3
+ class Converter < Iso::Converter
4
4
  def doctype_validate(_xmldoc)
5
5
  %w(japanese-industrial-standard technical-report
6
6
  technical-specification amendment).include? @doctype or
@@ -1,6 +1,6 @@
1
1
  module Metanorma
2
- module JIS
3
- VERSION = "0.3.4".freeze
2
+ module Jis
3
+ VERSION = "0.3.6".freeze
4
4
  end
5
5
  end
6
6
 
data/lib/metanorma/jis.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  require_relative "./jis/processor"
2
2
 
3
3
  module Metanorma
4
- module JIS
4
+ module Jis
5
5
  end
6
6
  end
data/lib/metanorma-jis.rb CHANGED
@@ -11,6 +11,6 @@ require "metanorma"
11
11
 
12
12
  if defined? Metanorma::Registry
13
13
  require_relative "metanorma/jis"
14
- Metanorma::Registry.instance.register(Metanorma::JIS::Processor)
14
+ Metanorma::Registry.instance.register(Metanorma::Jis::Processor)
15
15
  end
16
16
 
@@ -5,7 +5,7 @@ require_relative "parse"
5
5
 
6
6
  module Relaton
7
7
  module Render
8
- module JIS
8
+ module Jis
9
9
  class General < ::Relaton::Render::Iso::General
10
10
  def config_loc
11
11
  YAML.load_file(File.join(File.dirname(__FILE__), "config.yml"))
@@ -13,7 +13,7 @@ module Relaton
13
13
 
14
14
  def klass_initialize(_options)
15
15
  super
16
- @parseklass = Relaton::Render::JIS::Parse
16
+ @parseklass = Relaton::Render::Jis::Parse
17
17
  end
18
18
 
19
19
  def render1(doc)
@@ -2,7 +2,7 @@ require "metanorma-iso"
2
2
 
3
3
  module Relaton
4
4
  module Render
5
- module JIS
5
+ module Jis
6
6
  class Parse < ::Relaton::Render::Iso::Parse
7
7
  def simple_or_host_xml2hash(doc, host)
8
8
  ret = super
@@ -6,7 +6,7 @@ require "metanorma/jis/version"
6
6
 
7
7
  Gem::Specification.new do |spec|
8
8
  spec.name = "metanorma-jis"
9
- spec.version = Metanorma::JIS::VERSION
9
+ spec.version = Metanorma::Jis::VERSION
10
10
  spec.authors = ["Ribose Inc."]
11
11
  spec.email = ["open.source@ribose.com"]
12
12
 
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.3.4
4
+ version: 0.3.6
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-09-16 00:00:00.000000000 Z
11
+ date: 2024-10-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: japanese_calendar