metanorma-plateau 0.1.3 → 0.1.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: 838839bc86469a328f7252f84d236687d5584c0d59633746756a445a40e063fb
4
- data.tar.gz: 816088c99147f784b587d3c8b4c32c357aaa049340dc27e7fe0d09235dc810c0
3
+ metadata.gz: 994c9fb200d2e1cffe7ea418f5c6129233ae0319898f161e0b4387cda7b62606
4
+ data.tar.gz: 1cf4aa824bda63e7905f0a77fc1c5a684791232453f82da45aadbb0eee061094
5
5
  SHA512:
6
- metadata.gz: 599842b641f909db3fbbb804de614a340f5cf1b3699ba64d0c36a1b99b857cce80686e5a7babb87ce0fd453618d1037fe7fd707c93c4151b8291cc7e95b20782
7
- data.tar.gz: 266668f37b4ab39f4dc7f7b72659f7c7a5dd31184c9bac10a210f378619af9c0d0bd6424e09a85b6c582700c107571835fb34cfd7203b375dee4aeb803fc093a
6
+ metadata.gz: 6cf30287643b8d49fd4c1412b7a4b0381d81bb5f6210875916f6fcccd2a7edfc2fb3764f26eb374d5d8d1bd8a64d7f5fc2bb3735308b0242cc3a9ecccb93eae4
7
+ data.tar.gz: 7d5fe6507a675e5cf1fd8cc9d4c36cbd767e407d28b3fc0840963dbdf9198581df95bf2c0903d7115f1233c98a99aa6eef67e9e5e9106ed50790ff95708fd92f
@@ -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,12 +6,16 @@
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>
12
14
  <xsl:variable name="i18n_doctype_dict_technical_report"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">doctype_dict.technical-report</xsl:with-param></xsl:call-template></xsl:variable>
13
15
  <xsl:variable name="i18n_table_of_contents"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">table_of_contents</xsl:with-param></xsl:call-template></xsl:variable>
14
16
 
17
+ <xsl:variable name="vertical_layout" select="normalize-space(/*/plateau:metanorma-extension/plateau:presentation-metadata/plateau:vertical-layout)"/>
18
+
15
19
  <xsl:variable name="page_header">
16
20
  <xsl:value-of select="/*/plateau:metanorma-extension/plateau:presentation-metadata/plateau:use-case"/>
17
21
  <xsl:text>_</xsl:text>
@@ -88,7 +92,15 @@
88
92
  </fo:simple-page-master>
89
93
 
90
94
  <fo:simple-page-master master-name="document_preface" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
91
- <fo:region-body margin-top="50mm" margin-bottom="35mm" margin-left="26mm" margin-right="34mm"/>
95
+ <xsl:if test="$vertical_layout = 'true'">
96
+ <xsl:attribute name="page-width"><xsl:value-of select="$pageHeight"/>mm</xsl:attribute>
97
+ <xsl:attribute name="page-height"><xsl:value-of select="$pageWidth"/>mm</xsl:attribute>
98
+ </xsl:if>
99
+ <fo:region-body margin-top="50mm" margin-bottom="35mm" margin-left="26mm" margin-right="34mm">
100
+ <xsl:if test="$vertical_layout = 'true'">
101
+ <xsl:attribute name="writing-mode">tb-rl</xsl:attribute>
102
+ </xsl:if>
103
+ </fo:region-body>
92
104
  <fo:region-before region-name="header" extent="50mm"/>
93
105
  <fo:region-after region-name="footer" extent="35mm"/>
94
106
  <fo:region-start region-name="left-region" extent="26mm"/>
@@ -96,7 +108,15 @@
96
108
  </fo:simple-page-master>
97
109
 
98
110
  <fo:simple-page-master master-name="document_toc" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
