metanorma-csa 1.6.8 → 1.7.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: 8a611dbc71c58150cd8102bf56cf7f71b514a94b498600dfdd7f00e273eb81a9
4
- data.tar.gz: '018ce3ef9b1621ac802ac2defe1c9f8b4295a8eb945a28cc59e2509a87ab4f13'
3
+ metadata.gz: 03664b85f4eab48b265d24aaabc416c09d4aedcf83451a672866402d90a5c54f
4
+ data.tar.gz: 723c23cc0d9411ed6569c3281803574040d07fa89086f93fab1de5f79546ac9f
5
5
  SHA512:
6
- metadata.gz: f6a9634bccfd8971fce8ca005e93ba9d830b0d0529159e0cb3296fcce031c164b0cd56f1bfd01d67cfdaf2d5044a34c20f47754641ddce84bba73b124f0bc3a5
7
- data.tar.gz: f7ac4faaad94d9c4b9ce5ee70dcd79a06e73cfd4e5005f67d1fed6ac1d5e46489b6eff8a705f3d6933ac3ac8040f3a341274b1d4070e7f7b0a5b0543347fdbe9
6
+ metadata.gz: 5231750eb0d40277ebce1bb1f6c6320fd7abb04c6c303bcbdc9af67d18f851c484659cb6baf7052a383105b460303f2ffe672883d9443f0aa197c638a976d116
7
+ data.tar.gz: d37944dba89c7f98af07f9d77bbc0d7acbf9aa9ff325ad6e69e854ec270a22cd8acb217a0f5cd71ee98d283928faaf40f739892684a646cf68d249cef0b5b50e
@@ -596,6 +596,7 @@
596
596
  <ref name="bookmark"/>
597
597
  <ref name="image"/>
598
598
  <ref name="index"/>
599
+ <ref name="index-xref"/>
599
600
  </choice>
600
601
  </define>
601
602
  <define name="PureTextElement">
@@ -737,6 +738,37 @@
737
738
  </optional>
738
739
  </element>
739
740
  </define>
741
+ <define name="index-xref">
742
+ <element name="index-xref">
743
+ <attribute name="also">
744
+ <data type="boolean"/>
745
+ </attribute>
746
+ <element name="primary">
747
+ <oneOrMore>
748
+ <ref name="PureTextElement"/>
749
+ </oneOrMore>
750
+ </element>
751
+ <optional>
752
+ <element name="secondary">
753
+ <oneOrMore>
754
+ <ref name="PureTextElement"/>
755
+ </oneOrMore>
756
+ </element>
757
+ </optional>
758
+ <optional>
759
+ <element name="tertiary">
760
+ <oneOrMore>
761
+ <ref name="PureTextElement"/>
762
+ </oneOrMore>
763
+ </element>
764
+ </optional>
765
+ <element name="target">
766
+ <oneOrMore>
767
+ <ref name="PureTextElement"/>
768
+ </oneOrMore>
769
+ </element>
770
+ </element>
771
+ </define>
740
772
  <!-- bare ID element, used for referencing arbitrary spans of text -->
741
773
  <define name="bookmark">
742
774
  <element name="bookmark">
@@ -1,29 +1,24 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'asciidoctor'
4
- require 'metanorma/csa/version'
4
+ require 'metanorma-generic'
5
5
  require 'isodoc/csa/html_convert'
6
6
  require 'isodoc/csa/pdf_convert'
7
7
  require 'isodoc/csa/word_convert'
8
8
  require 'isodoc/csa/presentation_xml_convert'
9
- require 'asciidoctor/standoc/converter'
9
+ require 'metanorma/csa'
10
10
  require 'fileutils'
11
- require_relative 'validate'
12
11
 
13
12
  module Asciidoctor
14
13
  module Csa
15
- CSA_TYPE = 'csa'
16
-
17
- # A {Converter} implementation that generates CSD output, and a document
18
- # schema encapsulation of the document for validation
19
- class Converter < Standoc::Converter
14
+ class Converter < ::Asciidoctor::Generic::Converter
20
15
  XML_ROOT_TAG = "csa-standard".freeze
21
16
  XML_NAMESPACE = "https://www.metanorma.org/ns/csa".freeze
