metanorma-generic 1.11.3 → 2.0.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: 9b32cd6e5f3cc657071de1b5986d4d9a8be0dc4131be18e121503c190c094efe
4
- data.tar.gz: b15fddbf413d229223261950534adbf6ed23cd88a1a77be3caf09323833b7c03
3
+ metadata.gz: 91c4626d9d39c2843137aa04fa40e29b206aad99af497bd4557db2904b6a0333
4
+ data.tar.gz: 3e17cf92b1ad8a9c6af1d72f74206b1f01399a1676806642cc7e78bb34110dde
5
5
  SHA512:
6
- metadata.gz: 4541dfe4894263500820f3d81192b87c389813508a2b7971748108e825616fb7dd7fcbd1136fc8c1c8d27cd8416cbc16ac3ff0a328ca06c084bcda587e97ed06
7
- data.tar.gz: a3566a10cf53b3d19b22a99628f4949311e98472e52d3d54c229814d97e91e16259c96d5bee7457f796d0beb3c3a9e80dee96c1e80ace36a2cb47069634212bb
6
+ metadata.gz: 53c631bd4b142112021e756af04905964939d6ec3e8536df15660f0738ddc632640fde87a6059f67db7c78da520d1eb74931eb2ccf76e1adb7a471d3ab4f6fbe
7
+ data.tar.gz: 4dc996318a1ed6e42db1ef3532f980de7f3462c087b064f084b2eaa15759456dc02dfc6da6676dcc708a1180e053c1b68ae7bce4d21d459d4ab4ea7c92be97a5
@@ -9,35 +9,7 @@ on:
9
9
  pull_request:
10
10
 
11
11
  jobs:
12
- rake:
13
- name: Test on Ruby ${{ matrix.ruby }} ${{ matrix.os }}
14
- runs-on: ${{ matrix.os }}
15
- continue-on-error: ${{ matrix.experimental }}
16
- strategy:
17
- fail-fast: false
18
- matrix:
19
- ruby: [ '3.0', '2.7', '2.6', '2.5' ]
20
- os: [ ubuntu-latest, windows-latest, macos-latest ]
21
- experimental: [ false ]
22
- steps:
23
- - uses: actions/checkout@v2
24
- with:
25
- submodules: true
26
-
27
- - uses: ruby/setup-ruby@v1
28
- with:
29
- ruby-version: ${{ matrix.ruby }}
30
- bundler-cache: true
31
-
32
- - run: bundle exec rake
33
-
34
- tests-passed:
35
- needs: rake
36
- runs-on: ubuntu-latest
37
- steps:
38
- - uses: peter-evans/repository-dispatch@v1
39
- with:
40
- token: ${{ secrets.METANORMA_CI_PAT_TOKEN || secrets.GITHUB_TOKEN }}
41
- repository: ${{ github.repository }}
42
- event-type: tests-passed
43
- client-payload: '{"ref": "${{ github.ref }}", "sha": "${{ github.sha }}"}'
12
+ notify:
13
+ uses: metanorma/metanorma-build-scripts/.github/workflows/mn-processor-rake.yml@main
14
+ secrets:
15
+ pat_token: ${{ secrets.METANORMA_CI_PAT_TOKEN }}
data/.gitignore CHANGED
@@ -1,3 +1,13 @@
1
1
  .DS_Store
2
2
 
3
3
  .rubocop-https--*
4
+
5
+ /.rspec_status
6
+ /Gemfile.devel
7
+ /Gemfile.lock
8
+ /coverage/
9
+ /test.doc
10
+ /test.err
11
+ /test.html
12
+ /test.pdf
13
+ /test.presentation.xml
data/README.adoc CHANGED
@@ -31,7 +31,7 @@ Metanorma::Generic.configure do |config|
31
31
  config.document_namespace = 'https://open.ribose.com/standards/mine'
32
32
  config.xml_root_tag = 'mine-standard'
33
33
  config.logo_path = '/metanorma-mine/lib/isodoc/mine/html/logo.jpg'
34
- config.validate_rng_file = '/metanorma-mine/lib/asciidoctor/mine/mine.rng'
34
+ config.validate_rng_file = '/metanorma-mine/lib/metanorma/mine/mine.rng'
35
35
  config.htmlcoverpage = '/metanorma-mine/lib/isodoc/mine/html/html_mine_titlepage.html'
