metanorma-generic 1.7.2 → 1.7.3

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: 0d02192d5be665b9aa551746323610fe9b988beebecdb2958b8c5e82db73b5af
4
- data.tar.gz: 040ed75b73480fd867037665e2b6d7265b514231c4c9db9e875e6726f98087eb
3
+ metadata.gz: c325e9aa02cddaf26372e0199b21c55338e5abff1b8a1e8a25007567fb03b799
4
+ data.tar.gz: b6fc284631a359dc78e4f83744d1fbda26211b1692d74417b5a45af254b0266b
5
5
  SHA512:
6
- metadata.gz: 46ecf1b3a72fa9b298c2d775b330c81604fea4224f2794422f5df8a6ca89a7ff2d7b8564eac7b2626af9f94d88d9755d55e533dc27913428ea4d73c00c6e452d
7
- data.tar.gz: 1c652868d71eab1fb629726b5c3c8b2910e02d89f9ac41e532b9d3e907ac3305030105367ecf4c0dca1a06d38a953c5151cb2a938d244e6dd8c9ac14649f901d
6
+ metadata.gz: a0496b1c8cb2ef30e8265d08eaf4c0206f110a6687f6e2acc7d9e172e2e1975e266f9740ac628fa492d5b151ecad4a171653f9cc8704625e76359676231b6364
7
+ data.tar.gz: 3a4fd80dfd4fd4540950837182bf860676d4ea15f6a09cc207f64ab2025c2a54b0fa9aa84ba324585f6dcee41632ff38117b00a1dc8594c6d215e8b6779cc0e8
@@ -4,7 +4,8 @@ name: rake
4
4
 
5
5
  on:
6
6
  push:
7
- branches: [ master ]
7
+ branches: [ master, main ]
8
+ tags: [ v* ]
8
9
  pull_request:
9
10
 
10
11
  jobs:
@@ -31,14 +32,32 @@ jobs:
31
32
  steps:
32
33
  - uses: actions/checkout@master
33
34
 
34
- - name: Use Ruby
35
- uses: ruby/setup-ruby@v1
35
+ - uses: ruby/setup-ruby@v1
36
36
  with:
37
37
  ruby-version: ${{ matrix.ruby }}
38
- bundler-cache: true
39
38
 
40
- - name: Update gems
41
- run: bundle install --jobs 4 --retry 3
39
+ - uses: actions/cache@v1
40
+ with:
41
+ path: vendor/bundle
42
+ key: bundle-${{ matrix.os }}-${{ matrix.ruby }}-${{ hashFiles('**/*.gemspec') }}
43
+ restore-keys: bundle-${{ matrix.os }}-${{ matrix.ruby }}
44
+
45
+ - run: bundle config set path 'vendor/bundle'
46
+
47
+ - run: bundle install --jobs 4 --retry 3
42
48
 
43
- - name: Run specs
44
- run: bundle exec rake
49
+ - run: bundle exec rake
50
+
51
+ notify:
52
+ name: Trigger notify workflow
53
+ needs: rake
54
+ runs-on: ubuntu-latest
55
+ steps:
56
+ - name: Trigger notify workflow
57
+ uses: Sibz/github-status-action@v1
58
+ with:
59
+ authToken: ${{ secrets.GITHUB_TOKEN }}
60
+ context: 'tests-passed-successfully'
61
+ description: 'Tests passed successfully'
62
+ state: 'success'
63
+ sha: ${{ github.event.pull_request.head.sha || github.sha }}
@@ -3,9 +3,7 @@
3
3
  Formerly known as metanorma-acme
4
4
 
5
5
  image:https://img.shields.io/gem/v/metanorma-generic.svg["Gem Version", link="https://rubygems.org/gems/metanorma-generic"]
