metanorma 1.3.3 → 1.3.4

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: fec4f760c22a19793bca3f3cb2c5abc0b355a8554d5ac0720fe8e679a26db842
4
- data.tar.gz: ffa03687166474e66611a2fa0f5841281ae5b1127e078dd7cbf2993ec1a15f65
3
+ metadata.gz: c92210eec85835a4e8be4a85a1c1dbe84cc1b88163e0f3c9c9be136f0019cb6e
4
+ data.tar.gz: 066d89b3df0a8865f52e3e70b257a1a4ce3c71eb9f8b6840a87b9046743536d1
5
5
  SHA512:
6
- metadata.gz: 9721c89fe96d4bfb1bf6458fc79d824fa16887a349b2bdcd9618d6528ec0b32abf86158bc7658de8288bcf130ce3008427fcc06fe036179c652b70a2a3edd9f6
7
- data.tar.gz: 74993bec3d7dca356699d821dadb55f35f7f7c20d6a8270e2c3fc9e224225504fe4fe3dee77cdf9cbc0a55eeee033df0253a17307fac8fec76772dc02c5c2f2f
6
+ metadata.gz: d23d488ab60995b4745184cc5a22aaaf1c9b24694186b8cfb0d7359ecaea1a999fef99dcc71c15944d5e9fbdd377f0739b35f79528f46071a7a701b512fd3108
7
+ data.tar.gz: 70dd774b5b69a08661cacf0d2601b0a92cb45624848f23f6f3a397df02ef9c496ff44a64f1c1fc083d07bbfa8754921dafe6168d0472ab776cb1453b064313ce
@@ -16,19 +16,9 @@ jobs:
16
16
  strategy:
17
17
  fail-fast: false
18
18
  matrix:
19
- ruby: [ '2.7', '2.6', '2.5', '2.4' ]
19
+ ruby: [ '3.0', '2.7', '2.6', '2.5', '2.4' ]
20
20
  os: [ ubuntu-latest, windows-latest, macos-latest ]
21
21
  experimental: [ false ]
22
- include:
23
- - ruby: '3.0'
24
- os: 'ubuntu-latest'
25
- experimental: true
26
- - ruby: '3.0'
27
- os: 'windows-latest'
28
- experimental: true
29
- - ruby: '3.0'
30
- os: 'macos-latest'
31
- experimental: true
32
22
  steps:
33
23
  - uses: actions/checkout@v2
34
24
  with:
@@ -2,20 +2,14 @@ require "nokogiri"
2
2
 
3
3
  module Metanorma
4
4
  module Input
5
-
6
5
  class Asciidoc < Base
7
-
8
6
  def process(file, filename, type, options = {})
9
7
  require "asciidoctor"
10
8
  out_opts = {
11
- to_file: false,
12
- safe: :safe,
13
- backend: type,
14
- header_footer: true,
15
- attributes: [
16
- "nodoc", "stem", "xrefstyle=short", "docfile=#{filename}",
17
- "output_dir=#{options[:output_dir]}"
18
- ]
9
+ to_file: false, safe: :safe, backend: type, header_footer: true,
10
+ attributes: ["nodoc", "stem", "xrefstyle=short",
11
+ "docfile=#{filename}",
12
+ "output_dir=#{options[:output_dir]}"]
19
13
  }
20
14
  unless asciidoctor_validate(file, filename, out_opts)
21
15
  warn "Cannot continue compiling Asciidoctor document"
@@ -27,11 +21,12 @@ module Metanorma
27
21
  def asciidoctor_validate(file, filename, options)
28
22
  err = nil
29
23
  begin
30
- previous_stderr, $stderr = $stderr, StringIO.new
24
+ previous_stderr = $stderr
25
+ $stderr = StringIO.new
31
26
  ::Asciidoctor.load(file, options)
