metanorma-csa 2.7.2 → 2.7.4.pre.alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -11,16 +11,6 @@ module IsoDoc
11
11
  Metanorma::Csa.configuration
12
12
  end
13
13
 
14
- def title(isoxml, _out)
15
- main = isoxml.at(ns("//bibdata/title[@language='en']"))
16
- &.children&.to_xml
17
- set(:doctitle, main)
18
- end
19
-
20
- def subtitle(_isoxml, _out)
21
- nil
22
- end
23
-
24
14
  def author(isoxml, _out)
25
15
  set(:tc, "XXXX")
26
16
  tc = isoxml.at(ns("//bibdata/contributor[role/description = 'committee']/organization/subdivision[@type = 'Technical committee']/name"))
@@ -0,0 +1,7 @@
1
+ module Metanorma
2
+ module Csa
3
+ class Cleanup < Metanorma::Generic::Cleanup
4
+ extend Forwardable
5
+ end
6
+ end
7
+ end
@@ -43,6 +43,18 @@ module Metanorma
43
43
  nil, false, "#{@filename}.pdf")
44
44
  end
45
45
 
46
+ CSA_LOG_MESSAGES = {
47
+ # rubocop:disable Naming/VariableNumber
48
+ "CSA_1": { category: "Document Attributes",
49
+ error: "%s is not a recognised role",
50
+ severity: 2 },
51
+ # rubocop:enable Naming/VariableNumber
52
+ }.freeze
53
+
54
+ def log_messages
55
+ super.merge(CSA_LOG_MESSAGES)
56
+ end
57
+
46
58
  def sections_cleanup(xml)
47
59
  super
48
60
  xml.xpath("//*[@inline-header]").each do |h|
@@ -50,21 +62,6 @@ module Metanorma
50
62
  end
51
63
  end
52
64
 
53
- def bibdata_validate(doc)
54
- super
55
- role_validate(doc)
56
- end
57
-
58
- def role_validate(doc)
59
- doc&.xpath("//bibdata/contributor/role[description]")&.each do |r|
60
- r["type"] == "author" or next
61
- role = r.at("./description").text
62
- %w{full-author contributor staff reviewer}.include?(role) or
63
- @log.add("Document Attributes", nil,
64
- "#{role} is not a recognised role")
65
- end
66
- end
67
-
68
65
  def style(_node, _text)
69
66
  nil
70
67
  end
@@ -1,6 +1,6 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <grammar xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
3
- <!-- VERSION v2.1.1 -->
3
+ <!-- VERSION v2.1.3 -->
4
4
 
5
5
  <!--
6
6
  ALERT: cannot have root comments, because of https://github.com/metanorma/metanorma/issues/437
@@ -123,6 +123,10 @@ the type attribute defaults to `review` for reviews</a:documentation>
123
123
  <a:documentation>Notes whose scope is the current block</a:documentation>
124
124
  </ref>
125
125
  </zeroOrMore>
126
+ <ref name="BlockSource">
127
+ <a:documentation>Bibliographic source for the information in the list.
128
+ Sources are currently only rendered in metanorma-plateau</a:documentation>
129
+ </ref>
126
130
  </define>
127
131
  <define name="OlBody">
128
132
  <optional>
@@ -140,6 +144,10 @@ the type attribute defaults to `review` for reviews</a:documentation>
140
144
  <a:documentation>Notes whose scope is the current block</a:documentation>
141
145
  </ref>
142
146
  </zeroOrMore>
147
+ <ref name="BlockSource">
148
+ <a:documentation>Bibliographic source for the information in the list.
149
+ Sources are currently only rendered in metanorma-plateau</a:documentation>
150
+ </ref>
143
151
  </define>
144
152
  <define name="OlAttributes">
145
153
  <a:documentation>NOTE: `start` attribute is not included by default, because of problems it raises with DOC output</a:documentation>
@@ -188,6 +196,10 @@ the type attribute defaults to `review` for reviews</a:documentation>
188
196
  <a:documentation>Notes whose scope is the current block</a:documentation>
189
197
  </ref>
190
198
  </zeroOrMore>
199
+ <ref name="BlockSource">
200
+ <a:documentation>Bibliographic source for the information in the list.
201
+ Sources are currently only rendered in metanorma-plateau</a:documentation>
202
+ </ref>
191
203
  </define>
192
204
  <define name="dt">
193
205
  <element name="dt">
@@ -443,14 +455,7 @@ normative or informative references, some split references into sections organiz
443
455
  </ref>