36
36
  config.htmlintropage = '/metanorma-mine/lib/isodoc/mine/html/html_mine_intro.html'
37
37
  config.htmlstylesheet = '/metanorma-mine/lib/isodoc/mine/html/htmlstyle.scss'
@@ -1,183 +1,3 @@
1
- require "asciidoctor"
2
- require "asciidoctor/standoc/converter"
3
- require "fileutils"
4
- require_relative "front"
1
+ require "asciidoctor/generic/deprecated"
2
+ require "metanorma/generic/converter"
5
3
 
6
- module Asciidoctor
7
- module Generic
8
- class Converter < Standoc::Converter
9
- XML_ROOT_TAG = "generic-standard".freeze
10
- XML_NAMESPACE = "https://www.metanorma.org/ns/generic".freeze
11
-
12
- register_for "generic"
13
-
14
- def xml_root_tag
15
- configuration.xml_root_tag || XML_ROOT_TAG
16
- end
17
-
18
- def xml_namespace
19
- configuration.document_namespace || XML_NAMESPACE
20
- end
21
-
22
- def baselocation(loc)
23
- return nil if loc.nil?
24
-
25
- return loc
26
- File.expand_path(File.join(File.dirname(
27
- self.class::_file || __FILE__,
28
- ), "..", "..", "..", loc))
29
- end
30
-
31
- def docidentifier_cleanup(xmldoc)
32
- template = configuration.docid_template ||
33
- "{{ organization_name_short }} {{ docnumeric }}"
34
- docid = xmldoc.at("//bibdata/docidentifier")
35
- id = boilerplate_isodoc(xmldoc).populate_template(template, nil)
36
- id.empty? and docid.remove or docid.children = id
37
- end
38
-
39
- def doctype(node)
40
- d = super
41
- configuration.doctypes or return d == "article" ?
42
- (configuration.default_doctype || "standard") : d
43
- type = configuration.default_doctype ||
44
- configuration.doctypes.keys.dig(0) || "standard"
45
- unless configuration.doctypes.keys.include? d
46
- @log.add("Document Attributes", nil,
47
- "#{d} is not a legal document type: reverting to '#{type}'")
48
- d = type
49
- end
50
- d
51
- end
52
-
53
- def read_config_file(path_to_config_file)
54
- Metanorma::Generic.configuration
55
- .set_default_values_from_yaml_file(path_to_config_file)
56
- end
57
-
58
- def sectiontype_streamline(ret)
59
- if configuration&.termsdefs_titles&.map(&:downcase)&.include? ret
60
- "terms and definitions"
61
- elsif configuration&.symbols_titles&.map(&:downcase)&.include? ret
62
- "symbols and abbreviated terms"
63
- elsif configuration&.normref_titles&.map(&:downcase)&.include? ret
64
- "normative references"
65
- elsif configuration&.bibliography_titles&.map(&:downcase)&.include? ret
66
- "bibliography"
67
- else
68
- ret
69
- end
70
- end
71
-
72
- def document(node)
73
- read_config_file(node.attr("customize")) if node.attr("customize")
74
- super
75
- end
76
-
77
- def outputs(node, ret)
78
- File.open("#{@filename}.xml", "w:UTF-8") { |f| f.write(ret) }
79
- presentation_xml_converter(node)&.convert("#{@filename}.xml")
80
- html_converter(node)&.convert("#{@filename}.presentation.xml",
81
- nil, false, "#{@filename}.html")
82
- doc_converter(node)&.convert("#{@filename}.presentation.xml",
83
- nil, false, "#{@filename}.doc")
84
- pdf_converter(node)&.convert("#{@filename}.presentation.xml",
85
- nil, false, "#{@filename}.pdf")
86
- end
87
-
88
- def validate(doc)
89
- content_validate(doc)
90
- schema_validate(formattedstr_strip(doc.dup),
91
- baselocation(configuration.validate_rng_file) ||
92
- File.join(File.dirname(__FILE__), "generic.rng"))
93
- end
94
-
95
- def content_validate(doc)
96
- super
97
- bibdata_validate(doc.root)
98
- end
99
-
100
- def bibdata_validate(doc)
101
- stage_validate(doc)
102
- committee_validate(doc)
103
- end
104
-
105
- def stage_validate(xmldoc)
106
- stages = configuration&.stage_abbreviations&.keys || return
107
- stages.empty? and return
108
- stage = xmldoc&.at("//bibdata/status/stage")&.text
109
- stages.include? stage or
110
- @log.add("Document Attributes", nil,
111
- "#{stage} is not a recognised status")
112
- end
113
-
114
- def committee_validate(xmldoc)
115
- committees = Array(configuration&.committees) || return
116
- committees.empty? and return
117
- xmldoc.xpath("//bibdata/ext/editorialgroup/committee").each do |c|
118
- committees.include? c.text or
119
- @log.add("Document Attributes", nil,
120
- "#{c.text} is not a recognised committee")
121
- end
122
- end
123
-
124
- def sections_cleanup(xml)
125
- super
126
- xml.xpath("//*[@inline-header]").each do |h|
127
- h.delete("inline-header")
128
- end
129
- end
130
-
131
- def blank_method(*args); end
132
-
133
- def html_converter(node)
134
- IsoDoc::Generic::HtmlConvert.new(html_extract_attributes(node))
135
- end
136
-
137
- def presentation_xml_converter(node)
138
- IsoDoc::Generic::PresentationXMLConvert
139
- .new(html_extract_attributes(node))
140
- end
141
-
142
- alias_method :pdf_converter, :html_converter
143
- alias_method :style, :blank_method
144
- alias_method :title_validate, :blank_method
145
-
146
- def doc_converter(node)
147
- IsoDoc::Generic::WordConvert.new(doc_extract_attributes(node))
148
- end
149
-
150
- def configuration
151
- Metanorma::Generic.configuration
152
- end
153
-
154
- def boilerplate_isodoc(xmldoc)
155
- conv = super
156
- Metanorma::Generic::Configuration::CONFIG_ATTRS.each do |a|
157
- conv.meta.set(a, configuration.send(a))
158
- end
159
- conv
160
- end
161
-
162
- def boilerplate_file(xmldoc)
163
- f = configuration.boilerplate
164
- f.nil? and return super
165
- f.is_a? String and return baselocation(f)
166
- f.is_a? Hash and f[@lang] and return baselocation(f[@lang])
167
- super
168
- end
169
-
170
- def cleanup(xmldoc)
171
- super
172
- empty_metadata_cleanup(xmldoc)
173
- xmldoc
174
- end
175
-
176
- def empty_metadata_cleanup(xmldoc)
177
- xmldoc.xpath("//bibdata/ext//*").each do |x|
178
- x.remove if x.children.empty?
179
- end
180
- end
181
- end
182
- end
183
- end
@@ -0,0 +1,5 @@
1
+ warn "Please replace your references to Asciidoctor::Generic with Metanorma::Generic and your instances of require 'asciidoctor/generic' with require 'metanorma/generic'"
2
+
3
+ exit 127 if ENV['METANORMA_DEPRECATION_FAIL']
4
+
5
+ Asciidoctor::Generic = Metanorma::Generic unless defined? Asciidoctor::Generic
@@ -1,108 +1,3 @@
1
- module Asciidoctor
2
- module Generic
3
- class Converter < Standoc::Converter
4
- def default_publisher
5
- configuration.organization_name_long
6
- end
1
+ require "asciidoctor/generic/deprecated"
2
+ require "metanorma/generic/front"
7
3
 