6
- image:https://github.com/metanorma/metanorma-generic/workflows/macos/badge.svg["Build Status (macOS)", link="https://github.com/metanorma/metanorma-generic/actions?workflow=macos"]
7
- image:https://github.com/metanorma/metanorma-generic/workflows/ubuntu/badge.svg["Build Status (ubuntu)", link="https://github.com/metanorma/metanorma-generic/actions?workflow=ubuntu"]
8
- image:https://github.com/metanorma/metanorma-generic/workflows/windows/badge.svg["Build Status (Windows)", link="https://github.com/metanorma/metanorma-generic/actions?workflow=windows"]
6
+ image:https://github.com/metanorma/metanorma-generic/workflows/rake/badge.svg["Build Status", link="https://github.com/metanorma/metanorma-generic/actions?workflow=rake"]
9
7
  image:https://codeclimate.com/github/metanorma/metanorma-acme/badges/gpa.svg["Code Climate", link="https://codeclimate.com/github/metanorma/metanorma-acme"]
10
8
  image:https://img.shields.io/github/issues-pr-raw/metanorma/metanorma-generic.svg["Pull Requests", link="https://github.com/metanorma/metanorma-generic/pulls"]
11
9
  image:https://img.shields.io/github/commits-since/metanorma/metanorma-generic/latest.svg["Commits since latest",link="https://github.com/metanorma/metanorma-generic/releases"]
@@ -35,10 +35,11 @@ module Asciidoctor
35
35
 
36
36
  def doctype(node)
37
37
  d = super
38
- configuration.doctypes or return d == "article" ? "standard" : d
38
+ configuration.doctypes or return d == "article" ?
39
+ (configuration.default_doctype || "standard") : d
39
40
  type = configuration.default_doctype ||
40
- Array(configuration.doctypes).dig(0) || "standard"
41
- unless Array(configuration.doctypes).include? d
41
+ configuration.doctypes.keys.dig(0) || "standard"
42
+ unless configuration.doctypes.keys.include? d
42
43
  @log.add("Document Attributes", nil,
43
44
  "#{d} is not a legal document type: reverting to '#{type}'")
44
45
  d = type
@@ -63,6 +63,11 @@ module Asciidoctor
63
63
  end
64
64
  end
65
65
 
66
+ def metadata_doctype(node, xml)
67
+ d = doctype(node)
68
+ xml.doctype d, attr_code(abbreviation: configuration&.doctypes&.dig(d))
69
+ end
70
+
66
71
  EXT_STRUCT = %w(_output _attribute _list).freeze
67
72
 
68
73
  def metadata_ext_hash(node, ext, hash)
@@ -24,6 +24,14 @@
24
24
  <start>
25
25
  <ref name="standard-document"/>
26
26
  </start>
27
+ <define name="doctype">
28
+ <element name="doctype">
29
+ <optional>
30
+ <attribute name="abbreviation"/>
31
+ </optional>
32
+ <ref name="DocumentType"/>
33
+ </element>
34
+ </define>
27
35
  <define name="hyperlink">
28
36
  <element name="link">
29
37
  <attribute name="target">
@@ -141,6 +149,11 @@
141
149
  <data type="boolean"/>
142
150
  </attribute>
143
151
  </optional>
152
+ <optional>
153
+ <attribute name="key">
154
+ <data type="boolean"/>
155
+ </attribute>
156
+ </optional>
144
157
  <oneOrMore>
145
158
  <ref name="dt"/>
146
159
  <ref name="dd"/>
@@ -4,14 +4,6 @@ require "fileutils"
4
4
  module IsoDoc
5
5
  module Generic
6
6
  module BaseConvert
7
- =begin
8
- def baselocation(loc)
9
- return nil if loc.nil?
10
- File.expand_path(File.join(
11
- File.dirname(self.class::_file || __FILE__), "..", "..", "..", loc))
12
- end
13
- =end
14
-
15
7
  def cleanup(docxml)
16
8
  super
17
9
  term_cleanup(docxml)
@@ -33,7 +33,7 @@ module IsoDoc
33
33
  configuration.html_headerfont || '"Overpass",sans-serif'
34
34
  ),
35
35
  monospacefont: configuration.html_monospacefont || '"Space Mono",monospace'
36
- }
36
+ }.transform_values { |v| v&.empty? ? nil : v }
37
37
  end
38
38
 
39
39
  def default_file_locations(_options)
@@ -48,7 +48,7 @@ module IsoDoc
48
48
  html_doc_path("scripts.html"),
