metanorma-plateau 0.1.3 → 0.1.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: 838839bc86469a328f7252f84d236687d5584c0d59633746756a445a40e063fb
4
- data.tar.gz: 816088c99147f784b587d3c8b4c32c357aaa049340dc27e7fe0d09235dc810c0
3
+ metadata.gz: f4834c2ee47e184721abe8ad6bac4d72ee1e1d80eebd1edd5bf67fdf8f640be6
4
+ data.tar.gz: cccbce71fa3b654e5183b814114f33490d56b9f738b9cf9db6d66eb9dc9f8881
5
5
  SHA512:
6
- metadata.gz: 599842b641f909db3fbbb804de614a340f5cf1b3699ba64d0c36a1b99b857cce80686e5a7babb87ce0fd453618d1037fe7fd707c93c4151b8291cc7e95b20782
7
- data.tar.gz: 266668f37b4ab39f4dc7f7b72659f7c7a5dd31184c9bac10a210f378619af9c0d0bd6424e09a85b6c582700c107571835fb34cfd7203b375dee4aeb803fc093a
6
+ metadata.gz: 5c6185e00e3629e97e8aaace04150b1f44971c66b29e31addb05cffb81669d26c7fd880bb09e395c9317a471b9ab1c190dcb4a978c3838405a1df65ea733d12c
7
+ data.tar.gz: a9fd04e142af38ff37848b710098e507652c0311bd6dc6d41392839ea1cb4c0ba4a4de583e977f2eca7542385e3d6a182a853e94eb2b424af112aae1e2f7e6ec
@@ -12,14 +12,19 @@ module IsoDoc
12
12
 
13
13
  def xref_init(lang, script, _klass, labels, options)
14
14
  @xrefs = Xref.new(lang, script,
15
- HtmlConvert.new(language: lang, script: script),
15
+ HtmlConvert.new(language: lang, script:),
16
16
  labels, options)
17
17
  end
18
18
 
19
19
  def i18n_init(lang, script, locale, i18nyaml = nil)
20
- @i18n = I18n.new(lang, script, locale: locale,
20
+ @i18n = I18n.new(lang, script, locale:,
21
21
  i18nyaml: i18nyaml || @i18nyaml)
22
22
  end
23
+
24
+ def bibrenderer(options = {})
25
+ ::Relaton::Render::JIS::General.new(options.merge(language: @lang,
26
+ i18nhash: @i18n.get))
27
+ end
23
28
  end
24
29
  end
25
30
  end
@@ -6,6 +6,8 @@
6
6
 
7
7
  <xsl:variable name="debug">false</xsl:variable>
8
8
 
9
+ <xsl:variable name="isIgnoreComplexScripts">true</xsl:variable>
10
+
9
11
  <xsl:variable name="doctype" select="//plateau:plateau-standard[1]/plateau:bibdata/plateau:ext/plateau:doctype[@language = '' or not(@language)]"/>
10
12
 
11
13
  <xsl:variable name="i18n_doctype_dict_annex"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">doctype_dict.annex</xsl:with-param></xsl:call-template></xsl:variable>
@@ -1122,7 +1124,11 @@
1122
1124
  <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
1123
1125
  </xsl:if>
1124
1126
 
1125
- <xsl:if test="parent::plateau:clause">
1127
+ <xsl:if test="parent::plateau:note and not(following-sibling::*)">
1128
+ <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
1129
+ </xsl:if>
1130
+
1131
+ <xsl:if test="parent::plateau:clause or (ancestor::plateau:note and not(ancestor::plateau:table))">
1126
1132
  <xsl:text> </xsl:text>
1127
1133
  </xsl:if>
1128
1134
 
@@ -1143,6 +1149,42 @@
1143
1149
  </xsl:choose>
1144
1150
  </xsl:template>
1145
1151
 
1152
+ <xsl:template match="*[local-name() = 'note'][not(ancestor::plateau:table)]" priority="2">
1153
+
1154
+ <fo:block-container id="{@id}" xsl:use-attribute-sets="note-style" role="SKIP">
1155
+ <xsl:attribute name="margin-top">6pt</xsl:attribute>
1156
+ <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
1157
+
1158
+ <xsl:call-template name="setBlockSpanAll"/>
1159
+
1160
+ <xsl:call-template name="refine_note-style"/>
1161
+
1162
+ <fo:block-container margin-left="0mm" margin-right="0mm" role="SKIP">
1163
+
1164
+ <fo:table table-layout="fixed" width="99%" border="1pt solid black">
1165
+ <fo:table-body>
1166
+ <fo:table-row>
1167
+ <fo:table-cell padding="2mm">
1168
+ <fo:block keep-with-next="always" margin-bottom="10pt" role="SKIP">
1169
+ <xsl:apply-templates select="*[local-name() = 'name']"/>
1170
+ </fo:block>
1171
+ <fo:block>
1172
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
1173
+ </fo:block>
1174
+ </fo:table-cell>
1175
+ </fo:table-row>
1176
+ </fo:table-body>
1177
+ </fo:table>
1178
+ </fo:block-container>
1179
+ </fo:block-container>
1180
+ </xsl:template>
1181
+
1182
+ <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'note']" priority="3"/>
1183
+
1184
+ <xsl:template match="*[local-name() = 'note'][not(ancestor::plateau:table)]/*[local-name() = 'p']" priority="2">
1185
+ <xsl:call-template name="paragraph"/>
1186
+ </xsl:template>
1187
+
1146
1188
  <xsl:template match="plateau:termnote" priority="2">
