metanorma-gb 1.3.25 → 1.4.2
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/Gemfile +0 -1
- data/Rakefile +17 -0
- data/lib/asciidoctor/gb/biblio.rng +11 -3
- data/lib/asciidoctor/gb/converter.rb +22 -16
- data/lib/asciidoctor/gb/front.rb +2 -52
- data/lib/asciidoctor/gb/front_id.rb +57 -0
- data/lib/asciidoctor/gb/isodoc.rng +444 -1
- data/lib/asciidoctor/gb/isostandard.rng +10 -1
- data/lib/asciidoctor/gb/reqt.rng +23 -0
- data/lib/isodoc/gb/{gbbaseconvert.rb → base_convert.rb} +30 -34
- 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 +3653 -0
- data/lib/isodoc/gb/html/htmlcompliantstyle.scss +0 -1
- data/lib/isodoc/gb/{gbhtmlconvert.rb → html_convert.rb} +13 -3
- data/lib/isodoc/gb/pdf_convert.rb +21 -0
- 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 +4 -3
- data/lib/metanorma/gb/processor.rb +16 -9
- data/lib/metanorma/gb/version.rb +1 -1
- data/metanorma-gb.gemspec +3 -2
- metadata +33 -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
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require "isodoc"
|
2
|
+
|
3
|
+
module IsoDoc
|
4
|
+
module Gb
|
5
|
+
|
6
|
+
# A {Converter} implementation that generates HTML output, and a document
|
7
|
+
# schema encapsulation of the document for validation
|
8
|
+
#
|
9
|
+
class PdfConvert < IsoDoc::XslfoPdfConvert
|
10
|
+
def initialize(options)
|
11
|
+
@libdir = File.dirname(__FILE__)
|
12
|
+
super
|
13
|
+
end
|
14
|
+
|
15
|
+
def pdf_stylesheet(docxml)
|
16
|
+
"gb.recommendation.xsl"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
@@ -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,10 @@
|
|
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
|
+
require "isodoc/gb/pdf_convert"
|
7
8
|
|
8
9
|
if defined? Metanorma
|
9
10
|
require_relative "metanorma/gb"
|
@@ -7,6 +7,7 @@ module Metanorma
|
|
7
7
|
compliant_html: ["SimSun", "Cambria", "SimHei", "Calibri", "Courier New"],
|
8
8
|
html: ["SimSun", "Cambria", "SimHei", "Calibri", "Courier New"],
|
9
9
|
doc: ["SimSun", "Cambria", "SimHei", "Calibri", "Courier New"],
|
10
|
+
pdf: ["SimSun", "Cambria", "SimHei", "Calibri", "Courier New"],
|
10
11
|
}
|
11
12
|
end
|
12
13
|
|
@@ -22,7 +23,8 @@ module Metanorma
|
|
22
23
|
super.merge(
|
23
24
|
html: "html",
|
24
25
|
compliant_html: "compliant.html",
|
25
|
-
doc: "doc"
|
26
|
+
doc: "doc",
|
27
|
+
pdf: "pdf",
|
26
28
|
)
|
27
29
|
end
|
28
30
|
|
@@ -30,10 +32,6 @@ module Metanorma
|
|
30
32
|
"Metanorma::Gb #{Metanorma::Gb::VERSION}"
|
31
33
|
end
|
32
34
|
|
33
|
-
def input_to_isodoc(file, filename)
|
34
|
-
Metanorma::Input::Asciidoc.new.process(file, filename, @asciidoctor_backend)
|
35
|
-
end
|
36
|
-
|
37
35
|
def extract_options(file)
|
38
36
|
head = file.sub(/\n\n.*$/m, "\n")
|
39
37
|
/\n:standard-logo-img: (?<standardlogoimg>[^\n]+)\n/ =~ head
|
@@ -49,14 +47,23 @@ module Metanorma
|
|
49
47
|
super.merge(new_options)
|
50
48
|
end
|
51
49
|
|
52
|
-
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={})
|
53
56
|
case format
|
54
57
|
when :html
|
55
|
-
IsoDoc::Gb::HtmlConvert.new(options).convert(
|
58
|
+
IsoDoc::Gb::HtmlConvert.new(options).convert(inname, isodoc_node, nil, outname)
|
56
59
|
when :compliant_html
|
57
|
-
IsoDoc::Gb::HtmlConvert.new(options.merge(compliant: true)).convert(
|
60
|
+
IsoDoc::Gb::HtmlConvert.new(options.merge(compliant: true)).convert(inname, isodoc_node, nil, outname)
|
58
61
|
when :doc
|
59
|
-
IsoDoc::Gb::WordConvert.new(options).convert(
|
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)
|
60
67
|
else
|
61
68
|
super
|
62
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.
|
4
|
+
version: 1.4.2
|
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-23 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
|
@@ -255,17 +269,17 @@ files:
|
|
255
269
|
- lib/asciidoctor/gb/boilerplate.xml
|
256
270
|
- lib/asciidoctor/gb/converter.rb
|
257
271
|
- lib/asciidoctor/gb/front.rb
|
272
|
+
- lib/asciidoctor/gb/front_id.rb
|
258
273
|
- lib/asciidoctor/gb/gbstandard.rng
|
259
274
|
- lib/asciidoctor/gb/isodoc.rng
|
260
275
|
- lib/asciidoctor/gb/isostandard.rng
|
261
276
|
- lib/asciidoctor/gb/reqt.rng
|
262
277
|
- lib/asciidoctor/gb/section_input.rb
|
263
278
|
- lib/asciidoctor/gb/validate.rb
|
264
|
-
- lib/isodoc/gb/
|
265
|
-
- lib/isodoc/gb/
|
266
|
-
- lib/isodoc/gb/
|
267
|
-
- lib/isodoc/gb/
|
268
|
-
- lib/isodoc/gb/gbwordconvert.rb
|
279
|
+
- lib/isodoc/gb/base_convert.rb
|
280
|
+
- lib/isodoc/gb/cleanup.rb
|
281
|
+
- lib/isodoc/gb/common.rb
|
282
|
+
- lib/isodoc/gb/gb.recommendation.xsl
|
269
283
|
- lib/isodoc/gb/html/_coverpage.scss
|
270
284
|
- lib/isodoc/gb/html/blank.png
|
271
285
|
- lib/isodoc/gb/html/footer.png
|
@@ -302,9 +316,13 @@ files:
|
|
302
316
|
- lib/isodoc/gb/html/word_gb_intro.html
|
303
317
|
- lib/isodoc/gb/html/word_gb_titlepage.html
|
304
318
|
- lib/isodoc/gb/html/wordstyle.scss
|
319
|
+
- lib/isodoc/gb/html_convert.rb
|
305
320
|
- lib/isodoc/gb/i18n-en.yaml
|
306
321
|
- lib/isodoc/gb/i18n-zh-Hans.yaml
|
307
322
|
- lib/isodoc/gb/metadata.rb
|
323
|
+
- lib/isodoc/gb/pdf_convert.rb
|
324
|
+
- lib/isodoc/gb/presentation_xml_convert.rb
|
325
|
+
- lib/isodoc/gb/word_convert.rb
|
308
326
|
- lib/metanorma-gb.rb
|
309
327
|
- lib/metanorma/gb.rb
|
310
328
|
- lib/metanorma/gb/processor.rb
|
@@ -314,7 +332,7 @@ homepage: https://github.com/metanorma/metanorma-gb
|
|
314
332
|
licenses:
|
315
333
|
- BSD-2-Clause
|
316
334
|
metadata: {}
|
317
|
-
post_install_message:
|
335
|
+
post_install_message:
|
318
336
|
rdoc_options: []
|
319
337
|
require_paths:
|
320
338
|
- lib
|
@@ -329,9 +347,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
329
347
|
- !ruby/object:Gem::Version
|
330
348
|
version: '0'
|
331
349
|
requirements: []
|
332
|
-
|
333
|
-
|
334
|
-
signing_key:
|
350
|
+
rubygems_version: 3.0.3
|
351
|
+
signing_key:
|
335
352
|
specification_version: 4
|
336
353
|
summary: metanorma-gb lets you write GB standards in AsciiDoc.
|
337
354
|
test_files: []
|