metanorma-generic 1.7.2 → 1.9.0
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 +4 -4
- data/.github/workflows/rake.yml +29 -8
- data/README.adoc +1 -3
- data/lib/asciidoctor/generic/basicdoc.rng +52 -3
- data/lib/asciidoctor/generic/converter.rb +6 -4
- data/lib/asciidoctor/generic/front.rb +6 -1
- data/lib/asciidoctor/generic/isodoc.rng +64 -3
- data/lib/isodoc/generic/base_convert.rb +0 -8
- data/lib/isodoc/generic/html_convert.rb +9 -11
- data/lib/isodoc/generic/metadata.rb +7 -0
- data/lib/isodoc/generic/pdf_convert.rb +4 -4
- data/lib/isodoc/generic/utils.rb +3 -1
- data/lib/isodoc/generic/word_convert.rb +9 -11
- data/lib/metanorma/generic.rb +63 -1
- data/lib/metanorma/generic/fonts_manifest.yaml +5 -0
- data/lib/metanorma/generic/processor.rb +0 -15
- data/lib/metanorma/generic/version.rb +1 -1
- data/metanorma-generic.gemspec +2 -2
- data/metanorma.yml.example +8 -0
- metadata +7 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e582ecd8d43de406e8186a479152cf628582ffae80dc6f5430d1e11285457224
|
4
|
+
data.tar.gz: 3bbfbb2e35eee67d57135da7c4f53426ed25c45e9c665300fbfcacf9a506dff8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0edb8842be7662c773da294789c4fd0ce1c8d4b6efa653098bf220a3296dd889abf3348bcf77cd215fab4c6b8b28828c55cab82c1ed1033c79738f435f6f9f11
|
7
|
+
data.tar.gz: 30938a4bc5b6e60ebcb7e725a327d69baf0bab6a9694441792a176d7492a64953d0976159471fe6809564097cc8dc622171122e53c5ee77af1a5a3421d869960
|
data/.github/workflows/rake.yml
CHANGED
@@ -4,7 +4,8 @@ name: rake
|
|
4
4
|
|
5
5
|
on:
|
6
6
|
push:
|
7
|
-
branches: [ master ]
|
7
|
+
branches: [ master, main ]
|
8
|
+
tags: [ v* ]
|
8
9
|
pull_request:
|
9
10
|
|
10
11
|
jobs:
|
@@ -31,14 +32,34 @@ jobs:
|
|
31
32
|
steps:
|
32
33
|
- uses: actions/checkout@master
|
33
34
|
|
34
|
-
-
|
35
|
-
uses: ruby/setup-ruby@v1
|
35
|
+
- uses: ruby/setup-ruby@v1
|
36
36
|
with:
|
37
37
|
ruby-version: ${{ matrix.ruby }}
|
38
|
-
bundler-cache: true
|
39
38
|
|
40
|
-
-
|
41
|
-
run:
|
39
|
+
- if: matrix.os == 'macos-latest'
|
40
|
+
run: brew install autoconf automake libtool
|
42
41
|
|
43
|
-
-
|
44
|
-
|
42
|
+
- uses: actions/cache@v2
|
43
|
+
with:
|
44
|
+
path: vendor/bundle
|
45
|
+
key: bundle-${{ matrix.os }}-${{ matrix.ruby }}-${{ hashFiles('**/*.gemspec') }}
|
46
|
+
restore-keys: bundle-${{ matrix.os }}-${{ matrix.ruby }}
|
47
|
+
|
48
|
+
- run: bundle config set path 'vendor/bundle'
|
49
|
+
|
50
|
+
- run: bundle install --jobs 4 --retry 3
|
51
|
+
|
52
|
+
- run: bundle exec rake
|
53
|
+
|
54
|
+
tests-passed:
|
55
|
+
needs: rake
|
56
|
+
runs-on: ubuntu-latest
|
57
|
+
steps:
|
58
|
+
- name: Trigger tests passed event
|
59
|
+
uses: Sibz/github-status-action@v1
|
60
|
+
with:
|
61
|
+
authToken: ${{ secrets.METANORMA_CI_PAT_TOKEN || secrets.GITHUB_TOKEN }}
|
62
|
+
context: 'tests-passed-successfully'
|
63
|
+
description: 'Tests passed successfully'
|
64
|
+
state: 'success'
|
65
|
+
sha: ${{ github.event.pull_request.head.sha || github.sha }}
|
data/README.adoc
CHANGED
@@ -3,9 +3,7 @@
|
|
3
3
|
Formerly known as metanorma-acme
|
4
4
|
|
5
5
|
image:https://img.shields.io/gem/v/metanorma-generic.svg["Gem Version", link="https://rubygems.org/gems/metanorma-generic"]
|
6
|
-
image:https://github.com/metanorma/metanorma-generic/workflows/
|
7
|
-
image:https://github.com/metanorma/metanorma-generic/workflows/ubuntu/badge.svg["Build Status (ubuntu)", link="https://github.com/metanorma/metanorma-generic/actions?workflow=ubuntu"]
|
8
|
-
image:https://github.com/metanorma/metanorma-generic/workflows/windows/badge.svg["Build Status (Windows)", link="https://github.com/metanorma/metanorma-generic/actions?workflow=windows"]
|
6
|
+
image:https://github.com/metanorma/metanorma-generic/workflows/rake/badge.svg["Build Status", link="https://github.com/metanorma/metanorma-generic/actions?workflow=rake"]
|
9
7
|
image:https://codeclimate.com/github/metanorma/metanorma-acme/badges/gpa.svg["Code Climate", link="https://codeclimate.com/github/metanorma/metanorma-acme"]
|
10
8
|
image:https://img.shields.io/github/issues-pr-raw/metanorma/metanorma-generic.svg["Pull Requests", link="https://github.com/metanorma/metanorma-generic/pulls"]
|
11
9
|
image:https://img.shields.io/github/commits-since/metanorma/metanorma-generic/latest.svg["Commits since latest",link="https://github.com/metanorma/metanorma-generic/releases"]
|
@@ -596,6 +596,7 @@
|
|
596
596
|
<ref name="bookmark"/>
|
597
597
|
<ref name="image"/>
|
598
598
|
<ref name="index"/>
|
599
|
+
<ref name="index-xref"/>
|
599
600
|
</choice>
|
600
601
|
</define>
|
601
602
|
<define name="PureTextElement">
|
@@ -728,13 +729,61 @@
|
|
728
729
|
</define>
|
729
730
|
<define name="index">
|
730
731
|
<element name="index">
|
731
|
-
<attribute name="primary"/>
|
732
732
|
<optional>
|
733
|
-
<attribute name="
|
733
|
+
<attribute name="to">
|
734
|
+
<data type="IDREF"/>
|
735
|
+
</attribute>
|
736
|
+
</optional>
|
737
|
+
<element name="primary">
|
738
|
+
<oneOrMore>
|
739
|
+
<ref name="PureTextElement"/>
|
740
|
+
</oneOrMore>
|
741
|
+
</element>
|
742
|
+
<optional>
|
743
|
+
<element name="secondary">
|
744
|
+
<oneOrMore>
|
745
|
+
<ref name="PureTextElement"/>
|
746
|
+
</oneOrMore>
|
747
|
+
</element>
|
748
|
+
</optional>
|
749
|
+
<optional>
|
750
|
+
<element name="tertiary">
|
751
|
+
<oneOrMore>
|
752
|
+
<ref name="PureTextElement"/>
|
753
|
+
</oneOrMore>
|
754
|
+
</element>
|
755
|
+
</optional>
|
756
|
+
</element>
|
757
|
+
</define>
|
758
|
+
<define name="index-xref">
|
759
|
+
<element name="index-xref">
|
760
|
+
<attribute name="also">
|
761
|
+
<data type="boolean"/>
|
762
|
+
</attribute>
|
763
|
+
<element name="primary">
|
764
|
+
<oneOrMore>
|
765
|
+
<ref name="PureTextElement"/>
|
766
|
+
</oneOrMore>
|
767
|
+
</element>
|
768
|
+
<optional>
|
769
|
+
<element name="secondary">
|
770
|
+
<oneOrMore>
|
771
|
+
<ref name="PureTextElement"/>
|
772
|
+
</oneOrMore>
|
773
|
+
</element>
|
734
774
|
</optional>
|
735
775
|
<optional>
|
736
|
-
<
|
776
|
+
<element name="tertiary">
|
777
|
+
<oneOrMore>
|
778
|
+
<ref name="PureTextElement"/>
|
779
|
+
</oneOrMore>
|
780
|
+
</element>
|
737
781
|
</optional>
|
782
|
+
<element name="target">
|
783
|
+
<oneOrMore>
|
784
|
+
<ref name="PureTextElement"/>
|
785
|
+
</oneOrMore>
|
786
|
+
</element>
|
738
787
|
</element>
|
739
788
|
</define>
|
740
789
|
<!-- bare ID element, used for referencing arbitrary spans of text -->
|
@@ -21,6 +21,7 @@ module Asciidoctor
|
|
21
21
|
|
22
22
|
def baselocation(loc)
|
23
23
|
return nil if loc.nil?
|
24
|
+
return loc
|
24
25
|
File.expand_path(File.join(File.dirname(
|
25
26
|
self.class::_file || __FILE__), "..", "..", "..", loc))
|
26
27
|
end
|
@@ -35,10 +36,11 @@ module Asciidoctor
|
|
35
36
|
|
36
37
|
def doctype(node)
|
37
38
|
d = super
|
38
|
-
configuration.doctypes or return d == "article" ?
|
39
|
+
configuration.doctypes or return d == "article" ?
|
40
|
+
(configuration.default_doctype || "standard") : d
|
39
41
|
type = configuration.default_doctype ||
|
40
|
-
|
41
|
-
unless
|
42
|
+
configuration.doctypes.keys.dig(0) || "standard"
|
43
|
+
unless configuration.doctypes.keys.include? d
|
42
44
|
@log.add("Document Attributes", nil,
|
43
45
|
"#{d} is not a legal document type: reverting to '#{type}'")
|
44
46
|
d = type
|
@@ -148,7 +150,7 @@ module Asciidoctor
|
|
148
150
|
def boilerplate_isodoc(xmldoc)
|
149
151
|
conv = super
|
150
152
|
Metanorma::Generic::Configuration::CONFIG_ATTRS.each do |a|
|
151
|
-
conv.
|
153
|
+
conv.meta.set(a, configuration.send(a))
|
152
154
|
end
|
153
155
|
conv
|
154
156
|
end
|
@@ -63,13 +63,18 @@ module Asciidoctor
|
|
63
63
|
end
|
64
64
|
end
|
65
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
|
+
|
66
71
|
EXT_STRUCT = %w(_output _attribute _list).freeze
|
67
72
|
|
68
73
|
def metadata_ext_hash(node, ext, hash)
|
69
74
|
hash.each do |k, v|
|
70
75
|
next if EXT_STRUCT.include?(k) || !v&.is_a?(Hash) && !node.attr(k)
|
71
76
|
if v&.is_a?(Hash) && v["_list"]
|
72
|
-
csv_split(node.attr(k)).each do |val|
|
77
|
+
csv_split(node.attr(k), ",").each do |val|
|
73
78
|
metadata_ext_hash1(k, val, ext, v, node)
|
74
79
|
end
|
75
80
|
else
|
@@ -24,6 +24,14 @@
|
|
24
24
|
<start>
|
25
25
|
<ref name="standard-document"/>
|
26
26
|
</start>
|
27
|
+
<define name="doctype">
|
28
|
+
<element name="doctype">
|
29
|
+
<optional>
|
30
|
+
<attribute name="abbreviation"/>
|
31
|
+
</optional>
|
32
|
+
<ref name="DocumentType"/>
|
33
|
+
</element>
|
34
|
+
</define>
|
27
35
|
<define name="hyperlink">
|
28
36
|
<element name="link">
|
29
37
|
<attribute name="target">
|
@@ -47,6 +55,13 @@
|
|
47
55
|
<param name="pattern">\i\c*|\c+#\c+</param>
|
48
56
|
</data>
|
49
57
|
</attribute>
|
58
|
+
<optional>
|
59
|
+
<attribute name="to">
|
60
|
+
<data type="string">
|
61
|
+
<param name="pattern">\i\c*|\c+#\c+</param>
|
62
|
+
</data>
|
63
|
+
</attribute>
|
64
|
+
</optional>
|
50
65
|
<optional>
|
51
66
|
<attribute name="type">
|
52
67
|
<ref name="ReferenceFormat"/>
|
@@ -141,6 +156,11 @@
|
|
141
156
|
<data type="boolean"/>
|
142
157
|
</attribute>
|
143
158
|
</optional>
|
159
|
+
<optional>
|
160
|
+
<attribute name="key">
|
161
|
+
<data type="boolean"/>
|
162
|
+
</attribute>
|
163
|
+
</optional>
|
144
164
|
<oneOrMore>
|
145
165
|
<ref name="dt"/>
|
146
166
|
<ref name="dd"/>
|
@@ -233,6 +253,12 @@
|
|
233
253
|
<data type="boolean"/>
|
234
254
|
</attribute>
|
235
255
|
</optional>
|
256
|
+
<optional>
|
257
|
+
<attribute name="width"/>
|
258
|
+
</optional>
|
259
|
+
<optional>
|
260
|
+
<ref name="colgroup"/>
|
261
|
+
</optional>
|
236
262
|
<optional>
|
237
263
|
<ref name="tname"/>
|
238
264
|
</optional>
|
@@ -751,6 +777,21 @@
|
|
751
777
|
</define>
|
752
778
|
</include>
|
753
779
|
<!-- end overrides -->
|
780
|
+
<define name="colgroup">
|
781
|
+
<element name="colgroup">
|
782
|
+
<oneOrMore>
|
783
|
+
<ref name="col"/>
|
784
|
+
</oneOrMore>
|
785
|
+
</element>
|
786
|
+
</define>
|
787
|
+
<define name="col">
|
788
|
+
<element name="col">
|
789
|
+
<attribute name="width"/>
|
790
|
+
</element>
|
791
|
+
</define>
|
792
|
+
<define name="BibItemType" combine="choice">
|
793
|
+
<value>internal</value>
|
794
|
+
</define>
|
754
795
|
<define name="TextElement" combine="choice">
|
755
796
|
<ref name="concept"/>
|
756
797
|
</define>
|
@@ -801,6 +842,9 @@
|
|
801
842
|
<data type="boolean"/>
|
802
843
|
</attribute>
|
803
844
|
</optional>
|
845
|
+
<optional>
|
846
|
+
<attribute name="number"/>
|
847
|
+
</optional>
|
804
848
|
<optional>
|
805
849
|
<attribute name="obligation">
|
806
850
|
<choice>
|
@@ -856,9 +900,11 @@
|
|
856
900
|
<element name="code">
|
857
901
|
<text/>
|
858
902
|
</element>
|
859
|
-
<
|
860
|
-
<text
|
861
|
-
|
903
|
+
<optional>
|
904
|
+
<element name="text">
|
905
|
+
<text/>
|
906
|
+
</element>
|
907
|
+
</optional>
|
862
908
|
</element>
|
863
909
|
</define>
|
864
910
|
<define name="standard-document">
|
@@ -1028,6 +1074,9 @@
|
|
1028
1074
|
</choice>
|
1029
1075
|
</attribute>
|
1030
1076
|
</optional>
|
1077
|
+
<optional>
|
1078
|
+
<attribute name="number"/>
|
1079
|
+
</optional>
|
1031
1080
|
<optional>
|
1032
1081
|
<attribute name="type"/>
|
1033
1082
|
</optional>
|
@@ -1081,6 +1130,9 @@
|
|
1081
1130
|
<optional>
|
1082
1131
|
<attribute name="type"/>
|
1083
1132
|
</optional>
|
1133
|
+
<optional>
|
1134
|
+
<attribute name="number"/>
|
1135
|
+
</optional>
|
1084
1136
|
<optional>
|
1085
1137
|
<ref name="section-title"/>
|
1086
1138
|
</optional>
|
@@ -1183,6 +1235,9 @@
|
|
1183
1235
|
<optional>
|
1184
1236
|
<attribute name="type"/>
|
1185
1237
|
</optional>
|
1238
|
+
<optional>
|
1239
|
+
<attribute name="number"/>
|
1240
|
+
</optional>
|
1186
1241
|
<optional>
|
1187
1242
|
<attribute name="obligation">
|
1188
1243
|
<choice>
|
@@ -1511,6 +1566,7 @@
|
|
1511
1566
|
<value>add</value>
|
1512
1567
|
<value>modify</value>
|
1513
1568
|
<value>delete</value>
|
1569
|
+
<value>replace</value>
|
1514
1570
|
</choice>
|
1515
1571
|
</attribute>
|
1516
1572
|
<optional>
|
@@ -1541,6 +1597,11 @@
|
|
1541
1597
|
</optional>
|
1542
1598
|
<optional>
|
1543
1599
|
<element name="newcontent">
|
1600
|
+
<optional>
|
1601
|
+
<attribute name="id">
|
1602
|
+
<data type="ID"/>
|
1603
|
+
</attribute>
|
1604
|
+
</optional>
|
1544
1605
|
<zeroOrMore>
|
1545
1606
|
<ref name="BasicBlock"/>
|
1546
1607
|
</zeroOrMore>
|
@@ -4,14 +4,6 @@ require "fileutils"
|
|
4
4
|
module IsoDoc
|
5
5
|
module Generic
|
6
6
|
module BaseConvert
|
7
|
-
=begin
|
8
|
-
def baselocation(loc)
|
9
|
-
return nil if loc.nil?
|
10
|
-
File.expand_path(File.join(
|
11
|
-
File.dirname(self.class::_file || __FILE__), "..", "..", "..", loc))
|
12
|
-
end
|
13
|
-
=end
|
14
|
-
|
15
7
|
def cleanup(docxml)
|
16
8
|
super
|
17
9
|
term_cleanup(docxml)
|
@@ -25,15 +25,19 @@ module IsoDoc
|
|
25
25
|
def default_fonts(options)
|
26
26
|
{
|
27
27
|
bodyfont: (
|
28
|
-
options[:script] == "Hans" ? '"
|
28
|
+
options[:script] == "Hans" ? '"Source Han Sans",serif' :
|
29
29
|
configuration.html_bodyfont || '"Overpass",sans-serif'
|
30
30
|
),
|
31
31
|
headerfont: (
|
32
|
-
options[:script] == "Hans" ? '"
|
32
|
+
options[:script] == "Hans" ? '"Source Han Sans",sans-serif' :
|
33
33
|
configuration.html_headerfont || '"Overpass",sans-serif'
|
34
34
|
),
|
35
|
-
monospacefont: configuration.html_monospacefont || '"Space Mono",monospace'
|
36
|
-
|
35
|
+
monospacefont: configuration.html_monospacefont || '"Space Mono",monospace',
|
36
|
+
normalfontsize: configuration.html_normalfontsize,
|
37
|
+
smallerfontsize: configuration.html_smallerfontsize,
|
38
|
+
footnotefontsize: configuration.html_footnotefontsize,
|
39
|
+
monospacefontsize: configuration.html_monospacefontsize,
|
40
|
+
}.transform_values { |v| v&.empty? ? nil : v }
|
37
41
|
end
|
38
42
|
|
39
43
|
def default_file_locations(_options)
|
@@ -48,15 +52,9 @@ module IsoDoc
|
|
48
52
|
html_doc_path("scripts.html"),
|
49
53
|
i18nyaml: (configuration.i18nyaml.is_a?(String) ?
|
50
54
|
baselocation(configuration.i18nyaml) : nil)
|
51
|
-
}
|
55
|
+
}.transform_values { |v| v&.empty? ? nil : v }
|
52
56
|
end
|
53
57
|
|
54
|
-
=begin
|
55
|
-
def configuration
|
56
|
-
Metanorma::Generic.configuration
|
57
|
-
end
|
58
|
-
=end
|
59
|
-
|
60
58
|
def googlefonts
|
61
59
|
return unless configuration.webfont
|
62
60
|
Array(configuration.webfont).map do |x|
|
@@ -63,6 +63,13 @@ module IsoDoc
|
|
63
63
|
!(Array(stages).map { |m| m.downcase }.include? status.downcase)
|
64
64
|
end
|
65
65
|
|
66
|
+
def doctype(isoxml, _out)
|
67
|
+
super
|
68
|
+
b = isoxml&.at(ns("//bibdata/ext/doctype#{currlang}")) ||
|
69
|
+
isoxml&.at(ns("//bibdata/ext/doctype#{NOLANG}")) || return
|
70
|
+
a = b["abbreviation"] and set(:doctype_abbr, a)
|
71
|
+
end
|
72
|
+
|
66
73
|
def xmlhash2hash(h)
|
67
74
|
ret = {}
|
68
75
|
return ret if h.nil? || h[:kind] != "element"
|
@@ -22,12 +22,12 @@ module IsoDoc
|
|
22
22
|
|
23
23
|
def default_fonts(options)
|
24
24
|
{
|
25
|
-
bodyfont: (options[:script] == "Hans" ? '"
|
25
|
+
bodyfont: (options[:script] == "Hans" ? '"Source Han Sans",serif'
|
26
26
|
: configuration.html_bodyfont || '"Overpass",sans-serif'),
|
27
|
-
headerfont: (options[:script] == "Hans" ? '"
|
27
|
+
headerfont: (options[:script] == "Hans" ? '"Source Han Sans",sans-serif' :
|
28
28
|
configuration.html_headerfont || '"Overpass",sans-serif'),
|
29
29
|
monospacefont: configuration.html_monospacefont || '"Space Mono",monospace'
|
30
|
-
}
|
30
|
+
}.transform_values { |v| v&.empty? ? nil : v }
|
31
31
|
end
|
32
32
|
|
33
33
|
def default_file_locations(_options)
|
@@ -40,7 +40,7 @@ module IsoDoc
|
|
40
40
|
html_doc_path("html_generic_intro.html"),
|
41
41
|
scripts_pdf: baselocation(configuration.scripts_pdf) ||
|
42
42
|
html_doc_path("scripts.pdf.html")
|
43
|
-
}
|
43
|
+
}.transform_values { |v| v&.empty? ? nil : v }
|
44
44
|
end
|
45
45
|
|
46
46
|
def googlefonts
|
data/lib/isodoc/generic/utils.rb
CHANGED
@@ -9,8 +9,10 @@ module IsoDoc
|
|
9
9
|
File.join(File.dirname(__FILE__), loc)
|
10
10
|
end
|
11
11
|
|
12
|
-
|
12
|
+
def baselocation(loc)
|
13
13
|
return nil if loc.nil?
|
14
|
+
return "" if loc.empty?
|
15
|
+
return loc
|
14
16
|
f = defined?(self.class::_file) ? (self.class::_file || __FILE__) :
|
15
17
|
__FILE__
|
16
18
|
File.expand_path(File.join(
|
@@ -24,15 +24,19 @@ module IsoDoc
|
|
24
24
|
def default_fonts(options)
|
25
25
|
{
|
26
26
|
bodyfont: (
|
27
|
-
options[:script] == "Hans" ? '"
|
27
|
+
options[:script] == "Hans" ? '"Source Han Sans",serif' :
|
28
28
|
configuration.word_bodyfont || '"Arial",sans-serif'
|
29
29
|
),
|
30
30
|
headerfont: (
|
31
|
-
options[:script] == "Hans" ? '"
|
31
|
+
options[:script] == "Hans" ? '"Source Han Sans",sans-serif' :
|
32
32
|
configuration.word_headerfont || '"Arial",sans-serif'
|
33
33
|
),
|
34
|
-
monospacefont: configuration.word_monospacefont || '"Courier New",monospace'
|
35
|
-
|
34
|
+
monospacefont: configuration.word_monospacefont || '"Courier New",monospace',
|
35
|
+
normalfontsize: configuration.word_normalfontsize,
|
36
|
+
smallerfontsize: configuration.word_smallerfontsize,
|
37
|
+
footnotefontsize: configuration.word_footnotefontsize,
|
38
|
+
monospacefontsize: configuration.word_monospacefontsize,
|
39
|
+
}.transform_values { |v| v&.empty? ? nil : v }
|
36
40
|
end
|
37
41
|
|
38
42
|
def default_file_locations(options)
|
@@ -51,15 +55,9 @@ module IsoDoc
|
|
51
55
|
baselocation(configuration.i18nyaml) : nil),
|
52
56
|
ulstyle: "l3",
|
53
57
|
olstyle: "l2",
|
54
|
-
}
|
58
|
+
}.transform_values { |v| v&.empty? ? nil : v }
|
55
59
|
end
|
56
60
|
|
57
|
-
=begin
|
58
|
-
def configuration
|
59
|
-
Metanorma::Generic.configuration
|
60
|
-
end
|
61
|
-
=end
|
62
|
-
|
63
61
|
include BaseConvert
|
64
62
|
include Init
|
65
63
|
end
|
data/lib/metanorma/generic.rb
CHANGED
@@ -31,6 +31,10 @@ module Metanorma
|
|
31
31
|
html_bodyfont
|
32
32
|
html_headerfont
|
33
33
|
html_monospacefont
|
34
|
+
html_normalfontsize
|
35
|
+
html_monospacefontsize
|
36
|
+
html_smallerfontsize
|
37
|
+
html_footnotefontsize
|
34
38
|
metadata_extensions
|
35
39
|
metanorma_name
|
36
40
|
normref_titles
|
@@ -51,9 +55,33 @@ module Metanorma
|
|
51
55
|
word_bodyfont
|
52
56
|
word_headerfont
|
53
57
|
word_monospacefont
|
58
|
+
word_normalfontsize
|
59
|
+
word_monospacefontsize
|
60
|
+
word_smallerfontsize
|
61
|
+
word_footnotefontsize
|
54
62
|
xml_root_tag
|
55
63
|
].freeze
|
56
64
|
|
65
|
+
def filepath_attrs
|
66
|
+
return %i[
|
67
|
+
i18nyaml
|
68
|
+
boilerplate
|
69
|
+
logo_path
|
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
|
+
]
|
83
|
+
end
|
84
|
+
|
57
85
|
attr_accessor(*CONFIG_ATTRS)
|
58
86
|
|
59
87
|
class << self
|
@@ -84,13 +112,47 @@ module Metanorma
|
|
84
112
|
end
|
85
113
|
|
86
114
|
def set_default_values_from_yaml_file(config_file)
|
115
|
+
root_path = File.dirname(self.class::_file || __FILE__)
|
87
116
|
default_config_options = YAML.load(File.read(config_file))
|
117
|
+
if default_config_options["doctypes"]&.is_a? Array
|
118
|
+
default_config_options["doctypes"] = default_config_options["doctypes"].
|
119
|
+
each_with_object({}) { |k, m| m[k] = nil }
|
120
|
+
end
|
88
121
|
CONFIG_ATTRS.each do |attr_name|
|
89
|
-
|
122
|
+
value = default_config_options[attr_name.to_s]
|
123
|
+
if value && filepath_attrs.include?(attr_name)
|
124
|
+
value = absolute_path(value, root_path)
|
125
|
+
end
|
126
|
+
|
127
|
+
instance_variable_set("@#{attr_name}", value)
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
def blank?(v)
|
132
|
+
v.nil? || v.respond_to?(:empty?) && v.empty?
|
133
|
+
end
|
134
|
+
|
135
|
+
def absolute_path(value, root_path)
|
136
|
+
if value.is_a? Hash then absolute_path1(value, root_path)
|
137
|
+
elsif value.is_a? Array
|
138
|
+
value.reject { |a| blank?(a) }.each_with_object([]) do |v1, g|
|
139
|
+
g << absolute_path(v1, root_path)
|
140
|
+
end
|
141
|
+
elsif value.is_a?(String) && !value.empty?
|
142
|
+
File.join(root_path, "..", "..", value)
|
143
|
+
else
|
144
|
+
value
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
def absolute_path1(h, pref)
|
149
|
+
h.reject { |k, v| blank?(v) }.each_with_object({}) do |(k, v), g|
|
150
|
+
g[k] = absolute_path(v, pref)
|
90
151
|
end
|
91
152
|
end
|
92
153
|
end
|
93
154
|
|
155
|
+
|
94
156
|
class << self
|
95
157
|
extend Forwardable
|
96
158
|
|
@@ -2,21 +2,6 @@ require "metanorma/processor"
|
|
2
2
|
|
3
3
|
module Metanorma
|
4
4
|
module Generic
|
5
|
-
def self.fonts_used
|
6
|
-
{
|
7
|
-
html: [
|
8
|
-
configuration.html_bodyfont || "Overpass", configuration.html_headerfont || "Overpass",
|
9
|
-
configuration.html_monospacefont || "Space Mono"
|
10
|
-
].uniq,
|
11
|
-
doc: [
|
12
|
-
configuration.word_bodyfont || "Overpass", configuration.word_headerfont || "Overpass",
|
13
|
-
configuration.word_monospacefont || "Space Mono"].uniq,
|
14
|
-
pdf: [
|
15
|
-
configuration.word_bodyfont || "Overpass", configuration.word_headerfont || "Overpass",
|
16
|
-
configuration.word_monospacefont || "Space Mono"].uniq,
|
17
|
-
}
|
18
|
-
end
|
19
|
-
|
20
5
|
class Processor < Metanorma::Processor
|
21
6
|
def configuration
|
22
7
|
Metanorma::Generic.configuration
|
data/metanorma-generic.gemspec
CHANGED
@@ -28,8 +28,8 @@ Gem::Specification.new do |spec|
|
|
28
28
|
|
29
29
|
spec.add_dependency "htmlentities", "~> 4.3.4"
|
30
30
|
spec.add_dependency "ruby-jing"
|
31
|
-
spec.add_dependency "metanorma-standoc", "~> 1.
|
32
|
-
spec.add_dependency "isodoc", "~> 1.
|
31
|
+
spec.add_dependency "metanorma-standoc", "~> 1.8.0"
|
32
|
+
spec.add_dependency "isodoc", "~> 1.5.0"
|
33
33
|
|
34
34
|
spec.add_development_dependency "byebug", "~> 9.1"
|
35
35
|
spec.add_development_dependency "sassc", "2.4.0"
|
data/metanorma.yml.example
CHANGED
@@ -14,6 +14,10 @@ htmlstylesheet: /metanorma-mine/lib/isodoc/mine/html/htmlstyle.scss
|
|
14
14
|
html_bodyfont: '"Source Sans Pro",sans-serif'
|
15
15
|
html_headerfont: '"Source Sans Pro",sans-serif'
|
16
16
|
html_monospacefont: '"Source Code Pro",monospace'
|
17
|
+
html_normalfontsize: "1.0em"
|
18
|
+
html_monospacefontsize: "0.8em"
|
19
|
+
html_smallerfontsize: "0.9em"
|
20
|
+
html_footnotefontsize: "0.8em"
|
17
21
|
scripts: /metanorma-mine/lib/isodoc/mine/html/scripts.html
|
18
22
|
scripts_pdf: /metanorma-mine/lib/isodoc/mine/html/scripts.prd.html
|
19
23
|
standardstylesheet: /metanorma-mine/lib/isodoc/mine/html/
|
@@ -24,6 +28,10 @@ wordstylesheet: /metanorma-mine/lib/isodoc/mine/html/wordstyle.scss
|
|
24
28
|
word_bodyfont: '"Source Sans Pro","Arial",sans-serif'
|
25
29
|
word_headerfont: '"Source Sans Pro","Arial",sans-serif'
|
26
30
|
word_monospacefont: '"Source Code Pro",monospace'
|
31
|
+
word_normalfontsize: "12.0pt"
|
32
|
+
word_monospacefontsize: "11.0pt"
|
33
|
+
word_smallerfontsize: "10.0pt"
|
34
|
+
word_footnotefontsize: "9.0pt"
|
27
35
|
docid_template: "{{ organization_name_short }} {{ docnumeric }}"
|
28
36
|
metadata_extensions:
|
29
37
|
- security
|
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.
|
4
|
+
version: 1.9.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:
|
11
|
+
date: 2021-01-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: htmlentities
|
@@ -44,28 +44,28 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 1.
|
47
|
+
version: 1.8.0
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 1.
|
54
|
+
version: 1.8.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: isodoc
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 1.
|
61
|
+
version: 1.5.0
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 1.
|
68
|
+
version: 1.5.0
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: byebug
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -262,6 +262,7 @@ files:
|
|
262
262
|
- lib/isodoc/generic/xref.rb
|
263
263
|
- lib/metanorma-generic.rb
|
264
264
|
- lib/metanorma/generic.rb
|
265
|
+
- lib/metanorma/generic/fonts_manifest.yaml
|
265
266
|
- lib/metanorma/generic/processor.rb
|
266
267
|
- lib/metanorma/generic/version.rb
|
267
268
|
- metanorma-generic.gemspec
|