1147
1189
  <fo:block id="{@id}" xsl:use-attribute-sets="termnote-style">
1148
1190
  <fo:list-block provisional-distance-between-starts="{14 + $text_indent}mm">
@@ -7740,6 +7782,12 @@
7740
7782
  <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']">
7741
7783
  <attachment filename="{@name}"/>
7742
7784
  </xsl:for-each>
7785
+ <xsl:if test="not(//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment'])">
7786
+ <xsl:for-each select="//*[local-name() = 'bibitem'][@hidden = 'true'][*[local-name() = 'uri'][@type = 'attachment']]">
7787
+ <xsl:variable name="attachment_path" select="*[local-name() = 'uri'][@type = 'attachment']"/>
7788
+ <attachment filename="{$attachment_path}"/>
7789
+ </xsl:for-each>
7790
+ </xsl:if>
7743
7791
  </xsl:variable>
7744
7792
  <xsl:variable name="pdfAttachmentsList" select="xalan:nodeset($pdfAttachmentsList_)"/>
7745
7793
 
@@ -7752,7 +7800,7 @@
7752
7800
  <xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
7753
7801
  </xsl:when>
7754
7802
  <!-- link to the PDF attachment -->
7755
- <xsl:when test="$pdfAttachmentsList//attachment[@filename = current()/@target]">
7803
+ <xsl:when test="@attachment = 'true' and $pdfAttachmentsList//attachment[@filename = current()/@target]">
7756
7804
  <xsl:value-of select="concat('url(embedded-file:', @target, ')')"/>
7757
7805
  </xsl:when>
7758
7806
  <!-- <xsl:when test="starts-with($target_normalized, '_') and contains($target_normalized, '_attachments/') and $pdfAttachmentsList//attachment[@filename = $target_attachment_name]">
@@ -8399,7 +8447,16 @@
8399
8447
  </xsl:variable>
8400
8448
  <xsl:variable name="img_src">
8401
8449
  <xsl:choose>
8402
- <xsl:when test="not(starts-with(@src, 'data:'))"><xsl:value-of select="concat($basepath, @src)"/></xsl:when>
8450
+ <xsl:when test="not(starts-with(@src, 'data:'))">
8451
+ <xsl:choose>
8452
+ <xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 -->
8453
+ <xsl:value-of select="@src"/>
8454
+ </xsl:when>
8455
+ <xsl:otherwise>
8456
+ <xsl:value-of select="concat($basepath, @src)"/>
8457
+ </xsl:otherwise>
8458
+ </xsl:choose>
8459
+ </xsl:when>
8403
8460
  <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
8404
8461
  </xsl:choose>
8405
8462
  </xsl:variable>
@@ -8412,7 +8469,7 @@
8412
8469
  <!-- <xsl:message>width_effective=<xsl:value-of select="$width_effective"/></xsl:message>
8413
8470
  <xsl:message>indent_left=<xsl:value-of select="$indent_left"/></xsl:message>
8414
8471
  <xsl:message>image_width_effective=<xsl:value-of select="$image_width_effective"/> for <xsl:value-of select="ancestor::ogc:p[1]/@id"/></xsl:message> -->
8415
- <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $image_width_effective, $height_effective)"/>
8472
+ <xsl:variable name="scale" select="java:org.metanorma.fop.utils.ImageUtils.getImageScale($img_src, $image_width_effective, $height_effective)"/>
8416
8473
  <xsl:value-of select="$scale"/>
8417
8474
  </xsl:template>
8418
8475
 
