metanorma-generic 3.2.3 → 3.3.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7c11f49226ea10d4136e27236caf28a459cbdb5bcbbf6657a64b68d742158fe9
4
- data.tar.gz: 1ae50495c623e5ab73df0d2042f755dcf239594aea965fe7dbacad190804f787
3
+ metadata.gz: 8a998eb0defb881cf65235d4d55088a1f7d2373737cc43d8091454627a618ac8
4
+ data.tar.gz: 509375f79c9604449940ef4fab8b34674ec351f21884c87c4af72fec618ca0a7
5
5
  SHA512:
6
- metadata.gz: fcf1aa613e434f4eab913908d97b9c077b930514946e86bccd2ecfb78419ee28e7695aaca6cdc32b33321aa453fd11ea7894e7ed6207da9c67b7fcd3588395f0
7
- data.tar.gz: f2631b3642211fb2857565afb2f20e781e8d9228e148051303cc86c2cf7377659af8eecb1769c998021f1aa6124dc31f44a085c2b56c367cecb6bb9add39f7e1
6
+ metadata.gz: bccb46569ab529b5aedd490a01ff1a4e0d704b882eafbe8d51704293e43cf63d40343ddeae7b0b5f969a323c8845b2790c88e8f34a5ed0d365dcf745b93f0957
7
+ data.tar.gz: 5e953c83402667d279f55170ad5a1131471c3027e43c1b688e10759a8429320f7e5421b14c446344b42e09731a75dda7e839d5ea0aee60567abac9b929a4ee9a
@@ -78,11 +78,11 @@ nav {
78
78
  }
79
79
  }
80
80
 