99
- <fo:region-body margin-top="16.5mm" margin-bottom="22mm" margin-left="14.5mm" margin-right="22.3mm"/>
111
+ <xsl:if test="$vertical_layout = 'true'">
112
+ <xsl:attribute name="page-width"><xsl:value-of select="$pageHeight"/>mm</xsl:attribute>
113
+ <xsl:attribute name="page-height"><xsl:value-of select="$pageWidth"/>mm</xsl:attribute>
114
+ </xsl:if>
115
+ <fo:region-body margin-top="16.5mm" margin-bottom="22mm" margin-left="14.5mm" margin-right="22.3mm">
116
+ <xsl:if test="$vertical_layout = 'true'">
117
+ <xsl:attribute name="writing-mode">tb-rl</xsl:attribute>
118
+ </xsl:if>
119
+ </fo:region-body>
100
120
  <fo:region-before region-name="header" extent="16.5mm"/>
101
121
  <fo:region-after region-name="footer" extent="22mm"/>
102
122
  <fo:region-start region-name="left-region" extent="14.5mm"/>
@@ -104,7 +124,15 @@
104
124
  </fo:simple-page-master>
105
125
 
106
126
  <fo:simple-page-master master-name="document" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
107
- <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm"/>
127
+ <xsl:if test="$vertical_layout = 'true'">
128
+ <xsl:attribute name="page-width"><xsl:value-of select="$pageHeight"/>mm</xsl:attribute>
129
+ <xsl:attribute name="page-height"><xsl:value-of select="$pageWidth"/>mm</xsl:attribute>
130
+ </xsl:if>
131
+ <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm">
132
+ <xsl:if test="$vertical_layout = 'true'">
133
+ <xsl:attribute name="writing-mode">tb-rl</xsl:attribute>
134
+ </xsl:if>
135
+ </fo:region-body>
108
136
  <fo:region-before region-name="header" extent="{$marginTop}mm"/>
109
137
  <fo:region-after region-name="footer" extent="{$marginBottom}mm"/>
110
138
  <fo:region-start region-name="left-region" extent="{$marginLeftRight1}mm"/>
@@ -233,6 +261,11 @@
233
261
  <fo:static-content flow-name="header" role="artifact" id="__internal_layout__preface_header_{generate-id()}">
234
262
  <!-- grey background -->
235
263
  <fo:block-container absolute-position="fixed" left="24.2mm" top="40mm" height="231.4mm" width="161mm" background-color="rgb(242,242,242)" id="__internal_layout__preface_header_{$num}_{generate-id()}">
264
+ <xsl:if test="$vertical_layout = 'true'">
265
+ <xsl:attribute name="top">24.2mm</xsl:attribute>
266
+ <xsl:attribute name="left">40mm</xsl:attribute>
267
+ <xsl:attribute name="writing-mode">tb-rl</xsl:attribute>
268
+ </xsl:if>
236
269
  <fo:block> </fo:block>
237
270
  </fo:block-container>
238
271
  </fo:static-content>
@@ -1122,7 +1155,11 @@
1122
1155
  <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
1123
1156
  </xsl:if>
1124
1157
 
1125
- <xsl:if test="parent::plateau:clause">
1158
+ <xsl:if test="parent::plateau:note and not(following-sibling::*)">
1159
+ <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
1160
+ </xsl:if>
1161
+
1162
+ <xsl:if test="parent::plateau:clause or (ancestor::plateau:note and not(ancestor::plateau:table))">
1126
1163
  <xsl:text> </xsl:text>
1127
1164
  </xsl:if>
1128
1165
 
@@ -1143,6 +1180,42 @@
1143
1180
  </xsl:choose>
1144
1181
  </xsl:template>
1145
1182
 