32
- %r{(\n|^)asciidoctor: ERROR: ['"]?#{Regexp.escape(filename ||
33
- "<empty>")}['"]?: line \d+: include file not found: }.match($stderr.string) and
34
- err = $stderr.string
27
+ %r{(\n|^)asciidoctor: ERROR: ['"]?#{Regexp.escape(filename ||
28
+ "<empty>")}['"]?: line \d+: include file not found: }
29
+ .match($stderr.string) and err = $stderr.string
35
30
  ensure
36
31
  $stderr = previous_stderr
37
32
  end
@@ -45,8 +40,9 @@ module Metanorma
45
40
  /\n:mn-output-extensions: (?<extensions>[^\n]+)\n/ =~ headerextract
46
41
  /\n:mn-relaton-output-file: (?<relaton>[^\n]+)\n/ =~ headerextract
47
42
  /\n(?<asciimath>:mn-keep-asciimath:[^\n]*)\n/ =~ headerextract
48
- asciimath = defined?(asciimath) ?
49
- (!asciimath.nil? && asciimath != ":mn-keep-asciimath: false") : nil
43
+ asciimath = if defined?(asciimath)
44
+ (!asciimath.nil? && asciimath != ":mn-keep-asciimath: false")
45
+ end
50
46
  asciimath = nil if asciimath == false
51
47
  {
52
48
  type: defined?(type) ? type : nil,
@@ -60,38 +56,39 @@ module Metanorma
60
56
  attr&.sub(/^#{name}:\s*$/, "#{name}: true")&.sub(/^#{name}:\s+/, "")
61
57
  end
62
58
 
59
+ ADOC_OPTIONS = %w(htmlstylesheet htmlcoverpage htmlintropage scripts
60
+ scripts-override scripts-pdf wordstylesheet bare i18nyaml
61
+ standardstylesheet header wordcoverpage wordintropage
62
+ ulstyle olstyle htmlstylesheet-override
63
+ htmltoclevels doctoclevels sectionsplit
64
+ body-font header-font monospace-font title-font
65
+ wordstylesheet-override).freeze
66
+
63
67
  def extract_options(file)
64
68
  header = file.sub(/\n\n.*$/m, "\n")
65
- ret = %w(htmlstylesheet htmlcoverpage htmlintropage scripts
66
- scripts-pdf wordstylesheet
67
- standardstylesheet header wordcoverpage wordintropage i18nyaml
68
- ulstyle olstyle htmlstylesheet-override
69
- htmltoclevels doctoclevels sectionsplit
70
- body-font header-font monospace-font title-font
71
- wordstylesheet-override).each_with_object({}) do |w, acc|
69
+ ret = ADOC_OPTIONS.each_with_object({}) do |w, acc|
72
70
  m = /\n:#{w}: ([^\n]+)\n/.match(header) or next
73
71
  acc[w.gsub(/-/, "").sub(/override$/, "_override")
74
72
  .sub(/pdf$/, "_pdf").to_sym] = m[1]
75
73
  end
76
74
  /\n:data-uri-image: (?<datauriimage>[^\n]+)\n/ =~ header
77
- /\n:(?<hierarchical_assets>hierarchical-assets:[^\n]*)\n/ =~ header
75
+ /\n:(?<hier_assets>hierarchical-assets:[^\n]*)\n/ =~ header
78
76
  /\n:(?<use_xinclude>use-xinclude:[^\n]*)\n/ =~ header
79
77
  /\n:(?<break_up>break-up-urls-in-tables:[^\n]*)\n/ =~ header
80
78
 
81
- defined?(hierarchical_assets) and
82
- hierarchical_assets = empty_attr(hierarchical_assets, "hierarchical-assets")
79
+ defined?(hier_assets) and
80
+ hier_assets = empty_attr(hier_assets, "hierarchical-assets")
83
81
  defined?(use_xinclude) and
84
82
  use_xinclude = empty_attr(use_xinclude, "use-xinclude")
85
83
  defined?(break_up) and
86
84
  break_up = empty_attr(break_up, "break-up-urls-in-tables")
87
- ret.merge({
85
+ ret.merge(
88
86
  datauriimage: defined?(datauriimage) ? datauriimage != "false" : nil,
89
- hierarchical_assets: defined?(hierarchical_assets) ? hierarchical_assets : nil,
87
+ hierarchical_assets: defined?(hier_assets) ? hier_assets : nil,
90
88
  use_xinclude: defined?(use_xinclude) ? use_xinclude : nil,
91
89
  break_up_urls_in_tables: defined?(break_up) ? break_up : nil,
92
- }).reject { |_, val| val.nil? }
90
+ ).reject { |_, val| val.nil? }
93
91
  end
94
-
95
92
  end
96
93
  end
97
94
  end
@@ -1,3 +1,3 @@
1
1
  module Metanorma
2
- VERSION = "1.3.3".freeze
2
+ VERSION = "1.3.4".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.3
4
+ version: 1.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-05-24 00:00:00.000000000 Z
11
+ date: 2021-06-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciidoctor