html2doc 1.1.2 → 1.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: 64215843fa5fb0918c0c24d6023f466b3602d36fe155ff49687f2a9e447e6681
4
- data.tar.gz: 2fd0022ce58dd6106f27825b593b7d6c632913414699067cc70ba09936d47810
3
+ metadata.gz: 99602f2e4d42bf9e809ccc26cdfdba8a602ead1dfbfb68876ca2e90683e091e9
4
+ data.tar.gz: aba931c818606124656a92a78760e8870291829fcd4476656bbd1fa656697855
5
5
  SHA512:
6
- metadata.gz: fc525ead15dbbdbfede252026ae44451cd5b45fe8225c70cdefcccafd3e5a903a32d8e6dfdb396f67c58d11e8b2c48a36562bf8e4f439181f99a8f49b3799202
7
- data.tar.gz: 243b6c5efa00090e1248ad420d9641882fcc956fb8734333267459db9dbaffbf0742488164f4c72975ce4bb9b4e62458eb0c0d5dc03bb3cd7990863d77ba40a3
6
+ metadata.gz: 5e94fd597cd70658bd034f6a202c4010b31145b1da2375a59f6f35c648a278b6ad40221c85d6e19c25aaaf9da3e734c3d3fff33b6175226db4a1b468fea842ea
7
+ data.tar.gz: 30a8189d7440fa8742c2c83bc3bbff3ac2008e1fc7add0add4534bfaf341b1d80d12434b038051d729eb165aeca9199a1e79b4b9a430a397b386704a5121f461
@@ -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' ]
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:
data/.hound.yml CHANGED
@@ -1,3 +1,5 @@
1
+ # Auto-generated by Cimas: Do not edit it manually!
2
+ # See https://github.com/metanorma/cimas
1
3
  ruby:
2
- Enabled: true
4
+ enabled: true
3
5
  config_file: .rubocop.yml
data/.rubocop.yml CHANGED
@@ -1,12 +1,10 @@
1
- # This project follows the Ribose OSS style guide.
2
- # https://github.com/riboseinc/oss-guides
3
- # All project-specific additions and overrides should be specified in this file.
1
+ # Auto-generated by Cimas: Do not edit it manually!
2
+ # See https://github.com/metanorma/cimas
4
3
  inherit_from:
5
4
  - https://raw.githubusercontent.com/riboseinc/oss-guides/master/ci/rubocop.yml
6
5
 
7
6
  # local repo-specific modifications
7
+ # ...
8
8
 
9
9
  AllCops:
10
- DisplayCopNames: false
11
- StyleGuideCopsOnly: false
12
- TargetRubyVersion: 2.4
10
+ TargetRubyVersion: 2.5
data/README.adoc CHANGED
@@ -58,11 +58,12 @@ There there are two other Microsoft Word vendors in the Ruby ecosystem.
58
58
  --
59
59
  require "html2doc"
60
60
 
61
- Html2Doc.process(result, filename: filename, stylesheet: stylesheet, header_filename: header_filename, dir: dir, asciimathdelims: asciimathdelims, liststyles: liststyles)
61
+ Html2Doc.process(result, filename: filename, imagedir: imagedir, stylesheet: stylesheet, header_filename: header_filename, dir: dir, asciimathdelims: asciimathdelims, liststyles: liststyles)
62
62
  --
63
63
 
64
64
  result:: is the Html document to be converted into Word, as a string.
65
65
  filename:: is the name the document is to be saved as, without a file suffix
66
+ imagedir:: base directory for local image file names in source XML
66
67
  stylesheet:: is the full path filename of the CSS stylesheet for Microsoft Word-specific styles. If this is not provided, the program will used the default stylesheet included in the gem, `lib/html2doc/wordstyle.css`. The stylsheet provided must match this stylesheet; you can obtain one by saving a Word document with your desired styles to HTML, and extracting the style definitions from the HTML document header.
