xtotxt 0.6 → 0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/.DS_Store +0 -0
- data/lib/xtotxt.rb +3 -8
- metadata +4 -3
data/.DS_Store
ADDED
Binary file
|
data/lib/xtotxt.rb
CHANGED
@@ -3,7 +3,7 @@ require 'yaml'
|
|
3
3
|
class XtotxtError < StandardError; end
|
4
4
|
|
5
5
|
class Xtotxt
|
6
|
-
VERSION = 0.
|
6
|
+
VERSION = 0.7
|
7
7
|
SUPPORTED_EXTENSIONS = %w{txt pdf doc docx odt rtf html}
|
8
8
|
|
9
9
|
@@config_file_name = "xtotxt.yml"
|
@@ -46,6 +46,7 @@ class Xtotxt
|
|
46
46
|
when "rtf":
|
47
47
|
"#{@ext[:rtf]} --text #{input_file_name} > #{output_file_name}"
|
48
48
|
when "html":
|
49
|
+
# NB:
|
49
50
|
"#{@ext[:html]} -o #{output_file_name} #{input_file_name}"
|
50
51
|
else
|
51
52
|
raise XtotxtError.new("have no way to convert #{file_ext} yet")
|
@@ -87,13 +88,7 @@ class Xtotxt
|
|
87
88
|
|
88
89
|
def skip_unrtf_header(text)
|
89
90
|
a = text.lines.to_a
|
90
|
-
while
|
91
|
-
unless a.shift =~ /^###/
|
92
|
-
unless a.shift == "-----------------\n"
|
93
|
-
raise "cannot parse rtf"
|
94
|
-
end
|
95
|
-
break
|
96
|
-
end
|
91
|
+
while a.shift != "-----------------\n"
|
97
92
|
end
|
98
93
|
a.join
|
99
94
|
end
|
metadata
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xtotxt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 5
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: "0.
|
8
|
+
- 7
|
9
|
+
version: "0.7"
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Alexy Khrabrov
|
@@ -28,6 +28,7 @@ extensions: []
|
|
28
28
|
extra_rdoc_files: []
|
29
29
|
|
30
30
|
files:
|
31
|
+
- .DS_Store
|
31
32
|
- .gitignore
|
32
33
|
- .rvmrc
|
33
34
|
- Rakefile
|