1183
+ <xsl:template match="*[local-name() = 'note'][not(ancestor::plateau:table)]" priority="2">
1184
+
1185
+ <fo:block-container id="{@id}" xsl:use-attribute-sets="note-style" role="SKIP">
1186
+ <xsl:attribute name="margin-top">6pt</xsl:attribute>
1187
+ <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
1188
+
1189
+ <xsl:call-template name="setBlockSpanAll"/>
1190
+
1191
+ <xsl:call-template name="refine_note-style"/>
1192
+
1193
+ <fo:block-container margin-left="0mm" margin-right="0mm" role="SKIP">
1194
+
1195
+ <fo:table table-layout="fixed" width="99%" border="1pt solid black">
1196
+ <fo:table-body>
1197
+ <fo:table-row>
1198
+ <fo:table-cell padding="2mm">
1199
+ <fo:block keep-with-next="always" margin-bottom="10pt" role="SKIP">
1200
+ <xsl:apply-templates select="*[local-name() = 'name']"/>
1201
+ </fo:block>
1202
+ <fo:block>
1203
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
1204
+ </fo:block>
1205
+ </fo:table-cell>
1206
+ </fo:table-row>
1207
+ </fo:table-body>
1208
+ </fo:table>
1209
+ </fo:block-container>
1210
+ </fo:block-container>
1211
+ </xsl:template>
1212
+
1213
+ <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'note']" priority="3"/>
1214
+
1215
+ <xsl:template match="*[local-name() = 'note'][not(ancestor::plateau:table)]/*[local-name() = 'p']" priority="2">
1216
+ <xsl:call-template name="paragraph"/>
1217
+ </xsl:template>
1218
+
1146
1219
  <xsl:template match="plateau:termnote" priority="2">
1147
1220
  <fo:block id="{@id}" xsl:use-attribute-sets="termnote-style">
1148
1221
  <fo:list-block provisional-distance-between-starts="{14 + $text_indent}mm">
@@ -7740,6 +7813,12 @@
7740
7813
  <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']">
7741
7814
  <attachment filename="{@name}"/>
7742
7815
  </xsl:for-each>
7816
+ <xsl:if test="not(//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment'])">
7817
+ <xsl:for-each select="//*[local-name() = 'bibitem'][@hidden = 'true'][*[local-name() = 'uri'][@type = 'attachment']]">
7818
+ <xsl:variable name="attachment_path" select="*[local-name() = 'uri'][@type = 'attachment']"/>
7819
+ <attachment filename="{$attachment_path}"/>
7820
+ </xsl:for-each>
7821
+ </xsl:if>
7743
7822
  </xsl:variable>
7744
7823
  <xsl:variable name="pdfAttachmentsList" select="xalan:nodeset($pdfAttachmentsList_)"/>
7745
7824
 
@@ -7752,7 +7831,7 @@
7752
7831
  <xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
7753
7832
  </xsl:when>
7754
7833
  <!-- link to the PDF attachment -->
7755
- <xsl:when test="$pdfAttachmentsList//attachment[@filename = current()/@target]">
7834
+ <xsl:when test="@attachment = 'true' and $pdfAttachmentsList//attachment[@filename = current()/@target]">
7756
7835
  <xsl:value-of select="concat('url(embedded-file:', @target, ')')"/>
7757
7836
  </xsl:when>
7758
7837
  <!-- <xsl:when test="starts-with($target_normalized, '_') and contains($target_normalized, '_attachments/') and $pdfAttachmentsList//attachment[@filename = $target_attachment_name]">
@@ -8399,7 +8478,16 @@
8399
8478
  </xsl:variable>
8400
8479
  <xsl:variable name="img_src">
8401
8480
  <xsl:choose>
8402
- <xsl:when test="not(starts-with(@src, 'data:'))"><xsl:value-of select="concat($basepath, @src)"/></xsl:when>
8481
+ <xsl:when test="not(starts-with(@src, 'data:'))">
8482
+ <xsl:choose>
8483
+ <xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 -->
8484
+ <xsl:value-of select="@src"/>
8485
+ </xsl:when>
8486
+ <xsl:otherwise>
8487
+ <xsl:value-of select="concat($basepath, @src)"/>
8488
+ </xsl:otherwise>
8489
+ </xsl:choose>
8490
+ </xsl:when>
8403
8491
  <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
