metanorma-ribose 2.4.11 → 2.5.0

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: 69c928b3ec63a523f114024012f4b60f399be7308dbf4083f280fd24eca6c8d3
4
- data.tar.gz: 9999b24d08475a91bb43aad9f3fafc4f116f904eae713f50ea60e74c80eb6e67
3
+ metadata.gz: 6870f076ae8e391de38bef5ec500f584ddcafc218734c371e2ee60c9ee06d76a
4
+ data.tar.gz: 29b9819b5bd291e1c9cffc0f954fc49873fd1d00e349ec9ee86703f82b6286e8
5
5
  SHA512:
6
- metadata.gz: 902f120894f623afdeae41eace5e5f765c85964fb97540b2ff8599797acf673dfad713ac4cccf59f9c4f7f450615a92a4df31ff73a1aa77dd2036905080acdb9
7
- data.tar.gz: b819165043dbd27e06e4f8838a663897150eaf060dbfc951125aaef113e2d84d9c9dd54350f3912d96f8c53d1e91573483340295824bc9f78f41eecc661d6079
6
+ metadata.gz: 9196ee05f5e746185b80db74ca6ebb7a2ce0b58487a1e11de20ab4a7012bfbedd9213fb5a72687e37f1ffeccdc1084199c101c77d178777ef42e90a2b7cc9ea7
7
+ data.tar.gz: cfb292071e9ae8a2c5384b413438a5c24d9dadd2ccf9a565533c3be527cf722139c6f41433265f883de5bb9e158612de2d89f94563338bb150e7a5e8d475e7f1
@@ -21,6 +21,10 @@ module IsoDoc
21
21
  def clausedelim
22
22
  ""
23
23
  end
24
+
25
+ def configuration
26
+ Metanorma::Ribose.configuration
27
+ end
24
28
  end
25
29
  end
26
30
  end
@@ -229,6 +229,46 @@ h6:hover > a.anchor,
229
229
  .inline-header:hover > a.anchor {
230
230
  visibility: visible; }
231
231
 