8
- def org_abbrev
9
- if !configuration.organization_name_long.empty? &&
10
- !configuration.organization_name_short.empty? &&
11
- configuration.organization_name_long !=
12
- configuration.organization_name_short
13
- { configuration.organization_name_long =>
14
- configuration.organization_name_short }
15
- else
16
- super
17
- end
18
- end
19
-
20
- def relaton_relations
21
- Array(configuration.relations) || []
22
- end
23
-
24
- def metadata_committee(node, xml)
25
- return unless node.attr("committee")
26
- xml.editorialgroup do |a|
27
- a.committee node.attr("committee"),
28
- **attr_code(type: node.attr("committee-type"))
29
- i = 2
30
- while node.attr("committee_#{i}") do
31
- a.committee node.attr("committee_#{i}"),
32
- **attr_code(type: node.attr("committee-type_#{i}"))
33
- i += 1
34
- end
35
- end
36
- end
37
-
38
- def metadata_status(node, xml)
39
- xml.status do |s|
40
- s.stage ( node.attr("status") || node.attr("docstage") ||
41
- configuration.default_stage || "published" )
42
- x = node.attr("substage") and s.substage x
43
- x = node.attr("iteration") and s.iteration x
44
- end
45
- end
46
-
47
- def metadata_id(node, xml)
48
- xml.docidentifier **{ type:
49
- configuration.organization_name_short } do |i|
50
- i << "DUMMY"
51
- end
52
- xml.docnumber { |i| i << node.attr("docnumber") }
53
- end
54
-
55
- def metadata_ext(node, ext)
56
- super
57
- if configuration.metadata_extensions.is_a? Hash
58
- metadata_ext_hash(node, ext, configuration.metadata_extensions)
59
- else
60
- Array(configuration.metadata_extensions).each do |e|
61
- a = node.attr(e) and ext.send e, a
62
- end
63
- end
64
- end
65
-
66
- def metadata_doctype(node, xml)
67
- d = doctype(node)
68
- xml.doctype d, attr_code(abbreviation: configuration&.doctypes&.dig(d))
69
- end
70
-
71
- EXT_STRUCT = %w(_output _attribute _list).freeze
72
-
73
- def metadata_ext_hash(node, ext, hash)
74
- hash.each do |k, v|
75
- next if EXT_STRUCT.include?(k) || !v&.is_a?(Hash) && !node.attr(k)
76
- if v&.is_a?(Hash) && v["_list"]
77
- csv_split(node.attr(k), ",").each do |val|
78
- metadata_ext_hash1(k, val, ext, v, node)
79
- end
80
- else
81
- metadata_ext_hash1(k, node.attr(k), ext, v, node)
82
- end
83
- end
84
- end
85
-
86
- def metadata_ext_hash1(key, value, ext, hash, node)
87
- return if hash&.is_a?(Hash) && hash["_attribute"]
88
- is_hash = hash&.is_a?(Hash) &&
89
- !hash.keys.reject { |n| EXT_STRUCT.include?(n) }.empty?
90
- return if !is_hash && (value.nil? || value.empty?)
91
- name = hash&.is_a?(Hash) ? (hash["_output"] || key) : key
92
- ext.send name, **attr_code(metadata_ext_attrs(hash, node)) do |e|
93
- is_hash ? metadata_ext_hash(node, e, hash) : (e << value)
94
- end
95
- end
96
-
97
- def metadata_ext_attrs(hash, node)
98
- return {} unless hash.is_a?(Hash)
99
- ret = {}
100
- hash.each do |k, v|
101
- next unless v.is_a?(Hash) && v["_attribute"]
102
- ret[(v["_output"] || k).to_sym] = node.attr(k)
103
- end
104
- ret
105
- end
106
- end
107
- end
108
- end
@@ -1,7 +1,3 @@
1
- require "asciidoctor/generic/converter"
1
+ require "asciidoctor/generic/deprecated"
2
+ require "metanorma/generic"
2
3
 