8404
8492
  </xsl:choose>
8405
8493
  </xsl:variable>
@@ -8412,7 +8500,7 @@
8412
8500
  <!-- <xsl:message>width_effective=<xsl:value-of select="$width_effective"/></xsl:message>
8413
8501
  <xsl:message>indent_left=<xsl:value-of select="$indent_left"/></xsl:message>
8414
8502
  <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)"/>
8503
+ <xsl:variable name="scale" select="java:org.metanorma.fop.utils.ImageUtils.getImageScale($img_src, $image_width_effective, $height_effective)"/>
8416
8504
  <xsl:value-of select="$scale"/>
8417
8505
  </xsl:template>
8418
8506
 
@@ -8431,7 +8519,14 @@
8431
8519
  <xsl:value-of select="concat('url(file:///',$basepath, $src_png, ')')"/>
8432
8520
  </xsl:when>
8433
8521
  <xsl:when test="not(starts-with(@src, 'data:'))">
8434
- <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
8522
+ <xsl:choose>
8523
+ <xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 -->
8524
+ <xsl:value-of select="concat('url(file:///', @src, ')')"/>
8525
+ </xsl:when>
8526
+ <xsl:otherwise>
8527
+ <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
8528
+ </xsl:otherwise>
8529
+ </xsl:choose>
8435
8530
  </xsl:when>
8436
8531
  <xsl:otherwise>
8437
8532
  <xsl:value-of select="@src"/>
@@ -8453,7 +8548,14 @@
8453
8548
  </xsl:when>
8454
8549
  <xsl:when test="not(starts-with(@src, 'data:'))">
8455
8550
  <xsl:variable name="src">
8456
- <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
8551
+ <xsl:choose>
8552
+ <xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 -->
8553
+ <xsl:value-of select="concat('url(file:///', @src, ')')"/>
8554
+ </xsl:when>
8555
+ <xsl:otherwise>
8556
+ <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
8557
+ </xsl:otherwise>
8558
+ </xsl:choose>
8457
8559
  </xsl:variable>
8458
8560
  <xsl:variable name="file" select="java:java.io.File.new(@src)"/>
8459
8561
  <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($file)"/>
@@ -13291,6 +13393,39 @@
13291
13393
  </pdf:catalog>
13292
13394
  <x:xmpmeta xmlns:x="adobe:ns:meta/">
13293
13395
  <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
13396
+ <rdf:Description xmlns:pdfaExtension="http://www.aiim.org/pdfa/ns/extension/" xmlns:pdfaProperty="http://www.aiim.org/pdfa/ns/property#" xmlns:pdfaSchema="http://www.aiim.org/pdfa/ns/schema#" rdf:about="">
13397
+ <pdfaExtension:schemas>
13398
+ <rdf:Bag>
13399
+ <rdf:li rdf:parseType="Resource">
13400
+ <pdfaSchema:namespaceURI>http://www.aiim.org/pdfua/ns/id/</pdfaSchema:namespaceURI>
13401
+ <pdfaSchema:prefix>pdfuaid</pdfaSchema:prefix>
13402
+ <pdfaSchema:schema>PDF/UA identification schema</pdfaSchema:schema>
13403
+ <pdfaSchema:property>
13404
+ <rdf:Seq>
13405
+ <rdf:li rdf:parseType="Resource">
13406
+ <pdfaProperty:category>internal</pdfaProperty:category>
13407
+ <pdfaProperty:description>PDF/UA version identifier</pdfaProperty:description>
13408
+ <pdfaProperty:name>part</pdfaProperty:name>
13409
+ <pdfaProperty:valueType>Integer</pdfaProperty:valueType>
13410
+ </rdf:li>
13411
+ <rdf:li rdf:parseType="Resource">
13412
+ <pdfaProperty:category>internal</pdfaProperty:category>
13413
+ <pdfaProperty:description>PDF/UA amendment identifier</pdfaProperty:description>
13414
+ <pdfaProperty:name>amd</pdfaProperty:name>
13415
+ <pdfaProperty:valueType>Text</pdfaProperty:valueType>
13416
+ </rdf:li>
13417
+ <rdf:li rdf:parseType="Resource">
13418
+ <pdfaProperty:category>internal</pdfaProperty:category>
13419
+ <pdfaProperty:description>PDF/UA corrigenda identifier</pdfaProperty:description>
13420
+ <pdfaProperty:name>corr</pdfaProperty:name>
13421
+ <pdfaProperty:valueType>Text</pdfaProperty:valueType>
13422
+ </rdf:li>
13423
+ </rdf:Seq>
13424
+ </pdfaSchema:property>
13425
+ </rdf:li>
13426
+ </rdf:Bag>
13427
+ </pdfaExtension:schemas>
13428
+ </rdf:Description>
13294
13429
  <rdf:Description xmlns:pdf="http://ns.adobe.com/pdf/1.3/" xmlns:dc="http://purl.org/dc/elements/1.1/" rdf:about="">
