metanorma-generic 2.4.1 → 2.4.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/isodoc/generic/html/word_generic_intro.html +0 -3
- data/lib/isodoc/generic/metadata.rb +4 -1
- data/lib/isodoc/generic/utils.rb +8 -3
- data/lib/isodoc/generic/word_convert.rb +25 -18
- data/lib/metanorma/generic/converter.rb +10 -5
- data/lib/metanorma/generic/generic.rng +38 -4
- data/lib/metanorma/generic/isodoc.rng +16 -7
- data/lib/metanorma/generic/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 887490f8778fe098a195bdc2864f62a157779a0fff114b971e00729314ff0256
|
4
|
+
data.tar.gz: 43a57233fe44dca78b437cfc5b7b38208b25bb9f41ab0a70571c85baa8b6aa90
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f4c1a759d5b44ce75491e9aaa3a1608a815200cabb34c0ecc09e63d5a0f86f3429ff36e7b31b853ddddd7b8acb841abe378591dd03f6bc87eaffd7e2d7648d4d
|
7
|
+
data.tar.gz: a9e8da8406b04cb36db99d948dd2dd82c3bd69bdde02f1564b45248ed9fe5192cc16a8666c20112f9aded72f8b6edaa9ff3a129d7782b3e2da696864415031a1
|
@@ -11,7 +11,10 @@ class Nokogiri::XML::Node
|
|
11
11
|
h[:text] = text&.strip
|
12
12
|
a = attribute_nodes.map(&:to_hash)
|
13
13
|
if element? && !a.empty?
|
14
|
-
h[:attr] = a.inject({})
|
14
|
+
h[:attr] = a.inject({}) do |m, v|
|
15
|
+
m[v[:name]] = v[:text]
|
16
|
+
m
|
17
|
+
end
|
15
18
|
end
|
16
19
|
c = children.map(&:to_hash)
|
17
20
|
if element? && !(c&.size == 1 && c[0][:kind] == "text")
|
data/lib/isodoc/generic/utils.rb
CHANGED
@@ -12,11 +12,16 @@ module IsoDoc
|
|
12
12
|
def baselocation(loc)
|
13
13
|
return nil if loc.nil?
|
14
14
|
return "" if loc.empty?
|
15
|
+
|
15
16
|
return loc
|
16
|
-
f = defined?(self.class::_file)
|
17
|
-
|
17
|
+
f = if defined?(self.class::_file)
|
18
|
+
(self.class::_file || __FILE__)
|
19
|
+
else
|
20
|
+
__FILE__
|
21
|
+
end
|
18
22
|
File.expand_path(File.join(
|
19
|
-
|
23
|
+
File.dirname(f), "..", "..", "..", loc
|
24
|
+
))
|
20
25
|
end
|
21
26
|
end
|
22
27
|
end
|
@@ -17,44 +17,51 @@ module IsoDoc
|
|
17
17
|
attr_accessor :_file
|
18
18
|
end
|
19
19
|
|
20
|
-
def self.inherited(
|
21
|
-
k._file = caller_locations.first.absolute_path
|
20
|
+
def self.inherited(k)
|
21
|
+
k._file = caller_locations(1..1).first.absolute_path
|
22
22
|
end
|
23
23
|
|
24
24
|
def default_fonts(options)
|
25
25
|
{
|
26
26
|
bodyfont: (
|
27
|
-
options[:script] == "Hans"
|
28
|
-
|
27
|
+
if options[:script] == "Hans"
|
28
|
+
'"Source Han Sans",serif'
|
29
|
+
else
|
30
|
+
configuration.word_bodyfont || '"Arial",sans-serif'
|
31
|
+
end
|
29
32
|
),
|
30
33
|
headerfont: (
|
31
|
-
options[:script] == "Hans"
|
32
|
-
|
34
|
+
if options[:script] == "Hans"
|
35
|
+
'"Source Han Sans",sans-serif'
|
36
|
+
else
|
37
|
+
configuration.word_headerfont || '"Arial",sans-serif'
|
38
|
+
end
|
33
39
|
),
|
34
|
-
monospacefont:
|
40
|
+
monospacefont: configuration.word_monospacefont || '"Courier New",monospace',
|
35
41
|
normalfontsize: configuration.word_normalfontsize,
|
36
42
|
smallerfontsize: configuration.word_smallerfontsize,
|
37
43
|
footnotefontsize: configuration.word_footnotefontsize,
|
38
44
|
monospacefontsize: configuration.word_monospacefontsize,
|
39
|
-
}.transform_values { |v| v&.empty? ? nil : v
|
45
|
+
}.transform_values { |v| v&.empty? ? nil : v }
|
40
46
|
end
|
41
47
|
|
42
|
-
def default_file_locations(
|
48
|
+
def default_file_locations(_options)
|
43
49
|
{
|
44
50
|
wordstylesheet: baselocation(configuration.wordstylesheet) ||
|
45
|
-
|
51
|
+
html_doc_path("wordstyle.scss"),
|
46
52
|
standardstylesheet: baselocation(configuration.standardstylesheet) ||
|
47
|
-
|
53
|
+
html_doc_path("generic.scss"),
|
48
54
|
header: baselocation(configuration.header) ||
|
49
|
-
|
55
|
+
html_doc_path("header.html"),
|
50
56
|
wordcoverpage: baselocation(configuration.wordcoverpage) ||
|
51
|
-
|
57
|
+
html_doc_path("word_generic_titlepage.html"),
|
52
58
|
wordintropage: baselocation(configuration.wordintropage) ||
|
53
|
-
|
54
|
-
i18nyaml: (configuration.i18nyaml.is_a?(String)
|
55
|
-
|
56
|
-
|
57
|
-
|
59
|
+
html_doc_path("word_generic_intro.html"),
|
60
|
+
i18nyaml: (if configuration.i18nyaml.is_a?(String)
|
61
|
+
baselocation(configuration.i18nyaml)
|
62
|
+
end),
|
63
|
+
ulstyle: "l3",
|
64
|
+
olstyle: "l2",
|
58
65
|
}.transform_values { |v| v&.empty? ? nil : v }
|
59
66
|
end
|
60
67
|
|
@@ -39,12 +39,17 @@ module Metanorma
|
|
39
39
|
|
40
40
|
def doctype(node)
|
41
41
|
d = super
|
42
|
-
|
42
|
+
node.attr("doctype") == "article" and d = "article"
|
43
|
+
unless configuration.doctypes
|
44
|
+
d == "article" and return (configuration.default_doctype || "standard")
|
45
|
+
return d
|
46
|
+
end
|
43
47
|
type = configuration.default_doctype ||
|
44
|
-
configuration.doctypes.keys
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
+
configuration.doctypes.keys[0] || "standard"
|
49
|
+
if !configuration.doctypes.key?(d)
|
50
|
+
(node.attr("doctype") && node.attr("doctype") != "article") and # factory default
|
51
|
+
@log.add("Document Attributes", nil,
|
52
|
+
"#{d} is not a legal document type: reverting to '#{type}'")
|
48
53
|
d = type
|
49
54
|
end
|
50
55
|
d
|
@@ -1,7 +1,41 @@
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
-
<grammar ns=
|
3
|
-
<!--
|
2
|
+
<grammar ns='https://www.metanorma.org/ns/generic' xmlns="http://relaxng.org/ns/structure/1.0">
|
3
|
+
<!--
|
4
|
+
VERSION v1.2.1
|
5
|
+
Currently we inherit from a namespaced grammar, isostandard. Until we inherit from isodoc,
|
6
|
+
we cannot have a new default namespace: we will end up with a grammar with two different
|
7
|
+
namespaces, one for isostandard and one for csand additions. And we do not want that.
|
8
|
+
-->
|
4
9
|
<include href="biblio-standoc.rng"/>
|
5
|
-
<include href="isodoc.rng"
|
10
|
+
<include href="isodoc.rng">
|
11
|
+
<start>
|
12
|
+
<ref name="generic-standard"/>
|
13
|
+
</start>
|
14
|
+
</include>
|
15
|
+
<define name="generic-standard">
|
16
|
+
<element name="generic-standard">
|
17
|
+
<ref name="Root-Attributes"/>
|
18
|
+
<ref name="bibdata"/>
|
19
|
+
<zeroOrMore>
|
20
|
+
<ref name="termdocsource"/>
|
21
|
+
</zeroOrMore>
|
22
|
+
<optional>
|
23
|
+
<ref name="misccontainer"/>
|
24
|
+
</optional>
|
25
|
+
<optional>
|
26
|
+
<ref name="boilerplate"/>
|
27
|
+
</optional>
|
28
|
+
<ref name="preface"/>
|
29
|
+
<oneOrMore>
|
30
|
+
<ref name="sections"/>
|
31
|
+
</oneOrMore>
|
32
|
+
<zeroOrMore>
|
33
|
+
<ref name="annex"/>
|
34
|
+
</zeroOrMore>
|
35
|
+
<ref name="bibliography"/>
|
36
|
+
<zeroOrMore>
|
37
|
+
<ref name="indexsect"/>
|
38
|
+
</zeroOrMore>
|
39
|
+
</element>
|
40
|
+
</define>
|
6
41
|
</grammar>
|
7
|
-
<!-- end overrides -->
|
@@ -17,6 +17,7 @@
|
|
17
17
|
these elements; we just want one namespace for any child grammars
|
18
18
|
of this.
|
19
19
|
-->
|
20
|
+
<!-- VERSION v1.2.2 -->
|
20
21
|
<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">
|
21
22
|
<include href="reqt.rng"/>
|
22
23
|
<include href="basicdoc.rng">
|
@@ -210,6 +211,9 @@
|
|
210
211
|
<data type="boolean"/>
|
211
212
|
</attribute>
|
212
213
|
</optional>
|
214
|
+
<optional>
|
215
|
+
<attribute name="style"/>
|
216
|
+
</optional>
|
213
217
|
<ref name="CitationType"/>
|
214
218
|
<oneOrMore>
|
215
219
|
<ref name="PureTextElement"/>
|
@@ -1349,15 +1353,19 @@
|
|
1349
1353
|
</choice>
|
1350
1354
|
</element>
|
1351
1355
|
</define>
|
1356
|
+
<define name="Root-Attributes">
|
1357
|
+
<attribute name="version"/>
|
1358
|
+
<attribute name="schema-version"/>
|
1359
|
+
<attribute name="type">
|
1360
|
+
<choice>
|
1361
|
+
<value>semantic</value>
|
1362
|
+
<value>presentation</value>
|
1363
|
+
</choice>
|
1364
|
+
</attribute>
|
1365
|
+
</define>
|
1352
1366
|
<define name="standard-document">
|
1353
1367
|
<element name="standard-document">
|
1354
|
-
<
|
1355
|
-
<attribute name="type">
|
1356
|
-
<choice>
|
1357
|
-
<value>semantic</value>
|
1358
|
-
<value>presentation</value>
|
1359
|
-
</choice>
|
1360
|
-
</attribute>
|
1368
|
+
<ref name="Root-Attributes"/>
|
1361
1369
|
<ref name="bibdata"/>
|
1362
1370
|
<optional>
|
1363
1371
|
<ref name="misccontainer"/>
|
@@ -2131,6 +2139,7 @@
|
|
2131
2139
|
<choice>
|
2132
2140
|
<value>identical</value>
|
2133
2141
|
<value>modified</value>
|
2142
|
+
<value>adapted</value>
|
2134
2143
|
<value>restyled</value>
|
2135
2144
|
<value>context-added</value>
|
2136
2145
|
<value>generalisation</value>
|
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: 2.4.
|
4
|
+
version: 2.4.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-05-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: htmlentities
|