22
17
 
23
- register_for CSA_TYPE
18
+ register_for "csa"
24
19
 
25
- def default_publisher
26
- "Cloud Security Alliance"
20
+ def configuration
21
+ Metanorma::Csa.configuration
27
22
  end
28
23
 
29
24
  def personal_role(node, c, suffix)
@@ -47,34 +42,10 @@ module Asciidoctor
47
42
  end
48
43
  end
49
44
 
50
- def metadata_id(node, xml)
51
- dn = node.attr('docnumber') or return
52
- docstatus = node.attr('status')
53
- if docstatus
54
- abbr = IsoDoc::Csa::Metadata.new('en', 'Latn', @i18n)
55
- .stage_abbr(docstatus)
56
- dn = "#{dn}(#{abbr})" unless abbr.empty?
57
- end
58
- node.attr('copyright-year') && dn += ":#{node.attr('copyright-year')}"
59
- xml.docidentifier dn, **{ type: CSA_TYPE }
60
- xml.docnumber { |i| i << node.attr('docnumber') }
61
- end
62
-
63
45
  def title_validate(root)
64
46
  nil
65
47
  end
66
48
 
67
- def doctype(node)
68
- d = super
69
- unless %w{guidance proposal standard report whitepaper charter policy
70
- glossary case-study}.include? d
71
- @log.add("Document Attributes", nil,
72
- "#{d} is not a legal document type: reverting to 'standard'")
73
- d = 'standard'
74
- end
75
- d
76
- end
77
-
78
49
  def outputs(node, ret)
79
50
  File.open(@filename + ".xml", "w:UTF-8") { |f| f.write(ret) }
80
51
  presentation_xml_converter(node).convert(@filename + ".xml")
@@ -86,12 +57,6 @@ module Asciidoctor
86
57
  nil, false, "#{@filename}.pdf")
87
58
  end
88
59
 
89
- def validate(doc)
90
- content_validate(doc)
91
- schema_validate(formattedstr_strip(doc.dup),
92
- File.join(File.dirname(__FILE__), 'csa.rng'))
93
- end
94
-
95
60
  def sections_cleanup(x)
96
61
  super
97
62
  x.xpath("//*[@inline-header]").each do |h|
@@ -99,6 +64,21 @@ module Asciidoctor
99
64
  end
100
65
  end
101
66
 
67
+ def bibdata_validate(doc)
68
+ super
69
+ role_validate(doc)
70
+ end
71
+
72
+ def role_validate(doc)
73
+ doc&.xpath("//bibdata/contributor/role[description]")&.each do |r|
74
+ r["type"] == "author" or next
75
+ role = r.at("./description").text
76
+ %w{full-author contributor staff reviewer}.include?(role) or
77
+ @log.add("Document Attributes", nil,
78
+ "#{role} is not a recognised role")
79
+ end
80
+ end
81
+
102
82
  def style(n, t)
103
83
  return
104
84
  end
@@ -246,6 +246,9 @@
246
246
  <data type="boolean"/>
247
247
  </attribute>
248
248
  </optional>
249
+ <optional>
250
+ <ref name="colgroup"/>
251
+ </optional>
249
252
  <optional>
250
253
  <ref name="tname"/>
251
254
  </optional>
@@ -764,6 +767,18 @@
764
767
  </define>
765
768
  </include>
766
769
  <!-- end overrides -->
770
+ <define name="colgroup">
771
+ <element name="colgroup">
772
+ <oneOrMore>
773
+ <ref name="col"/>
774
+ </oneOrMore>
775
+ </element>
776
+ </define>
777
+ <define name="col">
778
+ <element name="col">
779
+ <attribute name="width"/>
780
+ </element>
781
+ </define>
767
782
  <define name="TextElement" combine="choice">
768
783
  <ref name="concept"/>
769
784
  </define>
@@ -5,18 +5,8 @@ require 'isodoc'
5
5
  module IsoDoc
6
6
  module Csa
7
7
  module BaseConvert
