metanorma-generic 1.6.3 → 1.7.0

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: 38f634ace384417096ff4e1ea82dcc50c0cad5d4a81186934df2c7f32e24ebe2
4
- data.tar.gz: 76a20654285bb56c3c7796c6ee3e8a57776a3417cdb81f945eca21c064454afd
3
+ metadata.gz: dbd87f79baeb66107643bd3c6e9377853f72f3b19d17615aced5737609ea31e4
4
+ data.tar.gz: a1e014a6a7076b4f39c37bcb35d67fecb221ff0494ba38ce88482affb8aef854
5
5
  SHA512:
6
- metadata.gz: dccf6988964bd683012b07ce100789538f44464b4c98f9f22804e12ef98434c05ada0a879a2f46e67c8d243f1263b0e25639c3dc2e66a320e3f28cf73e7f315e
7
- data.tar.gz: fb7a296bb6d167ec80ff110671b7dca107f510bd2e81c9ea2104f687595b10972a9d9fa7a8b9b9e45b4d1f8b6c6b8c0d2624c7e70f7e4d87827644e9a5fe88ad
6
+ metadata.gz: b26374f517b2c486fd6780a66f05357689990026dab52e88c8f8b9a1aec881653a4f23f915bf5e6944c83ae8fe943046ae42047382c3968a5b1cca11204f5a53
7
+ data.tar.gz: 35502f72cf8aa2f3f19848d4fe9326994f8af544531e71da3dabf61215329c164404cfd5d7fab6e72da66f43ae851272ceaf6a1d9fbf6a72fdf15552d6dcd4e6
@@ -158,17 +158,7 @@
158
158
  <data type="ID"/>
159
159
  </attribute>
160
160
  <oneOrMore>
161
- <choice>
162
- <ref name="formula"/>
163
- <ref name="ul"/>
164
- <ref name="ol"/>
165
- <ref name="dl"/>
166
- <ref name="quote"/>
167
- <ref name="sourcecode"/>
168
- <ref name="paragraph"/>
169
- <ref name="table"/>
170
- <ref name="figure"/>
171
- </choice>
161
+ <ref name="paragraph"/>
172
162
  </oneOrMore>
173
163
  </element>
174
164
  </define>
@@ -1028,6 +1018,9 @@
1028
1018
  <value>alphabet_upper</value>
1029
1019
  </choice>
1030
1020
  </attribute>
1021
+ <optional>
1022
+ <attribute name="start"/>
1023
+ </optional>
1031
1024
  <oneOrMore>
1032
1025
  <ref name="li"/>
1033
1026
  </oneOrMore>
@@ -32,6 +32,22 @@ module Asciidoctor
32
32
  configuration.organization_name_long
33
33
  end
34
34
 
35
+ def org_abbrev
36
+ if !configuration.organization_name_long.empty? &&
37
+ !configuration.organization_name_short.empty? &&
38
+ configuration.organization_name_long !=
39
+ configuration.organization_name_short
40
+ { configuration.organization_name_long =>
41
+ configuration.organization_name_short }
42
+ else
43
+ super
44
+ end
45
+ end
46
+
47
+ def relaton_relations
48
+ Array(configuration.relations) || []
49
+ end
50
+
35
51
  def metadata_committee(node, xml)
36
52
  return unless node.attr("committee")
37
53
  xml.editorialgroup do |a|
@@ -117,10 +133,10 @@ module Asciidoctor
117
133
 
118
134
  def outputs(node, ret)
119
135
  File.open(@filename + ".xml", "w:UTF-8") { |f| f.write(ret) }
