metanorma-generic 1.5.1 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1c1680dbc80de8b900946d582965cdb87975a2f796416441a9a5ad7958d3c5cf
4
- data.tar.gz: 361b7a5c7ecb51b5c3a2180e2f17b083384678e8e6a976a19f0b14e0fb704bf3
3
+ metadata.gz: 3e817f19db29a3edb02be3d16087975c2fbacc77e210288cce9389c8f988687c
4
+ data.tar.gz: 2f3aaa80cc738cb89e1465a769b98716de796fb33235d9e76867d91d3581310e
5
5
  SHA512:
6
- metadata.gz: c1edbb399ba66ea7c7836c5f4644fc5da9f1080b19d52b37ca42e2679811a858a540a9cd7c165fceea10e150e32039a6613b1f0ce25915b88c24dfefc73c01bd
7
- data.tar.gz: 34981e89ab1542522d57f6840907e19b5d107ae6b20d2aba15090253655ff79c7ede49d81ac5b608377c77f6c93bf09a00b6db81d1f4d13a1c914cf61e9472da
6
+ metadata.gz: 9c3aa01d6ed22902d8d5f45166a9fa7c8bf1fe341ab4237cae173c2ee332e25c8bf4117ca0ee5f287ec1d84c2317d4e68196fa1794331b36ee1cd64a5459c182
7
+ data.tar.gz: d545baf6c6822b5ff93baf8db5b23f22817214f556029ff1e531eca1762429440fb95f4ce3f849e2f2ba13a7cfe7aeb5dbabbdfac040fe5f409aa9a7a91b8219
@@ -24,7 +24,8 @@ module Asciidoctor
24
24
 
25
25
  def baselocation(loc)
26
26
  return nil if loc.nil?
27
- File.expand_path(File.join(File.dirname(self.class::_file || __FILE__), "..", "..", "..", loc))
27
+ File.expand_path(File.join(File.dirname(
28
+ self.class::_file || __FILE__), "..", "..", "..", loc))
28
29
  end
29
30
 
30
31
  def metadata_author(node, xml)
@@ -144,9 +145,12 @@ module Asciidoctor
144
145
  def outputs(node, ret)
145
146
  File.open(@filename + ".xml", "w:UTF-8") { |f| f.write(ret) }
146
147
  presentation_xml_converter(node).convert(@filename + ".xml")
147
- html_converter(node).convert(@filename + ".presentation.xml", nil, false, "#{@filename}.html")
148
- doc_converter(node).convert(@filename + ".presentation.xml", nil, false, "#{@filename}.doc")
149
- pdf_converter(node)&.convert(@filename + ".presentation.xml", nil, false, "#{@filename}.pdf")
148
+ html_converter(node).convert(@filename + ".presentation.xml",
149
+ nil, false, "#{@filename}.html")
150
+ doc_converter(node).convert(@filename + ".presentation.xml",
151
+ nil, false, "#{@filename}.doc")
152
+ pdf_converter(node)&.convert(@filename + ".presentation.xml",
153
+ nil, false, "#{@filename}.pdf")
150
154
 
151
155
  end
152
156
 
@@ -206,7 +210,7 @@ module Asciidoctor
206
210
  def boilerplate_isodoc(xmldoc)
207
211
  conv = super
208
212
  Metanorma::Generic::Configuration::CONFIG_ATTRS.each do |a|
209
- conv.labels[a] = configuration.send a
213
+ conv.i18n.set(a, configuration.send(a))
210
214
  end
211
215
  conv
212
216
  end
@@ -922,6 +922,9 @@
922
922
  <optional>
923
923
  <attribute name="script"/>
924
924
  </optional>
925
+ <optional>
926
+ <attribute name="type"/>
927
+ </optional>
925
928
  <optional>
926
929
  <attribute name="obligation">
927
930
  <choice>
@@ -961,9 +964,6 @@
961
964
  </define>
962
965
  <define name="content-subsection">
963
966
  <element name="clause">
964
- <optional>
965
- <attribute name="type"/>
966
- </optional>
967
967
  <ref name="Content-Section"/>
968
968
  </element>
969
969
  </define>
@@ -992,6 +992,9 @@
992
992
  </choice>
993
993
  </attribute>
994
994
  </optional>
995
+ <optional>
996
+ <attribute name="type"/>
997
+ </optional>
995
998
  <optional>
996
999
  <ref name="section-title"/>
997
1000
  </optional>
@@ -1011,9 +1014,6 @@
1011
1014
  </define>
1012
1015
  <define name="clause">
1013
1016
  <element name="clause">
1014
- <optional>
1015
- <attribute name="type"/>
1016
- </optional>
1017
1017
  <ref name="Clause-Section"/>
1018
1018
  </element>
1019
1019
  </define>