8
- def cleanup(docxml)
9
- super
10
- term_cleanup(docxml)
11
- end
12
-
13
- def term_cleanup(docxml)
14
- docxml.xpath("//p[@class = 'Terms']").each do |d|
15
- h2 = d.at("./preceding-sibling::*[@class = 'TermNum'][1]")
16
- h2.add_child("&nbsp;")
17
- h2.add_child(d.remove)
18
- end
19
- docxml
8
+ def configuration
9
+ Metanorma::Csa.configuration
20
10
  end
21
11
  end
22
12
  end
@@ -658,13 +658,13 @@
658
658
  <xsl:otherwise> <!-- for ordered lists -->
659
659
  <xsl:choose>
660
660
  <xsl:when test="../@type = 'arabic'">
661
- <xsl:number format="a)"/>
661
+ <xsl:number format="a)" lang="en"/>
662
662
  </xsl:when>
663
663
  <xsl:when test="../@type = 'alphabet'">
664
664
  <xsl:number format="1)"/>
665
665
  </xsl:when>
666
666
  <xsl:when test="../@type = 'alphabet_upper'">
667
- <xsl:number format="A)"/>
667
+ <xsl:number format="A)" lang="en"/>
668
668
  </xsl:when>
669
669
 
670
670
  <xsl:when test="../@type = 'roman'">
@@ -1447,10 +1447,12 @@
1447
1447
 
1448
1448
 
1449
1449
  <xsl:variable name="colwidths">
1450
- <xsl:call-template name="calculate-column-widths">
1451
- <xsl:with-param name="cols-count" select="$cols-count"/>
1452
- <xsl:with-param name="table" select="$simple-table"/>
1453
- </xsl:call-template>
1450
+ <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
1451
+ <xsl:call-template name="calculate-column-widths">
1452
+ <xsl:with-param name="cols-count" select="$cols-count"/>
1453
+ <xsl:with-param name="table" select="$simple-table"/>
1454
+ </xsl:call-template>
1455
+ </xsl:if>
1454
1456
  </xsl:variable>
1455
1457
  <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
1456
1458
 
@@ -1518,16 +1520,25 @@
1518
1520
  <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
1519
1521
  </xsl:if>
1520
1522
 
1521
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
1522
- <xsl:choose>
1523
- <xsl:when test=". = 1 or . = 0">
1524
- <fo:table-column column-width="proportional-column-width(2)"/>
1525
- </xsl:when>
1526
- <xsl:otherwise>
1527
- <fo:table-column column-width="proportional-column-width({.})"/>
1528
- </xsl:otherwise>
1529
- </xsl:choose>
1530
- </xsl:for-each>
1523
+ <xsl:choose>
1524
+ <xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
1525
+ <xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
1526
+ <fo:table-column column-width="{@width}"/>
1527
+ </xsl:for-each>
1528
+ </xsl:when>
1529
+ <xsl:otherwise>
1530
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
1531
+ <xsl:choose>
1532
+ <xsl:when test=". = 1 or . = 0">
1533
+ <fo:table-column column-width="proportional-column-width(2)"/>
1534
+ </xsl:when>
1535
+ <xsl:otherwise>
1536
+ <fo:table-column column-width="proportional-column-width({.})"/>
1537
+ </xsl:otherwise>
1538
+ </xsl:choose>
1539
+ </xsl:for-each>
1540
+ </xsl:otherwise>
1541
+ </xsl:choose>
1531
1542
 
1532
1543
  <xsl:choose>
1533
1544
  <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
@@ -1540,10 +1551,12 @@
1540
1551
 
1541
1552
  </fo:table>
1542
1553
 
1554
+ <xsl:variable name="colgroup" select="*[local-name()='colgroup']"/>
1543
1555
  <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
1544
1556
  <xsl:call-template name="insertTableFooterInSeparateTable">
1545
1557
  <xsl:with-param name="table_attributes" select="$table_attributes"/>
1546
1558
  <xsl:with-param name="colwidths" select="$colwidths"/>
1559
+ <xsl:with-param name="colgroup" select="$colgroup"/>
1547
1560
  </xsl:call-template>
1548
1561
  </xsl:for-each>
1549
1562
 
@@ -1797,12 +1810,22 @@
1797
1810
  </xsl:template><xsl:template name="insertTableFooterInSeparateTable">
1798
1811
  <xsl:param name="table_attributes"/>
1799
1812
  <xsl:param name="colwidths"/>