@@ -8431,7 +8488,14 @@
8431
8488
  <xsl:value-of select="concat('url(file:///',$basepath, $src_png, ')')"/>
8432
8489
  </xsl:when>
8433
8490
  <xsl:when test="not(starts-with(@src, 'data:'))">
8434
- <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
8491
+ <xsl:choose>
8492
+ <xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 -->
8493
+ <xsl:value-of select="concat('url(file:///', @src, ')')"/>
8494
+ </xsl:when>
8495
+ <xsl:otherwise>
8496
+ <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
8497
+ </xsl:otherwise>
8498
+ </xsl:choose>
8435
8499
  </xsl:when>
8436
8500
  <xsl:otherwise>
8437
8501
  <xsl:value-of select="@src"/>
@@ -8453,7 +8517,14 @@
8453
8517
  </xsl:when>
8454
8518
  <xsl:when test="not(starts-with(@src, 'data:'))">
8455
8519
  <xsl:variable name="src">
8456
- <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
8520
+ <xsl:choose>
8521
+ <xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 -->
8522
+ <xsl:value-of select="concat('url(file:///', @src, ')')"/>
8523
+ </xsl:when>
8524
+ <xsl:otherwise>
8525
+ <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
8526
+ </xsl:otherwise>
8527
+ </xsl:choose>
8457
8528
  </xsl:variable>
8458
8529
  <xsl:variable name="file" select="java:java.io.File.new(@src)"/>
8459
8530
  <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($file)"/>
@@ -13342,26 +13413,37 @@
13342
13413
  </x:xmpmeta>
13343
13414
  <!-- add attachments -->
13344
13415
  <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']">
13345
- <xsl:choose>
13346
- <xsl:when test="normalize-space() != ''">
13347
- <xsl:variable name="src_attachment" select="java:replaceAll(java:java.lang.String.new(.),'(&#13;&#10;|&#13;|&#10;)', '')"/> <!-- remove line breaks -->
13348
- <pdf:embedded-file src="{$src_attachment}" filename="{@name}"/>
13349
- </xsl:when>
13350
- <xsl:otherwise>
13351
- <!-- _{filename}_attachments -->
13352
- <!-- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, '_', $inputxml_filename_prefix, '_attachments', '/', @name, ')')"/> -->
13353
- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath , @name, ')')"/>
13354
- <pdf:embedded-file src="{$url}" filename="{@name}"/>
13355
- </xsl:otherwise>
13356
- </xsl:choose>
13416
+ <xsl:variable name="description" select="normalize-space(//*[local-name() = 'bibitem'][@hidden = 'true'][*[local-name() = 'uri'][@type = 'attachment'] = current()/@name]/*[local-name() = 'formattedref'])"/>
13417
+
13418
+ <pdf:embedded-file filename="{@name}">
13419
+ <xsl:attribute name="src">
13420
+ <xsl:choose>
13421
+ <xsl:when test="normalize-space() != ''">
13422
+ <xsl:variable name="src_attachment" select="java:replaceAll(java:java.lang.String.new(.),'(&#13;&#10;|&#13;|&#10;)', '')"/> <!-- remove line breaks -->
13423
+ <xsl:value-of select="$src_attachment"/>
13424
+ </xsl:when>
13425
+ <xsl:otherwise>
13426
+ <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath , @name, ')')"/>
13427
+ <xsl:value-of select="$url"/>
13428
+ </xsl:otherwise>
13429
+ </xsl:choose>
13430
+ </xsl:attribute>
13431
+ <xsl:if test="$description != ''">
13432
+ <xsl:attribute name="description"><xsl:value-of select="$description"/></xsl:attribute>
13433
+ </xsl:if>
13434
+ </pdf:embedded-file>
13357
13435
  </xsl:for-each>
13358
13436
  <!-- references to external attachments (no binary-encoded within the Metanorma XML file) -->
13359
13437
  <xsl:if test="not(//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment'])">
13360
13438
  <xsl:for-each select="//*[local-name() = 'bibitem'][@hidden = 'true'][*[local-name() = 'uri'][@type = 'attachment']]">
13361
13439
  <xsl:variable name="attachment_path" select="*[local-name() = 'uri'][@type = 'attachment']"/>
