metanorma-ogc 0.2.9 → 0.2.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/asciidoctor/ogc/biblio.rng +2 -2
- data/lib/asciidoctor/ogc/converter.rb +5 -5
- data/lib/asciidoctor/ogc/front.rb +27 -2
- data/lib/asciidoctor/ogc/ogc.rng +31 -23
- data/lib/asciidoctor/ogc/reqt.rng +6 -0
- data/lib/asciidoctor/ogc/validate.rb +2 -1
- data/lib/isodoc/ogc/html/_coverpage.scss +214 -0
- data/lib/isodoc/ogc/html/html_ogc_titlepage.html +6 -1
- data/lib/isodoc/ogc/html/htmlstyle.scss +347 -955
- data/lib/isodoc/ogc/html/ogc.scss +1 -1
- data/lib/isodoc/ogc/i18n-en.yaml +3 -0
- data/lib/isodoc/ogc/metadata.rb +13 -4
- data/lib/isodoc/ogc/reqt.rb +158 -35
- data/lib/isodoc/ogc/word_convert.rb +18 -10
- data/lib/metanorma/ogc/version.rb +1 -1
- metadata +4 -3
@@ -86,7 +86,7 @@ p.SourceTitle
|
|
86
86
|
mso-fareast-font-family:$bodyfont;
|
87
87
|
mso-bidi-font-family:$bodyfont;
|
88
88
|
mso-ansi-language:EN-GB;}
|
89
|
-
p.AdmonitionTitle
|
89
|
+
p.AdmonitionTitle, p.RecommendationTitle, p.RecommendationTestTitle
|
90
90
|
{mso-style-unhide:no;
|
91
91
|
mso-style-qformat:yes;
|
92
92
|
mso-style-parent:"";
|
data/lib/isodoc/ogc/i18n-en.yaml
CHANGED
data/lib/isodoc/ogc/metadata.rb
CHANGED
@@ -43,6 +43,10 @@ module IsoDoc
|
|
43
43
|
set(:keywords, keywords)
|
44
44
|
end
|
45
45
|
|
46
|
+
def unpublished(status)
|
47
|
+
!%w(published deprecated retired).include?(status.downcase)
|
48
|
+
end
|
49
|
+
|
46
50
|
def version(isoxml, _out)
|
47
51
|
super
|
48
52
|
revdate = get[:revdate]
|
@@ -77,12 +81,17 @@ module IsoDoc
|
|
77
81
|
a = xml.at(ns("//bibdata/uri[@type = 'previous']")) and set(:previousuri, a.text)
|
78
82
|
end
|
79
83
|
|
80
|
-
def
|
81
|
-
b
|
82
|
-
t = b.split(/[- ]/).map do |w|
|
84
|
+
def type_capitalise(b)
|
85
|
+
b.split(/[- ]/).map do |w|
|
83
86
|
w.capitalize unless %w(SWG).include? w
|
84
87
|
end.join(" ")
|
85
|
-
|
88
|
+
end
|
89
|
+
|
90
|
+
def doctype(isoxml, _out)
|
91
|
+
b = isoxml&.at(ns("//bibdata/ext/doctype"))&.text and
|
92
|
+
set(:doctype, type_capitalise(b))
|
93
|
+
b = isoxml&.at(ns("//bibdata/ext/docsubtype"))&.text and
|
94
|
+
set(:docsubtype, type_capitalise(b))
|
86
95
|
end
|
87
96
|
end
|
88
97
|
end
|
data/lib/isodoc/ogc/reqt.rb
CHANGED
@@ -6,75 +6,198 @@ module IsoDoc
|
|
6
6
|
module Ogc
|
7
7
|
module BaseConvert
|
8
8
|
def recommend_table_attr(node)
|
9
|
-
attr_code(id: node["id"],
|
10
|
-
|
9
|
+
attr_code(id: node["id"],
|
10
|
+
class: node["type"] == "verification" ?
|
11
|
+
"recommendtest" : "recommend",
|
12
|
+
style: "border-collapse:collapse;border-spacing:0;")
|
11
13
|
end
|
12
14
|
|
13
15
|
REQ_TBL_ATTR =
|
14
|
-
{ class: "
|
15
|
-
style: "width:100.0pt;padding:0 0 0 1em;margin-left:0pt;vertical-align:top;" }.freeze
|
16
|
+
{ style: "vertical-align:top;", class: "recommend" }.freeze
|
16
17
|
|
17
18
|
def recommendation_name(node, out, type)
|
18
|
-
|
19
|
+
label, title, lbl = recommendation_labels(node)
|
20
|
+
out.p **{ class: node["type"] == "verification" ?
|
21
|
+
"RecommendationTestTitle" : "RecommendationTitle" } do |b|
|
19
22
|
lbl = anchor(node['id'], :label, false)
|
20
23
|
b << (lbl.nil? ? l10n("#{type}:") : l10n("#{type} #{lbl}:"))
|
24
|
+
if title
|
25
|
+
b << " "
|
26
|
+
title.children.each { |n| parse(n,b) }
|
27
|
+
end
|
21
28
|
end
|
22
29
|
end
|
23
30
|
|
24
|
-
def recommend_title(node,
|
25
|
-
label = node.at(ns("./label"))
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
b << "#{clausedelim} " if label && title
|
32
|
-
title and title.children.each { |n| parse(n,b) }
|
31
|
+
def recommend_title(node, out)
|
32
|
+
label = node.at(ns("./label")) or return
|
33
|
+
out.tr do |tr|
|
34
|
+
tr.td **REQ_TBL_ATTR.merge(colspan: 2) do |td|
|
35
|
+
td.p do |p|
|
36
|
+
label.children.each { |n| parse(n, p) }
|
37
|
+
end
|
33
38
|
end
|
34
39
|
end
|
35
40
|
end
|
36
41
|
|
37
|
-
def
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
+
def recommendation_attributes1(node)
|
43
|
+
out = []
|
44
|
+
oblig = node["obligation"] and out << ["Obligation", oblig]
|
45
|
+
subj = node&.at(ns("./subject"))&.text and out << ["Subject", subj]
|
46
|
+
node.xpath(ns("./classification")).each do |c|
|
47
|
+
tag = c.at(ns("./tag"))
|
48
|
+
value = c.at(ns("./value"))
|
49
|
+
tag && value or next
|
50
|
+
out << [tag.text.capitalize, value.text]
|
51
|
+
end
|
52
|
+
out
|
53
|
+
end
|
54
|
+
|
55
|
+
|
56
|
+
def recommendation_attributes(node, out)
|
57
|
+
ret = recommendation_attributes1(node)
|
58
|
+
return if ret.empty?
|
59
|
+
ret.each do |i|
|
60
|
+
out.tr do |tr|
|
61
|
+
tr.td i[0], **REQ_TBL_ATTR
|
62
|
+
tr.td i[1], **REQ_TBL_ATTR
|
42
63
|
end
|
43
64
|
end
|
44
65
|
end
|
45
66
|
|
46
|
-
def
|
47
|
-
|
48
|
-
|
67
|
+
def requirement_component_parse(node, out)
|
68
|
+
return if node["exclude"] == "true"
|
69
|
+
node.elements.size == 1 && node.first_element_child.name == "dl" and
|
70
|
+
return reqt_dl(node.first_element_child, out)
|
71
|
+
out.tr do |tr|
|
72
|
+
tr.td **REQ_TBL_ATTR.merge(colspan: 2) do |td|
|
73
|
+
node.children.each { |n| parse(n, td) }
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
def reqt_dl(node, out)
|
79
|
+
node.xpath(ns("./dt")).each do |dt|
|
80
|
+
out.tr do |tr|
|
81
|
+
tr.td **REQ_TBL_ATTR do |td|
|
82
|
+
dt.children.each { |n| parse(n, td) }
|
83
|
+
end
|
84
|
+
dd = dt&.next_element and dd.name == "dd" or next
|
49
85
|
tr.td **REQ_TBL_ATTR do |td|
|
50
|
-
|
86
|
+
dd.children.each { |n| parse(n, td) }
|
51
87
|
end
|
52
|
-
recommendation_body(node, tr)
|
53
88
|
end
|
54
89
|
end
|
55
90
|
end
|
56
91
|
|
57
|
-
def
|
58
|
-
out.
|
59
|
-
|
60
|
-
tr.
|
61
|
-
recommendation_name(node, td,
|
92
|
+
def recommendation_header(node, out, label)
|
93
|
+
out.thead do |h|
|
94
|
+
h.tr do |tr|
|
95
|
+
tr.th **REQ_TBL_ATTR.merge(colspan: 2) do |td|
|
96
|
+
recommendation_name(node, td, label)
|
62
97
|
end
|
63
|
-
recommendation_body(node, tr)
|
64
98
|
end
|
65
99
|
end
|
66
100
|
end
|
67
101
|
|
68
|
-
def
|
102
|
+
def recommendation_parse1(node, out, label)
|
69
103
|
out.table **recommend_table_attr(node) do |t|
|
70
|
-
|
71
|
-
|
72
|
-
|
104
|
+
recommendation_header(node, out, label)
|
105
|
+
t.tbody do |b|
|
106
|
+
recommend_title(node, b)
|
107
|
+
recommendation_attributes(node, b)
|
108
|
+
node.children.each do |n|
|
109
|
+
parse(n, t) unless reqt_metadata_node(n)
|
73
110
|
end
|
74
|
-
recommendation_body(node, tr)
|
75
111
|
end
|
76
112
|
end
|
77
113
|
end
|
114
|
+
|
115
|
+
def recommendation_parse(node, out)
|
116
|
+
recommendation_parse1(node, out, node["type"] == "verification" ?
|
117
|
+
@labels["recommendationtest"] :
|
118
|
+
@recommendation_lbl)
|
119
|
+
end
|
120
|
+
|
121
|
+
def requirement_parse(node, out)
|
122
|
+
recommendation_parse1(node, out, node["type"] == "verification" ?
|
123
|
+
@labels["requirementtest"] : @requirement_lbl)
|
124
|
+
end
|
125
|
+
|
126
|
+
def permission_parse(node, out)
|
127
|
+
recommendation_parse1(node, out, node["type"] == "verification" ?
|
128
|
+
@labels["permissiontest"] : @permission_lbl)
|
129
|
+
end
|
130
|
+
|
131
|
+
FIRST_LVL_REQ = IsoDoc::Function::XrefGen::FIRST_LVL_REQ
|
132
|
+
|
133
|
+
def sequential_permission_names(clause, klass, label)
|
134
|
+
c = ::IsoDoc::Function::XrefGen::Counter.new
|
135
|
+
clause.xpath(ns(".//#{klass}#{FIRST_LVL_REQ}")).each do |t|
|
136
|
+
next if t["id"].nil? || t["id"].empty?
|
137
|
+
id = c.increment(t).print
|
138
|
+
@anchors[t["id"]] = anchor_struct(id, t, label, klass, t["unnumbered"])
|
139
|
+
sequential_permission_names1(t, id, "permission[not(@type = 'verification')]", @permission_lbl)
|
140
|
+
sequential_permission_names1(t, id, "requirement[not(@type = 'verification')]", @requirement_lbl)
|
141
|
+
sequential_permission_names1(t, id, "recommendation[not(@type = 'verification')]", @recommendation_lbl)
|
142
|
+
sequential_permission_names1(t, id, "permission[@type = 'verification']", @labels["permissiontest"])
|
143
|
+
sequential_permission_names1(t, id, "requirement[@type = 'verification']", @labels["requirementtest"])
|
144
|
+
sequential_permission_names1(t, id, "recommendation[@type = 'verification']", @labels["recommendationtest"])
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
def sequential_permission_names1(block, lbl, klass, label)
|
149
|
+
c = ::IsoDoc::Function::XrefGen::Counter.new
|
150
|
+
block.xpath(ns("./#{klass}")).each do |t|
|
151
|
+
next if t["id"].nil? || t["id"].empty?
|
152
|
+
id = "#{lbl}#{hierfigsep}#{c.increment(t).print}"
|
153
|
+
@anchors[t["id"]] = anchor_struct(id, t, label, klass, t["unnumbered"])
|
154
|
+
sequential_permission_names1(t, id, "permission[not(@type = 'verification')]", @permission_lbl)
|
155
|
+
sequential_permission_names1(t, id, "requirement[not(@type = 'verification')]", @requirement_lbl)
|
156
|
+
sequential_permission_names1(t, id, "recommendation[not(@type = 'verification')]", @recommendation_lbl)
|
157
|
+
sequential_permission_names1(t, id, "permission[@type = 'verification']", @labels["permissiontest"])
|
158
|
+
sequential_permission_names1(t, id, "requirement[@type = 'verification']", @labels["requirementtest"])
|
159
|
+
sequential_permission_names1(t, id, "recommendation[@type = 'verification']", @labels["recommendationtest"])
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
163
|
+
def sequential_asset_names(clause)
|
164
|
+
sequential_table_names(clause)
|
165
|
+
sequential_figure_names(clause)
|
166
|
+
sequential_formula_names(clause)
|
167
|
+
sequential_permission_names(clause, "permission[not(@type = 'verification')]", @permission_lbl)
|
168
|
+
sequential_permission_names(clause, "requirement[not(@type = 'verification')]", @requirement_lbl)
|
169
|
+
sequential_permission_names(clause, "recommendation[not(@type = 'verification')]", @recommendation_lbl)
|
170
|
+
sequential_permission_names(clause, "permission[@type = 'verification']", @labels["permissiontest"])
|
171
|
+
sequential_permission_names(clause, "requirement[@type = 'verification']", @labels["requirementtest"])
|
172
|
+
sequential_permission_names(clause, "recommendation[@type = 'verification']", @labels["recommendationtest"])
|
173
|
+
end
|
174
|
+
|
175
|
+
def hierarchical_asset_names(clause, num)
|
176
|
+
hierarchical_table_names(clause, num)
|
177
|
+
hierarchical_figure_names(clause, num)
|
178
|
+
hierarchical_formula_names(clause, num)
|
179
|
+
hierarchical_permission_names(clause, num, "permission[not(@type = 'verification')]", @permission_lbl)
|
180
|
+
hierarchical_permission_names(clause, num, "requirement[not(@type = 'verification')]", @requirement_lbl)
|
181
|
+
hierarchical_permission_names(clause, num, "recommendation[not(@type = 'verification')]", @recommendation_lbl)
|
182
|
+
hierarchical_permission_names(clause, num, "permission[@type = 'verification']", @labels["permissiontest"])
|
183
|
+
hierarchical_permission_names(clause, num, "requirement[@type = 'verification']", @labels["requirementtest"])
|
184
|
+
hierarchical_permission_names(clause, num, "recommendation[@type = 'verification']", @labels["recommendationtest"])
|
185
|
+
end
|
186
|
+
|
187
|
+
def hierarchical_permission_names(clause, num, klass, label)
|
188
|
+
c = ::IsoDoc::Function::XrefGen::Counter.new
|
189
|
+
clause.xpath(ns(".//#{klass}#{FIRST_LVL_REQ}")).each do |t|
|
190
|
+
next if t["id"].nil? || t["id"].empty?
|
191
|
+
lbl = "#{num}#{hiersep}#{c.increment(t).print}"
|
192
|
+
@anchors[t["id"]] = anchor_struct(lbl, t, label, klass, t["unnumbered"])
|
193
|
+
sequential_permission_names1(t, lbl, "permission[not(@type = 'verification')]", @permission_lbl)
|
194
|
+
sequential_permission_names1(t, lbl, "requirement[not(@type = 'verification')]", @requirement_lbl)
|
195
|
+
sequential_permission_names1(t, lbl, "recommendation[not(@type = 'verification')]", @recommendation_lbl)
|
196
|
+
sequential_permission_names1(t, lbl, "permission[@type = 'verification']", @labels["permissiontest"])
|
197
|
+
sequential_permission_names1(t, lbl, "requirement[@type = 'verification']", @labels["requirementtest"])
|
198
|
+
sequential_permission_names1(t, lbl, "recommendation[@type = 'verification']", @labels["recommendationtest"])
|
199
|
+
end
|
200
|
+
end
|
78
201
|
end
|
79
202
|
end
|
80
203
|
end
|
@@ -49,16 +49,6 @@ module IsoDoc
|
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
52
|
-
=begin
|
53
|
-
def make_body2(body, docxml)
|
54
|
-
body.div **{ class: "WordSection2" } do |div2|
|
55
|
-
info docxml, div2
|
56
|
-
div2.p { |p| p << " " } # placeholder
|
57
|
-
end
|
58
|
-
section_break(body)
|
59
|
-
end
|
60
|
-
=end
|
61
|
-
|
62
52
|
def insert_toc(intro, docxml, level)
|
63
53
|
toc = ""
|
64
54
|
toc += make_WordToC(docxml, level)
|
@@ -148,6 +138,24 @@ module IsoDoc
|
|
148
138
|
section_break(body)
|
149
139
|
end
|
150
140
|
|
141
|
+
def word_cleanup(docxml)
|
142
|
+
word_recommend_cleanup(docxml)
|
143
|
+
super
|
144
|
+
end
|
145
|
+
|
146
|
+
def word_recommend_cleanup(docxml)
|
147
|
+
docxml.xpath("//table[@class = 'recommendtest']/thead/tr").each do |tr|
|
148
|
+
style_update(tr, "background:#C9C9C9;")
|
149
|
+
end
|
150
|
+
docxml.xpath("//table[@class = 'recommend']/thead/tr").each do |tr|
|
151
|
+
style_update(tr, "background:#A5A5A5;")
|
152
|
+
end
|
153
|
+
docxml.xpath("//table[@class = 'recommend']/tbody/tr").
|
154
|
+
each_slice(2) do |tr1, tr2|
|
155
|
+
tr2 && style_update(tr2, "background:#C9C9C9;")
|
156
|
+
end
|
157
|
+
end
|
158
|
+
|
151
159
|
include BaseConvert
|
152
160
|
end
|
153
161
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metanorma-ogc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.10
|
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: 2020-01-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: htmlentities
|
@@ -257,6 +257,7 @@ files:
|
|
257
257
|
- lib/isodoc/ogc.rb
|
258
258
|
- lib/isodoc/ogc/base_convert.rb
|
259
259
|
- lib/isodoc/ogc/biblio.rb
|
260
|
+
- lib/isodoc/ogc/html/_coverpage.scss
|
260
261
|
- lib/isodoc/ogc/html/header.html
|
261
262
|
- lib/isodoc/ogc/html/html_ogc_intro.html
|
262
263
|
- lib/isodoc/ogc/html/html_ogc_titlepage.html
|
@@ -298,7 +299,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
298
299
|
version: '0'
|
299
300
|
requirements: []
|
300
301
|
rubyforge_project:
|
301
|
-
rubygems_version: 2.7.
|
302
|
+
rubygems_version: 2.7.7
|
302
303
|
signing_key:
|
303
304
|
specification_version: 4
|
304
305
|
summary: Metanorma for the Open Geospatial Consortium.
|