67
68
  header_filename:: is the filename of the HTML document containing header and footer for the document, as well as footnote/endnote separators; if there is none, use nil. To generate your own such document, save a Word document with headers/footers and/or footnote/endnote separators as an HTML document; the `header.html` will be in the `{filename}.fld` folder generated along with the HTML. A sample file is available at https://github.com/metanorma/metanorma-iso/blob/master/lib/asciidoctor/iso/word/header.html
68
69
  dir:: is the folder that any ancillary files (images, headers, filelist) are to be saved to. If not provided, it will be created as `{filename}_files`. Anything in the directory will be attached to the Word document; so this folder should only contain the images that accompany the document. (If the images are elsewhere on the local drive, the gem will move them into the folder. External URL images are left alone, and are not downloaded.)
data/html2doc.gemspec CHANGED
@@ -22,18 +22,18 @@ Gem::Specification.new do |spec|
22
22
  spec.require_paths = ["lib"]
23
23
  spec.files = `git ls-files`.split("\n")
24
24
  spec.test_files = `git ls-files -- {spec}/*`.split("\n")
25
- spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
25
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.5.0")
26
26
 
27
27
  spec.add_dependency "asciimath", "~> 2.0.2"
28
28
  spec.add_dependency "htmlentities", "~> 4.3.4"
29
29
  spec.add_dependency "image_size"
30
30
  spec.add_dependency "mime-types"
31
- spec.add_dependency "nokogiri", "~> 1.10"
31
+ spec.add_dependency "nokogiri", "~> 1.12"
32
32
  spec.add_dependency "plane1converter", "~> 0.0.1"
33
33
  spec.add_dependency "thread_safe"
34
34
  spec.add_dependency "uuidtools"
35
35
 
36
- spec.add_development_dependency "byebug", "~> 9.1"
36
+ spec.add_development_dependency "debug"
37
37
  spec.add_development_dependency "equivalent-xml", "~> 0.6"
38
38
  spec.add_development_dependency "guard", "~> 2.14"
39
39
  spec.add_development_dependency "guard-rspec", "~> 4.7"
data/lib/html2doc/base.rb CHANGED
@@ -53,7 +53,7 @@ module Html2Doc
53
53
 
54
54
  def self.cleanup(docxml, hash)
55
55
  namespace(docxml.root)
56
- image_cleanup(docxml, hash[:dir1], File.dirname(hash[:filename]))
56
+ image_cleanup(docxml, hash[:dir1], hash[:imagedir])
57
57
  mathml_to_ooml(docxml)
58
58
  lists(docxml, hash[:liststyles])
59
59
  footnotes(docxml)
@@ -1,3 +1,3 @@
1
1
  module Html2Doc
2
- VERSION = "1.1.2".freeze
2
+ VERSION = "1.2.1".freeze
3
3
  end
@@ -565,7 +565,7 @@ RSpec.describe Html2Doc do
565
565
 
566
566
  it "resizes images for height, in a file in a subdirectory" do
567
567
  simple_body = '<img src="19160-6.png">'
568
- Html2Doc.process(html_input(simple_body), filename: "spec/test")
568
+ Html2Doc.process(html_input(simple_body), filename: "spec/test", imagedir: "spec")
569
569
  testdoc = File.read("spec/test.doc", encoding: "utf-8")
570
570
  expect(testdoc).to match(%r{Content-Type: image/png})
571
571
  expect(image_clean(guid_clean(testdoc))).to match_fuzzy(<<~OUTPUT)
@@ -577,7 +577,7 @@ RSpec.describe Html2Doc do
577
577
 
578
578
  it "resizes images for width" do
579
579
  simple_body = '<img src="spec/19160-7.gif">'
580
- Html2Doc.process(html_input(simple_body), filename: "test")
580
+ Html2Doc.process(html_input(simple_body), filename: "test", imagedir: ".")
581
581
  testdoc = File.read("test.doc", encoding: "utf-8")
582
582
  expect(testdoc).to match(%r{Content-Type: image/gif})
583
583
  expect(image_clean(guid_clean(testdoc))).to match_fuzzy(<<~OUTPUT)
@@ -589,7 +589,7 @@ RSpec.describe Html2Doc do
589
589
 