444
456
  </zeroOrMore>
445
457
  <zeroOrMore>
446
- <ref name="doc_bibitem">
447
- <a:documentation>Bibliographic item cited in the document</a:documentation>
448
- </ref>
449
- <zeroOrMore>
450
- <ref name="note">
451
- <a:documentation>Annotation of the bibliographic item</a:documentation>
452
- </ref>
453
- </zeroOrMore>
458
+ <ref name="ReferenceEntry"/>
454
459
  </zeroOrMore>
455
460
  <zeroOrMore>
456
461
  <ref name="references">
@@ -592,18 +597,21 @@ gives an explicit page orientation</a:documentation>
592
597
  </element>
593
598
  </optional>
594
599
  </define>
595
- </include>
596
- <!-- end overrides -->
597
- <define name="FnAttributes" combine="interleave">
598
- <ref name="RequiredId"/>
599
- <optional>
600
- <attribute name="hiddenref">
601
- <a:documentation>If true, number the footnote as normal, but suppress display of the footnote reference in the document body.
600
+ <define name="FnAttributes">
601
+ <ref name="RequiredId"/>
602
+ <optional>
603
+ <attribute name="hiddenref">
604
+ <a:documentation>If true, number the footnote as normal, but suppress display of the footnote reference in the document body.
602
605
  This is done if the footnote reference is already presented in some other form, e.g. within a figure image.</a:documentation>
603
- <data type="boolean"/>
606
+ <data type="boolean"/>
607
+ </attribute>
608
+ </optional>
609
+ <attribute name="reference">
610
+ <a:documentation>The number of the footnote, used to identify it visually</a:documentation>
604
611
  </attribute>
605
- </optional>
606
- </define>
612
+ </define>
613
+ </include>
614
+ <!-- end overrides -->
607
615
  <define name="TdAttributes" combine="interleave">
608
616
  <ref name="RequiredId"/>
609
617
  <optional>
@@ -841,6 +849,17 @@ titlecase, or lowercase</a:documentation>
841
849
  <value>informative</value>
842
850
  </choice>
843
851
  </define>
852
+ <define name="ReferenceEntry">
853
+ <a:documentation>Entry in bibliography</a:documentation>
854
+ <ref name="doc_bibitem">
855
+ <a:documentation>Bibliographic item cited in the document</a:documentation>
856
+ </ref>
857
+ <zeroOrMore>
858
+ <ref name="note">
859
+ <a:documentation>Annotation of the bibliographic item</a:documentation>
860
+ </ref>
861
+ </zeroOrMore>
862
+ </define>
844
863
  <define name="doc_bibitem">
845
864
  <a:documentation>Standardisation document representation of bibliographic entry</a:documentation>
846
865
  <element name="bibitem">
@@ -871,6 +890,12 @@ titlecase, or lowercase</a:documentation>
871
890
  </oneOrMore>
872
891
  </element>
873
892
  </define>
893
+ <define name="ParagraphFnBody" combine="interleave">
894
+ <ref name="BlockSource">
895
+ <a:documentation>Bibliographic source for the information in the paragraph
896
+ parargaph sources are currently only rendered in metanorma-plateau</a:documentation>
897
+ </ref>
898
+ </define>
874
899
  <define name="BasicBlock" combine="choice">
875
900
  <ref name="columnbreak"/>
876
901
  </define>
@@ -0,0 +1,22 @@
1
+ require "nokogiri"
2
+ require "metanorma-generic"
3
+
4
+ module Metanorma
5
+ module Csa
6
+ class Validate < Metanorma::Generic::Validate
7
+ def bibdata_validate(doc)
8
+ super
9
+ role_validate(doc)
10
+ end
11
+
12
+ def role_validate(doc)
13
+ doc&.xpath("//bibdata/contributor/role[description]")&.each do |r|
14
+ r["type"] == "author" or next
15
+ role = r.at("./description").text
16
+ %w{full-author contributor staff reviewer}.include?(role) or
17
+ @log.add("CSA_1", nil, params: [role])
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Csa
3
- VERSION = "2.7.2".freeze
3
+ VERSION = "2.7.4.pre.alpha.1".freeze
4
4
  end
5
5
  end
data/lib/metanorma-csa.rb CHANGED
@@ -1,5 +1,7 @@
1
1
  require "asciidoctor" unless defined? Asciidoctor::Converter
2
2
  require_relative "metanorma/csa/converter"
