metanorma 1.1.4 → 1.1.5

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: 72a6cdf0d2785bbc70cc907a024ab4e03ce4bdf5cd744c73ccc24ee0e928e092
4
- data.tar.gz: bae5a06c2b0b71ecc46ed52699607eb235aa05d327f474328cce113510d4616e
3
+ metadata.gz: 42020b6888a6b5d4d11678cc5d3d217e93ced978e477d05fee31a6593722f78b
4
+ data.tar.gz: 4379ba9bcf18655c119598b44ead30f223d843edb33ce53205d4ad6c16826904
5
5
  SHA512:
6
- metadata.gz: 78f0012cc133961e454a58e28a67c47a527a766ef85d8e995b7495f5095ec149bc7b89849ca565c8b668487e43ef90d1cc2d0c00658deee546d15295280352cd
7
- data.tar.gz: 48a352c90ab1d5b4c2cd8e0e8581e58cd8425399d34cde1ba9ceafb333f36d2a6c048f59f739057840ce5bb6c7a0db2c5973dc26113c4d8102daf7300b806605
6
+ metadata.gz: 67525ff08b409c36a90cc8725dc150a518b2c3888f0b3518cc83113b51dcc739ba89120681fe0c2e36c4c6b8771178afe1abe25c64887aee93b29fb055c82a4e
7
+ data.tar.gz: c0f35a9f5f0e3b0397fb0f81eaf84b90be85f09af4cb99a25e9ac146e0b9658c0b0c26883015c0a8979d656f12d57f5dc0cb24f1af92fa1cb9c58ba7f5e13a90
@@ -7,8 +7,7 @@ module Metanorma
7
7
 
8
8
  def process(file, filename, type, options = {})
9
9
  require "asciidoctor"
10
- ::Asciidoctor.convert(
11
- file,
10
+ out_opts = {
12
11
  to_file: false,
13
12
  safe: :safe,
14
13
  backend: type,
@@ -16,8 +15,28 @@ module Metanorma
16
15
  attributes: [
17
16
  "nodoc", "stem", "xrefstyle=short", "docfile=#{filename}",
18
17
  "output_dir=#{options[:"output-dir"]}"
19
- ],
20
- )
18
+ ]
19
+ }
20
+ unless asciidoctor_validate(file, filename, out_opts)
21
+ warn "Cannot continue compiling Asciidoctor document"
22
+ abort
23
+ end
24
+ ::Asciidoctor.convert(file, out_opts)
25
+ end
26
+
27
+ def asciidoctor_validate(file, filename, options)
28
+ err = nil
29
+ begin
30
+ previous_stderr, $stderr = $stderr, StringIO.new
31
+ ::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
35
+ ensure
36
+ $stderr = previous_stderr
37
+ end
38
+ warn err unless err.nil?
39
+ err.nil?
21
40
  end
22
41
 
23
42
  def extract_metanorma_options(file)
@@ -1,3 +1,3 @@
1
1
  module Metanorma
2
- VERSION = "1.1.4"
2
+ VERSION = "1.1.5"
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.1.4
4
+ version: 1.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-08-27 00:00:00.000000000 Z
11
+ date: 2020-09-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciidoctor