html2odt 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +12 -0
- data/CHANGELOG.md +4 -0
- data/README.md +1 -0
- data/lib/html2odt/document.rb +6 -2
- data/lib/html2odt/image.rb +11 -0
- data/lib/html2odt/version.rb +1 -1
- metadata +20 -20
- data/Gemfile.lock +0 -32
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b7e81713f41dce40fa45764753a39d223a553fd9
|
4
|
+
data.tar.gz: e87f898ad29e339a024ea0820d794ac0ee5b98b0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5fd546c9b347ec908fe1412ca3239065a0c1e988b8f07ce4ef1f1985e38e1e08f230f90b7c67afb08af303e426c81babd94d5800c5ca5b3865814e9144c83651
|
7
|
+
data.tar.gz: b1f8f277a58aae0b132fac04a43a6189db977440b5200f6e49a4ba63f87a1c400ef6e26c46a7d9e34733c45a469f0c5427683b252e710f8eac1a0d24ce2abdd7
|
data/.gitignore
CHANGED
data/.travis.yml
ADDED
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
This gem provides a Ruby wrapper around the set of XLST stylesheets published as
|
4
4
|
[xhtml2odt](https://github.com/abompard/xhtml2odt).
|
5
5
|
|
6
|
+
[![Build Status](https://travis-ci.org/planio-gmbh/html2odt.svg?branch=master)](https://travis-ci.org/planio-gmbh/html2odt)
|
6
7
|
|
7
8
|
## html2odt vs. xhtml2odt
|
8
9
|
|
data/lib/html2odt/document.rb
CHANGED
@@ -267,7 +267,11 @@ class Html2Odt::Document
|
|
267
267
|
doc = Nokogiri::HTML::DocumentFragment.parse(html)
|
268
268
|
|
269
269
|
doc.css("a").each do |a|
|
270
|
-
|
270
|
+
begin
|
271
|
+
a["href"] = (base_uri + a["href"]).to_s
|
272
|
+
rescue URI::InvalidURIError
|
273
|
+
# Ignore invalid uris, they just stay as is
|
274
|
+
end
|
271
275
|
end
|
272
276
|
|
273
277
|
doc.to_xml(:save_with => Nokogiri::XML::Node::SaveOptions::AS_XML)
|
@@ -314,7 +318,7 @@ class Html2Odt::Document
|
|
314
318
|
file
|
315
319
|
end
|
316
320
|
|
317
|
-
return file
|
321
|
+
return file
|
318
322
|
end
|
319
323
|
|
320
324
|
# cannot handle image properly, return nil
|
data/lib/html2odt/image.rb
CHANGED
@@ -5,6 +5,17 @@ class Html2Odt::Image
|
|
5
5
|
@target_base = target_base
|
6
6
|
end
|
7
7
|
|
8
|
+
# Assign file instead of source, if you were creating tempfiles and need them
|
9
|
+
# to stay around until the ODT is generated.
|
10
|
+
def source=(file_or_path)
|
11
|
+
if file_or_path.respond_to? :path
|
12
|
+
@source = file_or_path.path
|
13
|
+
@file = file_or_path
|
14
|
+
else
|
15
|
+
@source = file_or_path.to_s
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
8
19
|
def valid?
|
9
20
|
return false if source.nil? or !File.readable?(source)
|
10
21
|
|
data/lib/html2odt/version.rb
CHANGED
metadata
CHANGED
@@ -1,111 +1,111 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: html2odt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gregor Schmidt (Planio)
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-06-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dimensions
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 1.3.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
26
|
version: 1.3.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: nokogiri
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ~>
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: 1.6.7.2
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ~>
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 1.6.7.2
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rubyzip
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ~>
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '1.0'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ~>
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '1.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: bundler
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ~>
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '1.12'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ~>
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '1.12'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rake
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ~>
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '10.0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - ~>
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '10.0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: minitest
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - ~>
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '5.0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - ~>
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '5.0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: byebug
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- -
|
101
|
+
- - '>='
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '0'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- -
|
108
|
+
- - '>='
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
111
|
description: html2odt generates ODT documents based on HTML fragments using xhtml2odt
|
@@ -117,11 +117,11 @@ executables:
|
|
117
117
|
extensions: []
|
118
118
|
extra_rdoc_files: []
|
119
119
|
files:
|
120
|
-
-
|
120
|
+
- .gitignore
|
121
|
+
- .travis.yml
|
121
122
|
- CHANGELOG.md
|
122
123
|
- CODE_OF_CONDUCT.md
|
123
124
|
- Gemfile
|
124
|
-
- Gemfile.lock
|
125
125
|
- LICENSE.txt
|
126
126
|
- README.md
|
127
127
|
- Rakefile
|
@@ -170,12 +170,12 @@ require_paths:
|
|
170
170
|
- lib
|
171
171
|
required_ruby_version: !ruby/object:Gem::Requirement
|
172
172
|
requirements:
|
173
|
-
- -
|
173
|
+
- - '>='
|
174
174
|
- !ruby/object:Gem::Version
|
175
175
|
version: '0'
|
176
176
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
177
177
|
requirements:
|
178
|
-
- -
|
178
|
+
- - '>='
|
179
179
|
- !ruby/object:Gem::Version
|
180
180
|
version: '0'
|
181
181
|
requirements: []
|
data/Gemfile.lock
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
html2odt (0.3.0)
|
5
|
-
dimensions (~> 1.3.0)
|
6
|
-
nokogiri (~> 1.6.7.2)
|
7
|
-
rubyzip (~> 1.0)
|
8
|
-
|
9
|
-
GEM
|
10
|
-
remote: https://rubygems.org/
|
11
|
-
specs:
|
12
|
-
byebug (9.0.3)
|
13
|
-
dimensions (1.3.0)
|
14
|
-
mini_portile2 (2.0.0)
|
15
|
-
minitest (5.8.4)
|
16
|
-
nokogiri (1.6.7.2)
|
17
|
-
mini_portile2 (~> 2.0.0.rc2)
|
18
|
-
rake (10.5.0)
|
19
|
-
rubyzip (1.2.0)
|
20
|
-
|
21
|
-
PLATFORMS
|
22
|
-
ruby
|
23
|
-
|
24
|
-
DEPENDENCIES
|
25
|
-
bundler (~> 1.12)
|
26
|
-
byebug
|
27
|
-
html2odt!
|
28
|
-
minitest (~> 5.0)
|
29
|
-
rake (~> 10.0)
|
30
|
-
|
31
|
-
BUNDLED WITH
|
32
|
-
1.12.3
|