3
- module Asciidoctor
4
- module Generic
5
-
6
- end
7
- end
File without changes
File without changes
@@ -0,0 +1,183 @@
1
+ require "asciidoctor"
2
+ require "metanorma/standoc/converter"
3
+ require "fileutils"
4
+ require_relative "front"
5
+
6
+ module Metanorma
7
+ module Generic
8
+ class Converter < Standoc::Converter
9
+ XML_ROOT_TAG = "generic-standard".freeze
10
+ XML_NAMESPACE = "https://www.metanorma.org/ns/generic".freeze
11
+
12
+ register_for "generic"
13
+
14
+ def xml_root_tag
15
+ configuration.xml_root_tag || XML_ROOT_TAG
16
+ end
17
+
18
+ def xml_namespace
19
+ configuration.document_namespace || XML_NAMESPACE
20
+ end
21
+
22
+ def baselocation(loc)
23
+ return nil if loc.nil?
24
+
25
+ return loc
26
+ File.expand_path(File.join(File.dirname(
27
+ self.class::_file || __FILE__,
28
+ ), "..", "..", "..", loc))
29
+ end
30
+
31
+ def docidentifier_cleanup(xmldoc)
32
+ template = configuration.docid_template ||
33
+ "{{ organization_name_short }} {{ docnumeric }}"
34
+ docid = xmldoc.at("//bibdata/docidentifier")
35
+ id = boilerplate_isodoc(xmldoc).populate_template(template, nil)
36
+ id.empty? and docid.remove or docid.children = id
37
+ end
38
+
39
+ def doctype(node)
40
+ d = super
41
+ configuration.doctypes or return d == "article" ?
42
+ (configuration.default_doctype || "standard") : d
43
+ type = configuration.default_doctype ||
44
+ configuration.doctypes.keys.dig(0) || "standard"
45
+ unless configuration.doctypes.keys.include? d
46
+ @log.add("Document Attributes", nil,
47
+ "#{d} is not a legal document type: reverting to '#{type}'")
48
+ d = type
49
+ end
50
+ d
51
+ end
52
+
53
+ def read_config_file(path_to_config_file)
54
+ Metanorma::Generic.configuration
55
+ .set_default_values_from_yaml_file(path_to_config_file)
56
+ end
57
+
58
+ def sectiontype_streamline(ret)
59
+ if configuration&.termsdefs_titles&.map(&:downcase)&.include? ret
60
+ "terms and definitions"
61
+ elsif configuration&.symbols_titles&.map(&:downcase)&.include? ret
62
+ "symbols and abbreviated terms"
63
+ elsif configuration&.normref_titles&.map(&:downcase)&.include? ret
64
+ "normative references"
65
+ elsif configuration&.bibliography_titles&.map(&:downcase)&.include? ret
66
+ "bibliography"
67
+ else
68
+ ret
69
+ end
70
+ end
71
+
72
+ def document(node)
73
+ read_config_file(node.attr("customize")) if node.attr("customize")
74
+ super
75
+ end
76
+
77
+ def outputs(node, ret)
78
+ File.open("#{@filename}.xml", "w:UTF-8") { |f| f.write(ret) }
79
+ presentation_xml_converter(node)&.convert("#{@filename}.xml")
80
+ html_converter(node)&.convert("#{@filename}.presentation.xml",
81
+ nil, false, "#{@filename}.html")
82
+ doc_converter(node)&.convert("#{@filename}.presentation.xml",
83
+ nil, false, "#{@filename}.doc")
84
+ pdf_converter(node)&.convert("#{@filename}.presentation.xml",
85
+ nil, false, "#{@filename}.pdf")
86
+ end
87
+
88
+ def validate(doc)
89
+ content_validate(doc)
90
+ schema_validate(formattedstr_strip(doc.dup),
91
+ baselocation(configuration.validate_rng_file) ||
92
+ File.join(File.dirname(__FILE__), "generic.rng"))
93
+ end
94
+
95
+ def content_validate(doc)
96
+ super
97
+ bibdata_validate(doc.root)
98
+ end
99
+
100
+ def bibdata_validate(doc)
101
+ stage_validate(doc)
102
+ committee_validate(doc)
103
+ end
104
+
105
+ def stage_validate(xmldoc)
106
+ stages = configuration&.stage_abbreviations&.keys || return
107
+ stages.empty? and return
108
+ stage = xmldoc&.at("//bibdata/status/stage")&.text
109
+ stages.include? stage or
110
+ @log.add("Document Attributes", nil,
111
+ "#{stage} is not a recognised status")
112
+ end
113
+
114
+ def committee_validate(xmldoc)
115
+ committees = Array(configuration&.committees) || return
116
+ committees.empty? and return
117
+ xmldoc.xpath("//bibdata/ext/editorialgroup/committee").each do |c|
118
+ committees.include? c.text or
119
+ @log.add("Document Attributes", nil,
120
+ "#{c.text} is not a recognised committee")
121
+ end
122
+ end
123
+
124
+ def sections_cleanup(xml)
125
+ super
126
+ xml.xpath("//*[@inline-header]").each do |h|
127
+ h.delete("inline-header")
128
+ end
129
+ end
130
+
131
+ def blank_method(*args); end
132
+
133
+ def html_converter(node)
134
+ IsoDoc::Generic::HtmlConvert.new(html_extract_attributes(node))
135
+ end
136
+
137
+ def presentation_xml_converter(node)
138
+ IsoDoc::Generic::PresentationXMLConvert
139
+ .new(html_extract_attributes(node))
140
+ end
141
+
142
+ alias_method :pdf_converter, :html_converter
143
+ alias_method :style, :blank_method
144
+ alias_method :title_validate, :blank_method
145
+
146
+ def doc_converter(node)
147
+ IsoDoc::Generic::WordConvert.new(doc_extract_attributes(node))
148
+ end
149
+
150
+ def configuration
151
+ Metanorma::Generic.configuration
152
+ end
153
+
154
+ def boilerplate_isodoc(xmldoc)
155
+ conv = super
156
+ Metanorma::Generic::Configuration::CONFIG_ATTRS.each do |a|
157
+ conv.meta.set(a, configuration.send(a))
158
+ end
159
+ conv
160
+ end
161
+
162
+ def boilerplate_file(xmldoc)
163
+ f = configuration.boilerplate
164
+ f.nil? and return super
165
+ f.is_a? String and return baselocation(f)
166
+ f.is_a? Hash and f[@lang] and return baselocation(f[@lang])
167
+ super
168
+ end
169
+
170
+ def cleanup(xmldoc)
171
+ super
172
+ empty_metadata_cleanup(xmldoc)
173
+ xmldoc
174
+ end
175
+
176
+ def empty_metadata_cleanup(xmldoc)
177
+ xmldoc.xpath("//bibdata/ext//*").each do |x|
178
+ x.remove if x.children.empty?
179
+ end
180
+ end
181
+ end
182
+ end
183
+ end
@@ -0,0 +1,108 @@
1
+ module Metanorma
2
+ module Generic
3
+ class Converter < Standoc::Converter
4
+ def default_publisher
5
+ configuration.organization_name_long
6
+ end
7
+
8
+ def org_abbrev
9
+ if !configuration.organization_name_long.empty? &&
10
+ !configuration.organization_name_short.empty? &&
11
+ configuration.organization_name_long !=
12
+ configuration.organization_name_short
13
+ { configuration.organization_name_long =>
14
+ configuration.organization_name_short }
15
+ else
16
+ super
17
+ end
18
+ end
19
+
20
+ def relaton_relations
21
+ Array(configuration.relations) || []
22
+ end
23
+
24
+ def metadata_committee(node, xml)
25
+ return unless node.attr("committee")
26
+ xml.editorialgroup do |a|
27
+ a.committee node.attr("committee"),
28
+ **attr_code(type: node.attr("committee-type"))
29
+ i = 2
30
+ while node.attr("committee_#{i}") do
31
+ a.committee node.attr("committee_#{i}"),
32
+ **attr_code(type: node.attr("committee-type_#{i}"))
33
+ i += 1
34
+ end
35
+ end
36
+ end
37
+
38
+ def metadata_status(node, xml)
39
+ xml.status do |s|
40
+ s.stage ( node.attr("status") || node.attr("docstage") ||
41
+ configuration.default_stage || "published" )
42
+ x = node.attr("substage") and s.substage x
43
+ x = node.attr("iteration") and s.iteration x
44
+ end
45
+ end
46
+
47
+ def metadata_id(node, xml)
48
+ xml.docidentifier **{ type:
49
+ configuration.organization_name_short } do |i|
50
+ i << "DUMMY"
51
+ end
52
+ xml.docnumber { |i| i << node.attr("docnumber") }
53
+ end
54
+
55
+ def metadata_ext(node, ext)
56
+ super
57
+ if configuration.metadata_extensions.is_a? Hash
58
+ metadata_ext_hash(node, ext, configuration.metadata_extensions)
59
+ else
60
+ Array(configuration.metadata_extensions).each do |e|
61
+ a = node.attr(e) and ext.send e, a
62
+ end
63
+ end
64
+ end
65
+
66
+ def metadata_doctype(node, xml)
67
+ d = doctype(node)
68
+ xml.doctype d, attr_code(abbreviation: configuration&.doctypes&.dig(d))
69
+ end
70
+
71
+ EXT_STRUCT = %w(_output _attribute _list).freeze
72
+
73
+ def metadata_ext_hash(node, ext, hash)
74
+ hash.each do |k, v|
75
+ next if EXT_STRUCT.include?(k) || !v&.is_a?(Hash) && !node.attr(k)
76
+ if v&.is_a?(Hash) && v["_list"]
77
+ csv_split(node.attr(k), ",").each do |val|
78
+ metadata_ext_hash1(k, val, ext, v, node)
79
+ end
80
+ else
81
+ metadata_ext_hash1(k, node.attr(k), ext, v, node)
82
+ end
83
+ end
84
+ end
85
+
86
+ def metadata_ext_hash1(key, value, ext, hash, node)
87
+ return if hash&.is_a?(Hash) && hash["_attribute"]
88
+ is_hash = hash&.is_a?(Hash) &&
89
+ !hash.keys.reject { |n| EXT_STRUCT.include?(n) }.empty?
90
+ return if !is_hash && (value.nil? || value.empty?)
91
+ name = hash&.is_a?(Hash) ? (hash["_output"] || key) : key
92
+ ext.send name, **attr_code(metadata_ext_attrs(hash, node)) do |e|
93
+ is_hash ? metadata_ext_hash(node, e, hash) : (e << value)
94
+ end
95
+ end
96
+
97
+ def metadata_ext_attrs(hash, node)
98
+ return {} unless hash.is_a?(Hash)
99
+ ret = {}
100
+ hash.each do |k, v|
101
+ next unless v.is_a?(Hash) && v["_attribute"]
102
+ ret[(v["_output"] || k).to_sym] = node.attr(k)
103
+ end
104
+ ret
105
+ end
106
+ end
107
+ end
108
+ end
File without changes
@@ -32,6 +32,19 @@
32
32
  <ref name="DocumentType"/>
