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.
@@ -1002,4 +1002,3 @@ span.keyword {
1002
1002
  .Admonition p, .admonition p {
1003
1003
  margin: 0;
1004
1004
  }
1005
-
@@ -1,4 +1,4 @@
1
- require_relative "gbbaseconvert"
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
+
@@ -0,0 +1,10 @@
1
+ require_relative "base_convert"
2
+ require "isodoc"
3
+
4
+ module IsoDoc
5
+ module Gb
6
+ class PresentationXMLConvert < IsoDoc::Iso::PresentationXMLConvert
7
+ end
8
+ end
9
+ end
10
+
@@ -1,4 +1,4 @@
1
- require_relative "gbbaseconvert"
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
@@ -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/gbconvert"
5
- require "isodoc/gb/gbhtmlconvert"
6
- require "isodoc/gb/gbwordconvert"
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 output(isodoc_node, outname, format, options={})
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(outname, isodoc_node)
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(outname, isodoc_node)
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(outname, isodoc_node)
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
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Gb
3
- VERSION = "1.3.25"
3
+ VERSION = "1.4.2"
4
4
  end
5
5
  end
@@ -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.3.0"
33
- spec.add_dependency "isodoc", "~> 1.0.0"
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.25
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-05-29 00:00:00.000000000 Z
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.3.0
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.3.0
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.0.0
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.0.0
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/gbbaseconvert.rb
265
- - lib/isodoc/gb/gbcleanup.rb
266
- - lib/isodoc/gb/gbconvert.rb
267
- - lib/isodoc/gb/gbhtmlconvert.rb
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
- rubyforge_project:
333
- rubygems_version: 2.7.6
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: []