metanorma-jis 0.0.4 → 0.0.5

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: 6bf51e10fbc568a6c14c9e8b4192e16f90b5dd093aff54cdc0fbdb9ef11566bb
4
- data.tar.gz: 060bddc60dd35141b7143e36a1cd66bc4ef89b9db9fc0b5d385ea9171d3baa8b
3
+ metadata.gz: 8aa2b9625e047934a606fac5b563a4dc8df41167eefe628458b432cbbaca8323
4
+ data.tar.gz: 21fffd5a4b5699203b50ddff19f63424a3247a2a4d02c3c0e7e70bea2df9fcdb
5
5
  SHA512:
6
- metadata.gz: fa5e35fcdff0101c14bd5f3d713560aa8e5236e055288e328b4024268bc9e62b1fbd399d75a388b337a7779be50939fc96438cedf691106f6ef77aca56921dd6
7
- data.tar.gz: 55665ed144401a91526a924d27a8b2134b818581627663e371fec91fe1ccf60afb384838364dfd3986798f093e03818cd9e0e9983f6371227d9b427f9b1aab5d
6
+ metadata.gz: b6175e4ab29f198e963f657f2f2420fe8d9bbc43eb574ab144bb5f384472265842045a8068e5ead0c6974daedf076d6e9296bf4e87d6c04312944c0622b20dc9
7
+ data.tar.gz: 04bc71690313eac02acc1a3ee88360c7153c84cd586f5af75824aac053d4d23eb0cf069c1a03352116631955eb378993ddb2c1ec3e64cf49f10d655fc1c80a3f
@@ -105,6 +105,8 @@ module IsoDoc
105
105
  def middle(isoxml, out)
106
106
  middle_title(isoxml, out)
107
107
  middle_admonitions(isoxml, out)
108
+ i = isoxml.at(ns("//sections/introduction")) and
109
+ introduction i, out
108
110
  scope isoxml, out, 0
109
111
  norm_ref isoxml, out, 0
110
112
  clause_etc isoxml, out, 0
@@ -2,7 +2,6 @@
2
2
 
3
3
  <nav>
4
4
 
5
- <h1 id="content">{{ labels["table_of_contents"] }}</h1>
6
5
  <div id="toc"></div>
7
6
 
8
7
  </nav>
@@ -935,7 +935,7 @@ p.Chapter, li.Chapter, div.Chapter {
935
935
  mso-no-proof: yes; }
936
936
 
937
937
  p.zzSTDTitle2, li.zzSTDTitle2, div.zzSTDTitle2 {
938
- mso-style-name: 章;
938
+ mso-style-name: 規格名称(英語);
939
939
  /* Standard name (English) */
940
940
  mso-style-unhide: no;
941
941
  mso-style-parent: "";
@@ -892,7 +892,7 @@ p.Chapter, li.Chapter, div.Chapter
892
892
  mso-bidi-font-weight:normal;
893
893
  mso-no-proof:yes;}
894
894
  p.zzSTDTitle2, li.zzSTDTitle2, div.zzSTDTitle2
