odt2html 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/CHANGELOG.md +3 -0
- data/README.md +14 -15
- data/bin/odt2html +3 -1
- data/lib/odt2html.rb +1 -1
- data/lib/odt2html/base.rb +13 -5
- data/spec/integration/files_spec.rb +4 -13
- metadata +4 -4
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,21 +1,20 @@
|
|
1
1
|
# ODT2HTML
|
2
2
|
|
3
|
-
|
4
|
-
Copyright (C) 2006 J. David Eisenberg
|
3
|
+
## Usage
|
5
4
|
|
6
|
-
|
7
|
-
modify it under the terms of the GNU Lesser General Public
|
8
|
-
License as published by the Free Software Foundation; either
|
9
|
-
version 2.1 of the License, or (at your option) any later version.
|
5
|
+
$ odt2html [OPTIONS]
|
10
6
|
|
11
|
-
|
12
|
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14
|
-
Lesser General Public License for more details.
|
7
|
+
## Available options
|
15
8
|
|
16
|
-
|
17
|
-
|
18
|
-
|
9
|
+
Option | Description
|
10
|
+
--------------- | -------------
|
11
|
+
--in [PATH] | Path to input file(required)
|
12
|
+
--out [PATH] | Path to output file(output to STDOUT if not provided)
|
13
|
+
--css [PATH] | Path to css file(css in header if not provided)
|
14
|
+
--images [PATH] | Path to images directory
|
19
15
|
|
20
|
-
|
21
|
-
|
16
|
+
## About
|
17
|
+
|
18
|
+
Author: Bernard Potocki <<bernard.potocki@imanel.org>>
|
19
|
+
|
20
|
+
Oryginal work: J. David Eisenberg <<catcode@catcode.com>>
|
data/bin/odt2html
CHANGED
data/lib/odt2html.rb
CHANGED
data/lib/odt2html/base.rb
CHANGED
@@ -219,15 +219,23 @@ HDR
|
|
219
219
|
if (@output_filename) then
|
220
220
|
output_file = File.open( @output_filename, "w")
|
221
221
|
else
|
222
|
-
output_file =
|
222
|
+
output_file = String.new
|
223
223
|
end
|
224
224
|
|
225
225
|
@output_doc.write( output_file, 2 )
|
226
|
-
output_file.close
|
227
226
|
|
228
|
-
|
229
|
-
|
230
|
-
|
227
|
+
if @output_filename
|
228
|
+
output_file.close
|
229
|
+
return nil
|
230
|
+
else
|
231
|
+
return output_file
|
232
|
+
end
|
233
|
+
rescue ArgumentError => e
|
234
|
+
puts e.message
|
235
|
+
exit
|
236
|
+
rescue Exception => e
|
237
|
+
puts "Cannot convert file: #{e}"
|
238
|
+
puts e.backtrace.join("\n")
|
231
239
|
end
|
232
240
|
|
233
241
|
def usage
|
@@ -5,20 +5,11 @@ describe "files" do
|
|
5
5
|
odt_path = File.join(File.dirname(__FILE__), *%w[.. fixtures example.odt])
|
6
6
|
html_path = File.join(File.dirname(__FILE__), *%w[.. fixtures example.html])
|
7
7
|
html_file = File.open(html_path)
|
8
|
-
tempfile = Tempfile.new('html')
|
9
8
|
|
10
|
-
|
11
|
-
|
12
|
-
parser.instance_variable_set('@input_filename', odt_path)
|
13
|
-
parser.instance_variable_set('@output_filename', tempfile.path)
|
9
|
+
parser = ODT2HTML::Base.new
|
10
|
+
parser.instance_variable_set('@input_filename', odt_path)
|
14
11
|
|
15
|
-
|
16
|
-
|
17
|
-
tempfile.rewind
|
18
|
-
html_content = html_file.read.gsub("[TITLE_HERE]", odt_path)
|
19
|
-
tempfile.read.should eql(html_content)
|
20
|
-
ensure
|
21
|
-
tempfile.close!
|
22
|
-
end
|
12
|
+
html_content = html_file.read.gsub("[TITLE_HERE]", odt_path)
|
13
|
+
parser.convert.should eql(html_content)
|
23
14
|
end
|
24
15
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: odt2html
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 1
|
10
|
+
version: 0.1.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Bernard Potocki
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-03-
|
18
|
+
date: 2011-03-04 00:00:00 +01:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|