metanorma-gb 1.3.26 → 1.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/macos.yml +0 -1
- data/.github/workflows/ubuntu.yml +10 -7
- data/.github/workflows/windows.yml +0 -1
- data/.gitignore +0 -2
- data/Gemfile +0 -1
- data/Rakefile +17 -0
- data/lib/asciidoctor/gb/biblio.rng +1 -1
- data/lib/asciidoctor/gb/converter.rb +16 -17
- data/lib/asciidoctor/gb/front_id.rb +1 -1
- data/lib/asciidoctor/gb/isodoc.rng +427 -0
- data/lib/asciidoctor/gb/isostandard.rng +3 -0
- data/lib/asciidoctor/gb/reqt.rng +23 -0
- data/lib/isodoc/gb/{gbbaseconvert.rb → base_convert.rb} +15 -13
- data/lib/isodoc/gb/{gbcleanup.rb → cleanup.rb} +0 -0
- data/lib/isodoc/gb/{gbconvert.rb → common.rb} +1 -1
- data/lib/isodoc/gb/gb.recommendation.xsl +752 -351
- data/lib/isodoc/gb/html/_coverpage.css +193 -0
- data/lib/isodoc/gb/html/gb.css +657 -0
- data/lib/isodoc/gb/html/htmlcompliantstyle.css +1303 -0
- data/lib/isodoc/gb/html/htmlcompliantstyle.scss +0 -1
- data/lib/isodoc/gb/html/htmlstyle.css +844 -0
- data/lib/isodoc/gb/html/wordstyle.css +2932 -0
- data/lib/isodoc/gb/{gbhtmlconvert.rb → html_convert.rb} +13 -3
- data/lib/isodoc/gb/pdf_convert.rb +2 -11
- data/lib/isodoc/gb/presentation_xml_convert.rb +10 -0
- data/lib/isodoc/gb/{gbwordconvert.rb → word_convert.rb} +18 -8
- data/lib/metanorma-gb.rb +3 -3
- data/lib/metanorma/gb/processor.rb +13 -10
- data/lib/metanorma/gb/version.rb +1 -1
- data/metanorma-gb.gemspec +3 -2
- metadata +35 -16
@@ -1,4 +1,4 @@
|
|
1
|
-
require_relative "
|
1
|
+
require_relative "base_convert"
|
2
2
|
require "isodoc"
|
3
3
|
|
4
4
|
module IsoDoc
|
@@ -27,6 +27,16 @@ module IsoDoc
|
|
27
27
|
}
|
28
28
|
end
|
29
29
|
|
30
|
+
def fonts_options
|
31
|
+
default_font_options = default_fonts(options)
|
32
|
+
{
|
33
|
+
bodyfont: options[:bodyfont] || default_font_options[:bodyfont],
|
34
|
+
headerfont: options[:headerfont] || default_font_options[:headerfont],
|
35
|
+
monospacefont: options[:monospacefont] || default_font_options[:monospacefont],
|
36
|
+
titlefont: options[:titlefont] || default_font_options[:titlefont]
|
37
|
+
}
|
38
|
+
end
|
39
|
+
|
30
40
|
def default_file_locations(options)
|
31
41
|
{
|
32
42
|
htmlstylesheet: options[:compliant] ? html_doc_path("htmlcompliantstyle.scss") : html_doc_path("htmlstyle.scss"),
|
@@ -37,7 +47,7 @@ module IsoDoc
|
|
37
47
|
end
|
38
48
|
|
39
49
|
def populate_template(docxml, format)
|
40
|
-
meta = @meta.get.merge(@labels)
|
50
|
+
meta = @meta.get.merge(@labels).merge(@meta.fonts_options || {})
|
41
51
|
logo = @common.format_logo(meta[:gbprefix], meta[:gbscope], format, @localdir)
|
42
52
|
logofile = @meta.standard_logo(meta[:gbprefix])
|
43
53
|
meta[:standard_agency_formatted] =
|
@@ -54,7 +64,7 @@ module IsoDoc
|
|
54
64
|
|
55
65
|
def annex_name(annex, name, div)
|
56
66
|
div.h1 **{ class: "Annex" } do |t|
|
57
|
-
t << "#{anchor(annex['id'], :label)}<br/><br/>"
|
67
|
+
t << "#{@xrefs.anchor(annex['id'], :label)}<br/><br/>"
|
58
68
|
t.b do |b|
|
59
69
|
name&.children&.each { |c2| parse(c2, b) }
|
60
70
|
end
|
@@ -12,17 +12,8 @@ module IsoDoc
|
|
12
12
|
super
|
13
13
|
end
|
14
14
|
|
15
|
-
def
|
16
|
-
|
17
|
-
docxml, outname_html, dir = convert_init(file, filename, debug)
|
18
|
-
/\.xml$/.match(filename) or
|
19
|
-
filename = Tempfile.open([outname_html, ".xml"], encoding: "utf-8") do |f|
|
20
|
-
f.write file
|
21
|
-
f.path
|
22
|
-
end
|
23
|
-
FileUtils.rm_rf dir
|
24
|
-
::Metanorma::Output::XslfoPdf.new.convert(
|
25
|
-
filename, outname_html + ".pdf", File.join(@libdir, "gb.recommendation.xsl"))
|
15
|
+
def pdf_stylesheet(docxml)
|
16
|
+
"gb.recommendation.xsl"
|
26
17
|
end
|
27
18
|
end
|
28
19
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require_relative "
|
1
|
+
require_relative "base_convert"
|
2
2
|
require "isodoc"
|
3
3
|
|
4
4
|
module IsoDoc
|
@@ -24,11 +24,21 @@ module IsoDoc
|
|
24
24
|
monospacefont: '"Courier New",monospace',
|
25
25
|
titlefont: (scope == "national" ? (script != "Hans" ? '"Cambria",serif' : '"SimSun",serif' ) :
|
26
26
|
(script == "Hans" ? '"SimHei",sans-serif' : '"Calibri",sans-serif' ))
|
27
|
-
}
|
28
|
-
end
|
27
|
+
}
|
28
|
+
end
|
29
|
+
|
30
|
+
def fonts_options
|
31
|
+
default_font_options = default_fonts(options)
|
32
|
+
{
|
33
|
+
bodyfont: options[:bodyfont] || default_font_options[:bodyfont],
|
34
|
+
headerfont: options[:headerfont] || default_font_options[:headerfont],
|
35
|
+
monospacefont: options[:monospacefont] || default_font_options[:monospacefont],
|
36
|
+
titlefont: options[:titlefont] || default_font_options[:titlefont]
|
37
|
+
}
|
38
|
+
end
|
29
39
|
|
30
40
|
def default_file_locations(options)
|
31
|
-
{
|
41
|
+
{
|
32
42
|
wordstylesheet: html_doc_path("wordstyle.scss"),
|
33
43
|
standardstylesheet: html_doc_path("gb.scss"),
|
34
44
|
header: html_doc_path("header.html"),
|
@@ -37,10 +47,10 @@ module IsoDoc
|
|
37
47
|
ulstyle: "l7",
|
38
48
|
olstyle: "l10",
|
39
49
|
}
|
40
|
-
end
|
50
|
+
end
|
41
51
|
|
42
52
|
ENDLINE = <<~END.freeze
|
43
|
-
<v:line
|
53
|
+
<v:line
|
44
54
|
alt="" style='position:absolute;left:0;text-align:left;z-index:251662848;
|
45
55
|
mso-wrap-edited:f;mso-width-percent:0;mso-height-percent:0;
|
46
56
|
mso-width-percent:0;mso-height-percent:0'
|
@@ -71,7 +81,7 @@ module IsoDoc
|
|
71
81
|
end
|
72
82
|
|
73
83
|
def populate_template(docxml, format)
|
74
|
-
meta = @meta.get.merge(@labels)
|
84
|
+
meta = @meta.get.merge(@labels).merge(@meta.fonts_options || {})
|
75
85
|
logo = @common.format_logo(meta[:gbprefix], meta[:gbscope], format, @localdir)
|
76
86
|
logofile = @meta.standard_logo(meta[:gbprefix])
|
77
87
|
meta[:standard_agency_formatted] =
|
@@ -84,7 +94,7 @@ module IsoDoc
|
|
84
94
|
|
85
95
|
def annex_name(annex, name, div)
|
86
96
|
div.h1 **{ class: "Annex" } do |t|
|
87
|
-
t << "#{anchor(annex['id'], :label)}<br/><br/>"
|
97
|
+
t << "#{@xrefs.anchor(annex['id'], :label)}<br/><br/>"
|
88
98
|
name&.children&.each { |c2| parse(c2, t) }
|
89
99
|
end
|
90
100
|
end
|
data/lib/metanorma-gb.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
require "asciidoctor" unless defined? Asciidoctor::Converter
|
2
2
|
require_relative "asciidoctor/gb/converter"
|
3
3
|
require_relative "metanorma/gb/version"
|
4
|
-
require "isodoc/gb/
|
5
|
-
require "isodoc/gb/
|
6
|
-
require "isodoc/gb/
|
4
|
+
require "isodoc/gb/common"
|
5
|
+
require "isodoc/gb/html_convert"
|
6
|
+
require "isodoc/gb/word_convert"
|
7
7
|
require "isodoc/gb/pdf_convert"
|
8
8
|
|
9
9
|
if defined? Metanorma
|
@@ -32,10 +32,6 @@ module Metanorma
|
|
32
32
|
"Metanorma::Gb #{Metanorma::Gb::VERSION}"
|
33
33
|
end
|
34
34
|
|
35
|
-
def input_to_isodoc(file, filename)
|
36
|
-
Metanorma::Input::Asciidoc.new.process(file, filename, @asciidoctor_backend)
|
37
|
-
end
|
38
|
-
|
39
35
|
def extract_options(file)
|
40
36
|
head = file.sub(/\n\n.*$/m, "\n")
|
41
37
|
/\n:standard-logo-img: (?<standardlogoimg>[^\n]+)\n/ =~ head
|
@@ -51,16 +47,23 @@ module Metanorma
|
|
51
47
|
super.merge(new_options)
|
52
48
|
end
|
53
49
|
|
54
|
-
def
|
50
|
+
def use_presentation_xml(ext)
|
51
|
+
return true if ext == :compliant_html
|
52
|
+
super
|
53
|
+
end
|
54
|
+
|
55
|
+
def output(isodoc_node, inname, outname, format, options={})
|
55
56
|
case format
|
56
57
|
when :html
|
57
|
-
IsoDoc::Gb::HtmlConvert.new(options).convert(
|
58
|
+
IsoDoc::Gb::HtmlConvert.new(options).convert(inname, isodoc_node, nil, outname)
|
58
59
|
when :compliant_html
|
59
|
-
IsoDoc::Gb::HtmlConvert.new(options.merge(compliant: true)).convert(
|
60
|
-
when :doc
|
61
|
-
IsoDoc::Gb::WordConvert.new(options).convert(outname, isodoc_node)
|
60
|
+
IsoDoc::Gb::HtmlConvert.new(options.merge(compliant: true)).convert(inname, isodoc_node, nil, outname)
|
62
61
|
when :doc
|
63
|
-
IsoDoc::Gb::
|
62
|
+
IsoDoc::Gb::WordConvert.new(options).convert(inname, isodoc_node, nil, outname)
|
63
|
+
when :pdf
|
64
|
+
IsoDoc::Gb::PdfConvert.new(options).convert(inname, isodoc_node, nil, outname)
|
65
|
+
when :presentation
|
66
|
+
IsoDoc::Gb::PresentationXMLConvert.new(options).convert(inname, isodoc_node, nil, outname)
|
64
67
|
else
|
65
68
|
super
|
66
69
|
end
|
data/lib/metanorma/gb/version.rb
CHANGED
data/metanorma-gb.gemspec
CHANGED
@@ -29,13 +29,14 @@ Gem::Specification.new do |spec|
|
|
29
29
|
spec.require_paths = ["lib"]
|
30
30
|
spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
|
31
31
|
|
32
|
-
spec.add_dependency "metanorma-iso", "~> 1.
|
33
|
-
spec.add_dependency "isodoc", "~> 1.
|
32
|
+
spec.add_dependency "metanorma-iso", "~> 1.4.0"
|
33
|
+
spec.add_dependency "isodoc", "~> 1.1.0"
|
34
34
|
spec.add_dependency "twitter_cldr", "~> 4.4.4"
|
35
35
|
spec.add_dependency "gb-agencies", "~> 0.0.4"
|
36
36
|
spec.add_dependency "htmlentities", "~> 4.3.4"
|
37
37
|
|
38
38
|
spec.add_development_dependency "byebug", "~> 9.1"
|
39
|
+
spec.add_development_dependency "sassc", "2.4.0"
|
39
40
|
spec.add_development_dependency "equivalent-xml", "~> 0.6"
|
40
41
|
spec.add_development_dependency "guard", "~> 2.14"
|
41
42
|
spec.add_development_dependency "guard-rspec", "~> 4.7"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metanorma-gb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3
|
4
|
+
version: 1.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-07-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: metanorma-iso
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.
|
19
|
+
version: 1.4.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 1.
|
26
|
+
version: 1.4.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: isodoc
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 1.
|
33
|
+
version: 1.1.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 1.
|
40
|
+
version: 1.1.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: twitter_cldr
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -94,6 +94,20 @@ dependencies:
|
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '9.1'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: sassc
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - '='
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 2.4.0
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - '='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 2.4.0
|
97
111
|
- !ruby/object:Gem::Dependency
|
98
112
|
name: equivalent-xml
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -262,12 +276,11 @@ files:
|
|
262
276
|
- lib/asciidoctor/gb/reqt.rng
|
263
277
|
- lib/asciidoctor/gb/section_input.rb
|
264
278
|
- lib/asciidoctor/gb/validate.rb
|
279
|
+
- lib/isodoc/gb/base_convert.rb
|
280
|
+
- lib/isodoc/gb/cleanup.rb
|
281
|
+
- lib/isodoc/gb/common.rb
|
265
282
|
- lib/isodoc/gb/gb.recommendation.xsl
|
266
|
-
- lib/isodoc/gb/
|
267
|
-
- lib/isodoc/gb/gbcleanup.rb
|
268
|
-
- lib/isodoc/gb/gbconvert.rb
|
269
|
-
- lib/isodoc/gb/gbhtmlconvert.rb
|
270
|
-
- lib/isodoc/gb/gbwordconvert.rb
|
283
|
+
- lib/isodoc/gb/html/_coverpage.css
|
271
284
|
- lib/isodoc/gb/html/_coverpage.scss
|
272
285
|
- lib/isodoc/gb/html/blank.png
|
273
286
|
- lib/isodoc/gb/html/footer.png
|
@@ -292,22 +305,29 @@ files:
|
|
292
305
|
- lib/isodoc/gb/html/gb-logos/gb-standard-zb.gif
|
293
306
|
- lib/isodoc/gb/html/gb-logos/gb-standard-zb.png
|
294
307
|
- lib/isodoc/gb/html/gb-logos/gb-standard-zb.svg
|
308
|
+
- lib/isodoc/gb/html/gb.css
|
295
309
|
- lib/isodoc/gb/html/gb.scss
|
296
310
|
- lib/isodoc/gb/html/header.html
|
297
311
|
- lib/isodoc/gb/html/html_compliant_gb_titlepage.html
|
298
312
|
- lib/isodoc/gb/html/html_gb_intro.html
|
299
313
|
- lib/isodoc/gb/html/html_gb_titlepage.html
|
314
|
+
- lib/isodoc/gb/html/htmlcompliantstyle.css
|
300
315
|
- lib/isodoc/gb/html/htmlcompliantstyle.scss
|
316
|
+
- lib/isodoc/gb/html/htmlstyle.css
|
301
317
|
- lib/isodoc/gb/html/htmlstyle.scss
|
302
318
|
- lib/isodoc/gb/html/logo.png
|
303
319
|
- lib/isodoc/gb/html/scripts.html
|
304
320
|
- lib/isodoc/gb/html/word_gb_intro.html
|
305
321
|
- lib/isodoc/gb/html/word_gb_titlepage.html
|
322
|
+
- lib/isodoc/gb/html/wordstyle.css
|
306
323
|
- lib/isodoc/gb/html/wordstyle.scss
|
324
|
+
- lib/isodoc/gb/html_convert.rb
|
307
325
|
- lib/isodoc/gb/i18n-en.yaml
|
308
326
|
- lib/isodoc/gb/i18n-zh-Hans.yaml
|
309
327
|
- lib/isodoc/gb/metadata.rb
|
310
328
|
- lib/isodoc/gb/pdf_convert.rb
|
329
|
+
- lib/isodoc/gb/presentation_xml_convert.rb
|
330
|
+
- lib/isodoc/gb/word_convert.rb
|
311
331
|
- lib/metanorma-gb.rb
|
312
332
|
- lib/metanorma/gb.rb
|
313
333
|
- lib/metanorma/gb/processor.rb
|
@@ -317,7 +337,7 @@ homepage: https://github.com/metanorma/metanorma-gb
|
|
317
337
|
licenses:
|
318
338
|
- BSD-2-Clause
|
319
339
|
metadata: {}
|
320
|
-
post_install_message:
|
340
|
+
post_install_message:
|
321
341
|
rdoc_options: []
|
322
342
|
require_paths:
|
323
343
|
- lib
|
@@ -332,9 +352,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
332
352
|
- !ruby/object:Gem::Version
|
333
353
|
version: '0'
|
334
354
|
requirements: []
|
335
|
-
|
336
|
-
|
337
|
-
signing_key:
|
355
|
+
rubygems_version: 3.0.3
|
356
|
+
signing_key:
|
338
357
|
specification_version: 4
|
339
358
|
summary: metanorma-gb lets you write GB standards in AsciiDoc.
|
340
359
|
test_files: []
|