13295
13430
  <!-- Dublin Core properties go here -->
13296
13431
  <dc:title>
@@ -13301,33 +13436,57 @@
13301
13436
 
13302
13437
  </xsl:for-each>
13303
13438
  </xsl:variable>
13304
- <xsl:choose>
13305
- <xsl:when test="normalize-space($title) != ''">
13306
- <xsl:value-of select="$title"/>
13307
- </xsl:when>
13308
- <xsl:otherwise>
13309
- <xsl:text> </xsl:text>
13310
- </xsl:otherwise>
13311
- </xsl:choose>
13439
+ <rdf:Alt>
13440
+ <rdf:li xml:lang="x-default">
13441
+ <xsl:choose>
13442
+ <xsl:when test="normalize-space($title) != ''">
13443
+ <xsl:value-of select="$title"/>
13444
+ </xsl:when>
13445
+ <xsl:otherwise>
13446
+ <xsl:text> </xsl:text>
13447
+ </xsl:otherwise>
13448
+ </xsl:choose>
13449
+ </rdf:li>
13450
+ </rdf:Alt>
13312
13451
  </dc:title>
13313
- <dc:creator>
13452
+ <xsl:variable name="dc_creator">
13314
13453
  <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
13315
13454
 
13316
- <xsl:for-each select="*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']">
13317
- <xsl:value-of select="*[local-name() = 'organization']/*[local-name() = 'name']"/>
13318
- <xsl:if test="position() != last()">; </xsl:if>
13319
- </xsl:for-each>
13455
+ <rdf:Seq>
13456
+ <xsl:for-each select="*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']">
13457
+ <rdf:li>
13458
+ <xsl:value-of select="*[local-name() = 'organization']/*[local-name() = 'name']"/>
13459
+ </rdf:li>
13460
+ <!-- <xsl:if test="position() != last()">; </xsl:if> -->
13461
+ </xsl:for-each>
13462
+ </rdf:Seq>
13320
13463
 
13321
13464
  </xsl:for-each>
13322
- </dc:creator>
13323
- <dc:description>
13465
+ </xsl:variable>
13466
+ <xsl:if test="normalize-space($dc_creator) != ''">
13467
+ <dc:creator>
13468
+ <xsl:copy-of select="$dc_creator"/>
13469
+ </dc:creator>
13470
+ </xsl:if>
13471
+
13472
+ <xsl:variable name="dc_description">
13324
13473
  <xsl:variable name="abstract">
13325
13474
 
13326
13475
  <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*[local-name() = 'abstract']//text()[not(ancestor::*[local-name() = 'title'])]"/>
13327
13476
 
13328
13477
  </xsl:variable>
