metanorma-standoc 2.2.2 → 2.2.2.1

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: e1259358ae365bba52ab94c40d88b6cc9d4b1eb9b65a9f7fc8edef4bd77138e0
4
- data.tar.gz: 6c348c7e3b1706287332368251d90fa277fee7e9a54a0fc0cd11e19f5464506b
3
+ metadata.gz: '0268c3ff4369ed762e3b37515adf258a24a51561802243c9e054428b09351570'
4
+ data.tar.gz: d9d652832d3a7ac866d3c4e1f47ee3fc1a9cb803658864278b0cefaa7f23ec68
5
5
  SHA512:
6
- metadata.gz: 602f12339e31a98c061ce7dc46d9fad6888b18e962942f110ebeea86f6739311b093578dbc8886a795bfcd01de790c40c134072449ff1e701779f2e29139a743
7
- data.tar.gz: 39b93eb600aa0f18e21982174fc204eb36a9f28ae7e1e3b5a4a78ddfa9a05a440e6e3d6b94cdf7824dbd71b62880a193d5c88028ecd78d074c7c9361961966f6
6
+ metadata.gz: ff1f0b3266523dfb2b67c2b1e888af2136970815da0caebd6f906168aa5b3083bad1c1d0c50d66b27d6faa7a35fcaf7608f1191bd35043b69c76b60b33bb3ee9
7
+ data.tar.gz: a94108f4584720b053727a46f6c9e9c634927543e9efcd0fab5633edcffebb8dee147f9231f978caac6ce65330f4e4d983c5dddeb49ffbfbee02f8a06aa01fbc
@@ -160,8 +160,11 @@ module Metanorma
160
160
  end
161
161
 
162
162
  def clean_abort(msg, file = nil)
163
- file and
164
- File.open("#{@filename}.xml.abort", "w:UTF-8") { |f| f.write(file) }
163
+ if file
164
+ doc = file.to_xml(encoding: "UTF-8", indent: 2,
165
+ save_with: Nokogiri::XML::Node::SaveOptions::AS_XML)
166
+ File.open("#{@filename}.xml.abort", "w:UTF-8") { |f| f.write(doc) }
167
+ end
165
168
  clean_exit
166
169
  abort(msg)
167
170
  end
@@ -1,18 +1,17 @@
1
1
  require "asciidoctor"
2
- require "metanorma/util"
3
- require "metanorma/standoc/version"
4
- require "metanorma/standoc/base"
5
- require "metanorma/standoc/front"
6
- require "metanorma/standoc/lists"
7
- require "metanorma/standoc/ref"
8
- require "metanorma/standoc/inline"
9
- require "metanorma/standoc/blocks"
10
- require "metanorma/standoc/section"
11
- require "metanorma/standoc/table"
12
- require "metanorma/standoc/validate"
13
- require "metanorma/standoc/utils"
14
- require "metanorma/standoc/cleanup"
15
- require "metanorma/standoc/reqt"
2
+ require_relative "version"
3
+ require_relative "base"
4
+ require_relative "front"
5
+ require_relative "lists"
6
+ require_relative "ref"
7
+ require_relative "inline"
8
+ require_relative "blocks"
9
+ require_relative "section"
10
+ require_relative "table"
11
+ require_relative "validate"
12
+ require_relative "utils"
13
+ require_relative "cleanup"
14
+ require_relative "reqt"
16
15
  require_relative "./macros"
17
16
 
18
17
  module Metanorma
@@ -55,7 +55,8 @@ module Metanorma
55
55
  table_validate(doc)
56
56
  requirement_validate(doc)
57
57
  image_validate(doc)
58
- @fatalerror.empty? or clean_abort(@fatalerror.join("\n"), doc.to_xml)
58
+ @fatalerror.empty? or
59
+ clean_abort(@fatalerror.join("\n"), doc)
59
60
  end
60
61
 
61
62
  def norm_ref_validate(doc)
@@ -108,7 +109,7 @@ module Metanorma
108
109
  Tempfile.open(["tmp", ".xml"], encoding: "UTF-8") do |f|
109
110
  schema_validate1(f, doc, schema)
110
111
  rescue Jing::Error => e
111
- clean_abort("Jing failed with error: #{e}", doc.to_xml)
112
+ clean_abort("Jing failed with error: #{e}", doc)
112
113
  ensure
113
114
  f.close!
114
115
  end
@@ -161,6 +162,7 @@ module Metanorma
161
162
  def image_validate(doc)
162
163
  doc.xpath("//image[@mimetype = 'image/png']").each do |i|
163
164
  d = Metanorma::Utils::datauri(i["src"], @localdir)
165
+ # d.chars.to_a.each_slice(80).to_a.map { |s| s.join }.each { |s| warn s }
164
166
  png_validate1(i, Base64.strict_decode64(d.sub(/^.+?base64,/, "")))
165
167
  end
166
168
  end
@@ -19,6 +19,6 @@ module Metanorma
19
19
  end
20
20
 
21
21
  module Standoc
22
- VERSION = "2.2.2".freeze
22
+ VERSION = "2.2.2.1".freeze
23
23
  end
24
24
  end
@@ -28,6 +28,7 @@ Gem::Specification.new do |spec|
28
28
  spec.add_dependency "asciidoctor", "~> 2.0.0"
29
29
  spec.add_dependency "iev", "~> 0.3.0"
30
30
  spec.add_dependency "isodoc", "~> 2.2.3"
31
+ spec.add_dependency "metanorma"
31
32
  spec.add_dependency "metanorma-plugin-datastruct", "~> 0.2.0"
32
33
  spec.add_dependency "metanorma-plugin-lutaml"
33
34
  spec.add_dependency "ruby-jing"
data/spec/spec_helper.rb CHANGED
@@ -20,7 +20,6 @@ require "asciidoctor"
20
20
  require "metanorma-standoc"
21
21
  require "rspec/matchers"
22
22
  require "equivalent-xml"
23
- require "metanorma"
24
23
  require "metanorma/standoc"
25
24
  require "rexml/document"
26
25
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-standoc
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.2
4
+ version: 2.2.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-09-05 00:00:00.000000000 Z
11
+ date: 2022-09-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciidoctor
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: 2.2.3
55
+ - !ruby/object:Gem::Dependency
56
+ name: metanorma
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: metanorma-plugin-datastruct
57
71
  requirement: !ruby/object:Gem::Requirement