81
- div.figure {
81
+ figure {
82
82
  @include figureBlock();
83
83
  }
84
84
 
85
- table div.figure {
85
+ table figure {
86
86
  padding: 0;
87
87
  margin: 0;
88
88
  }
@@ -328,11 +328,15 @@ p.Biblio, p.NormRef, div.Biblio, div.NormRef {
328
328
  margin-left: 2em;
329
329
  }
330
330
 
331
+ .Biblio.note, .Biblio.Note, .NormRef.note, .NormRef.Note {
332
+ margin-left: 3em;
333
+ }
334
+
331
335
  /*
332
336
  3.6 Source Code + figures
333
337
  */
334
338
 
335
- .figure, pre, .pseudocode {
339
+ figure, pre, .pseudocode {
336
340
  @include pseudocodeBlock(#f7f7f7);
337
341
  }
338
342
 
@@ -344,7 +348,7 @@ pre {
344
348
  @include recommendationBlock();
345
349
  @include listBlock();
346
350
 
347
- .FigureTitle, .SourceTitle {
351
+ figcaption, .SourceTitle {
348
352
  @include blockTitle()
349
353
  }
350
354
 
@@ -399,7 +403,7 @@ table {
399
403
  @include table(1px solid black);
400
404
  }
401
405
 
402
- p.TableTitle {
406
+ table > caption {
403
407
  text-align: center;
404
408
  margin-top: 2.5em;
405
409
  font-weight: 400;
@@ -658,7 +662,7 @@ To top button
658
662
  margin-top: 1.2em;
659
663
  }
660
664
 
661
- .note, .figure, pre, .pseudocode, table {
665
+ .note, figure, pre, .pseudocode, table {
662
666
  page-break-inside: avoid;
663
667
  }
664
668
 
@@ -1,5 +1,4 @@
1
1
  require_relative "base_convert"
2
- require "metanorma-generic"
3
2
  require "isodoc"
4
3
 
5
4
  module IsoDoc
@@ -208,11 +208,15 @@ Applicable to modify and delete</a:documentation>
208
208
  </zeroOrMore>
209
209
  <optional>
210
210
  <element name="newcontent">
211
- <a:documentation>New content to be added to the document; applicable to add and modify</a:documentation>
211
+ <a:documentation>New content to be added to the document; applicable to add and modify.
212
+ Can be blocks and/or sections</a:documentation>
212
213
  <ref name="OptionalId"/>
213
214
  <zeroOrMore>
214
215
  <ref name="BasicBlock"/>
215
216
  </zeroOrMore>
217
+ <zeroOrMore>
218
+ <ref name="section"/>
219
+ </zeroOrMore>
216
220
  </element>
217
221
  </optional>
218
222
  <zeroOrMore>
@@ -1939,10 +1939,10 @@ Detailed in https://www.relaton.org/model/relations/</a:documentation>
1939
1939
  <value>hasAnnotation</value>
1940
1940
  <value>draftOf</value>
1941
1941
  <value>hasDraft</value>
1942
- <value>preliminaryDraftOf</value>
1943
- <value>hasPreliminaryDraft</value>
1944
- <value>revisionDraftOf</value>
1945
- <value>hasRevisionDraft</value>
1942
+ <value>predecessorDraftOf</value>
1943
+ <value>hasPredecessorDraft</value>
1944
+ <value>successorDraftOf</value>
1945
+ <value>hasSuccessorDraft</value>
1946
1946
  <value>editionOf</value>
1947
1947
  <value>hasEdition</value>
1948
1948
  <value>updates</value>
@@ -0,0 +1,47 @@
1
+ module Metanorma
2
+ module Generic
3
+ class Cleanup < Standoc::Cleanup
4
+ extend Forwardable
5
+
6
+ def sections_cleanup(xml)
7
+ super
8
+ xml.xpath("//*[@inline-header]").each do |h|
9
+ h.delete("inline-header")
10
+ end
11
+ end
12
+
13
+ def boilerplate_isodoc(xmldoc)
14
+ conv = super or return nil
15
+ Metanorma::Generic::Configuration::CONFIG_ATTRS.each do |a|
16
+ conv.meta.set(a, configuration.send(a))
17
+ end
18
+ # conv.meta.set(:bibdata, bibdata_hash(xmldoc))
19
+ @isodoc = conv
20
+ @isodoc
21
+ end
22
+
23
+ def bibdata_hash(xmldoc)
24
+ b = xmldoc.at("//bibdata") || xmldoc.at("//xmlns:bibdata")
25
+ BibdataConfig.from_xml("<metanorma>#{b.to_xml}</metanorma>")
26
+ .bibdata.to_hash
27
+ end
28
+
29
+ def boilerplate_file(xmldoc)
30
+ f = configuration.boilerplate
31
+ f.nil? and return super
32
+ f.is_a? String and return @conv.baselocation(f)
33
+ f.is_a? Hash and f[@lang] and return @conv.baselocation(f[@lang])
34
+ super
35
+ end
36
+
37
+ def published?(status, _xmldoc)
38
+ stages = configuration&.published_stages || ["published"]
39
+ (Array(stages).map(&:downcase).include? status.downcase)
40
+ end
41
+
42
+ def configuration
43
+ @conv.configuration
44
+ end
45
+ end
46
+ end
47
+ end
@@ -1,5 +1,5 @@
1
1
  require "asciidoctor"
2
- require "metanorma/standoc/converter"
2
+ require "metanorma-standoc"
3
3
  require "fileutils"
4
4
  require_relative "front"
5
5
  require_relative "bibdata_config"
@@ -75,50 +75,6 @@ module Metanorma
75
75
  nil, false, "#{@filename}.pdf")
76
76
  end
77
77
 
78
- def schema_location
79
- baselocation(configuration.validate_rng_file) ||
80
- File.join(File.dirname(__FILE__), "generic.rng")
81
- end
82
-
83
- def schema_file
84
- configuration.validate_rng_file || "generic.rng"
85
- end
86
-
87
- def content_validate(doc)
88
- super
89
- bibdata_validate(doc.root)
90
- end
91
-
92
- def bibdata_validate(doc)
93
- stage_validate(doc)
94
- committee_validate(doc)
95
- end
96
-
97
- def stage_validate(xmldoc)
98
- stages = configuration.stage_abbreviations&.keys || return
99
- stages.empty? and return
100
- stage = xmldoc.at("//bibdata/status/stage")&.text
101
- stages.include? stage or
102
- @log.add("GENERIC_2", nil, params: [stage])
103
- end
104
-
105
- def committee_validate(xmldoc)
106
- committees = Array(configuration&.committees) || return
107
- committees.empty? and return
108
- xmldoc.xpath("//bibdata/contributor[role/description = 'committee']/" \
109
- "organization/subdivision/name").each do |c|
110
- committees.include? c.text or
111
- @log.add("GENERIC_3", nil, params: [c.text])
112
- end
113
- end
114
-
115
- def sections_cleanup(xml)
116
- super
117
- xml.xpath("//*[@inline-header]").each do |h|
118
- h.delete("inline-header")
119
- end
120
- end
121
-
122
78
  def blank_method(*args); end
123
79
 
124
80
  def html_converter(node)
@@ -129,7 +85,7 @@ module Metanorma
129
85
  IsoDoc::Generic::PresentationXMLConvert
130
86
  .new(html_extract_attributes(node)
131
87
  .merge(output_formats: ::Metanorma::Generic::Processor.new
132
- .output_formats))
88
+ .output_formats))
133
89
  end
134
90
 
135
91
  alias_method :pdf_converter, :html_converter
@@ -143,35 +99,6 @@ module Metanorma
143
99
  def configuration
144
100
  Metanorma::Generic.configuration
145
101
  end
146
-
147
- def boilerplate_isodoc(xmldoc)
148
- conv = super or return nil
149
- Metanorma::Generic::Configuration::CONFIG_ATTRS.each do |a|
150
- conv.meta.set(a, configuration.send(a))
151
- end
152
- # conv.meta.set(:bibdata, bibdata_hash(xmldoc))
153
- @isodoc = conv
154
- @isodoc
155
- end
156
-
157
- def bibdata_hash(xmldoc)
158
- b = xmldoc.at("//bibdata") || xmldoc.at("//xmlns:bibdata")
159
- BibdataConfig.from_xml("<metanorma>#{b.to_xml}</metanorma>")
160
- .bibdata.to_hash
161
- end
162
-
163
- def boilerplate_file(xmldoc)
164
- f = configuration.boilerplate
165
- f.nil? and return super
166
- f.is_a? String and return baselocation(f)
167
- f.is_a? Hash and f[@lang] and return baselocation(f[@lang])
168
- super
169
- end
170
-
171
- def published?(status, _xmldoc)
172
- stages = configuration&.published_stages || ["published"]
173
- (Array(stages).map(&:downcase).include? status.downcase)
174
- end
175
102
  end
176
103
  end
177
104
  end
@@ -641,8 +641,85 @@ This is done if the footnote reference is already presented in some other form,
641
641
  </ref>
642
642
  </zeroOrMore>
643
643
  </define>
644
+ <define name="altsource">
645
+ <a:documentation>Alternative file to use as media</a:documentation>
646
+ <element name="altsource">
647
+ <ref name="MediaAttributes"/>
648
+ <optional>
649
+ <attribute name="tag">
650
+ <a:documentation>Comma-delimited tag to indicate when the alternate file is to be used,
651
+ at minimum allows contain `html`, `doc`, `pdf` as the main target formats of Metanorma,
652
+ and `default` for the fallback. The presence of an altsource tagged `default` is required</a:documentation>
653
+ </attribute>
654
+ </optional>
655
+ <optional>
656
+ <attribute name="media">
657
+ <a:documentation>CSS media query to indicate when the alternate file is to be used</a:documentation>
658
+ </attribute>
659
+ </optional>
660
+ </element>
661
+ </define>
662
+ <define name="image">
663
+ <a:documentation>Container for image content</a:documentation>
664
+ <choice>
665
+ <element name="image">
666
+ <ref name="RequiredId"/>
667
+ <ref name="ImageAttributes">
668
+ <a:documentation>When specified along with altsource, ImageAttributes give the default image to be rendered</a:documentation>
669
+ </ref>
670
+ <ref name="ImageBody"/>
671
+ </element>
672
+ <element name="svg">
673
+ <a:documentation>Add svg mark up to image</a:documentation>
674
+ <oneOrMore>
675
+ <choice>
676
+ <text/>
677
+ <ref name="AnyElement"/>
678
+ </choice>
679
+ </oneOrMore>
680
+ </element>
681
+ </choice>
682
+ </define>
683
+ <define name="ImageAttributes">
684
+ <optional>
685
+ <ref name="MediaAttributes">
686
+ <a:documentation>If the image contains altsource, the media attributes are given on each of the altsource elements instead of the root node</a:documentation>
687
+ </ref>
688
+ </optional>
689
+ <ref name="MediaAccessibilityAttributes"/>
690
+ <optional>
691
+ <attribute name="width">
692
+ <a:documentation>Height of image</a:documentation>
693
+ <ref name="ImageSize"/>
694
+ </attribute>
695
+ </optional>
696
+ <optional>
697
+ <attribute name="height">
698
+ <a:documentation>Width of image</a:documentation>
699
+ <ref name="ImageSize"/>
700
+ </attribute>
701
+ </optional>
702
+ </define>
644
703
  </include>
645
704
  <!-- end overrides -->
705
+ <define name="ImageBody">
706
+ <optional>
707
+ <element name="svg">
708
+ <a:documentation>image can contain SVG XML, which is used to access its identifiers within the Metanorma XML</a:documentation>
709
+ <oneOrMore>
710
+ <choice>
711
+ <text/>
712
+ <ref name="AnyElement"/>
713
+ </choice>
714
+ </oneOrMore>
715
+ </element>
716
+ </optional>
717
+ <zeroOrMore>
718
+ <ref name="altsource">
719
+ <a:documentation>Alternative files to use as media</a:documentation>
720
+ </ref>
721
+ </zeroOrMore>
722
+ </define>
646
723
  <define name="key">
647
724
  <a:documentation>Key to a table, figure, or formula</a:documentation>
648
725
  <element name="key">
@@ -930,34 +1007,6 @@ titlecase, or lowercase</a:documentation>
930
1007
  <ref name="ReducedBibliographicItem"/>
931
1008
  </element>
932
1009
  </define>
933
- <define name="image" combine="choice">
934
- <choice>
935
- <element name="image">
936
- <ref name="RequiredId"/>
937
- <ref name="ImageAttributes"/>
938
- <optional>
939
- <element name="svg">
940
- <a:documentation>Allow svg in image/svg, for consistency</a:documentation>
941
- <oneOrMore>
942
- <choice>
943
- <text/>
944
- <ref name="AnyElement"/>
945
- </choice>
946
- </oneOrMore>
947
- </element>
948
- </optional>
949
- </element>
950
- <element name="svg">
951
- <a:documentation>Add svg mark up to image</a:documentation>
952
- <oneOrMore>
953
- <choice>
954
- <text/>
955
- <ref name="AnyElement"/>
956
- </choice>
957
- </oneOrMore>
958
- </element>
959
- </choice>
960
- </define>
961
1010
  <define name="ParagraphFnBody" combine="interleave">
962
1011
  <ref name="BlockSource">
963
1012
  <a:documentation>Bibliographic source for the information in the paragraph
@@ -0,0 +1,46 @@
1
+ module Metanorma
2
+ module Generic
3
+ class Validate < Standoc::Validate
4
+ def schema_location
5
+ @conv.baselocation(configuration.validate_rng_file) ||
6
+ File.join(File.dirname(__FILE__), "generic.rng")
7
+ end
8
+
9
+ def schema_file
10
+ configuration.validate_rng_file || "generic.rng"
11
+ end
12
+
13
+ def content_validate(doc)
14
+ super
15
+ bibdata_validate(doc.root)
16
+ end
17
+
18
+ def bibdata_validate(doc)
19
+ stage_validate(doc)
20
+ committee_validate(doc)
21
+ end
22
+
23
+ def stage_validate(xmldoc)
24
+ stages = configuration.stage_abbreviations&.keys || return
25
+ stages.empty? and return
26
+ stage = xmldoc.at("//bibdata/status/stage")&.text
27
+ stages.include? stage or
28
+ @log.add("GENERIC_2", nil, params: [stage])
29
+ end
30
+
31
+ def committee_validate(xmldoc)
32
+ committees = Array(configuration&.committees) || return
33
+ committees.empty? and return
34
+ xmldoc.xpath("//bibdata/contributor[role/description = 'committee']/" \
35
+ "organization/subdivision/name").each do |c|
36
+ committees.include? c.text or
37
+ @log.add("GENERIC_3", nil, params: [c.text])
38
+ end
39
+ end
40
+
41
+ def configuration
42
+ @conv.configuration
43
+ end
44
+ end
45
+ end
46
+ end
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Generic
3
- VERSION = "3.2.3".freeze
3
+ VERSION = "3.3.1".freeze
4
4
  end
5
5
  end
@@ -1,6 +1,8 @@
1
1
  require "metanorma/generic"
2
2
  require "asciidoctor"
3
3
  require "metanorma/generic/converter"
4
+ require "metanorma/generic/validate"
5
+ require "metanorma/generic/cleanup"
4
6
  require "isodoc/generic"
5
7
  require "metanorma"
6
8
 
@@ -27,7 +27,7 @@ Gem::Specification.new do |spec|
27
27
  spec.require_paths = ["lib"]
28
28
  spec.required_ruby_version = Gem::Requirement.new(">= 3.1.0")
29
29
 
30
- spec.add_dependency "metanorma-standoc", "~> 3.3.0"
30
+ spec.add_dependency "metanorma-standoc", "~> 3.3.1"
31
31
 
32
32
  spec.add_development_dependency "debug"
33
33
  spec.add_development_dependency "equivalent-xml", "~> 0.6"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-generic
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.3
4
+ version: 3.3.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: 2026-02-16 00:00:00.000000000 Z
11
+ date: 2026-03-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metanorma-standoc
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 3.3.0
19
+ version: 3.3.1
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.3.0
26
+ version: 3.3.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: debug
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -210,9 +210,6 @@ files:
210
210
  - LICENSE
211
211
  - README.adoc
212
212
  - lib/asciidoctor/generic.rb
213
- - lib/asciidoctor/generic/converter.rb
214
- - lib/asciidoctor/generic/deprecated.rb
215
- - lib/asciidoctor/generic/front.rb
216
213
  - lib/isodoc/generic.rb
217
214
  - lib/isodoc/generic/base_convert.rb
218
215
  - lib/isodoc/generic/html/generic.scss
@@ -240,6 +237,7 @@ files:
240
237
  - lib/metanorma/generic/bibdata_config.rb
241
238
  - lib/metanorma/generic/biblio-standoc.rng
242
239
  - lib/metanorma/generic/biblio.rng
240
+ - lib/metanorma/generic/cleanup.rb
243
241
  - lib/metanorma/generic/converter.rb
244
242
  - lib/metanorma/generic/fonts_manifest.yaml
245
243
  - lib/metanorma/generic/front.rb
@@ -249,6 +247,7 @@ files:
249
247
  - lib/metanorma/generic/processor.rb
250
248
  - lib/metanorma/generic/reqt.rng
251
249
  - lib/metanorma/generic/rsd.rng
250
+ - lib/metanorma/generic/validate.rb
252
251
  - lib/metanorma/generic/version.rb
253
252
  - metanorma-generic.gemspec
254
253
  - metanorma.yml.example
@@ -1,3 +0,0 @@
1
- require "asciidoctor/generic/deprecated"
2
- require "metanorma/generic/converter"
3
-
@@ -1,7 +0,0 @@
1
- warn <<~WARN
2
- Please replace your references to Asciidoctor::Generic with Metanorma::Generic and your instances of require 'asciidoctor/generic' with require 'metanorma/generic'
3
- WARN
4
-
5
- exit 127 if ENV["METANORMA_DEPRECATION_FAIL"]
6
-
7
- Asciidoctor::Generic = Metanorma::Generic unless defined? Asciidoctor::Generic
@@ -1,2 +0,0 @@
1
- require "asciidoctor/generic/deprecated"
2
- require "metanorma/generic/front"