1813
+ <xsl:param name="colgroup"/>
1800
1814
 
1801
1815
  <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
1802
1816
 
1803
1817
  <xsl:if test="$isNoteOrFnExist = 'true'">
1804
1818
 
1805
- <xsl:variable name="cols-count" select="count(xalan:nodeset($colwidths)//column)"/>
1819
+ <xsl:variable name="cols-count">
1820
+ <xsl:choose>
1821
+ <xsl:when test="xalan:nodeset($colgroup)//*[local-name()='col']">
1822
+ <xsl:value-of select="count(xalan:nodeset($colgroup)//*[local-name()='col'])"/>
1823
+ </xsl:when>
1824
+ <xsl:otherwise>
1825
+ <xsl:value-of select="count(xalan:nodeset($colwidths)//column)"/>
1826
+ </xsl:otherwise>
1827
+ </xsl:choose>
1828
+ </xsl:variable>
1806
1829
 
1807
1830
  <fo:table keep-with-previous="always">
1808
1831
  <xsl:for-each select="xalan:nodeset($table_attributes)/attribute">
@@ -1820,16 +1843,25 @@
1820
1843
  </xsl:choose>
1821
1844
  </xsl:for-each>
1822
1845
 
1823
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
1824
- <xsl:choose>
1825
- <xsl:when test=". = 1 or . = 0">
1826
- <fo:table-column column-width="proportional-column-width(2)"/>
1827
- </xsl:when>
1828
- <xsl:otherwise>
1829
- <fo:table-column column-width="proportional-column-width({.})"/>
1830
- </xsl:otherwise>
1831
- </xsl:choose>
1832
- </xsl:for-each>
1846
+ <xsl:choose>
1847
+ <xsl:when test="xalan:nodeset($colgroup)//*[local-name()='col']">
1848
+ <xsl:for-each select="xalan:nodeset($colgroup)//*[local-name()='col']">
1849
+ <fo:table-column column-width="{@width}"/>
1850
+ </xsl:for-each>
1851
+ </xsl:when>
1852
+ <xsl:otherwise>
1853
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
1854
+ <xsl:choose>
1855
+ <xsl:when test=". = 1 or . = 0">
1856
+ <fo:table-column column-width="proportional-column-width(2)"/>
1857
+ </xsl:when>
1858
+ <xsl:otherwise>
1859
+ <fo:table-column column-width="proportional-column-width({.})"/>
1860
+ </xsl:otherwise>
1861
+ </xsl:choose>
1862
+ </xsl:for-each>
1863
+ </xsl:otherwise>
1864
+ </xsl:choose>
1833
1865
 
1834
1866
  <fo:table-body>
1835
1867
  <fo:table-row>
@@ -4007,7 +4039,8 @@
4007
4039
  <fo:table-column column-width="107mm"/>
4008
4040
  <fo:table-column column-width="15mm"/>
4009
4041
  <fo:table-body>
4010
- <fo:table-row font-family="Arial" text-align="center" font-weight="bold" background-color="black" color="white">
4042
+ <fo:table-row text-align="center" font-weight="bold" background-color="black" color="white">
4043
+
4011
4044
  <fo:table-cell border="1pt solid black"><fo:block>Date</fo:block></fo:table-cell>
4012
4045
  <fo:table-cell border="1pt solid black"><fo:block>Type</fo:block></fo:table-cell>
4013
4046
  <fo:table-cell border="1pt solid black"><fo:block>Change</fo:block></fo:table-cell>
@@ -4025,6 +4058,10 @@
4025
4058
  <fo:block><xsl:apply-templates/></fo:block>
4026
4059
  </fo:table-cell>
4027
4060
  </xsl:template><xsl:template name="processBibitem">
4061
+
4062
+
4063
+ <!-- end BIPM bibitem processing-->
4064
+
4028
4065
 
4029
4066
 
4030
4067
 
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative 'base_convert'
4
+ require "isodoc/generic/html_convert"
4
5
  require_relative 'init'
5
6
  require 'isodoc'
6
7
 
@@ -8,52 +9,7 @@ module IsoDoc
8
9
  module Csa
9
10
  # A {Converter} implementation that generates CSA output, and a document
