metanorma-generic 1.10.0 → 1.10.1
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 +12 -11
- data/.hound.yml +3 -1
- data/.rubocop.yml +4 -8
- data/lib/asciidoctor/generic/biblio.rng +1 -0
- data/lib/asciidoctor/generic/generic.rng +3 -0
- data/lib/asciidoctor/generic/isodoc.rng +191 -3
- data/lib/isodoc/generic/metadata.rb +26 -21
- data/lib/metanorma/generic/version.rb +1 -1
- data/metanorma-generic.gemspec +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2abd9ea291615c858aa8c77067cebedee925fa9c4644c4a30bfba0f7734e8098
|
4
|
+
data.tar.gz: 1125772c1f2479ae3d67786ff3bc20e64fde743f57322eae5c338d6631d0d144
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 82dec664f4a88d80f262810a945718ed15844270df5747a1fe7c31d6e26ce04a6c3963db1047ed1efb665175e820a0b1fb48dab3ee713d135eeec8ad2a969c56
|
7
|
+
data.tar.gz: e502ff1bcf7f2550395f8dc6bee4aa3a1d8ce9136a04228121e8b88fdff484ccdff28c87c3e7fb4bf525587c473301a0a5a7ed005f8b7508a33aa4b34a0b7f4a
|
data/.github/workflows/rake.yml
CHANGED
@@ -16,19 +16,9 @@ jobs:
|
|
16
16
|
strategy:
|
17
17
|
fail-fast: false
|
18
18
|
matrix:
|
19
|
-
ruby: [ '2.7', '2.6', '2.5', '2.4' ]
|
19
|
+
ruby: [ '3.0', '2.7', '2.6', '2.5', '2.4' ]
|
20
20
|
os: [ ubuntu-latest, windows-latest, macos-latest ]
|
21
21
|
experimental: [ false ]
|
22
|
-
include:
|
23
|
-
- ruby: '3.0'
|
24
|
-
os: 'ubuntu-latest'
|
25
|
-
experimental: true
|
26
|
-
- ruby: '3.0'
|
27
|
-
os: 'windows-latest'
|
28
|
-
experimental: true
|
29
|
-
- ruby: '3.0'
|
30
|
-
os: 'macos-latest'
|
31
|
-
experimental: true
|
32
22
|
steps:
|
33
23
|
- uses: actions/checkout@v2
|
34
24
|
with:
|
@@ -40,3 +30,14 @@ jobs:
|
|
40
30
|
bundler-cache: true
|
41
31
|
|
42
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 }}"}'
|
data/.hound.yml
CHANGED
data/.rubocop.yml
CHANGED
@@ -1,14 +1,10 @@
|
|
1
|
-
#
|
2
|
-
# https://github.com/
|
3
|
-
# All project-specific additions and overrides should be specified in this file.
|
1
|
+
# Auto-generated by Cimas: Do not edit it manually!
|
2
|
+
# See https://github.com/metanorma/cimas
|
4
3
|
inherit_from:
|
5
4
|
- https://raw.githubusercontent.com/riboseinc/oss-guides/master/ci/rubocop.yml
|
6
5
|
|
7
6
|
# local repo-specific modifications
|
7
|
+
# ...
|
8
8
|
|
9
9
|
AllCops:
|
10
|
-
|
11
|
-
StyleGuideCopsOnly: false
|
12
|
-
TargetRubyVersion: 2.4
|
13
|
-
Rails:
|
14
|
-
Enabled: true
|
10
|
+
TargetRubyVersion: 2.5
|
@@ -45,6 +45,11 @@
|
|
45
45
|
<optional>
|
46
46
|
<attribute name="alt"/>
|
47
47
|
</optional>
|
48
|
+
<optional>
|
49
|
+
<attribute name="updatetype">
|
50
|
+
<data type="boolean"/>
|
51
|
+
</attribute>
|
52
|
+
</optional>
|
48
53
|
<text/>
|
49
54
|
</element>
|
50
55
|
</define>
|
@@ -543,6 +548,9 @@
|
|
543
548
|
</define>
|
544
549
|
<define name="BibDataExtensionType">
|
545
550
|
<ref name="doctype"/>
|
551
|
+
<optional>
|
552
|
+
<ref name="docsubtype"/>
|
553
|
+
</optional>
|
546
554
|
<optional>
|
547
555
|
<ref name="editorialgroup"/>
|
548
556
|
</optional>
|
@@ -876,8 +884,28 @@
|
|
876
884
|
</zeroOrMore>
|
877
885
|
</element>
|
878
886
|
</define>
|
887
|
+
<define name="pagebreak">
|
888
|
+
<element name="pagebreak">
|
889
|
+
<optional>
|
890
|
+
<attribute name="orientation">
|
891
|
+
<choice>
|
892
|
+
<value>landscape</value>
|
893
|
+
<value>portrait</value>
|
894
|
+
</choice>
|
895
|
+
</attribute>
|
896
|
+
</optional>
|
897
|
+
</element>
|
898
|
+
</define>
|
879
899
|
</include>
|
880
900
|
<!-- end overrides -->
|
901
|
+
<define name="docsubtype">
|
902
|
+
<element name="docsubtype">
|
903
|
+
<ref name="DocumentSubtype"/>
|
904
|
+
</element>
|
905
|
+
</define>
|
906
|
+
<define name="DocumentSubtype">
|
907
|
+
<text/>
|
908
|
+
</define>
|
881
909
|
<define name="colgroup">
|
882
910
|
<element name="colgroup">
|
883
911
|
<oneOrMore>
|
@@ -943,8 +971,170 @@
|
|
943
971
|
<ref name="permission"/>
|
944
972
|
<ref name="imagemap"/>
|
945
973
|
<ref name="svgmap"/>
|
974
|
+
<ref name="inputform"/>
|
975
|
+
</choice>
|
976
|
+
</define>
|
977
|
+
<define name="inputform">
|
978
|
+
<element name="form">
|
979
|
+
<attribute name="id">
|
980
|
+
<data type="ID"/>
|
981
|
+
</attribute>
|
982
|
+
<attribute name="name"/>
|
983
|
+
<attribute name="action"/>
|
984
|
+
<zeroOrMore>
|
985
|
+
<choice>
|
986
|
+
<ref name="TextElement"/>
|
987
|
+
<ref name="FormInput"/>
|
988
|
+
</choice>
|
989
|
+
</zeroOrMore>
|
990
|
+
</element>
|
991
|
+
</define>
|
992
|
+
<define name="FormInput">
|
993
|
+
<choice>
|
994
|
+
<ref name="input"/>
|
995
|
+
<ref name="formlabel"/>
|
996
|
+
<ref name="select"/>
|
997
|
+
<ref name="textarea"/>
|
998
|
+
</choice>
|
999
|
+
</define>
|
1000
|
+
<define name="InputType">
|
1001
|
+
<choice>
|
1002
|
+
<value>button</value>
|
1003
|
+
<value>checkbox</value>
|
1004
|
+
<value>date</value>
|
1005
|
+
<value>file</value>
|
1006
|
+
<value>password</value>
|
1007
|
+
<value>radio</value>
|
1008
|
+
<value>submit</value>
|
1009
|
+
<value>text</value>
|
946
1010
|
</choice>
|
947
1011
|
</define>
|
1012
|
+
<define name="input">
|
1013
|
+
<element name="input">
|
1014
|
+
<attribute name="type">
|
1015
|
+
<ref name="InputType"/>
|
1016
|
+
</attribute>
|
1017
|
+
<optional>
|
1018
|
+
<attribute name="checked">
|
1019
|
+
<data type="boolean"/>
|
1020
|
+
</attribute>
|
1021
|
+
</optional>
|
1022
|
+
<optional>
|
1023
|
+
<attribute name="disabled">
|
1024
|
+
<data type="boolean"/>
|
1025
|
+
</attribute>
|
1026
|
+
</optional>
|
1027
|
+
<optional>
|
1028
|
+
<attribute name="readonly">
|
1029
|
+
<data type="boolean"/>
|
1030
|
+
</attribute>
|
1031
|
+
</optional>
|
1032
|
+
<optional>
|
1033
|
+
<attribute name="maxlength">
|
1034
|
+
<data type="int"/>
|
1035
|
+
</attribute>
|
1036
|
+
</optional>
|
1037
|
+
<optional>
|
1038
|
+
<attribute name="minlength">
|
1039
|
+
<data type="int"/>
|
1040
|
+
</attribute>
|
1041
|
+
</optional>
|
1042
|
+
<optional>
|
1043
|
+
<attribute name="name"/>
|
1044
|
+
</optional>
|
1045
|
+
<optional>
|
1046
|
+
<attribute name="value"/>
|
1047
|
+
</optional>
|
1048
|
+
<optional>
|
1049
|
+
<attribute name="id">
|
1050
|
+
<data type="ID"/>
|
1051
|
+
</attribute>
|
1052
|
+
</optional>
|
1053
|
+
</element>
|
1054
|
+
</define>
|
1055
|
+
<define name="formlabel">
|
1056
|
+
<element name="label">
|
1057
|
+
<attribute name="for">
|
1058
|
+
<data type="IDREF"/>
|
1059
|
+
</attribute>
|
1060
|
+
<zeroOrMore>
|
1061
|
+
<ref name="PureTextElement"/>
|
1062
|
+
</zeroOrMore>
|
1063
|
+
</element>
|
1064
|
+
</define>
|
1065
|
+
<define name="select">
|
1066
|
+
<element name="select">
|
1067
|
+
<optional>
|
1068
|
+
<attribute name="name"/>
|
1069
|
+
</optional>
|
1070
|
+
<optional>
|
1071
|
+
<attribute name="value"/>
|
1072
|
+
</optional>
|
1073
|
+
<optional>
|
1074
|
+
<attribute name="id">
|
1075
|
+
<data type="ID"/>
|
1076
|
+
</attribute>
|
1077
|
+
</optional>
|
1078
|
+
<optional>
|
1079
|
+
<attribute name="disabled">
|
1080
|
+
<data type="boolean"/>
|
1081
|
+
</attribute>
|
1082
|
+
</optional>
|
1083
|
+
<optional>
|
1084
|
+
<attribute name="multiple">
|
1085
|
+
<data type="boolean"/>
|
1086
|
+
</attribute>
|
1087
|
+
</optional>
|
1088
|
+
<optional>
|
1089
|
+
<attribute name="size">
|
1090
|
+
<data type="int"/>
|
1091
|
+
</attribute>
|
1092
|
+
</optional>
|
1093
|
+
<oneOrMore>
|
1094
|
+
<ref name="option"/>
|
1095
|
+
</oneOrMore>
|
1096
|
+
</element>
|
1097
|
+
</define>
|
1098
|
+
<define name="option">
|
1099
|
+
<element name="option">
|
1100
|
+
<optional>
|
1101
|
+
<attribute name="disabled">
|
1102
|
+
<data type="boolean"/>
|
1103
|
+
</attribute>
|
1104
|
+
</optional>
|
1105
|
+
<optional>
|
1106
|
+
<attribute name="value"/>
|
1107
|
+
</optional>
|
1108
|
+
<zeroOrMore>
|
1109
|
+
<ref name="PureTextElement"/>
|
1110
|
+
</zeroOrMore>
|
1111
|
+
</element>
|
1112
|
+
</define>
|
1113
|
+
<define name="textarea">
|
1114
|
+
<element name="textarea">
|
1115
|
+
<optional>
|
1116
|
+
<attribute name="name"/>
|
1117
|
+
</optional>
|
1118
|
+
<optional>
|
1119
|
+
<attribute name="value"/>
|
1120
|
+
</optional>
|
1121
|
+
<optional>
|
1122
|
+
<attribute name="id">
|
1123
|
+
<data type="ID"/>
|
1124
|
+
</attribute>
|
1125
|
+
</optional>
|
1126
|
+
<optional>
|
1127
|
+
<attribute name="rows">
|
1128
|
+
<data type="int"/>
|
1129
|
+
</attribute>
|
1130
|
+
</optional>
|
1131
|
+
<optional>
|
1132
|
+
<attribute name="cols">
|
1133
|
+
<data type="int"/>
|
1134
|
+
</attribute>
|
1135
|
+
</optional>
|
1136
|
+
</element>
|
1137
|
+
</define>
|
948
1138
|
<define name="bibliography">
|
949
1139
|
<element name="bibliography">
|
950
1140
|
<oneOrMore>
|
@@ -1017,9 +1207,7 @@
|
|
1017
1207
|
</define>
|
1018
1208
|
<define name="IsoWorkgroup">
|
1019
1209
|
<optional>
|
1020
|
-
<attribute name="number"
|
1021
|
-
<data type="int"/>
|
1022
|
-
</attribute>
|
1210
|
+
<attribute name="number"/>
|
1023
1211
|
</optional>
|
1024
1212
|
<optional>
|
1025
1213
|
<attribute name="type"/>
|
@@ -4,20 +4,20 @@ require_relative "init"
|
|
4
4
|
require_relative "utils"
|
5
5
|
|
6
6
|
class Nokogiri::XML::Node
|
7
|
-
TYPENAMES = {1=>
|
7
|
+
TYPENAMES = { 1 => "element", 2 => "attribute", 3 => "text",
|
8
|
+
4 => "cdata", 8 => "comment" }.freeze
|
8
9
|
def to_hash
|
9
|
-
|
10
|
-
h
|
10
|
+
{ kind: TYPENAMES[node_type], name: name }.tap do |h|
|
11
|
+
h[:text] = text&.strip
|
11
12
|
a = attribute_nodes.map(&:to_hash)
|
12
13
|
if element? && !a.empty?
|
13
|
-
h
|
14
|
+
h[:attr] = a.inject({}) { |m, v| m[v[:name]] = v[:text]; m }
|
14
15
|
end
|
15
16
|
c = children.map(&:to_hash)
|
16
17
|
if element? && !(c&.size == 1 && c[0][:kind] == "text")
|
17
18
|
h.merge! kids: c.delete_if { |n| n[:kind] == "text" && n[:text].empty? }
|
18
19
|
end
|
19
20
|
end
|
20
|
-
ret
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
@@ -27,15 +27,16 @@ end
|
|
27
27
|
|
28
28
|
module IsoDoc
|
29
29
|
module Generic
|
30
|
-
|
31
30
|
class Metadata < IsoDoc::Metadata
|
32
31
|
def initialize(lang, script, labels)
|
33
32
|
super
|
34
33
|
here = File.dirname(__FILE__)
|
35
|
-
default_logo_path =
|
34
|
+
default_logo_path =
|
35
|
+
File.expand_path(File.join(here, "html", "logo.jpg"))
|
36
36
|
set(:logo, baselocation(configuration.logo_path) || default_logo_path)
|
37
37
|
unless configuration.logo_paths.nil?
|
38
|
-
set(:logo_paths,
|
38
|
+
set(:logo_paths,
|
39
|
+
Array(configuration.logo_paths).map { |p| baselocation(p) })
|
39
40
|
end
|
40
41
|
end
|
41
42
|
|
@@ -43,8 +44,8 @@ module IsoDoc
|
|
43
44
|
attr_accessor :_file
|
44
45
|
end
|
45
46
|
|
46
|
-
def self.inherited(
|
47
|
-
|
47
|
+
def self.inherited(klass) # rubocop:disable Lint/MissingSuper
|
48
|
+
klass._file = caller_locations(1..1).first.absolute_path
|
48
49
|
end
|
49
50
|
|
50
51
|
def author(isoxml, _out)
|
@@ -55,6 +56,7 @@ module IsoDoc
|
|
55
56
|
|
56
57
|
def stage_abbr(status)
|
57
58
|
return super unless configuration.stage_abbreviations
|
59
|
+
|
58
60
|
Hash(configuration.stage_abbreviations).dig(status)
|
59
61
|
end
|
60
62
|
|
@@ -65,32 +67,35 @@ module IsoDoc
|
|
65
67
|
|
66
68
|
def doctype(isoxml, _out)
|
67
69
|
super
|
68
|
-
b = isoxml&.at(ns("//bibdata/ext/doctype#{currlang}")) ||
|
70
|
+
b = isoxml&.at(ns("//bibdata/ext/doctype#{currlang}")) ||
|
69
71
|
isoxml&.at(ns("//bibdata/ext/doctype#{NOLANG}")) || return
|
70
72
|
a = b["abbreviation"] and set(:doctype_abbr, a)
|
71
73
|
end
|
72
74
|
|
73
|
-
def xmlhash2hash(
|
75
|
+
def xmlhash2hash(hash)
|
74
76
|
ret = {}
|
75
|
-
return ret if
|
76
|
-
|
77
|
-
|
77
|
+
return ret if hash.nil? || hash[:kind] != "element"
|
78
|
+
|
79
|
+
hash[:attr].nil? or
|
80
|
+
hash[:attr].each { |k, v| ret["#{hash[:name]}_#{k}"] = v }
|
81
|
+
ret[hash[:name]] = hash[:kids] ? xmlhash2hash_kids(hash) : hash[:text]
|
78
82
|
ret
|
79
83
|
end
|
80
84
|
|
81
|
-
def xmlhash2hash_kids(
|
85
|
+
def xmlhash2hash_kids(hash)
|
82
86
|
c = {}
|
83
|
-
|
87
|
+
hash[:kids].each do |n|
|
84
88
|
xmlhash2hash(n).each do |k1, v1|
|
85
|
-
c[k1] = c[k1].nil?
|
86
|
-
|
87
|
-
|
89
|
+
c[k1] = if c[k1].nil? then v1
|
90
|
+
elsif c[k1].is_a?(Array) then c[k1] << v1
|
91
|
+
else [c[k1], v1]
|
92
|
+
end
|
88
93
|
end
|
89
94
|
end
|
90
95
|
c
|
91
96
|
end
|
92
97
|
|
93
|
-
def ext(isoxml,
|
98
|
+
def ext(isoxml, _out)
|
94
99
|
b = isoxml&.at(ns("//bibdata/ext")) or return
|
95
100
|
set(:metadata_extensions, xmlhash2hash(b.to_hash)["ext"])
|
96
101
|
end
|
data/metanorma-generic.gemspec
CHANGED
@@ -24,7 +24,7 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.bindir = "exe"
|
25
25
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
26
26
|
spec.require_paths = ["lib"]
|
27
|
-
spec.required_ruby_version = Gem::Requirement.new(">= 2.
|
27
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.5.0")
|
28
28
|
|
29
29
|
spec.add_dependency "htmlentities", "~> 4.3.4"
|
30
30
|
spec.add_dependency "isodoc", "~> 1.6.0"
|
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.10.
|
4
|
+
version: 1.10.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: 2021-
|
11
|
+
date: 2021-06-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: htmlentities
|
@@ -275,7 +275,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
275
275
|
requirements:
|
276
276
|
- - ">="
|
277
277
|
- !ruby/object:Gem::Version
|
278
|
-
version: 2.
|
278
|
+
version: 2.5.0
|
279
279
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
280
280
|
requirements:
|
281
281
|
- - ">="
|