metanorma-csa 1.8.9 → 1.8.13

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: a7aefe79c1f9cb7bfad232959f298be205d970ac1502093b58af0aaf9436478d
4
- data.tar.gz: 8c4e27f9ca23412d6add815c971b0051ab280bd93d1f1418ae1743d7c3ef65af
3
+ metadata.gz: '0278402202df1d54400e2484353f2b72e6cc1cb1460b667d612e33ed59866bd8'
4
+ data.tar.gz: 5b0dc26b3f6ca9a6ebcefae0aab24c489d2cd44375b460fa7de256f49df33241
5
5
  SHA512:
6
- metadata.gz: 321c6a9aca508161b1aba80939fd09a63bc81b4073eacd597b2ed3ad3edb7381d4848778c114224fe81efd2bb7051cfc52791658ab5fa386797f3a8ce833d3a5
7
- data.tar.gz: 48bdcfb288a3697149f7031e38c26c2f80d5353927b6e3f2c2a9c8deedcbfceedafac68db4f0b281dac26294e99fdf7b3bf4ff05eaa23e74d469f0bd1f86c6de
6
+ metadata.gz: 1777e7470a39065734ebdba76f5b393516e368af17d023028caa91e91f968bff5228fb895ae9838b6eaeb9c27457fadd25a396331074d70043efd58959913051
7
+ data.tar.gz: f5d341dc22ac44eb35c04ffa55f7bdab25963543eb1f1851e3602563296f573e7793268b10e7a5bc9d70be5ad6e4b61f272e894a78b625a0e1a43324c2a39d87
@@ -624,6 +624,9 @@
624
624
  <choice>
625
625
  <ref name="PureTextElement"/>
626
626
  <ref name="stem"/>
627
+ <ref name="eref"/>
628
+ <ref name="xref"/>
629
+ <ref name="hyperlink"/>
627
630
  </choice>
628
631
  </zeroOrMore>
629
632
  </element>
@@ -634,6 +637,9 @@
634
637
  <choice>
635
638
  <ref name="PureTextElement"/>
636
639
  <ref name="stem"/>
640
+ <ref name="eref"/>
641
+ <ref name="xref"/>
642
+ <ref name="hyperlink"/>
637
643
  </choice>
638
644
  </zeroOrMore>
639
645
  </element>
@@ -641,7 +647,12 @@
641
647
  <define name="tt">
642
648
  <element name="tt">
643
649
  <zeroOrMore>
644
- <ref name="PureTextElement"/>
650
+ <choice>
651
+ <ref name="PureTextElement"/>
652
+ <ref name="eref"/>
653
+ <ref name="xref"/>
654
+ <ref name="hyperlink"/>
655
+ </choice>
645
656
  </zeroOrMore>
646
657
  </element>
647
658
  </define>
@@ -822,7 +833,9 @@
822
833
  <attribute name="alt"/>
823
834
  </optional>
824
835
  <ref name="CitationType"/>
825
- <text/>
836
+ <oneOrMore>
837
+ <ref name="PureTextElement"/>
838
+ </oneOrMore>
826
839
  </define>
827
840
  <define name="hyperlink">
828
841
  <element name="link">
@@ -835,7 +848,9 @@
835
848
  <optional>
836
849
  <attribute name="alt"/>
837
850
  </optional>
838
- <text/>
851
+ <oneOrMore>
852
+ <ref name="PureTextElement"/>
853
+ </oneOrMore>
839
854
  </element>
840
855
  </define>
841
856
  <define name="xref">
@@ -849,7 +864,9 @@
849
864
  <optional>
850
865
  <attribute name="alt"/>
851
866
  </optional>
852
- <text/>
867
+ <oneOrMore>
868
+ <ref name="PureTextElement"/>
869
+ </oneOrMore>
853
870
  </element>
854
871
  </define>
855
872
  <define name="fn">
@@ -1,19 +1,19 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'asciidoctor'
4
- require 'metanorma-generic'
5
- require 'isodoc/csa/html_convert'
6
- require 'isodoc/csa/pdf_convert'
7
- require 'isodoc/csa/word_convert'
8
- require 'isodoc/csa/presentation_xml_convert'
9
- require 'metanorma/csa'
10
- require 'fileutils'
3
+ require "asciidoctor"
4
+ require "metanorma-generic"
5
+ require "isodoc/csa/html_convert"
6
+ require "isodoc/csa/pdf_convert"
7
+ require "isodoc/csa/word_convert"
8
+ require "isodoc/csa/presentation_xml_convert"
9
+ require "metanorma/csa"
10
+ require "fileutils"
11
11
 