33
33
  </element>
34
34
  </define>
35
+ <define name="bibitem">
36
+ <element name="bibitem">
37
+ <attribute name="id">
38
+ <data type="ID"/>
39
+ </attribute>
40
+ <optional>
41
+ <attribute name="hidden">
42
+ <data type="boolean"/>
43
+ </attribute>
44
+ </optional>
45
+ <ref name="BibliographicItem"/>
46
+ </element>
47
+ </define>
35
48
  <define name="section-title">
36
49
  <element name="title">
37
50
  <zeroOrMore>
@@ -690,6 +703,7 @@
690
703
  <ref name="terms"/>
691
704
  <ref name="term-clause"/>
692
705
  <ref name="definitions"/>
706
+ <ref name="floating-title"/>
693
707
  </choice>
694
708
  </oneOrMore>
695
709
  </element>
@@ -1680,6 +1694,7 @@
1680
1694
  <ref name="clause-subsection"/>
1681
1695
  <ref name="terms"/>
1682
1696
  <ref name="definitions"/>
1697
+ <ref name="floating-title"/>
1683
1698
  </choice>
1684
1699
  </oneOrMore>
1685
1700
  </choice>
@@ -1722,6 +1737,7 @@
1722
1737
  <ref name="terms"/>
1723
1738
  <ref name="definitions"/>
