asciidoctor-gb 0.3.5 → 0.3.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e9213a1bd7d6f3ee41636366ddf0d10eb4e062d54a576e5f4759d4e85941e21e
4
- data.tar.gz: 27bf85a798034864204eb6cb4cf5b1ae1ff89a01d1dd9152fdb2a6081e73e70c
3
+ metadata.gz: fc8afdfe9783472af80f7034c6934df0ba76dd35a2013b777ac63ca758c9e907
4
+ data.tar.gz: 81295903887476e3069d30c615ff4f2b34bda8723dc64571c9f0507868419625
5
5
  SHA512:
6
- metadata.gz: 76443a422963f885da61d8266753d17ce8e6176ae38e051d375c4d2282d44c53a231298f732e97d3593e197db881ccef543cd08e1aaf0780a6b39aca354c0a43
7
- data.tar.gz: eb97aeb9db37f6692e6ca3a6fea18e653728930fa801f41814e8000b7a2b4d65d00975685f97f526eabf1f1a8c074fcb16ba6fbcb2e21f1477d05ef3e7293910
6
+ metadata.gz: 57560a856f9529465482a98bcade61ee1b9b47baaf7178363ce4851ebf0b99cc9c61e90cf402e8434b0887aed5916f33d032fa4948bec9c09ee5b85a59c4a5ad
7
+ data.tar.gz: 40598211a8031e40895ed56e3500ce6e8098a1f1605d88c6e02be2e065f100b1bc86d1c1dcf8cbd0c7fc7b93cf6ea19b360486070d97882991d7704461273cfc
@@ -18,6 +18,7 @@ Gem::Specification.new do |spec|
18
18
 
19
19
  spec.homepage = "https://github.com/riboseinc/asciidoctor-gb"
20
20
  spec.license = "BSD-2-Clause"
21
+ spec.post_install_message = "The asciidoctor-gb gem has been deprecated and has been replaced by metanorma-gb"
21
22
 
22
23
  spec.files = `git ls-files -z`.split("\x0").reject do |f|
23
24
  f.match(%r{^(test|spec|features)/})
@@ -28,7 +29,7 @@ Gem::Specification.new do |spec|
28
29
 
29
30
  spec.add_dependency "asciidoctor-iso", "~> 0.10.0"
30
31
  spec.add_dependency "gbbib", "~> 0.2.2"
31
- spec.add_dependency "isodoc", "~> 0.8.7"
32
+ spec.add_dependency "isodoc", "~> 0.8.8"
32
33
  spec.add_dependency "twitter_cldr"
33
34
  spec.add_dependency "gb-agencies", "~> 0.0.1"
34
35
 
@@ -7,8 +7,6 @@ require "gb_agencies"
7
7
  require_relative "./section_input.rb"
8
8
  require_relative "./front.rb"
9
9
  require_relative "./validate.rb"
10
- require "pp"
11
- # require "byebug"
12
10
 
13
11
  module Asciidoctor
14
12
  module Gb
@@ -34,10 +32,6 @@ module Asciidoctor
34
32
  ret1
35
33
  end
36
34
 
37
- def html_doc_path(file)
38
- File.join(File.dirname(__FILE__), File.join("html", file))
39
- end
40
-
41
35
  def html_converter(node)
42
36
  node.nil? ? IsoDoc::Gb::HtmlConvert.new({}) :
43
37
  IsoDoc::Gb::HtmlConvert.new(
@@ -48,6 +42,10 @@ module Asciidoctor
48
42
  titlefont: node.attr("title-font"),
49
43
  i18nyaml: node.attr("i18nyaml"),
50
44
  scope: node.attr("scope"),
45
+ htmlstylesheet: node.attr("htmlstylesheet"),
46
+ htmlcoverpage: node.attr("htmlcoverpage"),
47
+ htmlintropage: node.attr("htmlintropage"),
48
+ scripts: node.attr("scripts"),
51
49
  )
52
50
  end
53
51
 
@@ -62,6 +60,10 @@ module Asciidoctor
62
60
  i18nyaml: node.attr("i18nyaml"),
63
61
  scope: node.attr("scope"),
64
62
  compliant: true,
63
+ htmlstylesheet: node.attr("htmlstylesheet"),
64
+ htmlcoverpage: node.attr("htmlcoverpage"),
65
+ htmlintropage: node.attr("htmlintropage"),
66
+ scripts: node.attr("scripts"),
65
67
  )
66
68
  end
67
69
 
@@ -75,25 +77,16 @@ module Asciidoctor
75
77
  titlefont: node.attr("title-font"),
76
78
  i18nyaml: node.attr("i18nyaml"),
77
79
  scope: node.attr("scope"),