10
11
  # schema encapsulation of the document for validation
11
- class HtmlConvert < IsoDoc::HtmlConvert
12
- def initialize(options)
13
- @libdir = File.dirname(__FILE__)
14
- super
15
- end
16
-
17
- def default_fonts(options)
18
- is_hans = options[:script] == 'Hans'
19
- {
20
- bodyfont: (is_hans ? '"SimSun",serif' : 'AzoSans,"Source Sans Pro",sans-serif'),
21
- headerfont: (is_hans ? '"SimHei",sans-serif'
22
- : 'AzoSans,"Source Sans Pro",sans-serif'),
23
- monospacefont: '"Source Code Pro",monospace',
24
- normalfontsize: "1.2em",
25
- monospacefontsize: "1.0em",
26
- footnotefontsize: "0.9em",
27
- }
28
- end
29
-
30
- def default_file_locations(options)
31
- {
32
- htmlstylesheet: html_doc_path('htmlstyle.scss'),
33
- htmlcoverpage: html_doc_path('html_csa_titlepage.html'),
34
- htmlintropage: html_doc_path('html_csa_intro.html'),
35
- scripts: html_doc_path('scripts.html')
36
- }
37
- end
38
-
39
- def googlefonts()
40
- <<~HEAD.freeze
41
- <link href="https://fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,600,600i|Space+Mono:400,700" rel="stylesheet">
42
- <link href="https://fonts.googleapis.com/css?family=Rubik:300,300i,500" rel="stylesheet">
43
- <link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,300i,400,700,900" rel="stylesheet">
44
- <link href="https://fonts.googleapis.com/css2?family=Source+Code+Pro:ital,wght@0,300;0,600;1,300;1,600&display=swap" rel="stylesheet">
45
- HEAD
46
- end
47
-
48
- def make_body(xml, docxml)
49
- body_attr = { lang: 'EN-US', link: 'blue', vlink: '#954F72',
50
- 'xml:lang': 'EN-US', class: 'container' }
51
- xml.body **body_attr do |body|
52
- make_body1(body, docxml)
53
- make_body2(body, docxml)
54
- make_body3(body, docxml)
55
- end
56
- end
12
+ class HtmlConvert < IsoDoc::Generic::HtmlConvert
57
13
 
58
14
  include BaseConvert
59
15
  include Init
@@ -1,9 +1,8 @@
1
1
  module IsoDoc
2
2
  module Csa
3
- class I18n < IsoDoc::I18n
4
- def load_yaml1(lang, script)
5
- y = YAML.load_file(File.join(File.dirname(__FILE__), "i18n-en.yaml"))
6
- super.merge(y)
3
+ class I18n < IsoDoc::Generic::I18n
4
+ def configuration
5
+ Metanorma::Csa.configuration
7
6
  end
8
7
  end
9
8
  end
@@ -6,9 +6,9 @@ module IsoDoc
6
6
  module Csa
7
7
  # A {Converter} implementation that generates CSA output, and a document
8
8
  # schema encapsulation of the document for validation
9
- class Metadata < IsoDoc::Metadata
10
- def initialize(lang, script, labels)
11
- super
9
+ class Metadata < IsoDoc::Generic::Metadata
10
+ def configuration
11
+ Metanorma::Csa.configuration
12
12
  end
13
13
 
14
14
  def title(isoxml, _out)
@@ -27,22 +27,11 @@ module IsoDoc
27
27
  super
28
28
  end
29
29
 
30
-
31
30
  def docid(isoxml, _out)
32
31
  docnumber = isoxml.at(ns("//bibdata/docidentifier[@type = 'csa']"))
33
32
  set(:docnumber, docnumber&.text)
34
33
  end
35
34
 
36
- def stage_abbr(status)
37
- case status
38
- when "working-draft" then "wd"
39
- when "committee-draft" then "cd"
40
- when "draft-standard" then "d"
41
- else
42
- ""
43
- end
44
- end
45
-
46
35
  def personal_authors(isoxml)
47
36
  persons = auth_roles(isoxml, nonauth_roles(isoxml, {}))
48
37
  set(:roles_authors_affiliations, persons)
@@ -72,10 +61,6 @@ module IsoDoc
72
61
  end