1724
1739
  <ref name="references"/>
1740
+ <ref name="floating-title"/>
1725
1741
  </choice>
1726
1742
  </zeroOrMore>
1727
1743
  </group>
@@ -2534,4 +2550,17 @@
2534
2550
  </oneOrMore>
2535
2551
  </element>
2536
2552
  </define>
2553
+ <define name="floating-title">
2554
+ <element name="floating-title">
2555
+ <attribute name="id">
2556
+ <data type="ID"/>
2557
+ </attribute>
2558
+ <attribute name="depth">
2559
+ <data type="int"/>
2560
+ </attribute>
2561
+ <zeroOrMore>
2562
+ <ref name="TextElement"/>
2563
+ </zeroOrMore>
2564
+ </element>
2565
+ </define>
2537
2566
  </grammar>
File without changes
File without changes
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Generic
3
- VERSION = "1.11.3".freeze
3
+ VERSION = "2.0.0".freeze
4
4
  end
5
5
  end
@@ -3,6 +3,7 @@ require "metanorma/generic/version"
3
3
  require "forwardable"
4
4
  require "yaml"
5
5
 
6
+
6
7
  module Metanorma
7
8
  module Generic # rubocop:disable Style/MutableConstant
8
9
  ORGANIZATION_NAME_SHORT = "Acme"
@@ -1,6 +1,6 @@
1
1
  require "metanorma/generic"
2
2
  require "asciidoctor"
3
- require "asciidoctor/generic"
3
+ require "metanorma/generic/converter"
4
4
  require "isodoc/generic"
5
5
 
6
6
  if defined? Metanorma
@@ -27,7 +27,7 @@ Gem::Specification.new do |spec|
27
27
  spec.required_ruby_version = Gem::Requirement.new(">= 2.5.0")
28
28
 
29
29
  spec.add_dependency "htmlentities", "~> 4.3.4"
30
- spec.add_dependency "metanorma-standoc", "~> 1.11.0"
30
+ spec.add_dependency "metanorma-standoc", "~> 2.0.0"
31
31
  spec.add_dependency "ruby-jing"
32
32
 
33
33
  spec.add_development_dependency "debug"
@@ -7,7 +7,7 @@ logo_path: /metanorma-mine/lib/isodoc/mine/html/logo.jpg
7
7
  logo_paths:
8
8
  - /metanorma-mine/lib/isodoc/mine/html/logo1.jpg
9
9
  - /metanorma-mine/lib/isodoc/mine/html/logo2.jpg
10
- validate_rng_file: /metanorma-mine/lib/asciidoctor/mine/mine.rng
10
+ validate_rng_file: /metanorma-mine/lib/metanorma/mine/mine.rng
11
11
  htmlcoverpage: /metanorma-mine/lib/isodoc/mine/html/html_mine_titlepage.html
12
12
  htmlintropage: /metanorma-mine/lib/isodoc/mine/html/html_mine_intro.html
13
13
  htmlstylesheet: /metanorma-mine/lib/isodoc/mine/html/htmlstyle.scss
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: 1.11.3
4
+ version: 2.0.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: 2021-12-27 00:00:00.000000000 Z
11
+ date: 2022-01-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: htmlentities
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 1.11.0
33
+ version: 2.0.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 1.11.0
40
+ version: 2.0.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: ruby-jing
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -213,14 +213,9 @@ files:
213
213
  - bin/rspec
214
214
  - bin/setup
215
215
  - lib/asciidoctor/generic.rb
216
- - lib/asciidoctor/generic/basicdoc.rng
217
- - lib/asciidoctor/generic/biblio.rng
218
216
  - lib/asciidoctor/generic/converter.rb
217
+ - lib/asciidoctor/generic/deprecated.rb
219
218
  - lib/asciidoctor/generic/front.rb
220
- - lib/asciidoctor/generic/generic.rng
221
- - lib/asciidoctor/generic/isodoc.rng
222
- - lib/asciidoctor/generic/reqt.rng
223
- - lib/asciidoctor/generic/rsd.rng
224
219
  - lib/isodoc/generic.rb
225
220
  - lib/isodoc/generic/base_convert.rb
226
221
  - lib/isodoc/generic/html/generic.scss
@@ -243,8 +238,16 @@ files:
243
238
  - lib/isodoc/generic/xref.rb
244
239
  - lib/metanorma-generic.rb
245
240
  - lib/metanorma/generic.rb
241
+ - lib/metanorma/generic/basicdoc.rng
242
+ - lib/metanorma/generic/biblio.rng
243
+ - lib/metanorma/generic/converter.rb
246
244
  - lib/metanorma/generic/fonts_manifest.yaml
245
+ - lib/metanorma/generic/front.rb
246
+ - lib/metanorma/generic/generic.rng
247
+ - lib/metanorma/generic/isodoc.rng
247
248
  - lib/metanorma/generic/processor.rb
249
+ - lib/metanorma/generic/reqt.rng
250
+ - lib/metanorma/generic/rsd.rng
248
251
  - lib/metanorma/generic/version.rb
249
252
  - metanorma-generic.gemspec
250
253
  - metanorma.yml.example