120
- presentation_xml_converter(node).convert(@filename + ".xml")
121
- html_converter(node).convert(@filename + ".presentation.xml",
136
+ presentation_xml_converter(node)&.convert(@filename + ".xml")
137
+ html_converter(node)&.convert(@filename + ".presentation.xml",
122
138
  nil, false, "#{@filename}.html")
123
- doc_converter(node).convert(@filename + ".presentation.xml",
139
+ doc_converter(node)&.convert(@filename + ".presentation.xml",
124
140
  nil, false, "#{@filename}.doc")
125
141
  pdf_converter(node)&.convert(@filename + ".presentation.xml",
126
142
  nil, false, "#{@filename}.pdf")
@@ -141,6 +157,7 @@ module Asciidoctor
141
157
 
142
158
  def bibdata_validate(doc)
143
159
  stage_validate(doc)
160
+ committee_validate(doc)
144
161
  end
145
162
 
146
163
  def stage_validate(xmldoc)
@@ -151,6 +168,15 @@ module Asciidoctor
151
168
  @log.add("Document Attributes", nil, "#{stage} is not a recognised status")
152
169
  end
153
170
 
171
+ def committee_validate(xmldoc)
172
+ committees = Array(configuration&.committees) || return
173
+ committees.empty? and return
174
+ xmldoc.xpath("//bibdata/ext/editorialgroup/committee").each do |c|
175
+ committees.include? c.text or
176
+ @log.add("Document Attributes", nil, "#{c.text} is not a recognised committee")
177
+ end
178
+ end
179
+
154
180
  def sections_cleanup(x)
155
181
  super
156
182
  x.xpath("//*[@inline-header]").each do |h|
@@ -187,6 +213,14 @@ module Asciidoctor
187
213
  end
188
214
  conv
189
215
  end
216
+
217
+ def boilerplate_file(xmldoc)
218
+ f = configuration.boilerplate
219
+ f.nil? and return super
220
+ f.is_a? String and return baselocation(f)
221
+ f.is_a? Hash and f[@lang] and return baselocation(f[@lang])
222
+ super
223
+ end
190
224
  end
191
225
  end
192
226
  end
@@ -59,6 +59,13 @@
59
59
  </define>
60
60
  <define name="generic-standard">
61
61
  <element name="generic-standard">
62
+ <attribute name="version"/>
63
+ <attribute name="type">
64
+ <choice>
65
+ <value>semantic</value>
66
+ <value>presentation</value>
67
+ </choice>
68
+ </attribute>
62
69
  <ref name="bibdata"/>
63
70
  <zeroOrMore>
64
71
  <ref name="termdocsource"/>
@@ -64,6 +64,11 @@
64
64
  </choice>
65
65
  </attribute>
66
66
  </optional>
67
+ <optional>
68
+ <attribute name="droploc">
69
+ <data type="boolean"/>
70
+ </attribute>
71
+ </optional>
67
72
  <text/>
68
73
  </element>
69
74
  </define>
@@ -859,6 +864,13 @@
859
864
  </define>
860
865
  <define name="standard-document">
861
866
  <element name="standard-document">
867
+ <attribute name="version"/>
868
+ <attribute name="type">
869
+ <choice>
870
+ <value>semantic</value>
871
+ <value>presentation</value>
872
+ </choice>
873
+ </attribute>
862
874
  <ref name="bibdata"/>
863
875
  <optional>
864
876
  <ref name="boilerplate"/>
@@ -880,7 +892,7 @@
880
892
  <oneOrMore>
881
893
  <choice>
882
894
  <ref name="content"/>
883
- <ref name="preface_abstract"/>
895
+ <ref name="abstract"/>
884
896
  <ref name="foreword"/>
885
897
  <ref name="introduction"/>
886
898
  <ref name="acknowledgements"/>
@@ -1481,11 +1493,6 @@
1481
1493
  </optional>
1482
1494
  </element>
1483
1495
  </define>
1484
- <define name="preface_abstract">
1485
- <element name="abstract">
1486
- <ref name="Basic-Section"/>
1487
- </element>
1488
- </define>
1489
1496
  <define name="term-clause">
1490
1497
  <element name="clause">
1491
1498
  <optional>
@@ -4,11 +4,13 @@ require "fileutils"
4
4
  module IsoDoc
5
5
  module Generic
6
6
  module BaseConvert
7
+ =begin
7
8
  def baselocation(loc)
8
9
  return nil if loc.nil?
9
10
  File.expand_path(File.join(
10
11
  File.dirname(self.class::_file || __FILE__), "..", "..", "..", loc))
11
12
  end
13
+ =end
12
14
 
13
15
  def cleanup(docxml)
14
16
  super
@@ -24,10 +24,14 @@ module IsoDoc
24
24
 
25
25
  def default_fonts(options)
26
26
  {
27
- bodyfont: (options[:script] == "Hans" ? '"SimSun",serif'
28
- : configuration.html_bodyfont || '"Overpass",sans-serif'),
29
- headerfont: (options[:script] == "Hans" ? '"SimHei",sans-serif' :
30
- configuration.html_headerfont || '"Overpass",sans-serif'),
27
+ bodyfont: (
28
+ options[:script] == "Hans" ? '"SimSun",serif' :
29
+ configuration.html_bodyfont || '"Overpass",sans-serif'
30
+ ),
31
+ headerfont: (
32
+ options[:script] == "Hans" ? '"SimHei",sans-serif' :
33
+ configuration.html_headerfont || '"Overpass",sans-serif'
34
+ ),
31
35
  monospacefont: configuration.html_monospacefont || '"Space Mono",monospace'
32
36
  }
33
37
  end
@@ -35,20 +39,23 @@ module IsoDoc
35
39
  def default_file_locations(_options)
36
40
  {
37
41
  htmlstylesheet: baselocation(configuration.htmlstylesheet) ||
38
- html_doc_path("htmlstyle.scss"),
42
+ html_doc_path("htmlstyle.scss"),
39
43
  htmlcoverpage: baselocation(configuration.htmlcoverpage) ||
40
- html_doc_path("html_generic_titlepage.html"),
44
+ html_doc_path("html_generic_titlepage.html"),
41
45
  htmlintropage: baselocation(configuration.htmlintropage) ||
42
- html_doc_path("html_generic_intro.html"),
46
+ html_doc_path("html_generic_intro.html"),
43
47
  scripts: baselocation(configuration.scripts) ||
44
- html_doc_path("scripts.html"),
45
- i18nyaml: baselocation(configuration.i18nyaml)
48
+ html_doc_path("scripts.html"),
49
+ i18nyaml: (configuration.i18nyaml.is_a?(String) ?
50
+ baselocation(configuration.i18nyaml) : nil)
46
51
  }
47
52
  end
48
53
 
54
+ =begin
49
55
  def configuration
50
56
  Metanorma::Generic.configuration
51
57
  end
58
+ =end
52
59
 
53
60
  def googlefonts
54
61
  return unless configuration.webfont
@@ -0,0 +1,26 @@
1
+ require_relative "utils"
2
+
3
+ module IsoDoc
4
+ module Generic
5
+ class I18n < IsoDoc::I18n
6
+ class << self
7
+ attr_accessor :_file
8
+ end
9
+
10
+ def self.inherited( k )
11
+ k._file = caller_locations.first.absolute_path
12
+ end
13
+
14
+ def load_yaml1(lang, script)
15
+ return super unless configuration.i18nyaml
16
+ file = configuration.i18nyaml.is_a?(Hash) ?
17
+ configuration.i18nyaml[lang] : configuration.i18nyaml
18
+ return super if file.nil?
19
+ y = YAML.load_file(baselocation(file))
20
+ super.merge(y)
21
+ end
22
+
23
+ include Utils
24
+ end
25
+ end
26
+ end
@@ -1,6 +1,8 @@
1
1
  require "isodoc"
2
2
  require_relative "metadata"
3
3
  require_relative "xref"
4
+ require_relative "i18n"
5
+ require_relative "utils"
4
6
 
5
7
  module IsoDoc
6
8
  module Generic
@@ -15,14 +17,13 @@ module IsoDoc
15
17
  end
16
18
 
17
19
  def i18n_init(lang, script, i18nyaml = nil)
20
+ f = Metanorma::Generic.configuration.i18nyaml
21
+ f = nil unless f.is_a? String
18
22
  @i18n = I18n.new(
19
- lang, script, i18nyaml ||
20
- Metanorma::Generic.configuration.i18nyaml || @i18nyaml)
23
+ lang, script, i18nyaml || f || @i18nyaml)
21
24
  end
22
25
 
23
- def fileloc(loc)
24
- File.join(File.dirname(__FILE__), loc)
25
- end
26
+ include Utils
26
27
  end
27
28
  end
28
29
  end
@@ -1,5 +1,6 @@
1
1
  require "isodoc"
2
2
  require_relative "init"
3
+ require_relative "utils"
3
4
 
4
5
  module IsoDoc
5
6
  module Generic
@@ -23,6 +24,7 @@ module IsoDoc
23
24
  k._file = caller_locations.first.absolute_path
24
25
  end
25
26
 
27
+ =begin
26
28
  def baselocation(loc)
27
29
  return nil if loc.nil?
28
30
  File.expand_path(File.join(File.dirname(
@@ -34,6 +36,7 @@ module IsoDoc
34
36
  def configuration
35
37
  Metanorma::Generic.configuration
36
38
  end
39
+ =end
37
40
 
38
41
  def author(isoxml, _out)
39
42
  super
@@ -57,6 +60,8 @@ module IsoDoc
57
60
  set(e.to_sym, b)
58
61
  end
59
62
  end
63
+
64
+ include Utils
60
65
  end
61
66
  end
62
67
  end
@@ -0,0 +1,21 @@
1
+ module IsoDoc
2
+ module Generic
3
+ module Utils
4
+ def configuration
5
+ Metanorma::Generic.configuration
6
+ end
7
+
8
+ def fileloc(loc)
9
+ File.join(File.dirname(__FILE__), loc)
10
+ end
11
+
12
+ def baselocation(loc)
13
+ return nil if loc.nil?
14
+ f = defined?(self.class::_file) ? (self.class::_file || __FILE__) :
15
+ __FILE__
16
+ File.expand_path(File.join(
17
+ File.dirname(f), "..", "..", "..", loc))
18
+ end
19
+ end
20
+ end
21
+ end
@@ -23,10 +23,14 @@ module IsoDoc
23
23
 
24
24
  def default_fonts(options)
25
25
  {
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'),
26
+ bodyfont: (
27
+ options[:script] == "Hans" ? '"SimSun",serif' :
28
+ configuration.word_bodyfont || '"Arial",sans-serif'
29
+ ),
30
+ headerfont: (
31
+ options[:script] == "Hans" ? '"SimHei",sans-serif' :
32
+ configuration.word_headerfont || '"Arial",sans-serif'
33
+ ),
30
34
  monospacefont: configuration.word_monospacefont || '"Courier New",monospace'
31
35
  }
32
36
  end
@@ -34,24 +38,27 @@ module IsoDoc
34
38
  def default_file_locations(options)
35
39
  {
36
40
  wordstylesheet: baselocation(configuration.wordstylesheet) ||
37
- html_doc_path("wordstyle.scss"),
41
+ html_doc_path("wordstyle.scss"),
38
42
  standardstylesheet: baselocation(configuration.standardstylesheet) ||
39
- html_doc_path("generic.scss"),
43
+ html_doc_path("generic.scss"),
40
44
  header: baselocation(configuration.header) ||
41
- html_doc_path("header.html"),
45
+ html_doc_path("header.html"),
42
46
  wordcoverpage: baselocation(configuration.wordcoverpage) ||
43
- html_doc_path("word_generic_titlepage.html"),
47
+ html_doc_path("word_generic_titlepage.html"),
44
48
  wordintropage: baselocation(configuration.wordintropage) ||
45
- html_doc_path("word_generic_intro.html"),
46
- i18nyaml: baselocation(configuration.i18nyaml),
47
- ulstyle: "l3",
48
- olstyle: "l2",
49
+ html_doc_path("word_generic_intro.html"),
50
+ i18nyaml: (configuration.i18nyaml.is_a?(String) ?
51
+ baselocation(configuration.i18nyaml) : nil),
52
+ ulstyle: "l3",
53
+ olstyle: "l2",
49
54
  }
50
55
  end
51
56
 
57
+ =begin
52
58
  def configuration
53
59
  Metanorma::Generic.configuration
54
60
  end
61
+ =end
55
62
 
56
63
  include BaseConvert
57
64
  include Init
@@ -15,6 +15,8 @@ module Metanorma
15
15
  organization_name_short
16
16
  organization_name_long
17
17
  bibliography_titles
18
+ boilerplate
19
+ committees
18
20
  document_namespace
19
21
  docid_template
20
22
  doctypes
@@ -33,6 +35,7 @@ module Metanorma
33
35
  metanorma_name
34
36
  normref_titles
35
37
  published_stages
38
+ relations
36
39
  default_stage
37
40
  stage_abbreviations
38
41
  scripts
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Generic
3
- VERSION = "1.6.3"
3
+ VERSION = "1.7.0"
4
4
  end
5
5
  end
@@ -28,7 +28,7 @@ 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.5.0"
31
+ spec.add_dependency "metanorma-standoc", "~> 1.6.0"
32
32
  spec.add_dependency "isodoc", "~> 1.2.0"
33
33
 
34
34
  spec.add_development_dependency "byebug", "~> 9.1"
@@ -29,6 +29,11 @@ metadata_extensions:
29
29
  - security
30
30
  published_stages:
31
31
  - published
32
+ committees:
33
+ - TC 1
34
+ relations:
35
+ - part-of
36
+ - translated-from
32
37
  stage_abbreviations:
33
38
  draft-proposal:
34
39
  draft-development:
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.6.3
4
+ version: 1.7.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-09-11 00:00:00.000000000 Z
11
+ date: 2020-09-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: htmlentities
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 1.5.0
47
+ version: 1.6.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.5.0
54
+ version: 1.6.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: isodoc
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -253,10 +253,12 @@ files:
253
253
  - lib/isodoc/generic/html/word_generic_titlepage.html
254
254
  - lib/isodoc/generic/html/wordstyle.scss
255
255
  - lib/isodoc/generic/html_convert.rb
256
+ - lib/isodoc/generic/i18n.rb
256
257
  - lib/isodoc/generic/init.rb
257
258
  - lib/isodoc/generic/metadata.rb
258
259
  - lib/isodoc/generic/pdf_convert.rb
259
260
  - lib/isodoc/generic/presentation_xml_convert.rb
261
+ - lib/isodoc/generic/utils.rb
260
262
  - lib/isodoc/generic/word_convert.rb
261
263
  - lib/isodoc/generic/xref.rb
262
264
  - lib/metanorma-generic.rb