metanorma-ogc 1.0.2 → 1.0.7
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/macos.yml +10 -10
- data/.github/workflows/ubuntu.yml +25 -11
- data/.github/workflows/windows.yml +11 -12
- data/README.adoc +3 -2
- data/lib/asciidoctor/ogc/biblio.rng +131 -46
- data/lib/asciidoctor/ogc/boilerplate.xml +33 -50
- data/lib/asciidoctor/ogc/converter.rb +6 -10
- data/lib/asciidoctor/ogc/front.rb +10 -5
- data/lib/asciidoctor/ogc/isodoc.rng +37 -4
- data/lib/asciidoctor/ogc/ogc.rng +0 -4
- data/lib/asciidoctor/ogc/validate.rb +12 -10
- data/lib/isodoc/ogc/base_convert.rb +12 -107
- data/lib/isodoc/ogc/biblio.rb +13 -2
- data/lib/isodoc/ogc/html/html_ogc_titlepage.html +9 -8
- data/lib/isodoc/ogc/html/htmlstyle.scss +44 -13
- data/lib/isodoc/ogc/html/scripts.html +14 -27
- data/lib/isodoc/ogc/html/word_ogc_titlepage.html +13 -4
- data/lib/isodoc/ogc/i18n-en.yaml +3 -0
- data/lib/isodoc/ogc/metadata.rb +1 -23
- data/lib/isodoc/ogc/ogc.abstract-specification-topic.xsl +3225 -0
- data/lib/isodoc/ogc/ogc.best-practice.xsl +3225 -0
- data/lib/isodoc/ogc/ogc.change-request-supporting-document.xsl +3225 -0
- data/lib/isodoc/ogc/ogc.community-practice.xsl +3225 -0
- data/lib/isodoc/ogc/ogc.community-standard.xsl +3225 -0
- data/lib/isodoc/ogc/ogc.discussion-paper.xsl +3225 -0
- data/lib/isodoc/ogc/ogc.engineering-report.xsl +3225 -0
- data/lib/isodoc/ogc/ogc.other.xsl +3225 -0
- data/lib/isodoc/ogc/ogc.policy.xsl +3225 -0
- data/lib/isodoc/ogc/ogc.reference-model.xsl +3225 -0
- data/lib/isodoc/ogc/ogc.release-notes.xsl +3225 -0
- data/lib/isodoc/ogc/ogc.standard.xsl +3225 -0
- data/lib/isodoc/ogc/ogc.test-suite.xsl +3225 -0
- data/lib/isodoc/ogc/ogc.user-guide.xsl +3225 -0
- data/lib/isodoc/ogc/ogc.white-paper.xsl +3225 -0
- data/lib/isodoc/ogc/pdf_convert.rb +18 -77
- data/lib/isodoc/ogc/reqt.rb +76 -36
- data/lib/isodoc/ogc/sections.rb +111 -0
- data/lib/isodoc/ogc/word_convert.rb +20 -9
- data/lib/metanorma/ogc/processor.rb +8 -0
- data/lib/metanorma/ogc/version.rb +1 -1
- data/metanorma-ogc.gemspec +2 -3
- metadata +22 -21
- data/lib/isodoc/ogc/html/scripts.pdf.html +0 -72
@@ -1,96 +1,37 @@
|
|
1
1
|
require_relative "base_convert"
|
2
|
-
require "fileutils"
|
3
2
|
require "isodoc"
|
4
|
-
require_relative "metadata"
|
5
3
|
|
6
4
|
module IsoDoc
|
7
5
|
module Ogc
|
8
6
|
# A {Converter} implementation that generates PDF HTML output, and a
|
9
7
|
# document schema encapsulation of the document for validation
|
10
|
-
class PdfConvert < IsoDoc::
|
8
|
+
class PdfConvert < IsoDoc::XslfoPdfConvert
|
11
9
|
def initialize(options)
|
12
10
|
@libdir = File.dirname(__FILE__)
|
13
11
|
super
|
14
|
-
#FileUtils.cp html_doc_path('logo.jpg'), "logo.jpg"
|
15
|
-
#@files_to_delete << "logo.jpg"
|
16
12
|
end
|
17
13
|
|
18
|
-
def
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
14
|
+
def pdf_stylesheet(docxml)
|
15
|
+
doctype = docxml&.at(ns("//bibdata/ext/doctype"))&.text
|
16
|
+
doctype = "other" unless %w(abstract-specification-topic best-practice
|
17
|
+
change-request-supporting-document community-practice community-standard
|
18
|
+
discussion-paper engineering-report policy reference-model release-notes
|
19
|
+
standard user-guide test-suite white-paper).include? doctype
|
20
|
+
"ogc.#{doctype}.xsl"
|
24
21
|
end
|
25
22
|
|
26
|
-
def
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
end
|
34
|
-
|
35
|
-
def metadata_init(lang, script, labels)
|
36
|
-
@meta = Metadata.new(lang, script, labels)
|
37
|
-
end
|
38
|
-
|
39
|
-
def googlefonts
|
40
|
-
<<~HEAD.freeze
|
41
|
-
<link href="https://fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,600,600i|Space+Mono:400,700" rel="stylesheet" />
|
42
|
-
<link href="https://fonts.googleapis.com/css?family=Overpass:300,300i,600,900" rel="stylesheet" />
|
43
|
-
<link href="https://fonts.googleapis.com/css?family=Teko:300,400,500" rel="stylesheet">
|
44
|
-
HEAD
|
45
|
-
end
|
46
|
-
|
47
|
-
def admonition_class(node)
|
48
|
-
case node["type"]
|
49
|
-
when "important" then "Admonition.Important"
|
50
|
-
when "warning" then "Admonition.Warning"
|
51
|
-
else
|
52
|
-
"Admonition"
|
23
|
+
def convert(filename, file = nil, debug = false)
|
24
|
+
file = File.read(filename, encoding: "utf-8") if file.nil?
|
25
|
+
docxml, outname_html, dir = convert_init(file, filename, debug)
|
26
|
+
/\.xml$/.match(filename) or
|
27
|
+
filename = Tempfile.open([outname_html, ".xml"], encoding: "utf-8") do |f|
|
28
|
+
f.write file
|
29
|
+
f.path
|
53
30
|
end
|
31
|
+
FileUtils.rm_rf dir
|
32
|
+
::Metanorma::Output::XslfoPdf.new.convert(
|
33
|
+
filename, outname_html + ".pdf", File.join(@libdir, pdf_stylesheet(docxml)))
|
54
34
|
end
|
55
|
-
|
56
|
-
def make_body(xml, docxml)
|
57
|
-
body_attr = { lang: "EN-US", link: "blue", vlink: "#954F72", "xml:lang": "EN-US", class: "container" }
|
58
|
-
xml.body **body_attr do |body|
|
59
|
-
make_body1(body, docxml)
|
60
|
-
make_body2(body, docxml)
|
61
|
-
make_body3(body, docxml)
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
def html_toc(docxml)
|
66
|
-
docxml
|
67
|
-
end
|
68
|
-
|
69
|
-
def make_body3(body, docxml)
|
70
|
-
body.div **{ class: "main-section" } do |div3|
|
71
|
-
@prefacenum = 0
|
72
|
-
boilerplate docxml, div3
|
73
|
-
abstract docxml, div3
|
74
|
-
keywords docxml, div3
|
75
|
-
foreword docxml, div3
|
76
|
-
introduction docxml, div3
|
77
|
-
submittingorgs docxml, div3
|
78
|
-
submitters docxml, div3
|
79
|
-
preface docxml, div3
|
80
|
-
acknowledgements docxml, div3
|
81
|
-
middle docxml, div3
|
82
|
-
footnotes div3
|
83
|
-
comments div3
|
84
|
-
end
|
85
|
-
end
|
86
|
-
|
87
|
-
def authority_cleanup(docxml)
|
88
|
-
authority_cleanup1(docxml, "contact")
|
89
|
-
super
|
90
|
-
end
|
91
|
-
|
92
|
-
include BaseConvert
|
93
35
|
end
|
94
36
|
end
|
95
37
|
end
|
96
|
-
|
data/lib/isodoc/ogc/reqt.rb
CHANGED
@@ -7,7 +7,9 @@ module IsoDoc
|
|
7
7
|
module BaseConvert
|
8
8
|
def recommend_class(node)
|
9
9
|
return "recommendtest" if node["type"] == "verification"
|
10
|
+
return "recommendtest" if node["type"] == "abstracttest"
|
10
11
|
return "recommendclass" if node["type"] == "class"
|
12
|
+
return "recommendclass" if node["type"] == "conformanceclass"
|
11
13
|
"recommend"
|
12
14
|
end
|
13
15
|
|
@@ -22,7 +24,7 @@ module IsoDoc
|
|
22
24
|
|
23
25
|
def recommendation_name(node, out, type)
|
24
26
|
label, title, lbl = recommendation_labels(node)
|
25
|
-
out.p **{ class: node["type"]
|
27
|
+
out.p **{ class: %w(verification abstracttest).include?(node["type"]) ?
|
26
28
|
"RecommendationTestTitle" : "RecommendationTitle" } do |b|
|
27
29
|
lbl = anchor(node['id'], :label, false)
|
28
30
|
b << (lbl.nil? ? l10n("#{type}:") : l10n("#{type} #{lbl}:"))
|
@@ -47,25 +49,45 @@ module IsoDoc
|
|
47
49
|
def recommendation_attributes1(node)
|
48
50
|
out = []
|
49
51
|
oblig = node["obligation"] and out << ["Obligation", oblig]
|
50
|
-
subj = node&.at(ns("./subject"))&.text and
|
51
|
-
|
52
|
-
|
52
|
+
subj = node&.at(ns("./subject"))&.text and out << [rec_subj(node), subj]
|
53
|
+
node.xpath(ns("./inherit")).each do |i|
|
54
|
+
out << recommendation_attr_parse(i, "Dependency")
|
55
|
+
end
|
53
56
|
node.xpath(ns("./classification")).each do |c|
|
54
|
-
|
55
|
-
value = c.at(ns("./value")) or next
|
56
|
-
out << [tag.text.capitalize, value.text]
|
57
|
+
line = recommendation_attr_keyvalue(c, "tag", "value") and out << line
|
57
58
|
end
|
58
59
|
out
|
59
60
|
end
|
60
61
|
|
62
|
+
def rec_subj(node)
|
63
|
+
%w(class conformanceclass).include?(node["type"]) ?
|
64
|
+
"Target Type" : "Subject"
|
65
|
+
end
|
66
|
+
|
67
|
+
def recommendation_attr_parse(node, label)
|
68
|
+
text = noko do |xml|
|
69
|
+
node.children.each { |n| parse(n, xml) }
|
70
|
+
end.join
|
71
|
+
[label, text]
|
72
|
+
end
|
73
|
+
|
74
|
+
def recommendation_attr_keyvalue(node, key, value)
|
75
|
+
tag = node.at(ns("./#{key}")) or return nil
|
76
|
+
value = node.at(ns("./#{value}")) or return nil
|
77
|
+
[tag.text.capitalize, value.text]
|
78
|
+
end
|
61
79
|
|
62
80
|
def recommendation_attributes(node, out)
|
63
81
|
ret = recommendation_attributes1(node)
|
64
82
|
return if ret.empty?
|
65
83
|
ret.each do |i|
|
66
84
|
out.tr do |tr|
|
67
|
-
tr.td
|
68
|
-
|
85
|
+
tr.td **REQ_TBL_ATTR do |td|
|
86
|
+
td << i[0]
|
87
|
+
end
|
88
|
+
tr.td **REQ_TBL_ATTR do |td|
|
89
|
+
td << i[1]
|
90
|
+
end
|
69
91
|
end
|
70
92
|
end
|
71
93
|
end
|
@@ -122,6 +144,8 @@ module IsoDoc
|
|
122
144
|
label = case node["type"]
|
123
145
|
when "verification" then @labels["recommendationtest"]
|
124
146
|
when "class" then @labels["recommendationclass"]
|
147
|
+
when "abstracttest" then @labels["abstracttest"]
|
148
|
+
when "conformanceclass" then @labels["conformanceclass"]
|
125
149
|
else
|
126
150
|
@recommendation_lbl
|
127
151
|
end
|
@@ -132,6 +156,8 @@ module IsoDoc
|
|
132
156
|
label = case node["type"]
|
133
157
|
when "verification" then @labels["requirementtest"]
|
134
158
|
when "class" then @labels["requirementclass"]
|
159
|
+
when "abstracttest" then @labels["abstracttest"]
|
160
|
+
when "conformanceclass" then @labels["conformanceclass"]
|
135
161
|
else
|
136
162
|
@requirement_lbl
|
137
163
|
end
|
@@ -142,6 +168,8 @@ module IsoDoc
|
|
142
168
|
label = case node["type"]
|
143
169
|
when "verification" then @labels["permissiontest"]
|
144
170
|
when "class" then @labels["permissionclass"]
|
171
|
+
when "abstracttest" then @labels["abstracttest"]
|
172
|
+
when "conformanceclass" then @labels["conformanceclass"]
|
145
173
|
else
|
146
174
|
@permission_lbl
|
147
175
|
end
|
@@ -160,16 +188,30 @@ module IsoDoc
|
|
160
188
|
end
|
161
189
|
end
|
162
190
|
|
191
|
+
def req_class_paths
|
192
|
+
{
|
193
|
+
"class" => "@type = 'class'",
|
194
|
+
"test" => "@type = 'verification'",
|
195
|
+
"" => "not(@type = 'verification' or @type = 'class' or @type = 'abstracttest' or @type = 'conformanceclass')",
|
196
|
+
}
|
197
|
+
end
|
198
|
+
|
199
|
+
def req_class_paths2
|
200
|
+
{
|
201
|
+
"abstracttest" => "@type = 'abstracttest'",
|
202
|
+
"conformanceclass" => "@type = 'conformanceclass'",
|
203
|
+
}
|
204
|
+
end
|
205
|
+
|
163
206
|
def sequential_permission_children(t, id)
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
sequential_permission_names1(t, id, "recommendation[@type = 'class']", @labels["recommendationclass"])
|
207
|
+
req_class_paths.each do |k, v|
|
208
|
+
sequential_permission_names1(t, id, "permission[#{v}]", @labels["permission#{k}"])
|
209
|
+
sequential_permission_names1(t, id, "requirement[#{v}]", @labels["requirement#{k}"])
|
210
|
+
sequential_permission_names1(t, id, "recommendation[#{v}]", @labels["recommendation#{k}"])
|
211
|
+
end
|
212
|
+
req_class_paths2.each do |k, v|
|
213
|
+
sequential_permission_names1(t, id, "*[#{v}]", @labels[k])
|
214
|
+
end
|
173
215
|
end
|
174
216
|
|
175
217
|
def sequential_permission_names1(block, lbl, klass, label)
|
@@ -186,30 +228,28 @@ module IsoDoc
|
|
186
228
|
sequential_table_names(clause)
|
187
229
|
sequential_figure_names(clause)
|
188
230
|
sequential_formula_names(clause)
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
sequential_permission_names(clause, "recommendation[@type = 'class']", @labels["recommendationclass"])
|
231
|
+
req_class_paths.each do |k, v|
|
232
|
+
sequential_permission_names(clause, "permission[#{v}]", @labels["permission#{k}"])
|
233
|
+
sequential_permission_names(clause, "requirement[#{v}]", @labels["requirement#{k}"])
|
234
|
+
sequential_permission_names(clause, "recommendation[#{v}]", @labels["recommendation#{k}"])
|
235
|
+
end
|
236
|
+
req_class_paths2.each do |k, v|
|
237
|
+
sequential_permission_names(clause, "*[#{v}]", @labels[k])
|
238
|
+
end
|
198
239
|
end
|
199
240
|
|
200
241
|
def hierarchical_asset_names(clause, num)
|
201
242
|
hierarchical_table_names(clause, num)
|
202
243
|
hierarchical_figure_names(clause, num)
|
203
244
|
hierarchical_formula_names(clause, num)
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
hierarchical_permission_names(clause, num, "recommendation[@type = 'class']", @labels["recommendationclass"])
|
245
|
+
req_class_paths.each do |k, v|
|
246
|
+
hierarchical_permission_names(clause, num, "permission[#{v}]", @labels["permission#{k}"])
|
247
|
+
hierarchical_permission_names(clause, num, "requirement[#{v}]", @labels["requirement#{k}"])
|
248
|
+
hierarchical_permission_names(clause, num, "recommendation[#{v}]", @labels["recommendation#{k}"])
|
249
|
+
end
|
250
|
+
req_class_paths2.each do |k, v|
|
251
|
+
hierarchical_permission_names(clause, num, "*[#{v}]", @labels[k])
|
252
|
+
end
|
213
253
|
end
|
214
254
|
|
215
255
|
def hierarchical_permission_names(clause, num, klass, label)
|
@@ -0,0 +1,111 @@
|
|
1
|
+
module IsoDoc
|
2
|
+
module Ogc
|
3
|
+
module BaseConvert
|
4
|
+
def annex_name(annex, name, div)
|
5
|
+
div.h1 **{ class: "Annex" } do |t|
|
6
|
+
t << "#{anchor(annex['id'], :label)} "
|
7
|
+
t.br
|
8
|
+
t.b do |b|
|
9
|
+
name&.children&.each { |c2| parse(c2, b) }
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def keywords(_docxml, out)
|
15
|
+
kw = @meta.get[:keywords]
|
16
|
+
kw.empty? and return
|
17
|
+
@prefacenum += 1
|
18
|
+
out.div **{ class: "Section3" } do |div|
|
19
|
+
clause_name(RomanNumerals.to_roman(@prefacenum).downcase,
|
20
|
+
"Keywords", div, class: "IntroTitle")
|
21
|
+
div.p "The following are keywords to be used by search engines and "\
|
22
|
+
"document catalogues."
|
23
|
+
div.p kw.join(", ")
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
SUBMITTINGORGS =
|
28
|
+
"//bibdata/contributor[role/@type = 'author']/organization/name".freeze
|
29
|
+
|
30
|
+
def submittingorgs(docxml, out)
|
31
|
+
orgs = []
|
32
|
+
docxml.xpath(ns(SUBMITTINGORGS)).each { |org| orgs << org.text }
|
33
|
+
return if orgs.empty?
|
34
|
+
@prefacenum += 1
|
35
|
+
out.div **{ class: "Section3" } do |div|
|
36
|
+
clause_name(RomanNumerals.to_roman(@prefacenum).downcase,
|
37
|
+
"Submitting Organizations", div, class: "IntroTitle")
|
38
|
+
div.p "The following organizations submitted this Document to the "\
|
39
|
+
"Open Geospatial Consortium (OGC):"
|
40
|
+
div.ul do |ul|
|
41
|
+
orgs.each { |org| ul.li org }
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def submitters(docxml, out)
|
47
|
+
f = docxml.at(ns("//submitters")) || return
|
48
|
+
@prefacenum += 1
|
49
|
+
out.div **{ class: "Section3" } do |div|
|
50
|
+
clause_name(anchor(f['id'], :label), "Submitters", div,
|
51
|
+
class: "IntroTitle")
|
52
|
+
f.elements.each { |e| parse(e, div) unless e.name == "title" }
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def preface(isoxml, out)
|
57
|
+
title_attr = { class: "IntroTitle" }
|
58
|
+
isoxml.xpath(ns("//preface/clause")).each do |f|
|
59
|
+
@prefacenum += 1
|
60
|
+
out.div **{ class: "Section3", id: f["id"] } do |div|
|
61
|
+
clause_name(RomanNumerals.to_roman(@prefacenum).downcase,
|
62
|
+
f&.at(ns("./title")), div, title_attr)
|
63
|
+
f.elements.each { |e| parse(e, div) unless e.name == "title" }
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
def abstract(isoxml, out)
|
69
|
+
f = isoxml.at(ns("//preface/abstract")) || return
|
70
|
+
@prefacenum += 1
|
71
|
+
page_break(out)
|
72
|
+
out.div **attr_code(id: f["id"]) do |s|
|
73
|
+
clause_name(anchor(f["id"], :label), @abstract_lbl, s,
|
74
|
+
class: "AbstractTitle")
|
75
|
+
f.elements.each { |e| parse(e, s) unless e.name == "title" }
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
def foreword(isoxml, out)
|
80
|
+
f = isoxml.at(ns("//foreword")) || return
|
81
|
+
@prefacenum += 1
|
82
|
+
page_break(out)
|
83
|
+
out.div **attr_code(id: f["id"]) do |s|
|
84
|
+
clause_name(anchor(f["id"], :label), @foreword_lbl, s,
|
85
|
+
class: "ForewordTitle")
|
86
|
+
f.elements.each { |e| parse(e, s) unless e.name == "title" }
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
def acknowledgements(isoxml, out)
|
91
|
+
f = isoxml.at(ns("//acknowledgements")) || return
|
92
|
+
@prefacenum += 1
|
93
|
+
out.div **{ class: "Section3", id: f["id"] } do |div|
|
94
|
+
clause_name(anchor(f["id"], :label), f&.at(ns("./title")), div,
|
95
|
+
class: "IntroTitle")
|
96
|
+
f.elements.each { |e| parse(e, div) unless e.name == "title" }
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
def conformance(isoxml, out, num)
|
101
|
+
f = isoxml.at(ns("//clause[title = 'Conformance']")) or return num
|
102
|
+
out.div **attr_code(id: f["id"]) do |div|
|
103
|
+
num = num + 1
|
104
|
+
clause_name(num, "Conformance", div, nil)
|
105
|
+
f.elements.each { |e| parse(e, div) unless e.name == "title" }
|
106
|
+
end
|
107
|
+
num
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
@@ -12,13 +12,14 @@ module IsoDoc
|
|
12
12
|
def initialize(options)
|
13
13
|
@libdir = File.dirname(__FILE__)
|
14
14
|
super
|
15
|
-
#FileUtils.cp html_doc_path('logo.jpg'), "logo.jpg"
|
16
15
|
end
|
17
16
|
|
18
17
|
def default_fonts(options)
|
19
18
|
{
|
20
|
-
bodyfont: (options[:script] == "Hans" ? '"SimSun",serif' :
|
21
|
-
|
19
|
+
bodyfont: (options[:script] == "Hans" ? '"SimSun",serif' :
|
20
|
+
'"Times New Roman",serif'),
|
21
|
+
headerfont: (options[:script] == "Hans" ? '"SimHei",sans-serif' :
|
22
|
+
'"Times New Roman",serif'),
|
22
23
|
monospacefont: '"Courier New",monospace'
|
23
24
|
}
|
24
25
|
end
|
@@ -35,7 +36,6 @@ module IsoDoc
|
|
35
36
|
}
|
36
37
|
end
|
37
38
|
|
38
|
-
|
39
39
|
def metadata_init(lang, script, labels)
|
40
40
|
@meta = Metadata.new(lang, script, labels)
|
41
41
|
end
|
@@ -142,19 +142,29 @@ module IsoDoc
|
|
142
142
|
end
|
143
143
|
|
144
144
|
def word_cleanup(docxml)
|
145
|
-
word_recommend_cleanup(docxml)
|
146
145
|
super
|
146
|
+
word_recommend_cleanup(docxml)
|
147
|
+
word_copyright_cleanup(docxml)
|
147
148
|
word_license_cleanup(docxml)
|
148
149
|
word_term_cleanup(docxml)
|
149
150
|
docxml
|
150
151
|
end
|
151
152
|
|
152
153
|
def word_license_cleanup(docxml)
|
153
|
-
|
154
|
+
x = "//div[@class = 'boilerplate-license']//p[not(@class)]"
|
155
|
+
docxml.xpath(x).each do |p|
|
154
156
|
p["class"] = "license"
|
155
157
|
end
|
156
158
|
end
|
157
159
|
|
160
|
+
# center only the Copyright notice
|
161
|
+
def word_copyright_cleanup(docxml)
|
162
|
+
x = "//div[@class = 'boilerplate-copyright']/div[1]/p[not(@class)]"
|
163
|
+
docxml.xpath(x).each do |p|
|
164
|
+
p["align"] = "center"
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
158
168
|
def word_term_cleanup(docxml)
|
159
169
|
docxml.xpath("//p[@class = 'TermNum']//p[@class = 'Terms']").each do |p|
|
160
170
|
p.replace(p.children)
|
@@ -168,9 +178,10 @@ module IsoDoc
|
|
168
178
|
docxml.xpath("//table[@class = 'recommend']/thead/tr").each do |tr|
|
169
179
|
style_update(tr, "background:#A5A5A5;")
|
170
180
|
end
|
171
|
-
docxml.xpath("//table[@class = 'recommend']/tbody
|
172
|
-
each_slice(2) do |tr1, tr2|
|
173
|
-
|
181
|
+
docxml.xpath("//table[@class = 'recommend']/tbody").each do |tr|
|
182
|
+
tr.xpath("./tr").each_slice(2) do |tr1, tr2|
|
183
|
+
tr2 && style_update(tr2, "background:#C9C9C9;")
|
184
|
+
end
|
174
185
|
end
|
175
186
|
end
|
176
187
|
|