73
62
  persons
74
63
  end
75
-
76
- def unpublished(status)
77
- !%w(published withdrawn).include? status.downcase
78
- end
79
64
  end
80
65
  end
81
66
  end
@@ -1,9 +1,10 @@
1
1
  require_relative "init"
2
+ require "metanorma-generic"
2
3
  require "isodoc"
3
4
 
4
5
  module IsoDoc
5
6
  module Csa
6
- class PresentationXMLConvert < IsoDoc::PresentationXMLConvert
7
+ class PresentationXMLConvert < IsoDoc::Generic::PresentationXMLConvert
7
8
  def annex1(f)
8
9
  lbl = @xrefs.anchor(f['id'], :label)
9
10
  if t = f.at(ns("./title"))
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative 'base_convert'
4
+ require "isodoc/generic/word_convert"
4
5
  require_relative 'init'
5
6
  require 'isodoc'
6
7
 
@@ -9,35 +10,6 @@ module IsoDoc
9
10
  # A {Converter} implementation that generates CSA output, and a document
10
11
  # schema encapsulation of the document for validation
11
12
  class WordConvert < IsoDoc::WordConvert
12
- def initialize(options)
13
- @libdir = File.dirname(__FILE__)
14
- super
15
- end
16
-
17
- def default_fonts(options)
18
- is_hans = options[:script] == 'Hans'
19
- {
20
- bodyfont: (is_hans ? '"SimSun",serif' : 'AzoSans,Arial,sans-serif'),
21
- headerfont: (is_hans ? '"SimHei",sans-serif' : 'AzoSans,Arial,sans-serif'),
22
- monospacefont: '"Source Code Pro","Courier New",monospace',
23
- normalfontsize: "10.5pt",
24
- footnotefontsize: "10.0pt",
25
- monospacefontsize: "10.0pt",
26
- smallerfontsize: "10.0pt",
27
- }
28
- end
29
-
30
- def default_file_locations(options)
31
- {
32
- wordstylesheet: html_doc_path('wordstyle.scss'),
33
- standardstylesheet: html_doc_path('csa.scss'),
34
- header: html_doc_path('header.html'),
35
- wordcoverpage: html_doc_path('word_csa_titlepage.html'),
36
- wordintropage: html_doc_path('word_csa_intro.html'),
37
- ulstyle: 'l3',
38
- olstyle: 'l2'
39
- }
40
- end
41
13
 
42
14
  include BaseConvert
43
15
  include Init
@@ -1,6 +1,6 @@
1
1
  module IsoDoc
2
2
  module Csa
3
- class Xref < IsoDoc::Xref
3
+ class Xref < IsoDoc::Generic::Xref
4
4
  end
5
5
  end
6
6
  end
@@ -1,7 +1,32 @@
1
- require_relative 'csa/processor'
1
+ require "metanorma"
2
+ require "metanorma-generic"
3
+ require_relative './csa/processor'
2
4
 
3
5
  module Metanorma
4
6
  module Csa
7
+ class Configuration < Metanorma::Generic::Configuration
8
+ def initialize(*args)
9
+ super
10
+ end
11
+ end
5
12
 
13
+ class << self
14
+ extend Forwardable
15
+
16
+ attr_accessor :configuration
17
+
18
+ Configuration::CONFIG_ATTRS.each do |attr_name|
19
+ def_delegator :@configuration, attr_name
20
+ end
21
+
22
+ def configure
23
+ self.configuration ||= Configuration.new
24
+ yield(configuration)
25
+ end
26
+ end
27
+
28
+ configure {}
6
29
  end
7
30
  end
31
+ Metanorma::Registry.instance.register(Metanorma::Csa::Processor)
32
+
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'metanorma/processor'
4
- require 'asciidoctor/csa/converter'
5
4
 
6
5
  module Metanorma
7
6
  module Csa
@@ -10,7 +9,7 @@ module Metanorma
10
9
  def initialize
11
10
  @short = :csa
12
11
  @input_format = :asciidoc
13
- @asciidoctor_backend = Asciidoctor::Csa::CSA_TYPE.to_sym
12
+ @asciidoctor_backend = :csa
14
13
  end
15
14
 
16
15
  def output_formats
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Metanorma
4
4
  module Csa
5
- VERSION = '1.6.8'
5
+ VERSION = '1.7.0'
6
6
  end
7
7
  end
@@ -28,16 +28,7 @@ Gem::Specification.new do |spec|
28
28
  spec.require_paths = ["lib"]
29
29
  spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
30
30
 
31
- spec.add_dependency "htmlentities", "~> 4.3.4"
32
- spec.add_dependency "image_size"
33
- spec.add_dependency "mime-types"
34
- #spec.add_dependency "nokogiri"
35
- spec.add_dependency "ruby-jing"
36
- spec.add_dependency "thread_safe"
37
- spec.add_dependency "uuidtools"
38
-
39
- spec.add_dependency "metanorma-standoc", "~> 1.6.0"
40
- spec.add_dependency "isodoc", "~> 1.3.0"
31
+ spec.add_dependency "metanorma-generic", "~> 1.8.0"
41
32
 
42
33
  spec.add_development_dependency "byebug", "~> 9.1"
43
34
  spec.add_development_dependency "sassc", "2.4.0"
@@ -0,0 +1,60 @@
1
+ metanorma_name: csa
2
+ organization_name_short: CSA
3
+ organization_name_long: Cloud Security Alliance
4
+ document_namespace: https://www.metanorma.org/ns/csa
5
+ xml_root_tag: csa-standard
6
+ html_bodyfont: 'AzoSans,"Source Sans Pro",sans-serif'
7
+ html_headerfont: 'AzoSans,"Source Sans Pro",sans-serif'
8
+ html_monospacefont: '"Source Code Pro",monospace'
9
+ validate_rng_file: lib/asciidoctor/csa/csa.rng
10
+ htmlcoverpage: lib/isodoc/csa/html/html_csa_titlepage.html
11
+ htmlintropage: lib/isodoc/csa/html/html_csa_intro.html
12
+ htmlstylesheet: lib/isodoc/csa/html/htmlstyle.scss
13
+ html_normalfontsize: "1.2em"
14
+ html_monospacefontsize: "1.0em"
15
+ html_footnotefontsize: "0.9em"
16
+ scripts: lib/isodoc/csa/html/scripts.html
17
+ i18nyaml: lib/isodoc/csa/i18n-en.yaml
18
+ word_bodyfont: 'AzoSans,Arial,sans-serif'
19
+ word_headerfont: 'AzoSans,Arial,sans-serif'
20
+ word_monospacefont: '"Source Code Pro","Courier New",monospace'
21
+ word_normalfontsize: "10.5pt"
22
+ word_smallerfontsize: "10.0pt"
23
+ word_monospacefontsize: "10.0pt"
24
+ word_footnotefontsize: "10.0pt"
25
+ standardstylesheet: lib/isodoc/csa/html/csa.scss
26
+ header: lib/isodoc/csa/html/header.html
27
+ wordcoverpage: lib/isodoc/csa/html/word_csa_titlepage.html
28
+ wordintropage: lib/isodoc/csa/html/word_csa_intro.html
29
+ wordstylesheet: lib/isodoc/csa/html/wordstyle.scss
30
+ webfont:
31
+ - "https://fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,600,600i|Space+Mono:400,700"
32
+ - "https://fonts.googleapis.com/css?family=Rubik:300,300i,500"
33
+ - "https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,300i,400,700,900"
34
+ - "https://fonts.googleapis.com/css2?family=Source+Code+Pro:ital,wght@0,300;0,600;1,300;1,600&display=swap"
35
+ docid_template: "{{ docnumeric }}{% if stageabbr %}({{ stageabbr }}){%endif%}{% if docyear %}:{{docyear}}{%endif%}"
36
+ doctypes:
37
+ standard:
38
+ guidance:
39
+ proposal:
40
+ report:
41
+ whitepaper:
42
+ charter:
43
+ policy:
44
+ glossary:
45
+ case-study:
46
+ default_doctype: standard
47
+ published_stages:
48
+ - published
49
+ - withdrawn
50
+ default_stage: published
51
+ stage_abbreviations:
52
+ proposal:
53
+ working-draft: wd
54
+ committee-draft: cd
55
+ draft-standard: d
56
+ final-draft:
57
+ published:
58
+ withdrawn:
59
+ logo_path: ""
60
+
metadata CHANGED
@@ -1,127 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-csa
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.8
4
+ version: 1.7.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: 2020-11-30 00:00:00.000000000 Z
11
+ date: 2020-12-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: htmlentities
14
+ name: metanorma-generic
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 4.3.4
19
+ version: 1.8.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: 4.3.4
27
- - !ruby/object:Gem::Dependency
28
- name: image_size
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- version: '0'
41
- - !ruby/object:Gem::Dependency
42
- name: mime-types
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- version: '0'
48
- type: :runtime
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- version: '0'
55
- - !ruby/object:Gem::Dependency
56
- name: ruby-jing
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - ">="
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
- type: :runtime
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - ">="
67
- - !ruby/object:Gem::Version
68
- version: '0'
69
- - !ruby/object:Gem::Dependency
70
- name: thread_safe
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - ">="
74
- - !ruby/object:Gem::Version
75
- version: '0'
76
- type: :runtime
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - ">="
81
- - !ruby/object:Gem::Version
82
- version: '0'
83
- - !ruby/object:Gem::Dependency
84
- name: uuidtools
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - ">="
88
- - !ruby/object:Gem::Version
89
- version: '0'
90
- type: :runtime
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - ">="
95
- - !ruby/object:Gem::Version
96
- version: '0'
97
- - !ruby/object:Gem::Dependency
98
- name: metanorma-standoc
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - "~>"
102
- - !ruby/object:Gem::Version
103
- version: 1.6.0
104
- type: :runtime
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - "~>"
109
- - !ruby/object:Gem::Version
110
- version: 1.6.0
111
- - !ruby/object:Gem::Dependency
112
- name: isodoc
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - "~>"
116
- - !ruby/object:Gem::Version
117
- version: 1.3.0
118
- type: :runtime
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - "~>"
123
- - !ruby/object:Gem::Version
124
- version: 1.3.0
26
+ version: 1.8.0
125
27
  - !ruby/object:Gem::Dependency
