doc2text 0.4.9 → 0.4.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 17921878fc9429dc62612eb3086bec1a6123c785ea2c1646b41b1b4776cd3966
4
- data.tar.gz: 4568ce5c708f87e2f2b4bc694adf536bea2881a30337fd490c1d9ef7e36b4231
3
+ metadata.gz: 3c1beb721d04a176cf3c6865d627d1db7ec4d3f0659ccffe0ecc856ce402a09e
4
+ data.tar.gz: a5248bc158bfc3bcac2cb776bb613c0c0c275155997aa71df292a6ecd6459782
5
5
  SHA512:
6
- metadata.gz: d2ef479da4eee3cf3085e9a340b875cefaa9b8bac933cdfe33438026425524102c212490fde456780715a1974645610f6d71bad892fe7a76aebff17c3537d300
7
- data.tar.gz: 48e24af147a3ba17ec539380883d0f07c233367a3c6930731e3dbe97cd660c5832e36dd16e5cba0e0b2a98655d554c6530811db8e67f61b8fa36270c54f145fb
6
+ metadata.gz: cce97b69956004f57f17edcdd4276ee3da5d7c5174a4b48138c39705808ccc56c8caae6880f1b41fee4b02ade0b745b6ac0e7e4b43564d614f7e81523ff11a87
7
+ data.tar.gz: cba486e21727b50d6dbeed98374ccbeb5a3cd6494f8db0b4168a5c37612a4c9a13dba1c7986764179fc78657063b414879adff710812d501558ce367a8ac2069
@@ -19,6 +19,18 @@ module Doc2Text
19
19
  end
20
20
  end
21
21
 
22
+ def parse_styles
23
+ styles_parser = Doc2Text::Odt::StylesParser.new
24
+ xml = Nokogiri::XML::SAX::Parser.new(styles_parser)
25
+ xml.parse open File.join('word', 'styles.xml')
26
+ styles_parser.xml_root
27
+ end
28
+
29
+ def parse(markdown)
30
+ parser = Nokogiri::XML::SAX::Parser.new(markdown)
31
+ parser.parse open File.join('word', 'document.xml')
32
+ end
33
+
22
34
  def contains_extracted_files?
23
35
  File.exist? File.join(extract_path, '[Content_Types].xml')
24
36
  end
@@ -12,9 +12,9 @@ module Doc2Text
12
12
  |zip_file|
13
13
  Dir.mkdir(extract_path)
14
14
  zip_file.each do |entry|
15
- zipped_file_extract_path = File.join extract_path, entry.name
16
- FileUtils.mkdir_p File.dirname(zipped_file_extract_path)
17
- zip_file.extract entry, zipped_file_extract_path
15
+ zipped_file_extract_path = File.join extract_path, File.dirname(entry.name)
16
+ FileUtils.mkdir_p zipped_file_extract_path
17
+ zip_file.extract entry, nil, destination_directory: extract_path
18
18
  end
19
19
  }
20
20
  end
@@ -41,7 +41,7 @@ module Doc2Text
41
41
  end
42
42
 
43
43
  def extract_path
44
- File.join File.dirname(@document_path), ".#{File.basename(@document_path)}_#{extract_extension}"
44
+ @extract_path ||= File.join File.dirname(@document_path), ".#{File.basename(@document_path)}_#{extract_extension}"
45
45
  end
46
46
  end
47
47
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: doc2text
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.9
4
+ version: 0.4.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Valentin A.
@@ -78,7 +78,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
78
78
  - !ruby/object:Gem::Version
79
79
  version: '0'
80
80
  requirements: []
81
- rubygems_version: 4.0.10
81
+ rubygems_version: 3.6.7
82
82
  specification_version: 4
83
83
  summary: Translates odt to markdown
84
84
  test_files: []