80
+ wordstylesheet: node.attr("wordstylesheet"),
81
+ standardstylesheet: node.attr("standardstylesheet"),
82
+ header: node.attr("header"),
83
+ wordcoverpage: node.attr("wordcoverpage"),
84
+ wordintropage: node.attr("wordintropage"),
85
+ ulstyle: node.attr("ulstyle"),
86
+ olstyle: node.attr("olstyle"),
78
87
  )
79
88
  end
80
89
 
81
- def default_fonts(node)
82
- script = node.attr("script") || "Hans"
83
- b = node.attr("body-font") ||
84
- (script == "Hans" ? '"SimSun",serif' :
85
- script == "Latn" ? '"Cambria",serif' : '"SimSun",serif' )
86
- h = node.attr("header-font") ||
87
- (script == "Hans" ? '"SimHei",sans-serif' :
88
- script == "Latn" ? '"Calibri",sans-serif' : '"SimHei",sans-serif' )
89
- m = node.attr("monospace-font") || '"Courier New",monospace'
90
- scope = node.attr("scope") || "national"
91
- t = node.attr("title-font") ||
92
- (scope == "national" ? (script != "Hans" ? '"Cambria",serif' : '"SimSun",serif' ) :
93
- (script == "Hans" ? '"SimHei",sans-serif' : '"Calibri",sans-serif' ))
94
- "$bodyfont: #{b};\n$headerfont: #{h};\n$monospacefont: #{m};\n$titlefont: #{t};\n"
95
- end
96
-
97
90
  def document(node)
98
91
  init(node)
99
92
  ret = makexml(node).to_xml(indent: 2)
@@ -222,7 +215,6 @@ module Asciidoctor
222
215
  end
223
216
 
224
217
  def docidentifier_cleanup(xmldoc)
225
- #byebug
226
218
  id = xmldoc.at("//bibdata/docidentifier/project-number") or return
227
219
  scope = xmldoc.at("//gbscope")&.text
228
220
  prefix = xmldoc.at("//gbprefix")&.text
@@ -1,5 +1,5 @@
1
1
  module Asciidoctor
2
2
  module Gb
3
- VERSION = "0.3.5"
3
+ VERSION = "0.3.7"
4
4
  end
5
5
  end
@@ -1,6 +1,7 @@
1
1
  require "isodoc"
2
2
  require_relative "./gbcleanup.rb"
3
3
  require_relative "./metadata.rb"
4
+ require "fileutils"
4
5
 
5
6
  module IsoDoc
6
7
  module Gb
@@ -19,7 +20,8 @@ module IsoDoc
19
20
  return agency unless agency.is_a?(Array)
20
21
  if agency == ["中华人民共和国国家质量监督检验检疫总局", "中国国家标准化管理委员会"]
21
22
  logo = "gb-issuer-default.gif"
22
- system "cp #{fileloc(File.join('html/gb-logos', logo))} #{logo}"
23
+ #system "cp #{fileloc(File.join('html/gb-logos', logo))} #{logo}"
24
+ FileUtils.cp fileloc(File.join('html/gb-logos', logo)), logo
23
25
  return "<img src='#{logo}' alt='#{agency.join(",")}'></img>"
24
26
  end
25
27
  format_agency1(agency, format)
@@ -52,7 +54,8 @@ module IsoDoc
52
54
 
53
55
  def format_logo1(logo, prefix, scope)
54
56
  logo += ".gif"
55
- system "cp #{fileloc(File.join('html/gb-logos', logo))} #{logo}"
57
+ #system "cp #{fileloc(File.join('html/gb-logos', logo))} #{logo}"
58
+ FileUtils.cp fileloc(File.join('html/gb-logos', logo)), logo
56
59
  local = local_logo_suffix(scope)
57
60
  #@files_to_delete << logo
58
61
  "<img width='113' height='56' src='#{logo}' alt='#{prefix}'></img>"\
@@ -9,37 +9,41 @@ module IsoDoc
9
9
  # A {Converter} implementation that generates GB output, and a document
10
10
  # schema encapsulation of the document for validation
11
11
  class HtmlConvert < IsoDoc::HtmlConvert
12
+ def initialize(options)
13
+ @common = IsoDoc::Gb::Common.new(options)
14
+ @libdir = File.dirname(__FILE__)
15
+ super
16
+ @lang = "zh"
17
+ @script = "Hans"
18
+ end
19
+
12
20
  def default_fonts(options)
13
21
  script = options[:script] || "Hans"
14
- b = options[:bodyfont] ||
15
- (script == "Hans" ? '"SimSun",serif' :
16
- script == "Latn" ? '"Cambria",serif' : '"SimSun",serif' )
17
- h = options[:headerfont] ||
18
- (script == "Hans" ? '"SimHei",sans-serif' :
19
- script == "Latn" ? '"Calibri",sans-serif' : '"SimHei",sans-serif' )
20
- m = options[:monospacefont] || '"Courier New",monospace'
21
22
  scope = options[:scope] || "national"
22
- t = options[:titlefont] ||
23
- (scope == "national" ? (script != "Hans" ? '"Cambria",serif' : '"SimSun",serif' ) :
23
+ {
24
+ bodyfont: (script == "Hans" ? '"SimSun",serif' : '"Cambria",serif'),
25
+ headerfont: (script == "Hans" ? '"SimHei",sans-serif' : '"Calibri",sans-serif'),
26
+ monospacefont: '"Courier New",monospace',
27
+ titlefont: (scope == "national" ? (script != "Hans" ? '"Cambria",serif' : '"SimSun",serif' ) :
24
28
  (script == "Hans" ? '"SimHei",sans-serif' : '"Calibri",sans-serif' ))
25
- "$bodyfont: #{b};\n$headerfont: #{h};\n$monospacefont: #{m};\n$titlefont: #{t};\n"
29
+ }
26
30
  end
27
31
 
28
- def initialize(options)
29
- @common = IsoDoc::Gb::Common.new(options)
30
- super
31
- if options[:compliant]
32
- @htmlstylesheet = generate_css(html_doc_path("htmlcompliantstyle.scss"), true, default_fonts(options))
33
- @htmlcoverpage = html_doc_path("html_compliant_gb_titlepage.html")
34
- else
35
- @htmlstylesheet = generate_css(html_doc_path("htmlstyle.scss"), true, default_fonts(options))
36
- #@htmlcoverpage = html_doc_path("html_gb_titlepage.html")
37
- @htmlcoverpage = html_doc_path("html_compliant_gb_titlepage.html")
38
- end
39
- @htmlintropage = html_doc_path("html_gb_intro.html")
40
- @scripts = html_doc_path("scripts.html")
41
- @lang = "zh"
42
- @script = "Hans"
32
+ def default_file_locations(options)
33
+ {
34
+ htmlstylesheet: options[:compliant] ? html_doc_path("htmlcompliantstyle.scss") : html_doc_path("htmlstyle.scss"),
35
+ htmlcoverpage: html_doc_path("html_compliant_gb_titlepage.html"),
36
+ htmlintropage: html_doc_path("html_gb_intro.html"),
37
+ scripts: html_doc_path("scripts.html"),
38
+ }
39
+ end
40
+
41
+ def extract_fonts(options)
42
+ b = options[:bodyfont] || "Arial"
43
+ h = options[:headerfont] || "Arial"
44
+ m = options[:monospacefont] || "Courier"
45
+ t = options[:titlefont] || "Arial"
46
+ "$bodyfont: #{b};\n$headerfont: #{h};\n$monospacefont: #{m};\n$titlefont: #{t};\n"
43
47
  end
44
48
 
45
49
  def metadata_init(lang, script, labels)
@@ -63,10 +67,6 @@ module IsoDoc
63
67
  @cleanup.example_cleanup(docxml)
64
68
  end
65
69
 
66
- def html_doc_path(file)
67
- File.join(File.dirname(__FILE__), File.join("html", file))
68
- end
69
-
70
70
  def i18n_init(lang, script)
71
71
  super
72
72
  y = if lang == "en"
@@ -4,51 +4,52 @@ require_relative "gbcleanup"
4
4
  require "gb_agencies"
5
5
  require_relative "metadata"
6
6
  require_relative "gbwordrender"
7
+ require "fileutils"
7
8
 
8
9
  module IsoDoc
9
10
  module Gb
10
11
  # A {Converter} implementation that generates GB output, and a document
11
12
  # schema encapsulation of the document for validation
12
-
13
13
  class WordConvert < IsoDoc::WordConvert
14
- def default_fonts(options)
15
- script = options[:script] || "Hans"
16
- b = options[:bodyfont] ||
17
- (script == "Hans" ? '"SimSun",serif' :
18
- script == "Latn" ? '"Cambria",serif' : '"SimSun",serif' )
19
- h = options[:headerfont] ||
20
- (script == "Hans" ? '"SimHei",sans-serif' :
21
- script == "Latn" ? '"Calibri",sans-serif' : '"SimHei",sans-serif' )
22
- m = options[:monospacefont] || '"Courier New",monospace'
23
- scope = options[:scope] || "national"
24
- t = options[:titlefont] ||
25
- (scope == "national" ? (script != "Hans" ? '"Cambria",serif' : '"SimSun",serif' ) :
26
- (script == "Hans" ? '"SimHei",sans-serif' : '"Calibri",sans-serif' ))
27
- "$bodyfont: #{b};\n$headerfont: #{h};\n$monospacefont: #{m};\n$titlefont: #{t};\n"
28
- end
29
-
30
- def metadata_init(lang, script, labels)
31
- @meta = Metadata.new(lang, script, labels)
32
- @common = IsoDoc::Gb::Common.new(meta: @meta)
33
- end
34
-
35
- def html_doc_path(file)
36
- File.join(File.dirname(__FILE__), File.join("html", file))
37
- end
38
-
39
14
  def initialize(options)
40
15
  @common = IsoDoc::Gb::Common.new(options)
16
+ @libdir = File.dirname(__FILE__)
41
17
  super
42
- @wordstylesheet = generate_css(html_doc_path("wordstyle.scss"), false, default_fonts(options))
43
- @standardstylesheet = generate_css(html_doc_path("gb.scss"), false, default_fonts(options))
44
- @header = html_doc_path("header.html")
45
- @wordcoverpage = html_doc_path("word_gb_titlepage.html")
46
- @wordintropage = html_doc_path("word_gb_intro.html")
47
- @ulstyle = "l7"
48
- @olstyle = "l10"
49
18
  @lang = "zh"
50
19
  @script = "Hans"
51
20
  end
21
+
22
+ def default_fonts(options)
23
+ script = options[:script] || "Hans"
24
+ scope = options[:scope] || "national"
25
+ {
26
+ bodyfont: (script == "Hans" ? '"SimSun",serif' : '"Cambria",serif'),
27
+ headerfont: (script == "Hans" ? '"SimHei",sans-serif' : '"Calibri",sans-serif'),
28
+ monospacefont: '"Courier New",monospace',
29
+ titlefont: (scope == "national" ? (script != "Hans" ? '"Cambria",serif' : '"SimSun",serif' ) :
30
+ (script == "Hans" ? '"SimHei",sans-serif' : '"Calibri",sans-serif' ))
31
+ }
32
+ end
33
+
34
+ def default_file_locations(options)
35
+ {
36
+ wordstylesheet: html_doc_path("wordstyle.scss"),
37
+ standardstylesheet: html_doc_path("gb.scss"),
38
+ header: html_doc_path("header.html"),
39
+ wordcoverpage: html_doc_path("word_gb_titlepage.html"),
40
+ wordintropage: html_doc_path("word_gb_intro.html"),
41
+ ulstyle: "l7",
42
+ olstyle: "l10",
43
+ }
44
+ end
45
+
46
+ def extract_fonts(options)
47
+ b = options[:bodyfont] || "Arial"
48
+ h = options[:headerfont] || "Arial"
49
+ m = options[:monospacefont] || "Courier"
50
+ t = options[:titlefont] || "Arial"
51
+ "$bodyfont: #{b};\n$headerfont: #{h};\n$monospacefont: #{m};\n$titlefont: #{t};\n"
52
+ end
52
53
 
53
54
  def metadata_init(lang, script, labels)
54
55
  unless ["en", "zh"].include? lang
@@ -71,10 +72,6 @@ module IsoDoc
71
72
  @cleanup.example_cleanup(docxml)
72
73
  end
73
74
 
74
- def html_doc_path(file)
75
- File.join(File.dirname(__FILE__), File.join("html", file))
76
- end
77
-
78
75
  def i18n_init(lang, script)
79
76
  super
80
77
  y = if lang == "en"
@@ -109,6 +106,7 @@ module IsoDoc
109
106
  params = meta.map { |k, v| [k.to_s, v] }.to_h
110
107
  File.open("header.html", "w") { |f| f.write(template.render(params)) }
111
108
  system "cp #{@common.fileloc(File.join('html', 'blank.png'))} blank.png"
109
+ FileUtils.cp @common.fileloc(File.join('html', 'blank.png')), "blank.png"
112
110
  @files_to_delete << "blank.png"
113
111
  @files_to_delete << "header.html"
114
112
  "header.html"
@@ -133,10 +131,6 @@ module IsoDoc
133
131
  @cleanup.title_cleanup(docxml.at('//div[@class="WordSection2"]'))
134
132
  docxml
135
133
  end
136
-
137
- def html_doc_path(file)
138
- File.join(File.dirname(__FILE__), File.join("html", file))
139
- end
140
134
  end
141
135
  end
142
136
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: asciidoctor-gb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.5
4
+ version: 0.3.7
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-12 00:00:00.000000000 Z
11
+ date: 2018-08-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciidoctor-iso
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 0.8.7
47
+ version: 0.8.8
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 0.8.7
54
+ version: 0.8.8
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: twitter_cldr
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -354,7 +354,8 @@ homepage: https://github.com/riboseinc/asciidoctor-gb
354
354
  licenses:
355
355
  - BSD-2-Clause
356
356
  metadata: {}
357
- post_install_message:
357
+ post_install_message: The asciidoctor-gb gem has been deprecated and has been replaced
358
+ by metanorma-gb
358
359
  rdoc_options: []
359
360
  require_paths:
360
361
  - lib