isodoc 2.6.1 → 2.6.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: 7b149d913a483c336d7463e587e980fe234f4d1e32d8d683a070d919b0ce7429
4
- data.tar.gz: 46e568e2b91f13069f62131ab1b86e28fd74416c55ae0937935575927a578430
3
+ metadata.gz: 7d77a199eaa1452ad1dd61e4db65e4a4eec3d7856942033c2e6f31019db08708
4
+ data.tar.gz: 5f2bf413d05d58707097e3bb605c0b778088554c7238f5588102afbd6d07985a
5
5
  SHA512:
6
- metadata.gz: ae43a3f990e70f7d1929357172ca48b4cbc5db2750e61d1f91768c8087e796f5e333de64b60fc928434862e1fb874151c6a00a0cd41e25d491fe79e8604dfa9d
7
- data.tar.gz: 9abab47db0d610e3971c1f9a19af240449dc11d6cd1d8d0f9e1e860f4b00e4a6947cce60d8483ba8701a180472278badaee6d431a07bd32ba1727ea5ad4d9a16
6
+ metadata.gz: c7dc8fe34c7df07195377ff5c42e85b1597d5eb55e1c45951652f20521b16bf534f326c8e68a2058e4fa60b6b2f7bacbd5182da5488bca9ede76a4a9bfbb8c22
7
+ data.tar.gz: e2834d76979c5ceffe4a10b2a8471f2178b0d850e8d4b8fab3b321fed52d4902cb10624a3b4e72c164a70b1520cda41ba27f241fae1f367404b192059eaf70da
data/isodoc.gemspec CHANGED
@@ -28,12 +28,11 @@ Gem::Specification.new do |spec|
28
28
  end
29
29
  spec.required_ruby_version = Gem::Requirement.new(">= 2.7.0")
30
30
 
31
- spec.add_dependency "html2doc", "~> 1.6.0"
31
+ spec.add_dependency "html2doc", "~> 1.7.0"
32
32
  spec.add_dependency "htmlentities", "~> 4.3.4"
33
33
  # spec.add_dependency "isodoc-i18n", "~> 1.1.0" # already in relaton-render and mn-requirements
34
34
  spec.add_dependency "emf2svg"
35
35
  spec.add_dependency "liquid", "~> 5"
36
- spec.add_dependency "plurimath"
37
36
  spec.add_dependency "relaton-cli"
38
37
  # spec.add_dependency "metanorma-utils", "~> 1.5.0" # already in isodoc-i18n
39
38
  spec.add_dependency "mn2pdf"
@@ -10,7 +10,7 @@ require "mn-requirements"
10
10
  module IsoDoc
11
11
  class Convert < ::IsoDoc::Common
12
12
  attr_accessor :options, :i18n, :meta, :xrefs, :reqt_models,
13
- :requirements_processor
13
+ :requirements_processor, :doctype
14
14
 
15
15
  # htmlstylesheet: Generic stylesheet for HTML
16
16
  # htmlstylesheet_override: Override stylesheet for HTML
data/lib/isodoc/css.rb CHANGED
@@ -101,6 +101,7 @@ module IsoDoc
101
101
  stylesheet = convert_scss(filename, stylesheet, stripwordcss)
102
102
  end
103
103
  Tempfile.open([File.basename(filename, ".*"), "css"],
104
+ mode: File::BINARY | File::SHARE_DELETE,
104
105
  encoding: "utf-8") do |f|
105
106
  f.write(stylesheet)
106
107
  f
@@ -177,7 +177,8 @@ module IsoDoc
177
177
  imgtype = imgtype.sub(/\+[a-z0-9]+$/, "") # svg+xml
178
178
  imgtype = "png" unless /^[a-z0-9]+$/.match? imgtype
179
179
  imgtype == "postscript" and imgtype = "eps"
180
- Tempfile.open(["image", ".#{imgtype}"]) do |f|
180
+ Tempfile.open(["image", ".#{imgtype}"],
181
+ mode: File::BINARY | File::SHARE_DELETE) do |f|
181
182
  f.binmode
182
183
  f.write(Base64.strict_decode64(imgdata))
183
184
  @tempfile_cache << f # persist to the end
@@ -186,7 +187,8 @@ module IsoDoc
186
187
  end
187
188
 
188
189
  def save_svg(img)