@@ -1042,6 +1042,9 @@
1042
1042
  </choice>
1043
1043
  </attribute>
1044
1044
  </optional>
1045
+ <optional>
1046
+ <attribute name="type"/>
1047
+ </optional>
1045
1048
  <optional>
1046
1049
  <ref name="section-title"/>
1047
1050
  </optional>
@@ -1180,6 +1183,9 @@
1180
1183
  <optional>
1181
1184
  <attribute name="script"/>
1182
1185
  </optional>
1186
+ <optional>
1187
+ <attribute name="type"/>
1188
+ </optional>
1183
1189
  <optional>
1184
1190
  <attribute name="obligation">
1185
1191
  <choice>
@@ -1,40 +1,13 @@
1
1
  require "isodoc"
2
- require_relative "metadata"
3
- require_relative "xref"
4
2
  require "fileutils"
5
3
 
6
4
  module IsoDoc
7
5
  module Generic
8
6
  module BaseConvert
9
- def metadata_init(lang, script, labels)
10
- @meta = Metadata.new(lang, script, labels)
11
- end
12
-
13
- def xref_init(lang, script, klass, labels, options)
14
- @xrefs = Xref.new(lang, script, klass, labels, options)
15
- end
16
-
17
7
  def baselocation(loc)
18
8
  return nil if loc.nil?
19
- File.expand_path(File.join(File.dirname(self.class::_file || __FILE__), "..", "..", "..", loc))
20
- end
21
-
22
- def annex_name(annex, name, div)
23
- div.h1 **{ class: "Annex" } do |t|
24
- t << "#{@xrefs.anchor(annex['id'], :label)} "
25
- t.br
26
- t.b do |b|
27
- name&.children&.each { |c2| parse(c2, b) }
28
- end
29
- end
30
- end
31
-
32
- def i18n_init(lang, script)
33
- super
34
- end
35
-
36
- def fileloc(loc)
37
- File.join(File.dirname(__FILE__), loc)
9
+ File.expand_path(File.join(
10
+ File.dirname(self.class::_file || __FILE__), "..", "..", "..", loc))
38
11
  end
39
12
 
40
13
  def cleanup(docxml)
@@ -52,7 +25,8 @@ module IsoDoc
52
25
  end
53
26
 
54
27
  def make_body(xml, docxml)
55
- body_attr = { lang: "EN-US", link: "blue", vlink: "#954F72", "xml:lang": "EN-US", class: "container" }
28
+ body_attr = { lang: "EN-US", link: "blue", vlink: "#954F72",
29
+ "xml:lang": "EN-US", class: "container" }
56
30
  xml.body **body_attr do |body|
57
31
  make_body1(body, docxml)
58
32
  make_body2(body, docxml)
@@ -1,4 +1,5 @@
1
1
  require_relative "base_convert"
2
+ require_relative "init"
2
3
  require "isodoc"
3
4
 
4
5
  module IsoDoc
@@ -51,10 +52,13 @@ module IsoDoc
51
52
 
52
53
  def googlefonts
53
54
  return unless configuration.webfont
54
- Array(configuration.webfont).map { |x| %{<link href="#{x.gsub(/\&amp;/, '&')}" rel="stylesheet">} }.join("\n")
55
+ Array(configuration.webfont).map do |x|
56
+ %{<link href="#{x.gsub(/\&amp;/, '&')}" rel="stylesheet">}
57
+ end.join("\n")
55
58
  end
56
59
 
57
60
  include BaseConvert
61
+ include Init
58
62
  end
59
63
  end
60
64
  end
@@ -0,0 +1,27 @@
1
+ require "isodoc"
2
+ require_relative "metadata"
3
+ require_relative "xref"
4
+
5
+ module IsoDoc
6
+ module Generic
7
+ module Init
8
+ def metadata_init(lang, script, i18n)
9
+ @meta = Metadata.new(lang, script, i18n)
10
+ end
11
+
12
+ def xref_init(lang, script, klass, i18n, options)
13
+ html = HtmlConvert.new(language: lang, script: script)
14
+ @xrefs = Xref.new(lang, script, html, i18n, options)
15
+ end
16
+
17
+ def i18n_init(lang, script, i18nyaml = nil)
18
+ @i18n = I18n.new(lang, script, i18nyaml || @i18nyaml)
19
+ end
20
+
21
+ def fileloc(loc)
22
+ File.join(File.dirname(__FILE__), loc)
23
+ end
24
+ end
25
+ end
26
+ end
27
+
@@ -24,7 +24,8 @@ module IsoDoc
24
24
 
25
25
  def baselocation(loc)
26
26
  return nil if loc.nil?
27
- File.expand_path(File.join(File.dirname(self.class::_file || __FILE__), "..", "..", "..", loc))
27
+ File.expand_path(File.join(
28
+ File.dirname(self.class::_file || __FILE__), "..", "..", "..", loc))
28
29
  end