232
+ /* collapsible snippets: collapsible before hidable */
233
+ .hidable {
234
+ max-height: 0;
235
+ overflow: hidden;
236
+ transition: max-height 0.2s ease-out; }
237
+
238
+ .collapsible {
239
+ background-color: #777;
240
+ color: white;
241
+ cursor: pointer;
242
+ padding: 12px 0;
243
+ margin: 0;
244
+ width: 100%;
245
+ border: none;
246
+ text-align: left;
247
+ outline: none;
248
+ font-size: 15px; }
249
+
250
+ .active, .collapsible:hover {
251
+ background-color: #555; }
252
+
253
+ .collapsible:after {
254
+ content: '\25bc';
255
+ color: white;
256
+ font-weight: bold;
257
+ float: right;
258
+ margin-left: 12px;
259
+ margin-right: 12px; }
260
+
261
+ .active:after {
262
+ content: "\25b2"; }
263
+
264
+ /* collapsible: */
265
+ .collapsible + .hidable {
266
+ margin-top: 0; }
267
+
268
+ .collapsible:not(.active) + .hidable {
269
+ overflow: hidden;
270
+ padding: 0; }
271
+
232
272
  #standard-band {
233
273
  background-color: #0AC442; }
234
274
 
@@ -9,10 +9,6 @@ module IsoDoc
9
9
  # schema encapsulation of the document for validation
10
10
  #
11
11
  class HtmlConvert < IsoDoc::Generic::HtmlConvert
12
- def configuration
13
- Metanorma::Ribose.configuration
14
- end
15
-
16
12
  include BaseConvert
17
13
  include Init
18
14
  end
@@ -1,18 +1,18 @@
1
1
  require "isodoc"
2
+ require_relative "base_convert"
2
3
 
3
4
  module IsoDoc
4
5
  module Ribose
5
6
  # A {Converter} implementation that generates PDF HTML output, and a
6
7
  # document schema encapsulation of the document for validation
7
- class PdfConvert < IsoDoc::XslfoPdfConvert
8
+ class PdfConvert < IsoDoc::Generic::PdfConvert
8
9
  def initialize(options)
9
10
  @libdir = File.dirname(__FILE__)
10
11
  super
11
12
  end
12
13
 
13
- def pdf_stylesheet(_docxml)
14
- "ribose.standard.xsl"
15
- end
14
+ include BaseConvert
15
+ include Init
16
16
  end
17
17
  end
18
18
  end
@@ -3216,13 +3216,35 @@
3216
3216
  </xsl:for-each>
3217
3217
  </xsl:element>
3218
3218
 
3219
- <xsl:call-template name="insertAnnexInSeparatePageSequences"/>
3219
+ <xsl:call-template name="insertAnnexAndBibliographyInSeparatePageSequences"/>
3220
3220
 
3221
- <xsl:call-template name="insertBibliographyInSeparatePageSequences"/>
3221
+ <!-- <xsl:call-template name="insertBibliographyInSeparatePageSequences"/> -->
3222
3222
 
3223
3223
  <!-- <xsl:call-template name="insertIndexInSeparatePageSequences"/> -->
3224
3224
  </xsl:template> <!-- END: insertMainSectionsInSeparatePageSequences -->
3225
3225
 
3226
+ <xsl:template name="insertAnnexAndBibliographyInSeparatePageSequences">
3227
+ <xsl:for-each select="/*/*[local-name()='annex'] | /*/*[local-name()='bibliography']/*[not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]] | /*/*[local-name()='indexsect']">
3228
+ <xsl:sort select="@displayorder" data-type="number"/>
3229
+ <xsl:choose>
3230
+ <xsl:when test="local-name() = 'annex' or local-name() = 'indexsect'">
3231
+ <xsl:element name="page_sequence" namespace="{$namespace_full}">
3232
+ <xsl:attribute name="main_page_sequence"/>
3233
+ <xsl:apply-templates select="." mode="update_xml_step_move_pagebreak"/>
3234
+ </xsl:element>
3235
+ </xsl:when>
3236
+ <xsl:otherwise> <!-- bibliography -->
3237
+ <xsl:element name="bibliography" namespace="{$namespace_full}"> <!-- save context element -->
3238
+ <xsl:element name="page_sequence" namespace="{$namespace_full}">
3239
+ <xsl:attribute name="main_page_sequence"/>
3240
+ <xsl:apply-templates select="." mode="update_xml_step_move_pagebreak"/>
3241
+ </xsl:element>
3242
+ </xsl:element>
3243
+ </xsl:otherwise>
3244
+ </xsl:choose>
3245
+ </xsl:for-each>
3246
+ </xsl:template>
3247
+
3226
3248
  <xsl:template name="insertAnnexInSeparatePageSequences">
3227
3249
  <xsl:for-each select="/*/*[local-name()='annex']">
3228
3250
  <xsl:sort select="@displayorder" data-type="number"/>
@@ -7419,18 +7441,33 @@
7419
7441
 
7420
7442
  <xsl:template match="*[local-name()='localityStack']"/>
7421
7443
 
7444
+ <xsl:variable name="pdfAttachmentsList_">
7445
+ <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']">
7446
+ <attachment filename="{@name}"/>
7447
+ </xsl:for-each>
7448
+ </xsl:variable>
7449
+ <xsl:variable name="pdfAttachmentsList" select="xalan:nodeset($pdfAttachmentsList_)"/>
7450
+
7422
7451
  <xsl:template match="*[local-name()='link']" name="link">
7452
+ <xsl:variable name="target_normalized" select="translate(@target, '\', '/')"/>
7453
+ <xsl:variable name="target_attachment_name" select="substring-after($target_normalized, '_attachments/')"/>
7423
7454
  <xsl:variable name="target">
7424
7455
  <xsl:choose>
7425
7456
  <xsl:when test="@updatetype = 'true'">
7426
7457
  <xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
7427
7458
  </xsl:when>
7459
+ <!-- link to the PDF attachment -->
7460
+ <xsl:when test="$pdfAttachmentsList//attachment[@filename = current()/@target]">
7461
+ <xsl:value-of select="concat('url(embedded-file:', @target, ')')"/>
7462
+ </xsl:when>
7463
+ <!-- <xsl:when test="starts-with($target_normalized, '_') and contains($target_normalized, '_attachments/') and $pdfAttachmentsList//attachment[@filename = $target_attachment_name]">
7464
+ <xsl:value-of select="concat('url(embedded-file:', $target_attachment_name, ')')"/>
7465
+ </xsl:when>
7428
7466
  <xsl:when test="contains(@target, concat('_', $inputxml_filename_prefix, '_attachments'))">
7429
- <!-- link to the PDF attachment -->
7430
7467
  <xsl:variable name="target_" select="translate(@target, '\', '/')"/>
7431
7468
  <xsl:variable name="target__" select="substring-after($target_, concat('_', $inputxml_filename_prefix, '_attachments', '/'))"/>
7432
7469
  <xsl:value-of select="concat('url(embedded-file:', $target__, ')')"/>
7433
- </xsl:when>
7470
+ </xsl:when> -->
7434
7471
  <xsl:otherwise>
7435
7472
  <xsl:value-of select="normalize-space(@target)"/>
7436
7473
  </xsl:otherwise>
@@ -12026,6 +12063,19 @@
12026
12063
  <xsl:copy-of select="."/>
12027
12064
  </xsl:template>
12028
12065
 
12066
+ <xsl:template match="*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']" mode="update_xml_step1">
12067
+ <xsl:copy>
12068
+ <xsl:copy-of select="@*"/>
12069
+ <xsl:if test="1 = 2"> <!-- remove attachment/text(), because attachments added in the template 'addPDFUAmeta' before applying 'update_xml_step1' -->
12070
+ <xsl:variable name="name_filepath" select="concat($inputxml_basepath, @name)"/>
12071
+ <xsl:variable name="file_exists" select="normalize-space(java:exists(java:java.io.File.new($name_filepath)))"/>
12072
+ <xsl:if test="$file_exists = 'false'"> <!-- copy attachment content only if file on disk doesnt exist -->
12073
+ <xsl:value-of select="normalize-space(.)"/>
12074
+ </xsl:if>
12075
+ </xsl:if>
12076
+ </xsl:copy>
12077
+ </xsl:template>
12078
+
12029
12079
  <!-- add @id, mandatory for table auto-layout algorithm -->
12030
12080
  <xsl:template match="*[local-name() = 'dl' or local-name() = 'table'][not(@id)]" mode="update_xml_step1">
12031
12081
  <xsl:copy>
@@ -12896,11 +12946,13 @@
12896
12946
  <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']">
12897
12947
  <xsl:choose>
12898
12948
  <xsl:when test="normalize-space() != ''">
12899
- <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{.}" filename="{@name}"/>
12949
+ <xsl:variable name="src_attachment" select="java:replaceAll(java:java.lang.String.new(.),'(&#13;&#10;|&#13;|&#10;)', '')"/> <!-- remove line breaks -->
12950
+ <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{$src_attachment}" filename="{@name}"/>
12900
12951
  </xsl:when>
12901
12952
  <xsl:otherwise>
12902
12953
  <!-- _{filename}_attachments -->
12903
- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, '_', $inputxml_filename_prefix, '_attachments', '/', @name, ')')"/>
12954
+ <!-- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, '_', $inputxml_filename_prefix, '_attachments', '/', @name, ')')"/> -->
12955
+ <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath , @name, ')')"/>
12904
12956
  <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{$url}" filename="{@name}"/>
