metanorma-itu 1.0.13 → 1.0.14
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/itu/biblio.rng +53 -26
- data/lib/asciidoctor/itu/cleanup.rb +2 -0
- data/lib/asciidoctor/itu/front.rb +22 -18
- data/lib/asciidoctor/itu/isodoc.rng +28 -1
- data/lib/isodoc/itu/base_convert.rb +3 -2
- data/lib/isodoc/itu/html/header.html +8 -8
- data/lib/isodoc/itu/html/html_itu_titlepage.html +2 -2
- data/lib/isodoc/itu/html/itu.scss +1 -1
- data/lib/isodoc/itu/html/scripts.html +4 -20
- data/lib/isodoc/itu/html/word_itu_titlepage.html +2 -2
- data/lib/isodoc/itu/itu.recommendation.xsl +3451 -0
- data/lib/isodoc/itu/itu.resolution.xsl +3451 -0
- data/lib/isodoc/itu/pdf_convert.rb +13 -47
- data/lib/isodoc/itu/terms.rb +3 -4
- data/lib/isodoc/itu/word_convert.rb +1 -1
- data/lib/isodoc/itu/xref.rb +2 -2
- data/lib/metanorma/itu/processor.rb +4 -0
- data/lib/metanorma/itu/version.rb +1 -1
- metadata +4 -2
@@ -6,61 +6,27 @@ module IsoDoc
|
|
6
6
|
module ITU
|
7
7
|
# A {Converter} implementation that generates PDF HTML output, and a
|
8
8
|
# document schema encapsulation of the document for validation
|
9
|
-
class PdfConvert < IsoDoc::
|
9
|
+
class PdfConvert < IsoDoc::XslfoPdfConvert
|
10
10
|
def initialize(options)
|
11
11
|
@libdir = File.dirname(__FILE__)
|
12
12
|
@hierarchical_assets = options[:hierarchical_assets]
|
13
13
|
super
|
14
14
|
end
|
15
15
|
|
16
|
-
def
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
monospacefont: '"Space Mono",monospace'
|
25
|
-
}
|
26
|
-
end
|
27
|
-
|
28
|
-
def default_file_locations(_options)
|
29
|
-
{
|
30
|
-
htmlstylesheet: html_doc_path("htmlstyle.scss"),
|
31
|
-
htmlcoverpage: html_doc_path("html_itu_titlepage.html"),
|
32
|
-
htmlintropage: html_doc_path("html_itu_intro.html"),
|
33
|
-
scripts_pdf: html_doc_path("scripts.pdf.html"),
|
34
|
-
}
|
35
|
-
end
|
36
|
-
|
37
|
-
def googlefonts()
|
38
|
-
<<~HEAD.freeze
|
39
|
-
<link href="https://fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,600,600i,800|Space+Mono:400,700" rel="stylesheet">
|
40
|
-
HEAD
|
41
|
-
end
|
42
|
-
|
43
|
-
def make_body(xml, docxml)
|
44
|
-
body_attr = { lang: "EN-US", link: "blue", vlink: "#954F72", "xml:lang": "EN-US", class: "container" }
|
45
|
-
xml.body **body_attr do |body|
|
46
|
-
make_body1(body, docxml)
|
47
|
-
make_body2(body, docxml)
|
48
|
-
make_body3(body, docxml)
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
def make_body3(body, docxml)
|
53
|
-
body.div **{ class: "main-section" } do |div3|
|
54
|
-
boilerplate docxml, div3
|
55
|
-
abstract docxml, div3
|
56
|
-
preface docxml, div3
|
57
|
-
middle docxml, div3
|
58
|
-
footnotes div3
|
59
|
-
comments div3
|
16
|
+
def convert(filename, file = nil, debug = false)
|
17
|
+
file = File.read(filename, encoding: "utf-8") if file.nil?
|
18
|
+
docxml, outname_html, dir = convert_init(file, filename, debug)
|
19
|
+
resolution = docxml.at(ns("//bibdata/ext[doctype = 'resolution']"))
|
20
|
+
/\.xml$/.match(filename) or
|
21
|
+
filename = Tempfile.open([outname_html, ".xml"], encoding: "utf-8") do |f|
|
22
|
+
f.write file
|
23
|
+
f.path
|
60
24
|
end
|
25
|
+
FileUtils.rm_rf dir
|
26
|
+
::Metanorma::Output::XslfoPdf.new.convert(
|
27
|
+
filename, outname_html + ".pdf",
|
28
|
+
File.join(@libdir, resolution ? "itu.resolution.xsl" : "itu.recommendation.xsl"))
|
61
29
|
end
|
62
|
-
|
63
|
-
include BaseConvert
|
64
30
|
end
|
65
31
|
end
|
66
32
|
end
|
data/lib/isodoc/itu/terms.rb
CHANGED
@@ -1,16 +1,15 @@
|
|
1
1
|
module IsoDoc
|
2
2
|
module ITU
|
3
3
|
module BaseConvert
|
4
|
-
def
|
5
|
-
|
6
|
-
super
|
4
|
+
def term_def_title(node)
|
5
|
+
node
|
7
6
|
end
|
8
7
|
|
9
8
|
def terms_defs(node, out, num)
|
10
9
|
f = node.at(ns(IsoDoc::Convert::TERM_CLAUSE)) or return num
|
11
10
|
out.div **attr_code(id: f["id"]) do |div|
|
12
11
|
num = num + 1
|
13
|
-
clause_name(num,
|
12
|
+
clause_name(num, term_def_title(f.at(ns("./title"))), div, nil)
|
14
13
|
if f.at(ns("./clause | ./terms | ./term")).nil? then out.p "None."
|
15
14
|
else
|
16
15
|
f.children.reject { |c1| c1.name == "title" }.each do |c1|
|
@@ -117,7 +117,7 @@ module IsoDoc
|
|
117
117
|
def formula_parse1(node, out)
|
118
118
|
out.div **attr_code(id: node["id"], class: "formula") do |div|
|
119
119
|
div.p **attr_code(class: "formula") do |p|
|
120
|
-
insert_tab(div,
|
120
|
+
insert_tab(div, 1)
|
121
121
|
parse(node.at(ns("./stem")), div)
|
122
122
|
lbl = anchor(node['id'], :label, false)
|
123
123
|
unless lbl.nil?
|
data/lib/isodoc/itu/xref.rb
CHANGED
@@ -89,7 +89,7 @@ module IsoDoc
|
|
89
89
|
j = 0
|
90
90
|
c.increment(t)
|
91
91
|
end
|
92
|
-
label = c.print + (j.zero? ? "" : "-#{(
|
92
|
+
label = c.print + (j.zero? ? "" : "-#{(96 + j).chr.to_s}")
|
93
93
|
next if t["id"].nil? || t["id"].empty?
|
94
94
|
@anchors[t["id"]] =
|
95
95
|
anchor_struct(label, nil, @figure_lbl, "figure", t["unnumbered"])
|
@@ -106,7 +106,7 @@ module IsoDoc
|
|
106
106
|
c.increment(t)
|
107
107
|
end
|
108
108
|
label = "#{num}#{hiersep}#{c.print}" +
|
109
|
-
(j.zero? ? "" : "#{hierfigsep}#{(
|
109
|
+
(j.zero? ? "" : "#{hierfigsep}#{(96 + j).chr.to_s}")
|
110
110
|
next if t["id"].nil? || t["id"].empty?
|
111
111
|
@anchors[t["id"]] = anchor_struct(label, nil, @figure_lbl, "figure",
|
112
112
|
t["unnumbered"])
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metanorma-itu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.14
|
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
|
@@ -275,6 +275,8 @@ files:
|
|
275
275
|
- lib/isodoc/itu/html/wordstyle.scss
|
276
276
|
- lib/isodoc/itu/html_convert.rb
|
277
277
|
- lib/isodoc/itu/i18n-en.yaml
|
278
|
+
- lib/isodoc/itu/itu.recommendation.xsl
|
279
|
+
- lib/isodoc/itu/itu.resolution.xsl
|
278
280
|
- lib/isodoc/itu/metadata.rb
|
279
281
|
- lib/isodoc/itu/pdf_convert.rb
|
280
282
|
- lib/isodoc/itu/ref.rb
|