metanorma-generic 1.11.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rake.yml +4 -32
- data/.gitignore +10 -0
- data/README.adoc +1 -1
- data/lib/asciidoctor/generic/converter.rb +2 -182
- data/lib/asciidoctor/generic/deprecated.rb +5 -0
- data/lib/asciidoctor/generic/front.rb +2 -107
- data/lib/asciidoctor/generic.rb +2 -6
- data/lib/isodoc/generic/base_convert.rb +4 -3
- data/lib/isodoc/generic/html/generic.scss +0 -1
- data/lib/isodoc/generic/html/htmlstyle.scss +14 -11
- data/lib/isodoc/generic/html/scripts.html +0 -1
- data/lib/isodoc/generic/html/wordstyle.scss +30 -18
- data/lib/{asciidoctor → metanorma}/generic/basicdoc.rng +0 -0
- data/lib/{asciidoctor → metanorma}/generic/biblio.rng +0 -0
- data/lib/metanorma/generic/converter.rb +183 -0
- data/lib/metanorma/generic/front.rb +108 -0
- data/lib/{asciidoctor → metanorma}/generic/generic.rng +0 -0
- data/lib/{asciidoctor → metanorma}/generic/isodoc.rng +102 -19
- data/lib/{asciidoctor → metanorma}/generic/reqt.rng +0 -0
- data/lib/{asciidoctor → metanorma}/generic/rsd.rng +0 -0
- data/lib/metanorma/generic/version.rb +1 -1
- data/lib/metanorma/generic.rb +10 -21
- data/lib/metanorma-generic.rb +1 -1
- data/metanorma-generic.gemspec +2 -2
- data/metanorma.yml.example +1 -1
- metadata +19 -16
@@ -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>
|
@@ -58,7 +71,7 @@
|
|
58
71
|
<attribute name="alt"/>
|
59
72
|
</optional>
|
60
73
|
<optional>
|
61
|
-
<attribute name="
|
74
|
+
<attribute name="update-type">
|
62
75
|
<data type="boolean"/>
|
63
76
|
</attribute>
|
64
77
|
</optional>
|
@@ -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>
|
@@ -1796,6 +1812,20 @@
|
|
1796
1812
|
<data type="ID"/>
|
1797
1813
|
</attribute>
|
1798
1814
|
</optional>
|
1815
|
+
<optional>
|
1816
|
+
<attribute name="language"/>
|
1817
|
+
</optional>
|
1818
|
+
<optional>
|
1819
|
+
<attribute name="script"/>
|
1820
|
+
</optional>
|
1821
|
+
<optional>
|
1822
|
+
<attribute name="tag"/>
|
1823
|
+
</optional>
|
1824
|
+
<optional>
|
1825
|
+
<attribute name="multilingual-rendering">
|
1826
|
+
<ref name="MultilingualRenderingType"/>
|
1827
|
+
</attribute>
|
1828
|
+
</optional>
|
1799
1829
|
<oneOrMore>
|
1800
1830
|
<ref name="preferred"/>
|
1801
1831
|
</oneOrMore>
|
@@ -1814,9 +1844,6 @@
|
|
1814
1844
|
<optional>
|
1815
1845
|
<ref name="termsubject"/>
|
1816
1846
|
</optional>
|
1817
|
-
<optional>
|
1818
|
-
<ref name="termusage"/>
|
1819
|
-
</optional>
|
1820
1847
|
<oneOrMore>
|
1821
1848
|
<ref name="termdefinition"/>
|
1822
1849
|
</oneOrMore>
|
@@ -1880,17 +1907,37 @@
|
|
1880
1907
|
</attribute>
|
1881
1908
|
</optional>
|
1882
1909
|
<optional>
|
1883
|
-
<attribute name="
|
1910
|
+
<attribute name="geographic-area"/>
|
1884
1911
|
</optional>
|
1885
1912
|
<choice>
|
1886
1913
|
<ref name="expression_designation"/>
|
1887
1914
|
<ref name="letter_symbol_designation"/>
|
1888
1915
|
<ref name="graphical_symbol_designation"/>
|
1889
1916
|
</choice>
|
1917
|
+
<optional>
|
1918
|
+
<ref name="fieldofapplication"/>
|
1919
|
+
</optional>
|
1920
|
+
<optional>
|
1921
|
+
<ref name="usageinfo"/>
|
1922
|
+
</optional>
|
1890
1923
|
<zeroOrMore>
|
1891
1924
|
<ref name="termsource"/>
|
1892
1925
|
</zeroOrMore>
|
1893
1926
|
</define>
|
1927
|
+
<define name="fieldofapplication">
|
1928
|
+
<element name="field-of-application">
|
1929
|
+
<oneOrMore>
|
1930
|
+
<ref name="PureTextElement"/>
|
1931
|
+
</oneOrMore>
|
1932
|
+
</element>
|
1933
|
+
</define>
|
1934
|
+
<define name="usageinfo">
|
1935
|
+
<element name="usage-info">
|
1936
|
+
<oneOrMore>
|
1937
|
+
<ref name="PureTextElement"/>
|
1938
|
+
</oneOrMore>
|
1939
|
+
</element>
|
1940
|
+
</define>
|
1894
1941
|
<define name="letter_symbol_designation">
|
1895
1942
|
<element name="letter-symbol">
|
1896
1943
|
<optional>
|
@@ -1942,11 +1989,15 @@
|
|
1942
1989
|
</optional>
|
1943
1990
|
<element name="name">
|
1944
1991
|
<zeroOrMore>
|
1945
|
-
<
|
1992
|
+
<choice>
|
1993
|
+
<ref name="PureTextElement"/>
|
1994
|
+
<ref name="stem"/>
|
1995
|
+
<ref name="index"/>
|
1996
|
+
</choice>
|
1946
1997
|
</zeroOrMore>
|
1947
1998
|
</element>
|
1948
1999
|
<optional>
|
1949
|
-
<element name="
|
2000
|
+
<element name="abbreviation-type">
|
1950
2001
|
<ref name="AbbreviationType"/>
|
1951
2002
|
</element>
|
1952
2003
|
</optional>
|
@@ -1956,7 +2007,7 @@
|
|
1956
2007
|
</element>
|
1957
2008
|
</optional>
|
1958
2009
|
<optional>
|
1959
|
-
<element name="
|
2010
|
+
<element name="grammar">
|
1960
2011
|
<ref name="Grammar"/>
|
1961
2012
|
</element>
|
1962
2013
|
</optional>
|
@@ -1983,6 +2034,11 @@
|
|
1983
2034
|
<ref name="GrammarGender"/>
|
1984
2035
|
</element>
|
1985
2036
|
</zeroOrMore>
|
2037
|
+
<zeroOrMore>
|
2038
|
+
<element name="number">
|
2039
|
+
<ref name="GrammarNumber"/>
|
2040
|
+
</element>
|
2041
|
+
</zeroOrMore>
|
1986
2042
|
<optional>
|
1987
2043
|
<element name="isPreposition">
|
1988
2044
|
<data type="boolean"/>
|
@@ -2014,7 +2070,7 @@
|
|
2014
2070
|
</element>
|
2015
2071
|
</optional>
|
2016
2072
|
<zeroOrMore>
|
2017
|
-
<element name="
|
2073
|
+
<element name="grammar-value">
|
2018
2074
|
<text/>
|
2019
2075
|
</element>
|
2020
2076
|
</zeroOrMore>
|
@@ -2027,6 +2083,13 @@
|
|
2027
2083
|
<value>common</value>
|
2028
2084
|
</choice>
|
2029
2085
|
</define>
|
2086
|
+
<define name="GrammarNumber">
|
2087
|
+
<choice>
|
2088
|
+
<value>singular</value>
|
2089
|
+
<value>dual</value>
|
2090
|
+
<value>plural</value>
|
2091
|
+
</choice>
|
2092
|
+
</define>
|
2030
2093
|
<define name="termdomain">
|
2031
2094
|
<element name="domain">
|
2032
2095
|
<oneOrMore>
|
@@ -2041,13 +2104,6 @@
|
|
2041
2104
|
</oneOrMore>
|
2042
2105
|
</element>
|
2043
2106
|
</define>
|
2044
|
-
<define name="termusage">
|
2045
|
-
<element name="usageinfo">
|
2046
|
-
<oneOrMore>
|
2047
|
-
<ref name="BasicBlock"/>
|
2048
|
-
</oneOrMore>
|
2049
|
-
</element>
|
2050
|
-
</define>
|
2051
2107
|
<define name="termdefinition">
|
2052
2108
|
<element name="definition">
|
2053
2109
|
<choice>
|
@@ -2061,9 +2117,17 @@
|
|
2061
2117
|
</element>
|
2062
2118
|
</define>
|
2063
2119
|
<define name="verbaldefinition">
|
2064
|
-
<element name="
|
2120
|
+
<element name="verbal-definition">
|
2065
2121
|
<oneOrMore>
|
2066
|
-
<
|
2122
|
+
<choice>
|
2123
|
+
<ref name="paragraph"/>
|
2124
|
+
<ref name="dl"/>
|
2125
|
+
<ref name="ol"/>
|
2126
|
+
<ref name="ul"/>
|
2127
|
+
<ref name="table"/>
|
2128
|
+
<ref name="figure"/>
|
2129
|
+
<ref name="formula"/>
|
2130
|
+
</choice>
|
2067
2131
|
</oneOrMore>
|
2068
2132
|
<zeroOrMore>
|
2069
2133
|
<ref name="termsource"/>
|
@@ -2071,7 +2135,7 @@
|
|
2071
2135
|
</element>
|
2072
2136
|
</define>
|
2073
2137
|
<define name="nonverbalrep">
|
2074
|
-
<element name="
|
2138
|
+
<element name="non-verbal-representation">
|
2075
2139
|
<oneOrMore>
|
2076
2140
|
<choice>
|
2077
2141
|
<ref name="table"/>
|
@@ -2163,6 +2227,12 @@
|
|
2163
2227
|
<value>modified</value>
|
2164
2228
|
</choice>
|
2165
2229
|
</attribute>
|
2230
|
+
<attribute name="type">
|
2231
|
+
<choice>
|
2232
|
+
<value>authoritative</value>
|
2233
|
+
<value>lineage</value>
|
2234
|
+
</choice>
|
2235
|
+
</attribute>
|
2166
2236
|
<ref name="origin"/>
|
2167
2237
|
<optional>
|
2168
2238
|
<ref name="modification"/>
|
@@ -2480,4 +2550,17 @@
|
|
2480
2550
|
</oneOrMore>
|
2481
2551
|
</element>
|
2482
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>
|
2483
2566
|
</grammar>
|
File without changes
|
File without changes
|
data/lib/metanorma/generic.rb
CHANGED
@@ -3,8 +3,9 @@ require "metanorma/generic/version"
|
|
3
3
|
require "forwardable"
|
4
4
|
require "yaml"
|
5
5
|
|
6
|
+
|
6
7
|
module Metanorma
|
7
|
-
module Generic
|
8
|
+
module Generic # rubocop:disable Style/MutableConstant
|
8
9
|
ORGANIZATION_NAME_SHORT = "Acme"
|
9
10
|
ORGANIZATION_NAME_LONG = "Acme Corp."
|
10
11
|
DOCUMENT_NAMESPACE = "https://www.metanorma.org/ns/generic"
|
@@ -63,23 +64,10 @@ module Metanorma
|
|
63
64
|
].freeze
|
64
65
|
|
65
66
|
def filepath_attrs
|
66
|
-
%i[
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
logo_paths
|
71
|
-
header
|
72
|
-
htmlcoverpage
|
73
|
-
htmlintropage
|
74
|
-
htmlstylesheet
|
75
|
-
scripts
|
76
|
-
scripts_pdf
|
77
|
-
standardstylesheet
|
78
|
-
validate_rng_file
|
79
|
-
wordcoverpage
|
80
|
-
wordintropage
|
81
|
-
wordstylesheet
|
82
|
-
]
|
67
|
+
%i[i18nyaml boilerplate logo_path logo_paths header
|
68
|
+
htmlcoverpage htmlintropage htmlstylesheet scripts scripts_pdf
|
69
|
+
standardstylesheet validate_rng_file wordcoverpage wordintropage
|
70
|
+
wordstylesheet]
|
83
71
|
end
|
84
72
|
|
85
73
|
attr_accessor(*CONFIG_ATTRS)
|
@@ -88,7 +76,7 @@ module Metanorma
|
|
88
76
|
attr_accessor :_file
|
89
77
|
end
|
90
78
|
|
91
|
-
def self.inherited(klass)
|
79
|
+
def self.inherited(klass) # rubocop:disable Lint/MissingSuper
|
92
80
|
klass._file = caller_locations(1..1).first.absolute_path
|
93
81
|
end
|
94
82
|
|
@@ -115,7 +103,8 @@ module Metanorma
|
|
115
103
|
|
116
104
|
def set_default_values_from_yaml_file(config_file)
|
117
105
|
root_path = File.dirname(self.class::_file || __FILE__)
|
118
|
-
default_config_options =
|
106
|
+
default_config_options =
|
107
|
+
YAML.safe_load(File.read(config_file, encoding: "UTF-8"))
|
119
108
|
if default_config_options["doctypes"].is_a? Array
|
120
109
|
default_config_options["doctypes"] =
|
121
110
|
default_config_options["doctypes"].each_with_object({}) do |k, m|
|
@@ -133,7 +122,7 @@ module Metanorma
|
|
133
122
|
end
|
134
123
|
|
135
124
|
def blank?(val)
|
136
|
-
val.nil? || val.respond_to?(:empty?) && val.empty?
|
125
|
+
val.nil? || (val.respond_to?(:empty?) && val.empty?)
|
137
126
|
end
|
138
127
|
|
139
128
|
def absolute_path(value, root_path)
|
data/lib/metanorma-generic.rb
CHANGED
data/metanorma-generic.gemspec
CHANGED
@@ -27,10 +27,10 @@ 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", "~>
|
30
|
+
spec.add_dependency "metanorma-standoc", "~> 2.0.0"
|
31
31
|
spec.add_dependency "ruby-jing"
|
32
32
|
|
33
|
-
spec.add_development_dependency "
|
33
|
+
spec.add_development_dependency "debug"
|
34
34
|
spec.add_development_dependency "equivalent-xml", "~> 0.6"
|
35
35
|
spec.add_development_dependency "guard", "~> 2.14"
|
36
36
|
spec.add_development_dependency "guard-rspec", "~> 4.7"
|
data/metanorma.yml.example
CHANGED
@@ -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/
|
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
|