895
- {mso-style-name:章;
895
+ {mso-style-name:規格名称(英語);
896
896
  /* Standard name (English) */
897
897
  mso-style-unhide:no;
898
898
  mso-style-parent:"";
@@ -6,10 +6,3 @@ margin-left:5.1pt;margin-right:5.1pt'>
6
6
  </div>
7
7
 
8
8
 
9
- <p class="MsoNormal">
10
- <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
11
- </p>
12
-
13
- <p class="zzContents" style='margin-top:0cm'><span lang="EN-GB">{{ labels["table_of_contents"] }}</span></p>
14
-
15
- WORDTOC
@@ -2393,7 +2393,7 @@ div.WordSection2 {
2393
2393
  layout-grid: 17.0pt 0pt;
2394
2394
  mso-layout-grid-char-alt: 56; }
2395
2395
 
2396
- div.WordSection3 {
2396
+ div.WordSection3, div.colophon {
2397
2397
  page: WordSection3; }
2398
2398
 
2399
2399
  @page WordSection4 {
@@ -2405,7 +2405,7 @@ div.WordSection2
2405
2405
  mso-paper-source:0;
2406
2406
  layout-grid:17.0pt 0pt;
2407
2407
  mso-layout-grid-char-alt:56;}
2408
- div.WordSection3
2408
+ div.WordSection3, div.colophon
2409
2409
  {page:WordSection3;}
2410
2410
  @page WordSection4
2411
2411
  {size:21.0cm 842.0pt;
@@ -35,7 +35,7 @@ module IsoDoc
35
35
  }
36
36
  end
37
37
 
38
- def make_table_footnote_target(out, fnid, fnref)
38
+ def make_table_footnote_target(out, fnid, fnref)
39
39
  attrs = { id: fnid, class: "TableFootnoteRef" }
40
40
  out.span do |s|
41
41
  s << @i18n.table_footnote
@@ -88,6 +88,22 @@
88
88
  <fo:region-end region-name="right-region" extent="{$marginLeftRight2}mm"/>
89
89
  </fo:simple-page-master>
90
90
 
91
+ <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"/>
93
+ <fo:region-before region-name="header-odd-first" extent="{$marginTop}mm"/>
94
+ <fo:region-after region-name="footer" extent="{$marginBottom}mm"/>
95
+ <fo:region-start region-name="left-region" extent="{$marginLeftRight1}mm"/>
96
+ <fo:region-end region-name="right-region" extent="{$marginLeftRight2}mm"/>
97
+ </fo:simple-page-master>
98
+
99
+ <fo:page-sequence-master master-name="document_toc">
100
+ <fo:repeatable-page-master-alternatives>
101
+ <fo:conditional-page-master-reference page-position="first" master-reference="first_page_toc"/>
102
+ <fo:conditional-page-master-reference odd-or-even="even" master-reference="even"/>
103
+ <fo:conditional-page-master-reference odd-or-even="odd" master-reference="odd"/>
104
+ </fo:repeatable-page-master-alternatives>
105
+ </fo:page-sequence-master>
106
+
91
107
  <fo:page-sequence-master master-name="document_preface">
92
108
  <fo:repeatable-page-master-alternatives>
93
109
  <fo:conditional-page-master-reference odd-or-even="even" master-reference="even"/>
@@ -113,14 +129,14 @@
113
129
  <!-- landscape -->
114
130
  <fo:simple-page-master master-name="odd-landscape" page-width="{$pageHeight}mm" page-height="{$pageWidth}mm">
115
131
  <fo:region-body margin-top="{$marginLeftRight1}mm" margin-bottom="{$marginLeftRight2}mm" margin-left="{$marginBottom}mm" margin-right="{$marginTop}mm"/>
116
- <fo:region-before region-name="header" extent="{$marginLeftRight1}mm" precedence="true"/>
132
+ <fo:region-before region-name="header-odd" extent="{$marginLeftRight1}mm" precedence="true"/>
117
133
  <fo:region-after region-name="footer" extent="{$marginLeftRight2}mm" precedence="true"/>
118
134
  <fo:region-start region-name="left-region-landscape" extent="{$marginBottom}mm"/>
119
135
  <fo:region-end region-name="right-region-landscape" extent="{$marginTop}mm"/>
120
136
  </fo:simple-page-master>
121
137
  <fo:simple-page-master master-name="even-landscape" page-width="{$pageHeight}mm" page-height="{$pageWidth}mm">
122
138
  <fo:region-body margin-top="{$marginLeftRight2}mm" margin-bottom="{$marginLeftRight1}mm" margin-left="{$marginBottom}mm" margin-right="{$marginTop}mm"/>
123
- <fo:region-before region-name="header" extent="{$marginLeftRight2}mm" precedence="true"/>
139
+ <fo:region-before region-name="header-even" extent="{$marginLeftRight2}mm" precedence="true"/>
124
140
  <fo:region-after region-name="footer" extent="{$marginLeftRight1}mm" precedence="true"/>
125
141
  <fo:region-start region-name="left-region-landscape" extent="{$marginBottom}mm"/>
126
142
  <fo:region-end region-name="right-region-landspace" extent="{$marginTop}mm"/>
@@ -166,13 +182,27 @@
166
182
 
167
183
  <xsl:variable name="year_published" select="substring(/*/jis:bibdata/jis:date[@type = 'published']/jis:on, 1, 4)"/>
168
184
 
185
+ <xsl:variable name="element_name_colon_gothic">colon_gothic</xsl:variable>
186
+ <xsl:variable name="tag_colon_gothic_open">###<xsl:value-of select="$element_name_colon_gothic"/>###</xsl:variable>
187
+ <xsl:variable name="tag_colon_gothic_close">###/<xsl:value-of select="$element_name_colon_gothic"/>###</xsl:variable>
188
+
189
+ <xsl:variable name="docidentifier_" select="java:replaceAll(java:java.lang.String.new(/*/jis:bibdata/jis:docidentifier), '(:)', concat($tag_colon_gothic_open,'$1',$tag_colon_gothic_close))"/>
190
+
191
+ <xsl:variable name="docidentifier__"><text><xsl:call-template name="replace_text_tags">
192
+ <xsl:with-param name="tag_open" select="$tag_colon_gothic_open"/>
193
+ <xsl:with-param name="tag_close" select="$tag_colon_gothic_close"/>
194
+ <xsl:with-param name="text" select="$docidentifier_"/>
195
+ </xsl:call-template></text></xsl:variable>
196
+
169
197
  <xsl:variable name="docidentifier">
170
- <fo:inline><xsl:value-of select="$docnumber"/></fo:inline>
171
- <fo:inline font-family="IPAexGothic">:</fo:inline>
172
- <fo:inline><xsl:value-of select="$year_published"/></fo:inline>
198
+ <xsl:apply-templates select="xalan:nodeset($docidentifier__)/node()"/>
173
199
  </xsl:variable>
174
200
 
175
- <xsl:variable name="copyrightText">著作権法により無断での複製,転載等は禁止されております。</xsl:variable>
201
+ <xsl:variable name="copyrightText">
202
+ <xsl:call-template name="getLocalizedString">
203
+ <xsl:with-param name="key">permission_footer</xsl:with-param>
204
+ </xsl:call-template>
205
+ </xsl:variable>
176
206
 
177
207
  <xsl:variable name="doctype" select="/*/jis:bibdata/jis:ext/jis:doctype"/>
178
208
 
@@ -193,12 +223,20 @@
193
223
  <!-- Contents and preface pages -->
194
224
  <!-- ========================== -->
195
225
 
196
- <fo:page-sequence master-reference="document_preface" initial-page-number="1" force-page-count="no-force">
226
+ <fo:page-sequence master-reference="document_toc" initial-page-number="1" force-page-count="no-force">
197
227
 
198
228
  <xsl:call-template name="insertHeaderFooter">
199
229
  <xsl:with-param name="docidentifier" select="$docidentifier"/>
200
230
  <xsl:with-param name="copyrightText" select="$copyrightText"/>
201
231
  <xsl:with-param name="section">preface</xsl:with-param>
232
+ <xsl:with-param name="section_title">
233
+ <fo:inline font-family="IPAexGothic">
234
+ <xsl:text> </xsl:text>
235
+ <xsl:call-template name="getLocalizedString">
236
+ <xsl:with-param name="key">table_of_contents</xsl:with-param>
237
+ </xsl:call-template>
238
+ </fo:inline>
239
+ </xsl:with-param>
202
240
  </xsl:call-template>
203
241
 
204
242
  <fo:flow flow-name="xsl-region-body">
@@ -210,65 +248,9 @@
210
248
  <xsl:text disable-output-escaping="yes">--&gt;</xsl:text>
211
249
  </xsl:if>
212
250
 
213
- <fo:block text-align="center" font-size="14pt" font-family="IPAexGothic" margin-top="8.5mm">
214
- <!-- Contents -->
215
- <!-- <xsl:call-template name="getLocalizedString">
216
- <xsl:with-param name="key">table_of_contents</xsl:with-param>
217
- </xsl:call-template> -->
218
- <xsl:text>目 次</xsl:text>
219
- </fo:block>
220
-
221
- <fo:block text-align="right" font-size="8pt" font-family="IPAexMincho" margin-top="10mm">
222
- <!-- Page -->
223
- <!-- <xsl:call-template name="getLocalizedString">
224
- <xsl:with-param name="key">locality.page</xsl:with-param>
225
- </xsl:call-template> -->
226
- <xsl:text>ページ</xsl:text>
227
- </fo:block>
228
-
229
- <fo:block role="TOC" font-family="IPAexGothic">
230
- <xsl:if test="$contents/doc[@num = $num]//item[@display = 'true']">
231
- <xsl:for-each select="$contents/doc[@num = $num]//item[@display = 'true'][@level &lt;= $toc_level or @type='figure' or @type = 'table']">
232
- <fo:block role="TOCI">
233
- <xsl:choose>
234
- <xsl:when test="@type = 'bibliography'">
235
- </xsl:when>
236
- <xsl:when test="@type = 'annex'">
237
- <fo:block space-after="5pt">
238
- <xsl:call-template name="insertTocItem"/>
239
- </fo:block>
240
- </xsl:when>
241
- <xsl:otherwise>
242
- <fo:list-block space-after="5pt">
243
- <xsl:attribute name="provisional-distance-between-starts">
244
- <xsl:choose>
245
- <xsl:when test="string-length(@section) = 1">5mm</xsl:when>
246
- <xsl:when test="string-length(@section) &gt;= 2"><xsl:value-of select="5 + (string-length(@section) - 1) * 2"/>mm</xsl:when>
247
- <xsl:when test="@type = 'annex'">16mm</xsl:when>
248
- <xsl:otherwise>5mm</xsl:otherwise>
249
- </xsl:choose>
250
- </xsl:attribute>
251
- <fo:list-item>
252
- <fo:list-item-label end-indent="label-end()">
253
- <fo:block>
254
- <xsl:if test="@section != '' and @type != 'annex'">
255
- <xsl:attribute name="font-family">Times New Roman</xsl:attribute>
256
- <xsl:attribute name="font-weight">bold</xsl:attribute>
257
- </xsl:if>
258
- <xsl:value-of select="@section"/>
259
- </fo:block>
260
- </fo:list-item-label>
261
- <fo:list-item-body start-indent="body-start()">
262
- <xsl:call-template name="insertTocItem"/>
263
- </fo:list-item-body>
264
- </fo:list-item>
265
- </fo:list-block>
266
- </xsl:otherwise>
267
- </xsl:choose>
268
- </fo:block>
269
- </xsl:for-each>
270
- </xsl:if>
271
- </fo:block>
251
+ <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name() = 'clause'][@type = 'toc']">
252
+ <xsl:with-param name="num" select="$num"/>
253
+ </xsl:apply-templates>
272
254
 
273
255
  </fo:flow>
274
256
 
@@ -331,7 +313,9 @@
331
313
  <fo:block-container margin-left="70mm">
332
314
  <fo:block-container margin-left="0mm" margin-top="30mm" width="26.5mm" height="8.5mm" text-align="center" display-align="center" border="1pt solid black">
333
315
  <fo:block>
334
- <xsl:text>白 紙</xsl:text>
316
+ <xsl:call-template name="getLocalizedString">
317
+ <xsl:with-param name="key">white-paper</xsl:with-param>
318
+ </xsl:call-template>
335
319
  </fo:block>
336
320
  </fo:block-container>
337
321
  </fo:block-container>
@@ -483,6 +467,78 @@
483
467
  </fo:root>
484
468
  </xsl:template>
485
469
 
470
+ <xsl:template match="*[local-name() = 'colon_gothic']">
471
+ <!-- replace : to : (Fullwidth colon) and render it in the font IPAexGothic -->
472
+ <fo:inline font-family="IPAexGothic">:</fo:inline>
473
+ </xsl:template>
474
+
475
+ <xsl:template match="*[local-name()='preface']/*[local-name() = 'clause'][@type = 'toc']" priority="4">
476
+ <xsl:param name="num"/>
477
+ <xsl:apply-templates/>
478
+ <xsl:if test="count(*) = 1 and *[local-name() = 'title']"> <!-- if there isn't user ToC -->
479
+ <!-- fill ToC -->
480
+ <fo:block role="TOC" font-family="IPAexGothic">
481
+ <xsl:if test="$contents/doc[@num = $num]//item[@display = 'true']">
482
+ <xsl:for-each select="$contents/doc[@num = $num]//item[@display = 'true'][@level &lt;= $toc_level or @type='figure' or @type = 'table']">
483
+ <fo:block role="TOCI">
484
+ <xsl:choose>
485
+ <xsl:when test="@type = 'bibliography'">
486
+ </xsl:when>
487
+ <xsl:when test="@type = 'annex'">
488
+ <fo:block space-after="5pt">
489
+ <xsl:call-template name="insertTocItem"/>
490
+ </fo:block>
491
+ </xsl:when>
492
+ <xsl:otherwise>
493
+ <fo:list-block space-after="5pt">
494
+ <xsl:attribute name="provisional-distance-between-starts">
495
+ <xsl:choose>
496
+ <xsl:when test="string-length(@section) = 1">5mm</xsl:when>
497
+ <xsl:when test="string-length(@section) &gt;= 2"><xsl:value-of select="5 + (string-length(@section) - 1) * 2"/>mm</xsl:when>
498
+ <xsl:when test="@type = 'annex'">16mm</xsl:when>
499
+ <xsl:otherwise>5mm</xsl:otherwise>
500
+ </xsl:choose>
501
+ </xsl:attribute>
502
+ <fo:list-item>
503
+ <fo:list-item-label end-indent="label-end()">
504
+ <fo:block>
505
+ <xsl:if test="@section != '' and @type != 'annex'">
506
+ <xsl:attribute name="font-family">Times New Roman</xsl:attribute>
507
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
508
+ </xsl:if>
509
+ <xsl:value-of select="@section"/>
510
+ </fo:block>
511
+ </fo:list-item-label>
512
+ <fo:list-item-body start-indent="body-start()">
513
+ <xsl:call-template name="insertTocItem"/>
514
+ </fo:list-item-body>
515
+ </fo:list-item>
516
+ </fo:list-block>
517
+ </xsl:otherwise>
518
+ </xsl:choose>
519
+ </fo:block>
520
+ </xsl:for-each>
521
+ </xsl:if>
522
+ </fo:block>
523
+ </xsl:if>
524
+ </xsl:template>
525
+
526
+ <xsl:template match="*[local-name() = 'clause'][@type = 'toc']/*[local-name() = 'title']" priority="3">
527
+ <fo:block text-align="center" font-size="14pt" font-family="IPAexGothic" margin-top="8.5mm">
528
+ <!-- Contents -->
529
+ <!-- <xsl:call-template name="getLocalizedString">
530
+ <xsl:with-param name="key">table_of_contents</xsl:with-param>
531
+ </xsl:call-template> -->
532
+ <xsl:apply-templates/>
533
+ </fo:block>
534
+ <fo:block text-align="right" font-size="8pt" font-family="IPAexMincho" margin-top="10mm">
535
+ <!-- Page -->
536
+ <xsl:call-template name="getLocalizedString">
537
+ <xsl:with-param name="key">locality.page</xsl:with-param>
538
+ </xsl:call-template>
539
+ </fo:block>
540
+ </xsl:template>
541
+
486
542
  <xsl:template name="insertTocItem">
487
543
  <fo:block text-align-last="justify" role="TOCI">
488
544
  <fo:basic-link internal-destination="{@id}" fox:alt-text="{title}">
@@ -517,7 +573,15 @@
517
573
  <!-- title -->
518
574
  <fo:block role="H1" font-family="IPAexGothic" font-size="22pt" margin-top="27mm"><xsl:apply-templates select="/*/jis:bibdata/jis:title[@language = 'ja' and @type = 'main']/node()"/></fo:block>
519
575
  <!-- docidentifier, 3 part: number, colon and year-->
520
- <fo:block font-family="IPAexGothic" font-size="20pt" margin-top="15mm"><fo:inline font-family="Arial">JIS Z 8301</fo:inline><fo:inline baseline-shift="20%"><fo:inline font-size="10pt">:</fo:inline><fo:inline font-family="Times New Roman" font-size="10pt">2019</fo:inline></fo:inline></fo:block>
576
+ <xsl:variable name="docidentifier" select="/*/jis:bibdata/jis:docidentifier[@type = 'JIS']"/>
577
+ <xsl:variable name="docidentifier_number" select="java:replaceAll(java:java.lang.String.new($docidentifier), '^(.*)(:)(.*)$', '$1')"/>
578
+ <xsl:variable name="docidentifier_year" select="java:replaceAll(java:java.lang.String.new($docidentifier), '^(.*)(:)(.*)$', '$3')"/>
579
+
580
+ <fo:block font-family="IPAexGothic" font-size="20pt" margin-top="15mm">
581
+ <fo:inline font-family="Arial">JIS <xsl:value-of select="$docidentifier_number"/></fo:inline>
582
+ <fo:inline baseline-shift="20%"><fo:inline font-size="10pt">:</fo:inline>
583
+ <fo:inline font-family="Times New Roman" font-size="10pt"><xsl:value-of select="$docidentifier_year"/></fo:inline></fo:inline>
584
+ </fo:block>
521
585
  <fo:block font-family="Arial" font-size="14pt" margin-top="12mm"><fo:inline font-family="IPAexMincho">(</fo:inline>JSA<fo:inline font-family="IPAexMincho">)</fo:inline></fo:block>
522
586
  </fo:block-container>
523
587
 
@@ -988,7 +1052,7 @@
988
1052
  <!-- jis:term/jis:preferred2//text() | -->
989
1053
 
990
1054
  <!-- <name>注記 1</name> to <name>注記<font_en> 1</font_en></name> -->
991
- <xsl:template match="jis:title/text() | jis:note/jis:name/text() | jis:termnote/jis:name/text() | jis:table/jis:name/text() | jis:figure/jis:name/text() | jis:example/jis:name/text() | jis:termexample/jis:name/text() | jis:xref//text() | jis:origin/text()" mode="update_xml_step1">
1055
+ <xsl:template match="jis:title/text() | jis:note/jis:name/text() | jis:termnote/jis:name/text() | jis:table/jis:name/text() | jis:figure/jis:name/text() | jis:termexample/jis:name/text() | jis:xref//text() | jis:origin/text()" mode="update_xml_step1">
992
1056
  <xsl:variable name="text_en_" select="java:replaceAll(java:java.lang.String.new(.), $regex_en, concat($tag_font_en_bold_open,'$1',$tag_font_en_bold_close))"/>
993
1057
  <xsl:variable name="text_en"><text><xsl:call-template name="replace_text_tags">
994
1058
  <xsl:with-param name="tag_open" select="$tag_font_en_bold_open"/>
@@ -998,6 +1062,32 @@
998
1062
  <xsl:copy-of select="xalan:nodeset($text_en)/text/node()"/>
999
1063
  </xsl:template>
1000
1064
 
1065
+ <!-- move example title to the first paragraph -->
1066
+ <xsl:template match="jis:example[contains(jis:name/text(), ' — ')]" mode="update_xml_step1">
1067
+ <xsl:copy>
1068
+ <xsl:copy-of select="@*"/>
1069
+ <xsl:element name="p" namespace="https://www.metanorma.org/ns/jis">
1070
+ <xsl:value-of select="substring-after(jis:name/text(), ' — ')"/>
1071
+ </xsl:element>
1072
+ <xsl:apply-templates mode="update_xml_step1"/>
1073
+ </xsl:copy>
1074
+ </xsl:template>
1075
+ <xsl:template match="jis:example/jis:name/text()" mode="update_xml_step1">
1076
+ <xsl:variable name="example_name">
1077
+ <xsl:choose>
1078
+ <xsl:when test="contains(., ' — ')"><xsl:value-of select="substring-before(., ' — ')"/></xsl:when>
1079
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
1080
+ </xsl:choose>
1081
+ </xsl:variable>
1082
+ <xsl:variable name="text_en_" select="java:replaceAll(java:java.lang.String.new($example_name), $regex_en, concat($tag_font_en_bold_open,'$1',$tag_font_en_bold_close))"/>
1083
+ <xsl:variable name="text_en"><text><xsl:call-template name="replace_text_tags">
1084
+ <xsl:with-param name="tag_open" select="$tag_font_en_bold_open"/>
1085
+ <xsl:with-param name="tag_close" select="$tag_font_en_bold_close"/>
1086
+ <xsl:with-param name="text" select="$text_en_"/>
1087
+ </xsl:call-template></text></xsl:variable>
1088
+ <xsl:copy-of select="xalan:nodeset($text_en)/text/node()"/>
1089
+ </xsl:template>
1090
+
1001
1091
  <xsl:template match="jis:eref//text()" mode="update_xml_step1">
1002
1092
  <!-- Example: JIS Z 8301:2011 to <font_en_bold>JIS Z 8301</font_en_bold><font_en>:2011</font_en> -->
1003
1093
  <xsl:variable name="parts">
@@ -1037,22 +1127,26 @@
1037
1127
  <xsl:copy-of select="xalan:nodeset($text_en)/text/node()"/>
1038
1128
  </xsl:template>
1039
1129
 
1040
- <xsl:template match="*[local-name() = 'font_en_bold']">
1130
+ <xsl:template match="*[local-name() = 'font_en_bold'][normalize-space() != '']">
1131
+ <xsl:if test="ancestor::*[local-name() = 'td' or local-name() = 'th']"><xsl:value-of select="$zero_width_space"/></xsl:if>
1041
1132
  <fo:inline font-family="Times New Roman" font-weight="bold">
1042
1133
  <xsl:if test="ancestor::*[local-name() = 'preferred']">
1043
1134
  <xsl:attribute name="font-weight">normal</xsl:attribute>
1044
1135
  </xsl:if>
1045
1136
  <xsl:apply-templates/>
1046
1137
  </fo:inline>
1138
+ <xsl:if test="ancestor::*[local-name() = 'td' or local-name() = 'th']"><xsl:value-of select="$zero_width_space"/></xsl:if>
1047
1139
  </xsl:template>
1048
1140
 
1049
- <xsl:template match="*[local-name() = 'font_en']">
1141
+ <xsl:template match="*[local-name() = 'font_en'][normalize-space() != '']">
1142
+ <xsl:if test="ancestor::*[local-name() = 'td' or local-name() = 'th']"><xsl:value-of select="$zero_width_space"/></xsl:if>
1050
1143
  <fo:inline font-family="Times New Roman">
1051
1144
  <xsl:if test="ancestor::*[local-name() = 'preferred']">
1052
1145
  <xsl:attribute name="font-weight">normal</xsl:attribute>
1053
1146
  </xsl:if>
1054
1147
  <xsl:apply-templates/>
1055
1148
  </fo:inline>
1149
+ <xsl:if test="ancestor::*[local-name() = 'td' or local-name() = 'th']"><xsl:value-of select="$zero_width_space"/></xsl:if>
1056
1150
  </xsl:template>
1057
1151
 
1058
1152
  <!-- ========================= -->
@@ -1064,16 +1158,31 @@
1064
1158
  <xsl:param name="hidePageNumber">false</xsl:param>
1065
1159
  <xsl:param name="section"/>
1066
1160
  <xsl:param name="copyrightText"/>
1161
+ <xsl:param name="section_title"/>
1162
+ <fo:static-content flow-name="header-odd-first" role="artifact">
1163
+ <fo:block-container font-family="Arial" font-size="9pt" height="26mm" display-align="after" text-align="right">
1164
+ <xsl:if test="$section = 'main'"><fo:block><fo:page-number/></fo:block></xsl:if>
1165
+ <fo:block>
1166
+ <xsl:copy-of select="$docidentifier"/>
1167
+ </fo:block>
1168
+ </fo:block-container>
1169
+ </fo:static-content>
1067
1170
  <fo:static-content flow-name="header-odd" role="artifact">
1068
1171
  <fo:block-container font-family="Arial" font-size="9pt" height="26mm" display-align="after" text-align="right">
1069
1172
  <xsl:if test="$section = 'main'"><fo:block><fo:page-number/></fo:block></xsl:if>
1070
- <fo:block><xsl:copy-of select="$docidentifier"/></fo:block>
1173
+ <fo:block>
1174
+ <xsl:copy-of select="$docidentifier"/>
1175
+ <xsl:copy-of select="$section_title"/>
1176
+ </fo:block>
1071
1177
  </fo:block-container>
1072
1178
  </fo:static-content>
1073
1179
  <fo:static-content flow-name="header-even" role="artifact">
1074
1180
  <fo:block-container font-family="Arial" font-size="9pt" height="26mm" display-align="after">
1075
1181
  <xsl:if test="$section = 'main'"><fo:block><fo:page-number/></fo:block></xsl:if>
1076
- <fo:block><xsl:copy-of select="$docidentifier"/></fo:block>
1182
+ <fo:block>
1183
+ <xsl:copy-of select="$docidentifier"/>
1184
+ <xsl:copy-of select="$section_title"/>
1185
+ </fo:block>
1077
1186
  </fo:block-container>
1078
1187
  </fo:static-content>
1079
1188
  <xsl:call-template name="insertFooter">
@@ -1788,6 +1897,8 @@
1788
1897
  <xsl:attribute-set name="dt-block-style">
1789
1898
  <xsl:attribute name="margin-top">0pt</xsl:attribute>
1790
1899
 
1900
+ <xsl:attribute name="line-height">1.5</xsl:attribute>
1901
+
1791
1902
  </xsl:attribute-set>
1792
1903
 
1793
1904
  <xsl:attribute-set name="dl-name-style">
@@ -1814,6 +1925,9 @@
1814
1925
  </xsl:attribute-set>
1815
1926
 
1816
1927
  <xsl:attribute-set name="xref-style">
1928
+ <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
1929
+
1930
+ <xsl:attribute name="font-family">IPAexGothic</xsl:attribute>
1817
1931
 
1818
1932
  </xsl:attribute-set>
1819
1933
 
@@ -1914,6 +2028,12 @@
1914
2028
 
1915
2029
  <xsl:attribute-set name="figure-name-style">
1916
2030
 
2031
+ <xsl:attribute name="font-family">IPAexGothic</xsl:attribute>
2032
+ <xsl:attribute name="text-align">center</xsl:attribute>
2033
+ <xsl:attribute name="margin-top">6pt</xsl:attribute>
2034
+ <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
2035
+ <xsl:attribute name="keep-with-previous">always</xsl:attribute>
2036
+
1917
2037
  </xsl:attribute-set>
1918
2038
 
1919
2039
  <xsl:attribute-set name="figure-source-style">
@@ -3757,9 +3877,13 @@
3757
3877
  <xsl:attribute name="padding-right">0.5mm</xsl:attribute>
3758
3878
  </xsl:if>
3759
3879
 
3760
- <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
3761
- <xsl:value-of select="$current_fn_number_text"/>
3762
- </fo:basic-link>
3880
+ <xsl:call-template name="insert_basic_link">
3881
+ <xsl:with-param name="element">
3882
+ <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
3883
+ <xsl:value-of select="$current_fn_number_text"/>
3884
+ </fo:basic-link>
3885
+ </xsl:with-param>
3886
+ </xsl:call-template>
3763
3887
  </fo:inline>
3764
3888
  </xsl:variable>
3765
3889
 
@@ -4106,8 +4230,10 @@
4106
4230
  <xsl:apply-templates select="preceding-sibling::*[1][local-name() = 'p' and @keep-with-next = 'true']/node()"/>
4107
4231
  <xsl:text> </xsl:text>
4108
4232
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
4109
- <xsl:text/>
4110
- <xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
4233
+ <xsl:if test="*[local-name()='dd']/node()[normalize-space() != ''][1][self::text()]">
4234
+ <xsl:text> </xsl:text>
4235
+ </xsl:if>
4236
+ <xsl:apply-templates select="*[local-name()='dd']/node()" mode="inline"/>
4111
4237
  </fo:block>
4112
4238
 
4113
4239
  </xsl:when> <!-- END: only one component -->
@@ -4594,8 +4720,18 @@
4594
4720
  </xsl:if>
4595
4721
  </xsl:template>
4596
4722
 
4597
- <xsl:template match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
4598
- <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
4723
+ <xsl:template match="*[local-name()='dd']/*" mode="inline">
4724
+ <xsl:variable name="is_inline_element_after_where">
4725
+ <xsl:if test="(local-name() = 'p') and not(preceding-sibling::node()[normalize-space() != ''])">true</xsl:if>
4726
+ </xsl:variable>
4727
+ <xsl:choose>
4728
+ <xsl:when test="$is_inline_element_after_where = 'true'">
4729
+ <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
4730
+ </xsl:when>
4731
+ <xsl:otherwise>
4732
+ <xsl:apply-templates select="."/>
4733
+ </xsl:otherwise>
4734
+ </xsl:choose>
4599
4735
  </xsl:template>
4600
4736
 
4601
4737
  <!-- virtual html table for dl/[dt and dd] for IF (Intermediate Format) -->
@@ -6029,6 +6165,79 @@
6029
6165
  <xsl:value-of select="."/><xsl:value-of select="$zero_width_space"/>
6030
6166
  </xsl:template>
6031
6167
 
6168
+ <!-- special case for:
6169
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
6170
+ <mstyle displaystyle="true">
6171
+ <msup>
6172
+ <mi color="#00000000">C</mi>
6173
+ <mtext>R</mtext>
6174
+ </msup>
6175
+ <msubsup>
6176
+ <mtext>C</mtext>
6177
+ <mi>n</mi>
6178
+ <mi>k</mi>
6179
+ </msubsup>
6180
+ </mstyle>
6181
+ </math>
6182
+ -->
6183
+ <xsl:template match="mathml:msup/mathml:mi[. = '‌' or . = ''][not(preceding-sibling::*)][following-sibling::mathml:mtext]" mode="mathml">
6184
+ <xsl:copy>
6185
+ <xsl:copy-of select="@*"/>
6186
+ <xsl:variable name="next_mtext" select="ancestor::mathml:msup/following-sibling::*[1][self::mathml:msubsup or self::mathml:msub or self::mathml:msup]/mathml:mtext"/>
6187
+ <xsl:if test="string-length($next_mtext) != ''">
6188
+ <xsl:attribute name="color">#00000000</xsl:attribute>
6189
+ </xsl:if>
6190
+ <xsl:apply-templates/>
6191
+ <xsl:value-of select="$next_mtext"/>
6192
+ </xsl:copy>
6193
+ </xsl:template>
6194
+
6195
+ <!-- special case for:
6196
+ <msup>
6197
+ <mtext/>
6198
+ <mn>1</mn>
6199
+ </msup>
6200
+ convert to (add mspace after mtext and enclose them into mrow):
6201
+ <msup>
6202
+ <mrow>
6203
+ <mtext/>
6204
+ <mspace height="1.47ex"/>
6205
+ </mrow>
6206
+ <mn>1</mn>
6207
+ </msup>
6208
+ -->
6209
+ <xsl:template match="mathml:msup/mathml:mtext[not(preceding-sibling::*)]" mode="mathml">
6210
+ <mathml:mrow>
6211
+ <xsl:copy-of select="."/>
6212
+ <mathml:mspace height="1.47ex"/>
6213
+ </mathml:mrow>
6214
+ </xsl:template>
6215
+
6216
+ <!-- add space around vertical line -->
6217
+ <xsl:template match="mathml:mo[normalize-space(text()) = '|']" mode="mathml">
6218
+ <xsl:copy>
6219
+ <xsl:apply-templates select="@*" mode="mathml"/>
6220
+ <xsl:if test="not(@lspace)">
6221
+ <xsl:attribute name="lspace">0.4em</xsl:attribute>
6222
+ </xsl:if>
6223
+ <xsl:if test="not(@rspace)">
6224
+ <xsl:attribute name="rspace">0.4em</xsl:attribute>
6225
+ </xsl:if>
6226
+ <xsl:apply-templates mode="mathml"/>
6227
+ </xsl:copy>
6228
+ </xsl:template>
6229
+
6230
+ <!-- decrease fontsize for 'Circled Times' char -->
6231
+ <xsl:template match="mathml:mo[normalize-space(text()) = '⊗']" mode="mathml">
6232
+ <xsl:copy>
6233
+ <xsl:apply-templates select="@*" mode="mathml"/>
6234
+ <xsl:if test="not(@fontsize)">
6235
+ <xsl:attribute name="fontsize">55%</xsl:attribute>
6236
+ </xsl:if>
6237
+ <xsl:apply-templates mode="mathml"/>
6238
+ </xsl:copy>
6239
+ </xsl:template>
6240
+
6032
6241
  <!-- Examples:
6033
6242
  <stem type="AsciiMath">x = 1</stem>
6034
6243
  <stem type="AsciiMath"><asciimath>x = 1</asciimath></stem>
@@ -6086,19 +6295,23 @@
6086
6295
  <xsl:apply-templates/>
6087
6296
  </xsl:when>
6088
6297
  <xsl:otherwise>
6089
- <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
6090
- <xsl:choose>
6091
- <xsl:when test="normalize-space(.) = ''">
6092
- <xsl:call-template name="add-zero-spaces-link-java">
6093
- <xsl:with-param name="text" select="$target_text"/>
6094
- </xsl:call-template>
6095
- </xsl:when>
6096
- <xsl:otherwise>
6097
- <!-- output text from <link>text</link> -->
6098
- <xsl:apply-templates/>
6099
- </xsl:otherwise>
6100
- </xsl:choose>
6101
- </fo:basic-link>
6298
+ <xsl:call-template name="insert_basic_link">
6299
+ <xsl:with-param name="element">
6300
+ <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
6301
+ <xsl:choose>
6302
+ <xsl:when test="normalize-space(.) = ''">
6303
+ <xsl:call-template name="add-zero-spaces-link-java">
6304
+ <xsl:with-param name="text" select="$target_text"/>
6305
+ </xsl:call-template>
6306
+ </xsl:when>
6307
+ <xsl:otherwise>
6308
+ <!-- output text from <link>text</link> -->
6309
+ <xsl:apply-templates/>
6310
+ </xsl:otherwise>
6311
+ </xsl:choose>
6312
+ </fo:basic-link>
6313
+ </xsl:with-param>
6314
+ </xsl:call-template>
6102
6315
  </xsl:otherwise>
6103
6316
  </xsl:choose>
6104
6317
  </fo:inline>
@@ -6161,12 +6374,16 @@
6161
6374
  </xsl:template>
6162
6375
 
6163
6376
  <xsl:template match="*[local-name() = 'xref']">
6164
- <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
6165
- <xsl:if test="parent::*[local-name() = 'add']">
6166
- <xsl:call-template name="append_add-style"/>
6167
- </xsl:if>
6168
- <xsl:apply-templates/>
6169
- </fo:basic-link>
6377
+ <xsl:call-template name="insert_basic_link">
6378
+ <xsl:with-param name="element">
6379
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
6380
+ <xsl:if test="parent::*[local-name() = 'add']">
6381
+ <xsl:call-template name="append_add-style"/>
6382
+ </xsl:if>
6383
+ <xsl:apply-templates/>
6384
+ </fo:basic-link>
6385
+ </xsl:with-param>
6386
+ </xsl:call-template>
6170
6387
  </xsl:template>
6171
6388
 
6172
6389
  <!-- ====== -->
@@ -6546,7 +6763,7 @@
6546
6763
  <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
6547
6764
  </xsl:when>
6548
6765
  <xsl:when test="not(starts-with(@src, 'data:'))">
6549
- <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
6766
+ <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
6550
6767
  </xsl:when>
6551
6768
  <xsl:otherwise>
6552
6769
  <xsl:value-of select="@src"/>
@@ -6568,7 +6785,7 @@
6568
6785
  </xsl:when>
6569
6786
  <xsl:when test="not(starts-with(@src, 'data:'))">
6570
6787
  <xsl:variable name="src">
6571
- <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
6788
+ <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
6572
6789
  </xsl:variable>
6573
6790
  <xsl:variable name="file" select="java:java.io.File.new(@src)"/>
6574
6791
  <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($file)"/>
@@ -6954,15 +7171,19 @@
6954
7171
  <xsl:param name="dest"/>
6955
7172
  <fo:block-container position="absolute" left="{$left}px" top="{$top}px" width="{$width}px" height="{$height}px">
6956
7173
  <fo:block font-size="1pt">
6957
- <fo:basic-link internal-destination="{$dest}" fox:alt-text="svg link">
6958
- <fo:inline-container inline-progression-dimension="100%">
6959
- <fo:block-container height="{$height - 1}px" width="100%">
6960
- <!-- DEBUG <xsl:if test="local-name()='polygon'">
6961
- <xsl:attribute name="background-color">magenta</xsl:attribute>
6962
- </xsl:if> -->
6963
- <fo:block> </fo:block></fo:block-container>
6964
- </fo:inline-container>
6965
- </fo:basic-link>
7174
+ <xsl:call-template name="insert_basic_link">
7175
+ <xsl:with-param name="element">
7176
+ <fo:basic-link internal-destination="{$dest}" fox:alt-text="svg link">
7177
+ <fo:inline-container inline-progression-dimension="100%">
7178
+ <fo:block-container height="{$height - 1}px" width="100%">
7179
+ <!-- DEBUG <xsl:if test="local-name()='polygon'">
7180
+ <xsl:attribute name="background-color">magenta</xsl:attribute>
7181
+ </xsl:if> -->
7182
+ <fo:block> </fo:block></fo:block-container>
7183
+ </fo:inline-container>
7184
+ </fo:basic-link>
7185
+ </xsl:with-param>
7186
+ </xsl:call-template>
6966
7187
  </fo:block>
6967
7188
  </fo:block-container>
6968
7189
  </xsl:template>
@@ -7333,6 +7554,11 @@
7333
7554
  <xsl:if test="normalize-space() != ''">
7334
7555
  <fo:block xsl:use-attribute-sets="figure-name-style">
7335
7556
 
7557
+ <xsl:if test="ancestor::jis:figure">
7558
+ <xsl:attribute name="margin-top">0</xsl:attribute>
7559
+ <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
7560
+ </xsl:if>
7561
+
7336
7562
  <xsl:apply-templates/>
7337
7563
  </fo:block>
7338
7564
  </xsl:if>
@@ -8506,14 +8732,18 @@
8506
8732
  </xsl:template>
8507
8733
 
8508
8734
  <xsl:template match="*[local-name() = 'origin']">
8509
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
8510
- <xsl:if test="normalize-space(@citeas) = ''">
8511
- <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
8512
- </xsl:if>
8513
- <fo:inline xsl:use-attribute-sets="origin-style">
8514
- <xsl:apply-templates/>
8515
- </fo:inline>
8516
- </fo:basic-link>
8735
+ <xsl:call-template name="insert_basic_link">
8736
+ <xsl:with-param name="element">
8737
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
8738
+ <xsl:if test="normalize-space(@citeas) = ''">
8739
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
8740
+ </xsl:if>
8741
+ <fo:inline xsl:use-attribute-sets="origin-style">
8742
+ <xsl:apply-templates/>
8743
+ </fo:inline>
8744
+ </fo:basic-link>
8745
+ </xsl:with-param>
8746
+ </xsl:call-template>
8517
8747
  </xsl:template>
8518
8748
 
8519
8749
  <!-- not using, see https://github.com/glossarist/iev-document/issues/23 -->
@@ -8587,9 +8817,13 @@
8587
8817
  <xsl:if test="../*[local-name() = 'author']">
8588
8818
  <xsl:text>, </xsl:text>
8589
8819
  </xsl:if>
8590
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
8591
- <xsl:apply-templates/>
8592
- </fo:basic-link>
8820
+ <xsl:call-template name="insert_basic_link">
8821
+ <xsl:with-param name="element">
8822
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
8823
+ <xsl:apply-templates/>
8824
+ </fo:basic-link>
8825
+ </xsl:with-param>
8826
+ </xsl:call-template>
8593
8827
  </xsl:template>
8594
8828
 
8595
8829
  <xsl:template match="*[local-name() = 'author']">
@@ -8638,25 +8872,29 @@
8638
8872
  <xsl:variable name="citeas" select="java:replaceAll(java:java.lang.String.new(@citeas),'^\[?(.+?)\]?$','$1')"/> <!-- remove leading and trailing brackets -->
8639
8873
  <xsl:variable name="text" select="normalize-space()"/>
8640
8874
 
8641
- <fo:basic-link fox:alt-text="{@citeas}">
8642
- <xsl:if test="normalize-space(@citeas) = ''">
8643
- <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
8644
- </xsl:if>
8645
- <xsl:if test="@type = 'inline'">
8875
+ <xsl:call-template name="insert_basic_link">
8876
+ <xsl:with-param name="element">
8877
+ <fo:basic-link fox:alt-text="{@citeas}">
8878
+ <xsl:if test="normalize-space(@citeas) = ''">
8879
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
8880
+ </xsl:if>
8881
+ <xsl:if test="@type = 'inline'">
8646
8882
 
8647
- </xsl:if>
8883
+ </xsl:if>
8648
8884
 
8649
- <xsl:choose>
8650
- <xsl:when test="$external-destination != ''"> <!-- external hyperlink -->
8651
- <xsl:attribute name="external-destination"><xsl:value-of select="$external-destination"/></xsl:attribute>
8652
- </xsl:when>
8653
- <xsl:otherwise>
8654
- <xsl:attribute name="internal-destination"><xsl:value-of select="@bibitemid"/></xsl:attribute>
8655
- </xsl:otherwise>
8656
- </xsl:choose>
8885
+ <xsl:choose>
8886
+ <xsl:when test="$external-destination != ''"> <!-- external hyperlink -->
8887
+ <xsl:attribute name="external-destination"><xsl:value-of select="$external-destination"/></xsl:attribute>
8888
+ </xsl:when>
8889
+ <xsl:otherwise>
8890
+ <xsl:attribute name="internal-destination"><xsl:value-of select="@bibitemid"/></xsl:attribute>
8891
+ </xsl:otherwise>
8892
+ </xsl:choose>
8657
8893
 
8658
- <xsl:apply-templates/>
8659
- </fo:basic-link>
8894
+ <xsl:apply-templates/>
8895
+ </fo:basic-link>
8896
+ </xsl:with-param>
8897
+ </xsl:call-template>
8660
8898
 
8661
8899
  </fo:inline>
8662
8900
  </xsl:when>
@@ -8880,15 +9118,17 @@
8880
9118
  <!-- ===================================== -->
8881
9119
  <xsl:variable name="ul_labels_">
8882
9120
 
8883
- <label level="1">–</label>
8884
- <label level="2">•</label>
8885
- <label level="3" font-size="75%">o</label> <!-- white circle -->
9121
+ <label level="1">-</label> <!-- full-width hyphen minus -->
9122
+ <label level="2" font-size="130%" line-height="1.2">・</label> <!-- Katakana Middle Dot -->
8886
9123
 
8887
9124
  </xsl:variable>
8888
9125
  <xsl:variable name="ul_labels" select="xalan:nodeset($ul_labels_)"/>
8889
9126
 
8890
9127
  <xsl:template name="setULLabel">
8891
- <xsl:variable name="list_level_" select="count(ancestor::*[local-name() = 'ul']) + count(ancestor::*[local-name() = 'ol'])"/>
9128
+ <xsl:variable name="list_level__">
9129
+ <xsl:value-of select="count(ancestor::*[local-name() = 'ul'])"/>
9130
+ </xsl:variable>
9131
+ <xsl:variable name="list_level_" select="number($list_level__)"/>
8892
9132
  <xsl:variable name="list_level">
8893
9133
  <xsl:choose>
8894
9134
  <xsl:when test="$list_level_ &lt;= 3"><xsl:value-of select="$list_level_"/></xsl:when>
@@ -9021,9 +9261,18 @@
9021
9261
  </fo:block-container>
9022
9262
  </xsl:when>
9023
9263
  <xsl:otherwise>
9024
- <fo:block>
9025
- <xsl:apply-templates select="." mode="list"/>
9026
- </fo:block>
9264
+
9265
+ <fo:block-container>
9266
+ <xsl:if test="ancestor::jis:ol or ancestor::jis:ul">
9267
+ <xsl:attribute name="margin-left">3.5mm</xsl:attribute>
9268
+ </xsl:if>
9269
+ <fo:block-container margin-left="0mm">
9270
+ <fo:block>
9271
+ <xsl:apply-templates select="." mode="list"/>
9272
+ </fo:block>
9273
+ </fo:block-container>
9274
+ </fo:block-container>
9275
+
9027
9276
  </xsl:otherwise>
9028
9277
  </xsl:choose>
9029
9278
  </xsl:template>
@@ -9715,24 +9964,32 @@
9715
9964
  <xsl:for-each select="*[local-name() = 'tab']">
9716
9965
  <xsl:variable name="current_id" select="generate-id()"/>
9717
9966
  <fo:table-cell>
9718
- <fo:block>
9719
- <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
9720
- <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
9721
- <xsl:choose>
9722
- <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
9723
- <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
9724
- </xsl:choose>
9725
- </xsl:for-each>
9726
- </fo:basic-link>
9967
+ <fo:block line-height-shift-adjustment="disregard-shifts">
9968
+ <xsl:call-template name="insert_basic_link">
9969
+ <xsl:with-param name="element">
9970
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
9971
+ <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
9972
+ <xsl:choose>
9973
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
9974
+ <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
9975
+ </xsl:choose>
9976
+ </xsl:for-each>
9977
+ </fo:basic-link>
9978
+ </xsl:with-param>
9979
+ </xsl:call-template>
9727
9980
  </fo:block>
9728
9981
  </fo:table-cell>
9729
9982
  </xsl:for-each>
9730
9983
  <!-- last column - for page numbers -->
9731
9984
  <fo:table-cell text-align="right" font-size="10pt" font-weight="bold" font-family="Arial">
9732
9985
  <fo:block>
9733
- <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
9734
- <fo:page-number-citation ref-id="{$target}"/>
9735
- </fo:basic-link>
9986
+ <xsl:call-template name="insert_basic_link">
9987
+ <xsl:with-param name="element">
9988
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
9989
+ <fo:page-number-citation ref-id="{$target}"/>
9990
+ </fo:basic-link>
9991
+ </xsl:with-param>
9992
+ </xsl:call-template>
9736
9993
  </fo:block>
9737
9994
  </fo:table-cell>
9738
9995
  </xsl:template>
@@ -9774,6 +10031,27 @@
9774
10031
  <!-- End Table of Contents (ToC) processing -->
9775
10032
  <!-- =================== -->
9776
10033
 
10034
+ <!-- insert fo:basic-link, if external-destination or internal-destination is non-empty, otherwise insert fo:inline -->
10035
+ <xsl:template name="insert_basic_link">
10036
+ <xsl:param name="element"/>
10037
+ <xsl:variable name="element_node" select="xalan:nodeset($element)"/>
10038
+ <xsl:variable name="external-destination" select="normalize-space(count($element_node/fo:basic-link/@external-destination[. != '']) = 1)"/>
10039
+ <xsl:variable name="internal-destination" select="normalize-space(count($element_node/fo:basic-link/@internal-destination[. != '']) = 1)"/>
10040
+ <xsl:choose>
10041
+ <xsl:when test="$external-destination = 'true' or $internal-destination = 'true'">
10042
+ <xsl:copy-of select="$element_node"/>
10043
+ </xsl:when>
10044
+ <xsl:otherwise>
10045
+ <fo:inline>
10046
+ <xsl:for-each select="$element_node/fo:basic-link/@*[local-name() != 'external-destination' and local-name() != 'internal-destination' and local-name() != 'alt-text']">
10047
+ <xsl:attribute name="{local-name()}"><xsl:value-of select="."/></xsl:attribute>
10048
+ </xsl:for-each>
10049
+ <xsl:copy-of select="$element_node/fo:basic-link/node()"/>
10050
+ </fo:inline>
10051
+ </xsl:otherwise>
10052
+ </xsl:choose>
10053
+ </xsl:template>
10054
+
9777
10055
  <xsl:template match="*[local-name() = 'variant-title']"/> <!-- [@type = 'sub'] -->
9778
10056
  <xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']" mode="subtitle">
9779
10057
  <fo:inline padding-right="5mm"> </fo:inline>
@@ -154,6 +154,7 @@ module IsoDoc
154
154
  def display_order(docxml)
155
155
  i = 0
156
156
  i = display_order_xpath(docxml, "//preface/*", i)
157
+ i = display_order_at(docxml, "//sections/introduction", i)
157
158
  i = display_order_at(docxml, "//clause[@type = 'scope']", i)
158
159
  i = display_order_at(docxml, @xrefs.klass.norm_ref_xpath, i)
159
160
  i = display_order_at(docxml, "//sections/terms | " \
@@ -174,6 +175,27 @@ module IsoDoc
174
175
  elem.children = l10n("#{@i18n.source}: #{to_xml(elem.children).strip}")
175
176
  end
176
177
 
178
+ def toc_title_insert_pt(docxml)
179
+ ins = docxml.at(ns("//preface")) ||
180
+ docxml.at(ns("//sections | //annex | //bibliography"))
181
+ &.before("<preface> </preface>")
182
+ &.previous_element or return nil
183
+ ins.children.last.after(" ").next
184
+ end
185
+
186
+ def preface_rearrange(doc)
187
+ move_introduction(doc)
188
+ super
189
+ end
190
+
191
+ def move_introduction(doc)
192
+ source = doc.at(ns("//preface/introduction")) or return
193
+ dest = doc.at(ns("//sections")) ||
194
+ doc.at(ns("//preface")).after("<sections> </sections>").next_element
195
+ dest.children.empty? and dest.children = " "
196
+ dest.children.first.next = source
197
+ end
198
+
177
199
  include Init
178
200
  end
179
201
  end
@@ -99,24 +99,16 @@ module IsoDoc
99
99
  end
100
100
  end
101
101
 
102
- def preface(isoxml, out)
103
- isoxml.xpath(ns("//preface/clause | //preface/references | " \
104
- "//preface/definitions | //preface/terms")).each do |f|
105
- out.div **attr_code(class: "Section3", id: f["id"],
106
- type: f["type"]) do |div|
107
- clause_name(f, f&.at(ns("./title")), div, { class: "IntroTitle" })
108
- f.elements.each do |e|
109
- parse(e, div) unless e.name == "title"
110
- end
111
- end
112
- end
102
+ def preface_attrs(node)
103
+ { id: node["id"], type: node["type"],
104
+ class: node["type"] == "toc" ? "TOC" : "Section3" }
113
105
  end
114
106
 
115
- def introduction(isoxml, out)
116
- f = isoxml.at(ns("//introduction")) || return
117
- out.div class: "Section3", id: f["id"] do |div|
118
- clause_name(f, f.at(ns("./title")), div, { class: "IntroTitle" })
119
- f.elements.each do |e|
107
+ def introduction(clause, out)
108
+ out.div class: "Section3", id: clause["id"] do |div|
109
+ clause_name(clause, clause.at(ns("./title")), div,
110
+ { class: "IntroTitle" })
111
+ clause.elements.each do |e|
120
112
  parse(e, div) unless e.name == "title"
121
113
  end
122
114
  end
@@ -125,11 +117,7 @@ module IsoDoc
125
117
  def make_body2(body, docxml)
126
118
  body.div class: "WordSection2" do |div2|
127
119
  boilerplate docxml, div2
128
- preface_block docxml, div2
129
- abstract docxml, div2
130
- foreword docxml, div2
131
- preface docxml, div2
132
- acknowledgements docxml, div2
120
+ front docxml, div2
133
121
  div2.p { |p| p << "&#xa0;" } # placeholder
134
122
  end
135
123
  section_break(body)
@@ -138,7 +126,8 @@ module IsoDoc
138
126
  def middle(isoxml, out)
139
127
  middle_title(isoxml, out)
140
128
  middle_admonitions(isoxml, out)
141
- introduction isoxml, out
129
+ i = isoxml.at(ns("//sections/introduction")) and
130
+ introduction i, out
142
131
  scope isoxml, out, 0
143
132
  norm_ref isoxml, out, 0
144
133
  clause_etc isoxml, out, 0
@@ -17,6 +17,7 @@
17
17
  these elements; we just want one namespace for any child grammars
18
18
  of this.
19
19
  -->
20
+ <!-- VERSION v1.2.1 -->
20
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">
21
22
  <include href="reqt.rng"/>
22
23
  <include href="basicdoc.rng">
@@ -1349,15 +1350,19 @@
1349
1350
  </choice>
1350
1351
  </element>
1351
1352
  </define>
1353
+ <define name="Root-Attributes">
1354
+ <attribute name="version"/>
1355
+ <attribute name="schema-version"/>
1356
+ <attribute name="type">
1357
+ <choice>
1358
+ <value>semantic</value>
1359
+ <value>presentation</value>
1360
+ </choice>
1361
+ </attribute>
1362
+ </define>
1352
1363
  <define name="standard-document">
1353
1364
  <element name="standard-document">
1354
- <attribute name="version"/>
1355
- <attribute name="type">
1356
- <choice>
1357
- <value>semantic</value>
1358
- <value>presentation</value>
1359
- </choice>
1360
- </attribute>
1365
+ <ref name="Root-Attributes"/>
1361
1366
  <ref name="bibdata"/>
1362
1367
  <optional>
1363
1368
  <ref name="misccontainer"/>
@@ -1,6 +1,9 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
3
- <!-- default namespace isostandard = "https://www.metanorma.com/ns/iso" -->
3
+ <!--
4
+ VERSION v1.2.1
5
+ default namespace isostandard = "https://www.metanorma.com/ns/iso"
6
+ -->
4
7
  <include href="isodoc.rng">
5
8
  <start>
6
9
  <ref name="iso-standard"/>
@@ -240,13 +243,7 @@
240
243
  -->
241
244
  <define name="iso-standard">
242
245
  <element name="iso-standard">
243
- <attribute name="version"/>
244
- <attribute name="type">
245
- <choice>
246
- <value>semantic</value>
247
- <value>presentation</value>
248
- </choice>
249
- </attribute>
246
+ <ref name="Root-Attributes"/>
250
247
  <ref name="bibdata"/>
251
248
  <zeroOrMore>
252
249
  <ref name="termdocsource"/>
@@ -1,6 +1,9 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
- <grammar ns="https://www.metanorma.org/ns/jis" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
3
- <!-- default namespace = "https://www.metanorma.com/ns/jis" -->
2
+ <grammar ns='https://www.metanorma.org/ns/jis' xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
3
+ <!--
4
+ VERSION v1.2.1
5
+ default namespace = "https://www.metanorma.com/ns/jis"
6
+ -->
4
7
  <include href="relaton-jis.rng"/>
5
8
  <include href="isostandard.rng">
6
9
  <start>
@@ -37,13 +40,7 @@
37
40
  -->
38
41
  <define name="jis-standard">
39
42
  <element name="jis-standard">
40
- <attribute name="version"/>
41
- <attribute name="type">
42
- <choice>
43
- <value>semantic</value>
44
- <value>presentation</value>
45
- </choice>
46
- </attribute>
43
+ <ref name="Root-Attributes"/>
47
44
  <ref name="bibdata"/>
48
45
  <zeroOrMore>
49
46
  <ref name="termdocsource"/>
@@ -1,6 +1,6 @@
1
1
  module Metanorma
2
2
  module JIS
3
- VERSION = "0.0.4".freeze
3
+ VERSION = "0.0.5".freeze
4
4
  end
5
5
  end
6
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.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-04-10 00:00:00.000000000 Z
11
+ date: 2023-04-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metanorma-iso