metanorma-mpfd 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/asciidoctor/mpfd/converter.rb +11 -0
- data/lib/asciidoctor/mpfd/version.rb +1 -1
- data/lib/isodoc/mpfd/html_convert.rb +18 -18
- data/lib/isodoc/mpfd/pdf_convert.rb +89 -89
- data/lib/isodoc/mpfd/word_convert.rb +29 -22
- data/metanorma-mpfd.gemspec +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3aa5a9f0ef4bfd60f3ed379ab93658d135595d46f683ccf902cf500dc872259d
|
4
|
+
data.tar.gz: acc27115044a5e3f1503e81bf004144538123dde339c35340a19acb1a37c6efb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5cf869caa9bc42e2ba1369d100bf737316ea04b34994b39ea00d00024b1ad9c340c903e82fdbc1ecb20af1754fc6f0c60de9b043d28bc5ee0a047a322159cb2f
|
7
|
+
data.tar.gz: 47516f68c9b7c8b079af57a1bee5cc161fb21e8563f430679fe7a8cbacd5d463c91b67af075d820f44df54da32df6719eea825cfabd742da777d551ff1fd8b06
|
@@ -161,6 +161,10 @@ module Asciidoctor
|
|
161
161
|
titlefont: node.attr("title-font"),
|
162
162
|
i18nyaml: node.attr("i18nyaml"),
|
163
163
|
scope: node.attr("scope"),
|
164
|
+
htmlstylesheet: node.attr("htmlstylesheet"),
|
165
|
+
htmlcoverpage: node.attr("htmlcoverpage"),
|
166
|
+
htmlintropage: node.attr("htmlintropage"),
|
167
|
+
scripts: node.attr("scripts"),
|
164
168
|
)
|
165
169
|
end
|
166
170
|
|
@@ -173,6 +177,13 @@ module Asciidoctor
|
|
173
177
|
titlefont: node.attr("title-font"),
|
174
178
|
i18nyaml: node.attr("i18nyaml"),
|
175
179
|
scope: node.attr("scope"),
|
180
|
+
wordstylesheet: node.attr("wordstylesheet"),
|
181
|
+
standardstylesheet: node.attr("standardstylesheet"),
|
182
|
+
header: node.attr("header"),
|
183
|
+
wordcoverpage: node.attr("wordcoverpage"),
|
184
|
+
wordintropage: node.attr("wordintropage"),
|
185
|
+
ulstyle: node.attr("ulstyle"),
|
186
|
+
olstyle: node.attr("olstyle"),
|
176
187
|
)
|
177
188
|
end
|
178
189
|
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require "isodoc"
|
2
2
|
require_relative "metadata"
|
3
|
+
require "fileutils"
|
3
4
|
|
4
5
|
module IsoDoc
|
5
6
|
module Mpfd
|
@@ -8,31 +9,30 @@ module IsoDoc
|
|
8
9
|
# schema encapsulation of the document for validation
|
9
10
|
#
|
10
11
|
class HtmlConvert < IsoDoc::HtmlConvert
|
11
|
-
def rsd_html_path(file)
|
12
|
-
File.join(File.dirname(__FILE__), File.join("html", file))
|
13
|
-
end
|
14
|
-
|
15
12
|
def initialize(options)
|
13
|
+
@libdir = File.dirname(__FILE__)
|
16
14
|
super
|
17
|
-
|
18
|
-
@
|
19
|
-
@htmlintropage = rsd_html_path("html_rsd_intro.html")
|
20
|
-
@scripts = rsd_html_path("scripts.html")
|
21
|
-
system "cp #{rsd_html_path('logo.jpg')} logo.jpg"
|
22
|
-
system "cp #{rsd_html_path('mpfa-logo-no-text@4x.png')} mpfa-logo-no-text@4x.png"
|
15
|
+
FileUtils.cp html_doc_path("logo.jpg"), "logo.jpg"
|
16
|
+
FileUtils.cp html_doc_path('mpfa-logo-no-text@4x.png'), "mpfa-logo-no-text@4x.png"
|
23
17
|
@files_to_delete << "logo.jpg"
|
24
18
|
@files_to_delete << "mpfa-logo-no-text@4x.png"
|
25
19
|
end
|
26
20
|
|
27
21
|
def default_fonts(options)
|
28
|
-
|
29
|
-
(options[:script] == "Hans" ? '"SimSun",serif' :
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
22
|
+
{
|
23
|
+
bodyfont: (options[:script] == "Hans" ? '"SimSun",serif' : '"Titillium Web",sans-serif'),
|
24
|
+
headerfont: (options[:script] == "Hans" ? '"SimHei",sans-serif' : '"Titillium Web",sans-serif'),
|
25
|
+
monospacefont: '"Space Mono",monospace'
|
26
|
+
}
|
27
|
+
end
|
28
|
+
|
29
|
+
def default_file_locations(_options)
|
30
|
+
{
|
31
|
+
htmlstylesheet: html_doc_path("htmlstyle.scss"),
|
32
|
+
htmlcoverpage: html_doc_path("html_rsd_titlepage.html"),
|
33
|
+
htmlintropage: html_doc_path("html_rsd_intro.html"),
|
34
|
+
scripts: html_doc_path("scripts.html"),
|
35
|
+
}
|
36
36
|
end
|
37
37
|
|
38
38
|
def metadata_init(lang, script, labels)
|
@@ -1,36 +1,36 @@
|
|
1
1
|
require "isodoc"
|
2
2
|
require_relative "metadata"
|
3
|
+
require "fileutils"
|
3
4
|
|
4
5
|
module IsoDoc
|
5
6
|
module Mpfd
|
6
7
|
# A {Converter} implementation that generates PDF HTML output, and a
|
7
8
|
# document schema encapsulation of the document for validation
|
8
9
|
class PdfConvert < IsoDoc::PdfConvert
|
9
|
-
def rsd_html_path(file)
|
10
|
-
File.join(File.dirname(__FILE__), File.join("html", file))
|
11
|
-
end
|
12
|
-
|
13
10
|
def initialize(options)
|
11
|
+
@libdir = File.dirname(__FILE__)
|
14
12
|
super
|
15
|
-
|
16
|
-
@
|
17
|
-
@htmlintropage = rsd_html_path("html_rsd_intro.html")
|
18
|
-
@scripts = rsd_html_path("scripts.html")
|
19
|
-
system "cp #{rsd_html_path('logo.jpg')} logo.jpg"
|
20
|
-
system "cp #{rsd_html_path('mpfa-logo-no-text@4x.png')} mpfa-logo-no-text@4x.png"
|
13
|
+
FileUtils.cp html_doc_path("logo.jpg"), "logo.jpg"
|
14
|
+
FileUtils.cp html_doc_path('mpfa-logo-no-text@4x.png'), "mpfa-logo-no-text@4x.png"
|
21
15
|
@files_to_delete << "logo.jpg"
|
22
16
|
@files_to_delete << "mpfa-logo-no-text@4x.png"
|
23
17
|
end
|
24
18
|
|
25
19
|
def default_fonts(options)
|
26
|
-
|
27
|
-
(options[:script] == "Hans" ? '"SimSun",serif' :
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
20
|
+
{
|
21
|
+
bodyfont: (options[:script] == "Hans" ? '"SimSun",serif' : '"Titillium Web",sans-serif'),
|
22
|
+
headerfont: (options[:script] == "Hans" ? '"SimHei",sans-serif' : '"Titillium Web",sans-serif'),
|
23
|
+
monospacefont: '"Space Mono",monospace'
|
24
|
+
}
|
25
|
+
end
|
26
|
+
|
27
|
+
def default_file_locations(_options)
|
28
|
+
{
|
29
|
+
htmlstylesheet: html_doc_path("htmlstyle.scss"),
|
30
|
+
htmlcoverpage: html_doc_path("html_rsd_titlepage.html"),
|
31
|
+
htmlintropage: html_doc_path("html_rsd_intro.html"),
|
32
|
+
scripts: html_doc_path("scripts.html"),
|
33
|
+
}
|
34
34
|
end
|
35
35
|
|
36
36
|
def metadata_init(lang, script, labels)
|
@@ -179,84 +179,84 @@ module IsoDoc
|
|
179
179
|
@clause_lbl = y["clause"]
|
180
180
|
end
|
181
181
|
|
182
|
-
|
182
|
+
def terms_defs_title(f)
|
183
183
|
return f&.at(ns("./title"))&.content
|
184
184
|
end
|
185
185
|
|
186
|
-
|
187
|
-
|
186
|
+
TERM_CLAUSE = "//preface/terms | "\
|
187
|
+
"//preface/clause[descendant::terms]".freeze
|
188
|
+
|
189
|
+
|
190
|
+
def terms_defs(isoxml, out, num)
|
191
|
+
f = isoxml.at(ns(TERM_CLAUSE)) or return num
|
192
|
+
out.div **attr_code(id: f["id"]) do |div|
|
193
|
+
clause_name(nil, terms_defs_title(f), div, nil)
|
194
|
+
f.elements.each do |e|
|
195
|
+
parse(e, div) unless %w{title source}.include? e.name
|
196
|
+
end
|
197
|
+
end
|
198
|
+
num
|
199
|
+
end
|
200
|
+
|
201
|
+
FRONT_CLAUSE = "//*[parent::preface]".freeze
|
202
|
+
#FRONT_CLAUSE = "//clause[parent::preface] | //terms[parent::preface]".freeze
|
203
|
+
|
204
|
+
def preface(isoxml, out)
|
205
|
+
isoxml.xpath(ns(FRONT_CLAUSE)).each do |c|
|
206
|
+
if c.name == "terms" then terms_defs isoxml, out, 0
|
207
|
+
else
|
208
|
+
out.div **attr_code(id: c["id"]) do |s|
|
209
|
+
clause_name(get_anchors[c['id']][:label],
|
210
|
+
c&.at(ns("./title"))&.content, s, nil)
|
211
|
+
c.elements.reject { |c1| c1.name == "title" }.each do |c1|
|
212
|
+
parse(c1, s)
|
213
|
+
end
|
214
|
+
end
|
215
|
+
end
|
216
|
+
end
|
217
|
+
end
|
218
|
+
|
219
|
+
def make_body3(body, docxml)
|
220
|
+
body.div **{ class: "main-section" } do |div3|
|
221
|
+
preface docxml, div3
|
222
|
+
middle docxml, div3
|
223
|
+
footnotes div3
|
224
|
+
comments div3
|
225
|
+
end
|
226
|
+
end
|
188
227
|
|
228
|
+
def middle(isoxml, out)
|
229
|
+
middle_title(out)
|
230
|
+
clause isoxml, out
|
231
|
+
annex isoxml, out
|
232
|
+
bibliography isoxml, out
|
233
|
+
end
|
189
234
|
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
235
|
+
def termdef_parse(node, out)
|
236
|
+
set_termdomain("")
|
237
|
+
node.children.each { |n| parse(n, out) }
|
238
|
+
end
|
239
|
+
|
240
|
+
def initial_anchor_names(d)
|
241
|
+
#preface_names(d.at(ns("//foreword")))
|
242
|
+
#preface_names(d.at(ns("//introduction")))
|
243
|
+
#preface_names(d.at(ns("//preface/terms | "\
|
244
|
+
#"//preface/clause[descendant::terms]")))
|
245
|
+
d.xpath(ns(FRONT_CLAUSE)).each do |c|
|
246
|
+
preface_names(c)
|
247
|
+
sequential_asset_names(c)
|
196
248
|
end
|
249
|
+
middle_section_asset_names(d)
|
250
|
+
clause_names(d, 0)
|
251
|
+
termnote_anchor_names(d)
|
252
|
+
termexample_anchor_names(d)
|
253
|
+
end
|
254
|
+
|
255
|
+
def annex_name_lbl(clause, num)
|
256
|
+
l10n("<b>#{@annex_lbl} #{num}</b>")
|
197
257
|
end
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
FRONT_CLAUSE = "//*[parent::preface]".freeze
|
202
|
-
#FRONT_CLAUSE = "//clause[parent::preface] | //terms[parent::preface]".freeze
|
203
|
-
|
204
|
-
def preface(isoxml, out)
|
205
|
-
isoxml.xpath(ns(FRONT_CLAUSE)).each do |c|
|
206
|
-
if c.name == "terms" then terms_defs isoxml, out, 0
|
207
|
-
else
|
208
|
-
out.div **attr_code(id: c["id"]) do |s|
|
209
|
-
clause_name(get_anchors[c['id']][:label],
|
210
|
-
c&.at(ns("./title"))&.content, s, nil)
|
211
|
-
c.elements.reject { |c1| c1.name == "title" }.each do |c1|
|
212
|
-
parse(c1, s)
|
213
|
-
end
|
214
|
-
end
|
215
|
-
end
|
216
|
-
end
|
217
|
-
end
|
218
|
-
|
219
|
-
def make_body3(body, docxml)
|
220
|
-
body.div **{ class: "main-section" } do |div3|
|
221
|
-
preface docxml, div3
|
222
|
-
middle docxml, div3
|
223
|
-
footnotes div3
|
224
|
-
comments div3
|
225
|
-
end
|
226
|
-
end
|
227
|
-
|
228
|
-
def middle(isoxml, out)
|
229
|
-
middle_title(out)
|
230
|
-
clause isoxml, out
|
231
|
-
annex isoxml, out
|
232
|
-
bibliography isoxml, out
|
233
|
-
end
|
234
|
-
|
235
|
-
def termdef_parse(node, out)
|
236
|
-
set_termdomain("")
|
237
|
-
node.children.each { |n| parse(n, out) }
|
238
|
-
end
|
239
|
-
|
240
|
-
def initial_anchor_names(d)
|
241
|
-
#preface_names(d.at(ns("//foreword")))
|
242
|
-
#preface_names(d.at(ns("//introduction")))
|
243
|
-
#preface_names(d.at(ns("//preface/terms | "\
|
244
|
-
#"//preface/clause[descendant::terms]")))
|
245
|
-
d.xpath(ns(FRONT_CLAUSE)).each do |c|
|
246
|
-
preface_names(c)
|
247
|
-
sequential_asset_names(c)
|
248
|
-
end
|
249
|
-
middle_section_asset_names(d)
|
250
|
-
clause_names(d, 0)
|
251
|
-
termnote_anchor_names(d)
|
252
|
-
termexample_anchor_names(d)
|
253
|
-
end
|
254
|
-
|
255
|
-
def annex_name_lbl(clause, num)
|
256
|
-
l10n("<b>#{@annex_lbl} #{num}</b>")
|
257
|
-
end
|
258
|
-
|
259
|
-
def clause_names(docxml, sect_num)
|
258
|
+
|
259
|
+
def clause_names(docxml, sect_num)
|
260
260
|
q = "//clause[parent::sections]"
|
261
261
|
@topnum = nil
|
262
262
|
lvl = 0
|
@@ -1,40 +1,47 @@
|
|
1
1
|
require "isodoc"
|
2
2
|
require_relative "metadata"
|
3
|
+
require "fileutils"
|
3
4
|
|
4
5
|
module IsoDoc
|
5
6
|
module Mpfd
|
6
7
|
# A {Converter} implementation that generates Word output, and a document
|
7
8
|
# schema encapsulation of the document for validation
|
8
|
-
|
9
9
|
class WordConvert < IsoDoc::WordConvert
|
10
10
|
def rsd_html_path(file)
|
11
11
|
File.join(File.dirname(__FILE__), File.join("html", file))
|
12
12
|
end
|
13
13
|
|
14
14
|
def initialize(options)
|
15
|
+
@libdir = File.dirname(__FILE__)
|
15
16
|
super
|
16
|
-
|
17
|
-
|
18
|
-
@header = rsd_html_path("header.html")
|
19
|
-
@wordcoverpage = rsd_html_path("word_rsd_titlepage.html")
|
20
|
-
@wordintropage = rsd_html_path("word_rsd_intro.html")
|
21
|
-
@ulstyle = "l3"
|
22
|
-
@olstyle = "l2"
|
23
|
-
system "cp #{rsd_html_path('logo.jpg')} logo.jpg"
|
24
|
-
system "cp #{rsd_html_path('mpfa-logo-no-text@4x.png')} mpfa-logo-no-text@4x.png"
|
17
|
+
FileUtils.cp html_doc_path("logo.jpg"), "logo.jpg"
|
18
|
+
FileUtils.cp html_doc_path('mpfa-logo-no-text@4x.png'), "mpfa-logo-no-text@4x.png"
|
25
19
|
@files_to_delete << "logo.jpg"
|
26
20
|
@files_to_delete << "mpfa-logo-no-text@4x.png"
|
27
21
|
end
|
28
22
|
|
29
23
|
def default_fonts(options)
|
30
|
-
|
31
|
-
(options[:script] == "Hans" ? '"SimSun",serif' :
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
24
|
+
{
|
25
|
+
bodyfont: (options[:script] == "Hans" ? '"SimSun",serif' : '"Arial",sans-serif'),
|
26
|
+
headerfont: (options[:script] == "Hans" ? '"SimHei",sans-serif' : '"Arial",sans-serif'),
|
27
|
+
monospacefont: '"Courier New",monospace'
|
28
|
+
}
|
29
|
+
end
|
30
|
+
|
31
|
+
def default_file_locations(options)
|
32
|
+
{
|
33
|
+
htmlstylesheet: html_doc_path("htmlstyle.scss"),
|
34
|
+
htmlcoverpage: html_doc_path("html_rsd_titlepage.html"),
|
35
|
+
htmlintropage: html_doc_path("html_rsd_intro.html"),
|
36
|
+
scripts: html_doc_path("scripts.html"),
|
37
|
+
wordstylesheet: html_doc_path("wordstyle.scss"),
|
38
|
+
standardstylesheet: html_doc_path("rsd.scss"),
|
39
|
+
header: html_doc_path("header.html"),
|
40
|
+
wordcoverpage: html_doc_path("word_rsd_titlepage.html"),
|
41
|
+
wordintropage: html_doc_path("word_rsd_intro.html"),
|
42
|
+
ulstyle: "l3",
|
43
|
+
olstyle: "l2",
|
44
|
+
}
|
38
45
|
end
|
39
46
|
|
40
47
|
def metadata_init(lang, script, labels)
|
@@ -233,11 +240,11 @@ module IsoDoc
|
|
233
240
|
node.children.each { |n| parse(n, out) }
|
234
241
|
end
|
235
242
|
|
236
|
-
|
237
|
-
|
238
|
-
|
243
|
+
def annex_name_lbl(clause, num)
|
244
|
+
l10n("<b>#{@annex_lbl} #{num}</b>")
|
245
|
+
end
|
239
246
|
|
240
|
-
|
247
|
+
def clause_names(docxml, sect_num)
|
241
248
|
q = "//clause[parent::sections]"
|
242
249
|
@topnum = nil
|
243
250
|
lvl = 0
|
data/metanorma-mpfd.gemspec
CHANGED
@@ -29,7 +29,7 @@ Gem::Specification.new do |spec|
|
|
29
29
|
spec.add_dependency "htmlentities", "~> 4.3.4"
|
30
30
|
spec.add_dependency "nokogiri"
|
31
31
|
spec.add_dependency "asciidoctor-iso", "~> 0.10.1"
|
32
|
-
spec.add_dependency "isodoc", "
|
32
|
+
spec.add_dependency "isodoc", "~> 0.8.8"
|
33
33
|
spec.add_dependency "twitter_cldr"
|
34
34
|
|
35
35
|
spec.add_development_dependency "bundler", "~> 1.15"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metanorma-mpfd
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-08-
|
11
|
+
date: 2018-08-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: asciidoctor
|
@@ -70,16 +70,16 @@ dependencies:
|
|
70
70
|
name: isodoc
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - "
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 0.8.
|
75
|
+
version: 0.8.8
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - "
|
80
|
+
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 0.8.
|
82
|
+
version: 0.8.8
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: twitter_cldr
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -319,7 +319,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
319
319
|
version: '0'
|
320
320
|
requirements: []
|
321
321
|
rubyforge_project:
|
322
|
-
rubygems_version: 2.7.
|
322
|
+
rubygems_version: 2.7.6
|
323
323
|
signing_key:
|
324
324
|
specification_version: 4
|
325
325
|
summary: metanorma-mpfd lets you write MPF documents in AsciiDoc.
|