metanorma-gb 1.4.3 → 1.5.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -742,7 +742,6 @@ p.TitlePageSubhead, li.TitlePageSubhead, div.TitlePageSubhead {
742
742
  line-height: 12.5pt;
743
743
  mso-pagination: widow-orphan;
744
744
  page-break-after: avoid;
745
- mso-outline-level: 2;
746
745
  mso-hyphenate: none;
747
746
  tab-stops: 27.0pt 35.0pt;
748
747
  font-size: 10.5pt;
@@ -698,7 +698,6 @@ mso-style-noshow:yes;
698
698
  line-height:12.5pt;
699
699
  mso-pagination:widow-orphan;
700
700
  page-break-after:avoid;
701
- mso-outline-level:2;
702
701
  mso-hyphenate:none;
703
702
  tab-stops:27.0pt 35.0pt;
704
703
  font-size:10.5pt;
@@ -1,3 +1,4 @@
1
+ require_relative "init"
1
2
  require_relative "base_convert"
2
3
  require "isodoc"
3
4
 
@@ -47,31 +48,23 @@ module IsoDoc
47
48
  end
48
49
 
49
50
  def populate_template(docxml, format)
50
- meta = @meta.get.merge(@labels).merge(@meta.fonts_options || {})
51
+ meta = @meta.get.merge(@i18n.get).merge(@meta.fonts_options || {})
51
52
  logo = @common.format_logo(meta[:gbprefix], meta[:gbscope], format, @localdir)
52
53
  logofile = @meta.standard_logo(meta[:gbprefix])
53
54
  meta[:standard_agency_formatted] =
54
55
  @common.format_agency(meta[:standard_agency], format, @localdir)
55
56
  meta[:standard_logo] = logo
56
-
57
57
  template = Liquid::Template.parse(docxml)
58
58
  template.render(meta.map { |k, v| [k.to_s, v] }.to_h)
59
-
60
- #template = liquid(docxml)
61
- #template.render(meta.map { |k, v| [k.to_s, empty2nil(v)] }.to_h).
62
- #gsub('<', '<').gsub('>', '>').gsub('&', '&')
63
59
  end
64
60
 
65
- def annex_name(annex, name, div)
66
- div.h1 **{ class: "Annex" } do |t|
67
- t << "#{@xrefs.anchor(annex['id'], :label)}<br/><br/>"
68
- t.b do |b|
69
- name&.children&.each { |c2| parse(c2, b) }
70
- end
71
- end
61
+ def insert_tab(out, n)
62
+ tab = "&#x3000;"
63
+ [1..n].each { out << tab }
72
64
  end
73
65
 
74
66
  include BaseConvert
67
+ include Init
75
68
  end
76
69
  end
77
70
  end
@@ -0,0 +1,16 @@
1
+ module IsoDoc
2
+ module Gb
3
+ class I18n < IsoDoc::Iso::I18n
4
+ def load_yaml1(lang, script)
5
+ y = if lang == "en"
6
+ YAML.load_file(File.join(File.dirname(__FILE__), "i18n-en.yaml"))
7
+ elsif lang == "zh" && script == "Hans"
8
+ YAML.load_file(File.join(File.dirname(__FILE__), "i18n-zh-Hans.yaml"))
9
+ else
10
+ YAML.load_file(File.join(File.dirname(__FILE__), "i18n-zh-Hans.yaml"))
11
+ end
12
+ super.merge(y)
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,29 @@
1
+ require "isodoc"
2
+ require_relative "metadata"
3
+ require_relative "xref"
4
+ require_relative "i18n"
5
+
6
+ module IsoDoc
7
+ module Gb
8
+ module Init
9
+ def metadata_init(lang, script, labels)
10
+ unless ["en", "zh"].include? lang
11
+ lang = "zh"
12
+ script = "Hans"
13
+ end
14
+ @meta = Metadata.new(lang, script, labels)
15
+ @meta.set(:standardclassimg, @standardclassimg)
16
+ @common&.meta = @meta
17
+ end
18
+
19
+ def xref_init(lang, script, klass, labels, options)
20
+ @xrefs = Xref.new(lang, script, HtmlConvert.new(language: lang, script: script), labels, options)
21
+ end
22
+
23
+ def i18n_init(lang, script, i18nyaml = nil)
24
+ @i18n = I18n.new(lang, script, i18nyaml || @i18nyaml)
25
+ end
26
+ end
27
+ end
28
+ end
29
+
@@ -8,7 +8,7 @@ module IsoDoc
8
8
  # A {Converter} implementation that generates GB output, and a document
9
9
  # schema encapsulation of the document for validation
10
10
  class Metadata < IsoDoc::Iso::Metadata
11
- def initialize(lang, script, labels)
11
+ def initialize(lang, script, i18n)
12
12
  super
13
13
  set(:docmaintitlezh, "")
14
14
  set(:docsubtitlezh, "XXXX")
@@ -1,9 +1,25 @@
1
- require_relative "base_convert"
1
+ require_relative "init"
2
2
  require "isodoc"
3
3
 
4
4
  module IsoDoc
5
5
  module Gb
6
6
  class PresentationXMLConvert < IsoDoc::Iso::PresentationXMLConvert
7
+ def example1(f)
8
+ n = @xrefs.get[f["id"]]
9
+ lbl = (n.nil? || n[:label].nil? || n[:label].empty?) ? @i18n.example :
10
+ l10n("#{@i18n.example} #{n[:label]}")
11
+ prefix_name(f, "&nbsp;&mdash; ", l10n(lbl + ":"), "name")
12
+ end
13
+
14
+ def annex1(f)
15
+ lbl = @xrefs.anchor(f['id'], :label)
16
+ if t = f.at(ns("./title"))
17
+ t.children = "#{t.children.to_xml}"
18
+ end
19
+ prefix_name(f, "<br/><br/>", lbl, "title")
20
+ end
21
+
22
+ include Init
7
23
  end
8
24
  end
9
25
  end
@@ -1,4 +1,5 @@
1
1
  require_relative "base_convert"
2
+ require_relative "init"
2
3
  require "isodoc"
3
4
 
4
5
  module IsoDoc
@@ -71,17 +72,17 @@ module IsoDoc
71
72
  out.table **attr_code(id: node["id"], class: "example") do |t|
72
73
  t.tr do |tr|
73
74
  tr.td **EXAMPLE_TBL_ATTR do |td|
74
- td << l10n(example_label(node) + ":")
75
+ node.at(ns("./name")).children.each { |n| parse(n, td) }
75
76
  end
76
77
  tr.td **{ valign: "top", class: "example" } do |td|
77
- node.children.each { |n| parse(n, td) }
78
+ node.children.each { |n| parse(n, td) unless n.name == "name" }
78
79
  end
79
80
  end
80
81
  end
81
82
  end
82
83
 
83
84
  def populate_template(docxml, format)
84
- meta = @meta.get.merge(@labels).merge(@meta.fonts_options || {})
85
+ meta = @meta.get.merge(@i18n.get).merge(@meta.fonts_options || {})
85
86
  logo = @common.format_logo(meta[:gbprefix], meta[:gbscope], format, @localdir)
86
87
  logofile = @meta.standard_logo(meta[:gbprefix])
87
88
  meta[:standard_agency_formatted] =
@@ -92,13 +93,6 @@ module IsoDoc
92
93
  gsub('&lt;', '&#x3c;').gsub('&gt;', '&#x3e;').gsub('&amp;', '&#x26;')
93
94
  end
94
95
 
95
- def annex_name(annex, name, div)
96
- div.h1 **{ class: "Annex" } do |t|
97
- t << "#{@xrefs.anchor(annex['id'], :label)}<br/><br/>"
98
- name&.children&.each { |c2| parse(c2, t) }
99
- end
100
- end
101
-
102
96
  def make_body(xml, docxml)
103
97
  body_attr = { lang: "EN-US", link: "blue", vlink: "#954F72" }
104
98
  xml.body **body_attr do |body|
@@ -126,6 +120,7 @@ module IsoDoc
126
120
  end
127
121
 
128
122
  include BaseConvert
123
+ include Init
129
124
  end
130
125
  end
131
126
  end
@@ -0,0 +1,6 @@
1
+ module IsoDoc
2
+ module Gb
3
+ class Xref < IsoDoc::Xref
4
+ end
5
+ end
6
+ end
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Gb
3
- VERSION = "1.4.3"
3
+ VERSION = "1.5.4"
4
4
  end
5
5
  end
@@ -29,8 +29,8 @@ 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.4.0"
33
- spec.add_dependency "isodoc", "~> 1.1.0"
32
+ spec.add_dependency "metanorma-iso", "~> 1.5.0"
33
+ spec.add_dependency "isodoc", "~> 1.2.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"
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.3
4
+ version: 1.5.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-07-26 00:00:00.000000000 Z
11
+ date: 2020-08-27 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.4.0
19
+ version: 1.5.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.4.0
26
+ version: 1.5.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.1.0
33
+ version: 1.2.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.1.0
40
+ version: 1.2.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: twitter_cldr
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -267,6 +267,7 @@ files:
267
267
  - lib/asciidoctor/gb/basicdoc.rng
268
268
  - lib/asciidoctor/gb/biblio.rng
269
269
  - lib/asciidoctor/gb/boilerplate.xml
270
+ - lib/asciidoctor/gb/cleanup.rb
270
271
  - lib/asciidoctor/gb/converter.rb
271
272
  - lib/asciidoctor/gb/front.rb
272
273
  - lib/asciidoctor/gb/front_id.rb
@@ -324,10 +325,13 @@ files:
324
325
  - lib/isodoc/gb/html_convert.rb
325
326
  - lib/isodoc/gb/i18n-en.yaml
326
327
  - lib/isodoc/gb/i18n-zh-Hans.yaml
328
+ - lib/isodoc/gb/i18n.rb
329
+ - lib/isodoc/gb/init.rb
327
330
  - lib/isodoc/gb/metadata.rb
328
331
  - lib/isodoc/gb/pdf_convert.rb
329
332
  - lib/isodoc/gb/presentation_xml_convert.rb
330
333
  - lib/isodoc/gb/word_convert.rb
334
+ - lib/isodoc/gb/xref.rb
331
335
  - lib/metanorma-gb.rb
332
336
  - lib/metanorma/gb.rb
333
337
  - lib/metanorma/gb/processor.rb