13362
- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, $attachment_path, ')')"/>
13363
- <xsl:variable name="filename_embedded" select="substring-after($attachment_path, concat('_', $inputxml_filename_prefix, '_attachments', '/'))"/>
13364
- <pdf:embedded-file src="{$url}" filename="{$filename_embedded}"/>
13440
+ <xsl:variable name="url" select="concat('url(file:///',$basepath, $attachment_path, ')')"/>
13441
+ <xsl:variable name="description" select="normalize-space(*[local-name() = 'formattedref'])"/>
13442
+ <pdf:embedded-file src="{$url}" filename="{$attachment_path}">
13443
+ <xsl:if test="$description != ''">
13444
+ <xsl:attribute name="description"><xsl:value-of select="$description"/></xsl:attribute>
13445
+ </xsl:if>
13446
+ </pdf:embedded-file>
13365
13447
  </xsl:for-each>
13366
13448
  </xsl:if>
13367
13449
  </xsl:template> <!-- addPDFUAmeta -->
@@ -13737,7 +13819,14 @@
13737
13819
  <xsl:value-of select="$src"/>
13738
13820
  </xsl:when>
13739
13821
  <xsl:otherwise>
13740
- <xsl:value-of select="concat('url(file:///',$basepath, $src, ')')"/>
13822
+ <xsl:choose>
13823
+ <xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 -->
13824
+ <xsl:value-of select="concat('url(file:///', @src, ')')"/>
13825
+ </xsl:when>
13826
+ <xsl:otherwise>
13827
+ <xsl:value-of select="concat('url(file:///',$basepath, $src, ')')"/>
13828
+ </xsl:otherwise>
13829
+ </xsl:choose>
13741
13830
  </xsl:otherwise>
13742
13831
  </xsl:choose>
13743
13832
  </xsl:template>
@@ -79,10 +79,6 @@ module IsoDoc
79
79
  @iso.ol_depth(node)
80
80
  end
81
81
 
82
- def bibliography_bibitem_number(docxml)
83
- super
84
- end
85
-
86
82
  include Init
87
83
  end
88
84
  end
@@ -73,11 +73,16 @@ module IsoDoc
73
73
 
74
74
  def list_item_anchor_names(list, list_anchor, depth, prev_label,
75
75
  refer_list)
76
- @iso.list_item_anchor_names(list, list_anchor, depth, prev_label, refer_list)
76
+ @iso.anchors.merge!(@anchors)
77
+ @iso.list_item_anchor_names(list, list_anchor, depth, prev_label,
78
+ refer_list)
79
+ @anchors.merge!(@iso.anchors)
77
80
  end
78
81
 
79
82
  def list_item_value(entry, counter, depth, opts)
83
+ @iso.anchors.merge!(@anchors)
80
84
  @iso.list_item_value(entry, counter, depth, opts)
85
+ @anchors.merge!(@iso.anchors)
81
86
  end
82
87
  end
83
88
  end
@@ -1000,14 +1000,14 @@
1000
1000
  <define name="PureTextElement">
1001
1001
  <choice>
1002
1002
  <text/>
1003
- <ref name="em"/>
1004
- <ref name="strong"/>
1003
+ <ref name="pure_em"/>
1004
+ <ref name="pure_strong"/>
1005
1005
  <ref name="sub"/>
1006
1006
  <ref name="sup"/>
1007
- <ref name="tt"/>
1008
- <ref name="underline"/>
1009
- <ref name="strike"/>
1010
- <ref name="smallcap"/>
1007
+ <ref name="pure_tt"/>
1008
+ <ref name="pure_underline"/>
1009
+ <ref name="pure_strike"/>
1010
+ <ref name="pure_smallcap"/>
1011
1011
  <ref name="br"/>
1012
1012
  </choice>
1013
1013
  </define>
@@ -1031,6 +1031,13 @@
1031
1031
  </zeroOrMore>
1032
1032
  </element>
1033
1033
  </define>
1034
+ <define name="pure_em">
1035
+ <element name="em">
1036
+ <zeroOrMore>
1037
+ <ref name="PureTextElement"/>
1038
+ </zeroOrMore>
1039
+ </element>
1040
+ </define>
1034
1041
  <define name="strong">
1035
1042
  <element name="strong">
1036
1043
  <zeroOrMore>
@@ -1046,6 +1053,13 @@
1046
1053
  </zeroOrMore>
1047
1054
  </element>
1048
1055
  </define>
1056
+ <define name="pure_strong">
1057
+ <element name="strong">
1058
+ <zeroOrMore>
1059
+ <ref name="PureTextElement"/>
1060
+ </zeroOrMore>
1061
+ </element>
1062
+ </define>
1049
1063
  <define name="tt">
1050
1064
  <element name="tt">
1051
1065
  <zeroOrMore>
@@ -1060,6 +1074,13 @@
1060
1074
  </zeroOrMore>
1061
1075
  </element>