126
28
  name: byebug
127
29
  requirement: !ruby/object:Gem::Requirement
@@ -294,7 +196,6 @@ files:
294
196
  - lib/asciidoctor/csa/csa.rng
295
197
  - lib/asciidoctor/csa/isodoc.rng
296
198
  - lib/asciidoctor/csa/reqt.rng
297
- - lib/asciidoctor/csa/validate.rb
298
199
  - lib/isodoc/csa/base_convert.rb
299
200
  - lib/isodoc/csa/csa.standard.xsl
300
201
  - lib/isodoc/csa/html/csa-logo-white.png
@@ -328,6 +229,7 @@ files:
328
229
  - lib/metanorma/csa/processor.rb
329
230
  - lib/metanorma/csa/version.rb
330
231
  - metanorma-csa.gemspec
232
+ - metanorma.yml
331
233
  homepage: https://github.com/metanorma/metanorma-csa
332
234
  licenses:
333
235
  - BSD-2-Clause
@@ -1,33 +0,0 @@
1
- module Asciidoctor
2
- module Csa
3
- class Converter < Standoc::Converter
4
- def content_validate(doc)
5
- super
6
- bibdata_validate(doc.root)
7
- end
8
-
9
- def bibdata_validate(doc)
10
- stage_validate(doc)
11
- role_validate(doc)
12
- end
13
-
14
- def stage_validate(xmldoc)
15
- stage = xmldoc&.at("//bibdata/status/stage")&.text
16
- %w(proposal working-draft committee-draft draft-standard final-draft
17
- published withdrawn).include? stage or
18
- @log.add("Document Attributes", nil,
19
- "#{stage} is not a recognised status")
20
- end
21
-
22
- def role_validate(doc)
23
- doc&.xpath("//bibdata/contributor/role[description]")&.each do |r|
24
- r["type"] == "author" or next
25
- role = r.at("./description").text
26
- %w{full-author contributor staff reviewer}.include?(role) or
27
- @log.add("Document Attributes", nil,
28
- "#{role} is not a recognised role")
29
- end
30
- end
31
- end
32
- end
33
- end