metanorma-ogc 1.0.4 → 1.0.5
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 +0 -7
- data/.github/workflows/ubuntu.yml +2 -9
- data/.github/workflows/windows.yml +0 -8
- data/lib/asciidoctor/ogc/biblio.rng +107 -32
- data/lib/asciidoctor/ogc/converter.rb +4 -2
- data/lib/asciidoctor/ogc/isodoc.rng +28 -1
- data/lib/asciidoctor/ogc/ogc.rng +0 -4
- data/lib/isodoc/ogc/html/html_ogc_titlepage.html +2 -1
- data/lib/isodoc/ogc/html/scripts.html +4 -20
- data/lib/isodoc/ogc/html/word_ogc_titlepage.html +13 -4
- data/lib/isodoc/ogc/ogc.community-standard.xsl +3140 -0
- data/lib/isodoc/ogc/ogc.engineering-report.xsl +3140 -0
- data/lib/isodoc/ogc/ogc.other.xsl +3140 -0
- data/lib/isodoc/ogc/ogc.policy.xsl +3140 -0
- data/lib/isodoc/ogc/ogc.reference-model.xsl +3140 -0
- data/lib/isodoc/ogc/ogc.release-notes.xsl +3140 -0
- data/lib/isodoc/ogc/ogc.standard.xsl +3140 -0
- data/lib/isodoc/ogc/ogc.test-suite.xsl +3140 -0
- data/lib/isodoc/ogc/ogc.user-guide.xsl +3140 -0
- data/lib/isodoc/ogc/pdf_convert.rb +15 -78
- data/lib/metanorma/ogc/processor.rb +4 -0
- data/lib/metanorma/ogc/version.rb +1 -1
- metadata +11 -2
@@ -1,95 +1,32 @@
|
|
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
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
htmlstylesheet: html_doc_path("htmlstyle.scss"),
|
29
|
-
htmlcoverpage: html_doc_path("html_ogc_titlepage.html"),
|
30
|
-
htmlintropage: html_doc_path("html_ogc_intro.html"),
|
31
|
-
scripts_pdf: html_doc_path("scripts.pdf.html"),
|
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"
|
53
|
-
end
|
54
|
-
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
|
14
|
+
def convert(filename, file = nil, debug = false)
|
15
|
+
file = File.read(filename, encoding: "utf-8") if file.nil?
|
16
|
+
docxml, outname_html, dir = convert_init(file, filename, debug)
|
17
|
+
doctype = docxml&.at(ns("//bibdata/ext/doctype"))&.text
|
18
|
+
doctype = "other" unless %w(community-standard engineering-report policy
|
19
|
+
reference-model release-notes standard user-guide test-suite).include? doctype
|
20
|
+
/\.xml$/.match(filename) or
|
21
|
+
filename = Tempfile.open([outname_html, ".xml"], encoding: "utf-8") do |f|
|
22
|
+
f.write file
|
23
|
+
f.path
|
84
24
|
end
|
25
|
+
FileUtils.rm_rf dir
|
26
|
+
::Metanorma::Output::XslfoPdf.new.convert(
|
27
|
+
filename, outname_html + ".pdf",
|
28
|
+
File.join(@libdir, "unece.#{doctype}.xsl"))
|
85
29
|
end
|
86
|
-
|
87
|
-
def authority_cleanup(docxml)
|
88
|
-
authority_cleanup1(docxml, "contact")
|
89
|
-
super
|
90
|
-
end
|
91
|
-
|
92
|
-
include BaseConvert
|
93
30
|
end
|
94
31
|
end
|
95
32
|
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: 1.0.
|
4
|
+
version: 1.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-05-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: htmlentities
|
@@ -257,6 +257,15 @@ files:
|
|
257
257
|
- lib/isodoc/ogc/html_convert.rb
|
258
258
|
- lib/isodoc/ogc/i18n-en.yaml
|
259
259
|
- lib/isodoc/ogc/metadata.rb
|
260
|
+
- lib/isodoc/ogc/ogc.community-standard.xsl
|
261
|
+
- lib/isodoc/ogc/ogc.engineering-report.xsl
|
262
|
+
- lib/isodoc/ogc/ogc.other.xsl
|
263
|
+
- lib/isodoc/ogc/ogc.policy.xsl
|
264
|
+
- lib/isodoc/ogc/ogc.reference-model.xsl
|
265
|
+
- lib/isodoc/ogc/ogc.release-notes.xsl
|
266
|
+
- lib/isodoc/ogc/ogc.standard.xsl
|
267
|
+
- lib/isodoc/ogc/ogc.test-suite.xsl
|
268
|
+
- lib/isodoc/ogc/ogc.user-guide.xsl
|
260
269
|
- lib/isodoc/ogc/pdf_convert.rb
|
261
270
|
- lib/isodoc/ogc/reqt.rb
|
262
271
|
- lib/isodoc/ogc/sections.rb
|