12
12
  module Asciidoctor
13
13
  module Csa
14
14
  class Converter < ::Asciidoctor::Generic::Converter
15
- XML_ROOT_TAG = "csa-standard".freeze
16
- XML_NAMESPACE = "https://www.metanorma.org/ns/csa".freeze
15
+ XML_ROOT_TAG = "csa-standard"
16
+ XML_NAMESPACE = "https://www.metanorma.org/ns/csa"
17
17
 
18
18
  register_for "csa"
19
19
 
@@ -21,46 +21,47 @@ module Asciidoctor
21
21
  Metanorma::Csa.configuration
22
22
  end
23
23
 
24
- def personal_role(node, c, suffix)
24
+ def personal_role(node, contrib, suffix)
25
25
  role = node.attr("role#{suffix}")&.downcase || "full author"
26
- c.role **{ type: role == "editor" ? "editor" : "author" } do |r|
26
+ contrib.role **{ type: role == "editor" ? "editor" : "author" } do |r|
27
27
  r.description role.strip.gsub(/\s/, "-")
28
28
  end
29
29
  end
30
30
 
31
31
  def metadata_committee(node, xml)
32
32
  return unless node.attr("technical-committee")
33
+
33
34
  xml.editorialgroup do |a|
34
35
  a.committee node.attr("technical-committee"),
35
- **attr_code(type: node.attr("technical-committee-type"))
36
+ **attr_code(type: node.attr("technical-committee-type"))
36
37
  i = 2
37
- while node.attr("technical-committee_#{i}") do
38
+ while node.attr("technical-committee_#{i}")
38
39
  a.committee node.attr("technical-committee_#{i}"),
39
- **attr_code(type: node.attr("technical-committee-type_#{i}"))
40
+ **attr_code(type: node.attr("technical-committee-type_#{i}"))
40
41
  i += 1
41
42
  end
42
43
  end
43
44
  end
44
45
 
45
- def title_validate(root)
46
+ def title_validate(_root)
46
47
  nil
47
48
  end
48
49
 
49
50
  def outputs(node, ret)
50
- File.open(@filename + ".xml", "w:UTF-8") { |f| f.write(ret) }
51
- presentation_xml_converter(node).convert(@filename + ".xml")
52
- html_converter(node).convert(@filename + ".presentation.xml",
53
- nil, false, "#{@filename}.html")
54
- doc_converter(node).convert(@filename + ".presentation.xml",
55
- nil, false, "#{@filename}.doc")
56
- pdf_converter(node)&.convert(@filename + ".presentation.xml",
57
- nil, false, "#{@filename}.pdf")
51
+ File.open("#{@filename}.xml", "w:UTF-8") { |f| f.write(ret) }
52
+ presentation_xml_converter(node).convert("#{@filename}.xml")
53
+ html_converter(node).convert("#{@filename}.presentation.xml",
54
+ nil, false, "#{@filename}.html")
55
+ doc_converter(node).convert("#{@filename}.presentation.xml",
56
+ nil, false, "#{@filename}.doc")
57
+ pdf_converter(node)&.convert("#{@filename}.presentation.xml",
58
+ nil, false, "#{@filename}.pdf")
58
59
  end
59
60
 
60
- def sections_cleanup(x)
61
+ def sections_cleanup(xml)
61
62
  super
62
- x.xpath("//*[@inline-header]").each do |h|
63
- h.delete('inline-header')
63
+ xml.xpath("//*[@inline-header]").each do |h|
64
+ h.delete("inline-header")
64
65
  end
65
66
  end
66
67
 
@@ -74,13 +75,13 @@ module Asciidoctor
74
75
  r["type"] == "author" or next
75
76
  role = r.at("./description").text
76
77
  %w{full-author contributor staff reviewer}.include?(role) or
77
- @log.add("Document Attributes", nil,
78
- "#{role} is not a recognised role")
78
+ @log.add("Document Attributes", nil,
79
+ "#{role} is not a recognised role")
79
80
  end
80
81
  end
81
82
 
82
- def style(n, t)
83
- return
83
+ def style(_node, _text)
84
+ nil
84
85
  end
85
86
 
86
87
  def html_converter(node)
@@ -89,6 +90,7 @@ module Asciidoctor
89
90
 
90
91
  def pdf_converter(node)
91
92
  return if node.attr("no-pdf")
93
+
92
94
  IsoDoc::Csa::PdfConvert.new(html_extract_attributes(node))
93
95
  end
94
96