590
590
  it "resizes images for height" do
591
591
  simple_body = '<img src="spec/19160-8.jpg">'
592
- Html2Doc.process(html_input(simple_body), filename: "test")
592
+ Html2Doc.process(html_input(simple_body), filename: "test", imagedir: ".")
593
593
  testdoc = File.read("test.doc", encoding: "utf-8")
594
594
  expect(testdoc).to match(%r{Content-Type: image/jpeg})
595
595
  expect(image_clean(guid_clean(testdoc))).to match_fuzzy(<<~OUTPUT)
@@ -642,7 +642,7 @@ RSpec.describe Html2Doc do
642
642
 
643
643
  it "does not move images if they are external URLs" do
644
644
  simple_body = '<img src="https://example.com/19160-6.png">'
645
- Html2Doc.process(html_input(simple_body), filename: "test")
645
+ Html2Doc.process(html_input(simple_body), filename: "test", imagedir: ".")
646
646
  testdoc = File.read("test.doc", encoding: "utf-8")
647
647
  expect(image_clean(guid_clean(testdoc))).to match_fuzzy(<<~OUTPUT)
648
648
  #{WORD_HDR} #{DEFAULT_STYLESHEET} #{WORD_HDR_END}
@@ -653,7 +653,7 @@ RSpec.describe Html2Doc do
653
653
 
654
654
  it "deals with absolute image locations" do
655
655
  simple_body = %{<img src="#{__dir__}/19160-6.png">}
656
- Html2Doc.process(html_input(simple_body), filename: "spec/test")
656
+ Html2Doc.process(html_input(simple_body), filename: "spec/test", imagedir: ".")
657
657
  testdoc = File.read("spec/test.doc", encoding: "utf-8")
658
658
  expect(testdoc).to match(%r{Content-Type: image/png})
659
659
  expect(image_clean(guid_clean(testdoc))).to match_fuzzy(<<~OUTPUT)
@@ -836,7 +836,7 @@ RSpec.describe Html2Doc do
836
836
  it "test image base64 image encoding" do
837
837
  simple_body = '<img src="19160-6.png">'
838
838
  Html2Doc.process(html_input(simple_body),
839
- filename: "spec/test", debug: true)
839
+ filename: "spec/test", debug: true, imagedir: "spec")
840
840
  testdoc = File.read("spec/test.doc", encoding: "utf-8")
841
841
  base64_image = testdoc[/image\/png\n\n(.*?)\n\n----/m, 1].gsub!("\n", "")
842
842
  base64_image_basename = testdoc[%r{Content-ID: <([0-9a-z\-]+)\.png}m, 1]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: html2doc
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.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: 2021-05-24 00:00:00.000000000 Z
11
+ date: 2021-11-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciimath
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '1.10'
75
+ version: '1.12'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '1.10'
82
+ version: '1.12'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: plane1converter
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -123,19 +123,19 @@ dependencies:
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
125
  - !ruby/object:Gem::Dependency
126
- name: byebug
126
+ name: debug
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - "~>"
129
+ - - ">="
130
130
  - !ruby/object:Gem::Version
131
- version: '9.1'
131
+ version: '0'
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - "~>"
136
+ - - ">="
137
137
  - !ruby/object:Gem::Version
138
- version: '9.1'
138
+ version: '0'
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: equivalent-xml
141
141
  requirement: !ruby/object:Gem::Requirement
@@ -327,14 +327,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
327
327
  requirements:
328
328
  - - ">="
329
329
  - !ruby/object:Gem::Version
330
- version: 2.4.0
330
+ version: 2.5.0
331
331
  required_rubygems_version: !ruby/object:Gem::Requirement
332
332
  requirements:
333
333
  - - ">="
334
334
  - !ruby/object:Gem::Version
335
335
  version: '0'
336
336
  requirements: []
337
- rubygems_version: 3.1.4
337
+ rubygems_version: 3.2.22
338
338
  signing_key:
339
339
  specification_version: 4
340
340
  summary: Convert HTML document to Microsoft Word document