49
49
  i18nyaml: (configuration.i18nyaml.is_a?(String) ?
50
50
  baselocation(configuration.i18nyaml) : nil)
51
- }
51
+ }.transform_values { |v| v&.empty? ? nil : v }
52
52
  end
53
53
 
54
54
  =begin
@@ -63,6 +63,13 @@ module IsoDoc
63
63
  !(Array(stages).map { |m| m.downcase }.include? status.downcase)
64
64
  end
65
65
 
66
+ def doctype(isoxml, _out)
67
+ super
68
+ b = isoxml&.at(ns("//bibdata/ext/doctype#{currlang}")) ||
69
+ isoxml&.at(ns("//bibdata/ext/doctype#{NOLANG}")) || return
70
+ a = b["abbreviation"] and set(:doctype_abbr, a)
71
+ end
72
+
66
73
  def xmlhash2hash(h)
67
74
  ret = {}
68
75
  return ret if h.nil? || h[:kind] != "element"
@@ -27,7 +27,7 @@ module IsoDoc
27
27
  headerfont: (options[:script] == "Hans" ? '"SimHei",sans-serif' :
28
28
  configuration.html_headerfont || '"Overpass",sans-serif'),
29
29
  monospacefont: configuration.html_monospacefont || '"Space Mono",monospace'
30
- }
30
+ }.transform_values { |v| v&.empty? ? nil : v }
31
31
  end
32
32
 
33
33
  def default_file_locations(_options)
@@ -40,7 +40,7 @@ module IsoDoc
40
40
  html_doc_path("html_generic_intro.html"),
41
41
  scripts_pdf: baselocation(configuration.scripts_pdf) ||
42
42
  html_doc_path("scripts.pdf.html")
43
- }
43
+ }.transform_values { |v| v&.empty? ? nil : v }
44
44
  end
45
45
 
46
46
  def googlefonts
@@ -9,8 +9,9 @@ module IsoDoc
9
9
  File.join(File.dirname(__FILE__), loc)
10
10
  end
11
11
 
12
- def baselocation(loc)
12
+ def baselocation(loc)
13
13
  return nil if loc.nil?
14
+ return "" if loc.empty?
14
15
  f = defined?(self.class::_file) ? (self.class::_file || __FILE__) :
15
16
  __FILE__
16
17
  File.expand_path(File.join(
@@ -32,7 +32,7 @@ module IsoDoc
32
32
  configuration.word_headerfont || '"Arial",sans-serif'
33
33
  ),
34
34
  monospacefont: configuration.word_monospacefont || '"Courier New",monospace'
35
- }
35
+ }.transform_values { |v| v&.empty? ? nil : v }
36
36
  end
37
37
 
38
38
  def default_file_locations(options)
@@ -51,15 +51,9 @@ module IsoDoc
51
51
  baselocation(configuration.i18nyaml) : nil),
52
52
  ulstyle: "l3",
53
53
  olstyle: "l2",
54
- }
54
+ }.transform_values { |v| v&.empty? ? nil : v }
55
55
  end
56
56
 
57
- =begin
58
- def configuration
59
- Metanorma::Generic.configuration
60
- end
61
- =end
62
-
63
57
  include BaseConvert
64
58
  include Init
65
59
  end
@@ -85,6 +85,10 @@ module Metanorma
85
85
 
86
86
  def set_default_values_from_yaml_file(config_file)
87
87
  default_config_options = YAML.load(File.read(config_file))
88
+ if default_config_options["doctypes"]&.is_a? Array
89
+ default_config_options["doctypes"] = default_config_options["doctypes"].
90
+ each_with_object({}) { |k, m| m[k] = nil }
91
+ end
88
92
  CONFIG_ATTRS.each do |attr_name|
89
93
  instance_variable_set("@#{attr_name}", default_config_options[attr_name.to_s])
90
94
  end
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Generic
3
- VERSION = "1.7.2"
3
+ VERSION = "1.7.3"
4
4
  end
5
5
  end
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.7.2
4
+ version: 1.7.3
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-10-25 00:00:00.000000000 Z
11
+ date: 2020-11-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: htmlentities