189
- Tempfile.open(["image", ".svg"]) do |f|
190
+ Tempfile.open(["image", ".svg"],
191
+ mode: File::BINARY | File::SHARE_DELETE) do |f|
190
192
  f.write(img.to_xml)
191
193
  @tempfile_cache << f # persist to the end
192
194
  f.path
data/lib/isodoc/init.rb CHANGED
@@ -19,6 +19,8 @@ module IsoDoc
19
19
  end
20
20
 
21
21
  def toc_init(docxml)
22
+ @doctype = docxml.at(ns("//bibdata/ext/doctype"))&.text
23
+ @xrefs.klass.doctype = @doctype
22
24
  x = "//metanorma-extension/presentation-metadata" \
23
25
  "[name[text() = 'TOC Heading Levels']]/value"
24
26
  n = docxml.at(ns(x.sub("TOC", "DOC TOC"))) and
@@ -154,7 +154,6 @@ module IsoDoc
154
154
  def cache_dataimage(uri)
155
155
  if %r{^data:}.match?(uri)
156
156
  uri = save_dataimage(uri)
157
- @tempfile_cache << uri
158
157
  end
159
158
  uri
160
159
  end
@@ -1,3 +1,3 @@
1
1
  module IsoDoc
2
- VERSION = "2.6.1".freeze
2
+ VERSION = "2.6.3".freeze
3
3
  end
@@ -95,7 +95,9 @@ module IsoDoc
95
95
  .merge(@meta.labels ? { labels: @meta.labels } : {})
96
96
  meta[:filename] = filename
97
97
  params = meta.transform_keys(&:to_s)
98
- Tempfile.open(%w(header html), encoding: "utf-8") do |f|
98
+ Tempfile.open(%w(header html),
99
+ mode: File::BINARY | File::SHARE_DELETE,
100
+ encoding: "utf-8") do |f|
99
101
  f.write(template.render(params))
100
102
  f
101
103
  end
@@ -9,7 +9,7 @@ module IsoDoc
9
9
  s&.previous_element&.remove # page break
10
10
  s.remove
11
11
  end
12
- intro.sub(/WORDTOC/, toc)
12
+ intro.sub("WORDTOC", toc)
13
13
  else
14
14
  source = docxml.at("//div[@class = 'TOC']") and
15
15
  source.children = toc
data/lib/isodoc/xref.rb CHANGED
@@ -58,6 +58,7 @@ module IsoDoc
58
58
 
59
59
  # extract names for all anchors, xref and label
60
60
  def parse(docxml)
61
+ @doctype = docxml.at(ns("//bibdata/ext/doctype"))&.text
61
62
  @seen = SeenAnchor.new(docxml)
62
63
  amend_preprocess(docxml) if @parse_settings.empty?
63
64
  initial_anchor_names(docxml)
@@ -57,6 +57,7 @@ module IsoDoc
57
57
  file = File.read(input_fname, encoding: "utf-8") if file.nil?
58
58
  input_file, docxml, filename =
59
59
  input_xml_path(input_fname, file, debug)
60
+ @doctype = Nokogiri::XML(file).at(ns("//bibdata/ext/doctype"))&.text
60
61
  ::Metanorma::Output::XslfoPdf.new.convert(
61
62
  filename,
62
63
  output_fname || output_filename(input_fname),
@@ -78,6 +79,7 @@ module IsoDoc
78
79
  def input_xml_path(input_filename, xml_file, debug)
79
80
  docxml, filename, dir = convert_init(xml_file, input_filename, debug)
80
81
  input_filename = Tempfile.open([File.basename(filename), ".xml"],
82
+ mode: File::BINARY | File::SHARE_DELETE,
81
83
  encoding: "utf-8") do |f|
82
84
  f.write docxml
83
85
  f
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: isodoc
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.6.1
4
+ version: 2.6.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-08-28 00:00:00.000000000 Z
11
+ date: 2023-09-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: html2doc
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 1.6.0
19
+ version: 1.7.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 1.6.0
26
+ version: 1.7.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: htmlentities
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -66,20 +66,6 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '5'
69
- - !ruby/object:Gem::Dependency
70
- name: plurimath
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - ">="
74
- - !ruby/object:Gem::Version
75
- version: '0'
76
- type: :runtime
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - ">="
81
- - !ruby/object:Gem::Version
82
- version: '0'
83
69
  - !ruby/object:Gem::Dependency
84
70
  name: relaton-cli
85
71
  requirement: !ruby/object:Gem::Requirement