29
30
 
30
31
  def configuration
@@ -1,4 +1,5 @@
1
1
  require_relative "base_convert"
2
+ require_relative "init"
2
3
  require "isodoc"
3
4
 
4
5
  module IsoDoc
@@ -58,6 +59,7 @@ module IsoDoc
58
59
  end
59
60
 
60
61
  include BaseConvert
62
+ include Init
61
63
  end
62
64
  end
63
65
  end
@@ -1,9 +1,18 @@
1
- require_relative "base_convert"
1
+ require_relative "init"
2
2
  require "isodoc"
3
3
 
4
4
  module IsoDoc
5
5
  module Generic
6
6
  class PresentationXMLConvert < IsoDoc::PresentationXMLConvert
7
+ def annex1(f)
8
+ lbl = @xrefs.anchor(f['id'], :label)
9
+ if t = f.at(ns("./title"))
10
+ t.children = "<strong>#{t.children.to_xml}</strong>"
11
+ end
12
+ prefix_name(f, "<br/>", lbl, "title")
13
+ end
14
+
15
+ include Init
7
16
  end
8
17
  end
9
18
  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
@@ -22,8 +23,10 @@ module IsoDoc
22
23
 
23
24
  def default_fonts(options)
24
25
  {
25
- bodyfont: (options[:script] == "Hans" ? '"SimSun",serif' : configuration.word_bodyfont || '"Arial",sans-serif'),
26
- headerfont: (options[:script] == "Hans" ? '"SimHei",sans-serif' : configuration.word_headerfont || '"Arial",sans-serif'),
26
+ bodyfont: (options[:script] == "Hans" ? '"SimSun",serif' :
27
+ configuration.word_bodyfont || '"Arial",sans-serif'),
28
+ headerfont: (options[:script] == "Hans" ? '"SimHei",sans-serif' :
29
+ configuration.word_headerfont || '"Arial",sans-serif'),
27
30
  monospacefont: configuration.word_monospacefont || '"Courier New",monospace'
28
31
  }
29
32
  end
@@ -51,6 +54,7 @@ module IsoDoc
51
54
  end
52
55
 
53
56
  include BaseConvert
57
+ include Init
54
58
  end
55
59
  end
56
60
  end
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Generic
3
- VERSION = "1.5.1"
3
+ VERSION = "1.6.0"
4
4
  end
5
5
  end
@@ -28,10 +28,11 @@ Gem::Specification.new do |spec|
28
28
 
29
29
  spec.add_dependency "htmlentities", "~> 4.3.4"
30
30
  spec.add_dependency "ruby-jing"
31
- spec.add_dependency "metanorma-standoc", "~> 1.4.0"
32
- spec.add_dependency "isodoc", "~> 1.1.0"
31
+ spec.add_dependency "metanorma-standoc", "~> 1.5.0"
32
+ spec.add_dependency "isodoc", "~> 1.2.0"
33
33
 
34
34
  spec.add_development_dependency "byebug", "~> 9.1"
35
+ spec.add_development_dependency "sassc", "2.4.0"
35
36
  spec.add_development_dependency "equivalent-xml", "~> 0.6"
36
37
  spec.add_development_dependency "guard", "~> 2.14"
37
38
  spec.add_development_dependency "guard-rspec", "~> 4.7"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-generic
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.1
4
+ version: 1.6.0
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-10 00:00:00.000000000 Z
11
+ date: 2020-07-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: htmlentities
@@ -44,28 +44,28 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 1.4.0
47
+ version: 1.5.0
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: 1.4.0
54
+ version: 1.5.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: isodoc
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 1.1.0
61
+ version: 1.2.0
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 1.1.0
68
+ version: 1.2.0
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: byebug
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -80,6 +80,20 @@ dependencies:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '9.1'
83
+ - !ruby/object:Gem::Dependency
84
+ name: sassc
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '='
88
+ - !ruby/object:Gem::Version
89
+ version: 2.4.0
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '='
95
+ - !ruby/object:Gem::Version
96
+ version: 2.4.0
83
97
  - !ruby/object:Gem::Dependency
84
98
  name: equivalent-xml
85
99
  requirement: !ruby/object:Gem::Requirement
@@ -239,6 +253,7 @@ files:
239
253
  - lib/isodoc/generic/html/word_generic_titlepage.html
240
254
  - lib/isodoc/generic/html/wordstyle.scss
241
255
  - lib/isodoc/generic/html_convert.rb
256
+ - lib/isodoc/generic/init.rb
242
257
  - lib/isodoc/generic/metadata.rb
243
258
  - lib/isodoc/generic/pdf_convert.rb
244
259
  - lib/isodoc/generic/presentation_xml_convert.rb