12905
12957
  </xsl:otherwise>
12906
12958
  </xsl:choose>
@@ -15,15 +15,6 @@ module Metanorma
15
15
  )
16
16
  end
17
17
 
18
- def fonts_manifest
19
- {
20
- "Source Sans Pro" => nil,
21
- "STIX Two Math" => nil,
22
- "Source Serif Pro" => nil,
23
- "Source Code Pro" => nil,
24
- }
25
- end
26
-
27
18
  def version
28
19
  "Metanorma::Ribose #{Metanorma::Ribose::VERSION}"
29
20
  end
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Ribose
3
- VERSION = "2.4.11".freeze
3
+ VERSION = "2.5.0".freeze
4
4
  end
5
5
  end
@@ -29,7 +29,7 @@ Gem::Specification.new do |spec|
29
29
  spec.require_paths = ["lib"]
30
30
  spec.required_ruby_version = Gem::Requirement.new(">= 3.1.0")
31
31
 
32
- spec.add_dependency "metanorma-generic", "~> 2.6.2"
32
+ spec.add_dependency "metanorma-generic", "~> 2.7.0"
33
33
 
34
34
  spec.add_development_dependency "debug"
35
35
  spec.add_development_dependency "equivalent-xml", "~> 0.6"
@@ -41,4 +41,5 @@ Gem::Specification.new do |spec|
41
41
  spec.add_development_dependency "sassc", "2.4.0"
42
42
  spec.add_development_dependency "simplecov", "~> 0.15"
43
43
  spec.add_development_dependency "timecop", "~> 0.9"
44
+ spec.add_development_dependency "xml-c14n"
44
45
  end
data/metanorma.yml CHANGED
@@ -21,6 +21,7 @@ header: lib/isodoc/ribose/html/header.html
21
21
  wordcoverpage: lib/isodoc/ribose/html/word_rsd_titlepage.html
22
22
  wordintropage: lib/isodoc/ribose/html/word_rsd_intro.html
23
23
  wordstylesheet: lib/isodoc/ribose/html/wordstyle.scss
24
+ pdf_stylesheet: lib/isodoc/ribose/ribose.standard.xsl
24
25
  word_bodyfont: '"Source Sans Pro","Arial",sans-serif'
25
26
  word_headerfont: '"Source Sans Pro","Arial",sans-serif'
26
27
  word_monospacefont: '"Source Code Pro",monospace'
@@ -49,3 +50,8 @@ metadata_extensions:
49
50
  webfont:
50
51
  - "https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,300i,600,600i&display=swap"
51
52
  - "https://fonts.googleapis.com/css2?family=Source+Code+Pro:ital,wght@0,300;0,600;1,300;1,600&display=swap"
53
+ fonts_manifest:
54
+ Source Sans Pro:
55
+ STIX Two Math:
56
+ Source Serif Pro:
57
+ Source Code Pro:
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-ribose
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.11
4
+ version: 2.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-07-22 00:00:00.000000000 Z
11
+ date: 2024-08-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metanorma-generic
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 2.6.2
19
+ version: 2.7.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 2.6.2
26
+ version: 2.7.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: debug
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -164,6 +164,20 @@ dependencies:
164
164
  - - "~>"
165
165
  - !ruby/object:Gem::Version
166
166
  version: '0.9'
167
+ - !ruby/object:Gem::Dependency
168
+ name: xml-c14n
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - ">="
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
174
+ type: :development
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - ">="
179
+ - !ruby/object:Gem::Version
180
+ version: '0'
167
181
  description: |
168
182
  metanorma-ribose lets you write Ribose standards in AsciiDoc syntax.
169
183