1062
1076
  </define>
1077
+ <define name="pure_tt">
1078
+ <element name="tt">
1079
+ <zeroOrMore>
1080
+ <ref name="PureTextElement"/>
1081
+ </zeroOrMore>
1082
+ </element>
1083
+ </define>
1063
1084
  <define name="keyword">
1064
1085
  <element name="keyword">
1065
1086
  <zeroOrMore>
@@ -1090,13 +1111,42 @@
1090
1111
  <zeroOrMore>
1091
1112
  <choice>
1092
1113
  <ref name="PureTextElement"/>
1114
+ <ref name="stem"/>
1115
+ <ref name="eref"/>
1116
+ <ref name="xref"/>
1117
+ <ref name="hyperlink"/>
1093
1118
  <ref name="index"/>
1094
1119
  <ref name="index-xref"/>
1095
1120
  </choice>
1096
1121
  </zeroOrMore>
1097
1122
  </element>
1098
1123
  </define>
1124
+ <define name="pure_strike">
1125
+ <element name="strike">
1126
+ <zeroOrMore>
1127
+ <ref name="PureTextElement"/>
1128
+ </zeroOrMore>
1129
+ </element>
1130
+ </define>
1099
1131
  <define name="underline">
1132
+ <element name="underline">
1133
+ <optional>
1134
+ <attribute name="style"/>
1135
+ </optional>
1136
+ <zeroOrMore>
1137
+ <choice>
1138
+ <ref name="PureTextElement"/>
1139
+ <ref name="stem"/>
1140
+ <ref name="eref"/>
1141
+ <ref name="xref"/>
1142
+ <ref name="hyperlink"/>
1143
+ <ref name="index"/>
1144
+ <ref name="index-xref"/>
1145
+ </choice>
1146
+ </zeroOrMore>
1147
+ </element>
1148
+ </define>
1149
+ <define name="pure_underline">
1100
1150
  <element name="underline">
1101
1151
  <optional>
1102
1152
  <attribute name="style"/>
@@ -1107,6 +1157,21 @@
1107
1157
  </element>
1108
1158
  </define>
1109
1159
  <define name="smallcap">
1160
+ <element name="smallcap">
1161
+ <zeroOrMore>
1162
+ <choice>
1163
+ <ref name="PureTextElement"/>
1164
+ <ref name="stem"/>
1165
+ <ref name="eref"/>
1166
+ <ref name="xref"/>
1167
+ <ref name="hyperlink"/>
1168
+ <ref name="index"/>
1169
+ <ref name="index-xref"/>
1170
+ </choice>
1171
+ </zeroOrMore>
1172
+ </element>
1173
+ </define>
1174
+ <define name="pure_smallcap">
1110
1175
  <element name="smallcap">
1111
1176
  <zeroOrMore>
1112
1177
  <ref name="PureTextElement"/>
@@ -1204,7 +1204,9 @@
1204
1204
  <optional>
1205
1205
  <ref name="formattedref"/>
1206
1206
  </optional>
1207
- <ref name="btitle"/>
1207
+ <oneOrMore>
1208
+ <ref name="btitle"/>
1209
+ </oneOrMore>
1208
1210
  <optional>
1209
1211
  <ref name="bplace"/>
1210
1212
  </optional>
@@ -662,6 +662,9 @@
662
662
  <value>LatexMath</value>
663
663
  </choice>
664
664
  </attribute>
665
+ <optional>
666
+ <attribute name="number-format"/>
667
+ </optional>
665
668
  <attribute name="block">
666
669
  <data type="boolean"/>
667
670
  </attribute>
@@ -66,6 +66,9 @@
66
66
  <ref name="MultilingualRenderingType"/>
67
67
  </attribute>
68
68
  </optional>
69
+ <optional>
70
+ <attribute name="class"/>
71
+ </optional>
69
72
  <optional>
70
73
  <ref name="reqtitle"/>
71
74
  </optional>
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Plateau
3
- VERSION = "0.1.3".freeze
3
+ VERSION = "0.1.5".freeze
4
4
  end
5
5
  end
@@ -1,4 +1,4 @@
1
- irequire "asciidoctor" unless defined? Asciidoctor::Converter
1
+ require "asciidoctor" unless defined? Asciidoctor::Converter
2
2
  require_relative "metanorma/plateau/converter"
3
3
  require_relative "metanorma/plateau/version"
4
4
  require "isodoc/plateau/html_convert"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-plateau
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.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: 2024-08-19 00:00:00.000000000 Z
11
+ date: 2024-09-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metanorma-jis