3
+ require_relative "metanorma/csa/cleanup"
4
+ require_relative "metanorma/csa/validate"
3
5
  require_relative "isodoc/csa/html_convert"
4
6
  require_relative "isodoc/csa/pdf_convert"
5
7
  require_relative "isodoc/csa/word_convert"
@@ -27,12 +27,11 @@ Gem::Specification.new do |spec|
27
27
  spec.bindir = "exe"
28
28
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
29
29
  spec.require_paths = ["lib"]
30
- spec.required_ruby_version = Gem::Requirement.new(">= 3.1.0")
30
+ spec.required_ruby_version = Gem::Requirement.new(">= 3.3.0")
31
31
 
32
- spec.add_dependency "metanorma-generic", "~> 3.1.0"
32
+ spec.add_dependency "metanorma-generic", "~> 3.5"
33
33
 
34
34
  spec.add_development_dependency "debug"
35
- spec.add_development_dependency "equivalent-xml", "~> 0.6"
36
35
  spec.add_development_dependency "guard", "~> 2.14"
37
36
  spec.add_development_dependency "guard-rspec", "~> 4.7"
38
37
  spec.add_development_dependency "rake", "~> 13.0"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-csa
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.7.2
4
+ version: 2.7.4.pre.alpha.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-08-18 00:00:00.000000000 Z
11
+ date: 2026-10-22 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: 3.1.0
19
+ version: '3.5'
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: 3.1.0
26
+ version: '3.5'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: debug
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -38,20 +38,6 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
- - !ruby/object:Gem::Dependency
42
- name: equivalent-xml
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: '0.6'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: '0.6'
55
41
  - !ruby/object:Gem::Dependency
56
42
  name: guard
57
43
  requirement: !ruby/object:Gem::Requirement
@@ -209,12 +195,12 @@ files:
209
195
  - ".rubocop.yml"
210
196
  - CODE_OF_CONDUCT.md
211
197
  - Gemfile
198
+ - Gemfile.devel
212
199
  - LICENSE
213
200
  - README.adoc
214
201
  - lib/isodoc/csa/base_convert.rb
215
202
  - lib/isodoc/csa/csa.standard.xsl
216
203
  - lib/isodoc/csa/html/csa-logo-white.png
217
- - lib/isodoc/csa/html/csa.css
218
204
  - lib/isodoc/csa/html/csa.png
219
205
  - lib/isodoc/csa/html/csa.scss
220
206
  - lib/isodoc/csa/html/dots-w@2x.png
@@ -222,11 +208,9 @@ files:
222
208
  - lib/isodoc/csa/html/header.html
223
209
  - lib/isodoc/csa/html/html_csa_intro.html
224
210
  - lib/isodoc/csa/html/html_csa_titlepage.html
225
- - lib/isodoc/csa/html/htmlstyle.css
226
211
  - lib/isodoc/csa/html/htmlstyle.scss
227
212
  - lib/isodoc/csa/html/word_csa_intro.html
228
213
  - lib/isodoc/csa/html/word_csa_titlepage.html
229
- - lib/isodoc/csa/html/wordstyle.css
230
214
  - lib/isodoc/csa/html/wordstyle.scss
231
215
  - lib/isodoc/csa/html_convert.rb
232
216
  - lib/isodoc/csa/i18n-en.yaml
@@ -243,12 +227,14 @@ files:
243
227
  - lib/metanorma/csa/biblio-standoc.rng
244
228
  - lib/metanorma/csa/biblio.rng
245
229
  - lib/metanorma/csa/boilerplate.adoc
230
+ - lib/metanorma/csa/cleanup.rb
246
231
  - lib/metanorma/csa/converter.rb
247
232
  - lib/metanorma/csa/csa.rng
248
233
  - lib/metanorma/csa/isodoc.rng
249
234
  - lib/metanorma/csa/processor.rb
250
235
  - lib/metanorma/csa/relaton-csa.rng
251
236
  - lib/metanorma/csa/reqt.rng
237
+ - lib/metanorma/csa/validate.rb
252
238
  - lib/metanorma/csa/version.rb
253
239
  - metanorma-csa.gemspec
254
240
  - metanorma.yml
@@ -264,7 +250,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
264
250
  requirements:
265
251
  - - ">="
266
252
  - !ruby/object:Gem::Version
267
- version: 3.1.0
253
+ version: 3.3.0
268
254
  required_rubygems_version: !ruby/object:Gem::Requirement
269
255
  requirements:
270
256
  - - ">="