13329
- <xsl:value-of select="normalize-space($abstract)"/>
13330
- </dc:description>
13478
+ <rdf:Alt>
13479
+ <rdf:li xml:lang="x-default">
13480
+ <xsl:value-of select="normalize-space($abstract)"/>
13481
+ </rdf:li>
13482
+ </rdf:Alt>
13483
+ </xsl:variable>
13484
+ <xsl:if test="normalize-space($dc_description)">
13485
+ <dc:description>
13486
+ <xsl:copy-of select="$dc_description"/>
13487
+ </dc:description>
13488
+ </xsl:if>
13489
+
13331
13490
  <pdf:Keywords>
13332
13491
  <xsl:call-template name="insertKeywords">
13333
13492
  <xsl:with-param name="meta">true</xsl:with-param>
@@ -13342,26 +13501,37 @@
13342
13501
  </x:xmpmeta>
13343
13502
  <!-- add attachments -->
13344
13503
  <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>
13504
+ <xsl:variable name="description" select="normalize-space(//*[local-name() = 'bibitem'][@hidden = 'true'][*[local-name() = 'uri'][@type = 'attachment'] = current()/@name]/*[local-name() = 'formattedref'])"/>
13505
+
13506
+ <pdf:embedded-file filename="{@name}">
13507
+ <xsl:attribute name="src">
13508
+ <xsl:choose>
13509
+ <xsl:when test="normalize-space() != ''">
13510
+ <xsl:variable name="src_attachment" select="java:replaceAll(java:java.lang.String.new(.),'(&#13;&#10;|&#13;|&#10;)', '')"/> <!-- remove line breaks -->
13511
+ <xsl:value-of select="$src_attachment"/>
13512
+ </xsl:when>
13513
+ <xsl:otherwise>
13514
+ <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath , @name, ')')"/>
13515
+ <xsl:value-of select="$url"/>
13516
+ </xsl:otherwise>
13517
+ </xsl:choose>
13518
+ </xsl:attribute>
13519
+ <xsl:if test="$description != ''">
13520
+ <xsl:attribute name="description"><xsl:value-of select="$description"/></xsl:attribute>
13521
+ </xsl:if>
13522
+ </pdf:embedded-file>
13357
13523
  </xsl:for-each>
13358
13524
  <!-- references to external attachments (no binary-encoded within the Metanorma XML file) -->
13359
13525
  <xsl:if test="not(//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment'])">
13360
13526
  <xsl:for-each select="//*[local-name() = 'bibitem'][@hidden = 'true'][*[local-name() = 'uri'][@type = 'attachment']]">
13361
13527
  <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}"/>
13528
+ <xsl:variable name="url" select="concat('url(file:///',$basepath, $attachment_path, ')')"/>
13529
+ <xsl:variable name="description" select="normalize-space(*[local-name() = 'formattedref'])"/>
13530
+ <pdf:embedded-file src="{$url}" filename="{$attachment_path}">
13531
+ <xsl:if test="$description != ''">
13532
+ <xsl:attribute name="description"><xsl:value-of select="$description"/></xsl:attribute>
13533
+ </xsl:if>
13534
+ </pdf:embedded-file>
13365
13535
  </xsl:for-each>
13366
13536
  </xsl:if>
13367
13537
  </xsl:template> <!-- addPDFUAmeta -->
@@ -13737,7 +13907,14 @@
13737
13907
  <xsl:value-of select="$src"/>
13738
13908
  </xsl:when>
13739
13909
  <xsl:otherwise>
13740
- <xsl:value-of select="concat('url(file:///',$basepath, $src, ')')"/>
13910
+ <xsl:choose>
13911
+ <xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 -->
13912
+ <xsl:value-of select="concat('url(file:///', @src, ')')"/>
13913
+ </xsl:when>
13914
+ <xsl:otherwise>
13915
+ <xsl:value-of select="concat('url(file:///',$basepath, $src, ')')"/>
13916
+ </xsl:otherwise>
13917
+ </xsl:choose>
13741
13918
  </xsl:otherwise>
13742
13919
  </xsl:choose>
13743
13920
  </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