Module: Coradoc::Input::Docx
- Defined in:
- lib/coradoc/input/docx.rb
Class Method Summary collapse
- .processor_execute(input, options = {}) ⇒ Object
- .processor_id ⇒ Object
- .processor_match?(filename) ⇒ Boolean
- .processor_postprocess(data, options) ⇒ Object
-
.processor_wants_filenames ⇒ Object
This processor prefers to work on original files.
Class Method Details
.processor_execute(input, options = {}) ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/coradoc/input/docx.rb', line 15 def self.processor_execute(input, = {}) image_dir = Dir.mktmpdir = .merge(sourcedir: image_dir) doc = WordToMarkdown.new(input, image_dir) doc = Coradoc::Input::HTML.cleaner.preprocess_word_html(doc.document.html) = WordToMarkdown::REVERSE_MARKDOWN_OPTIONS.merge() Coradoc::Input::HTML.to_coradoc(doc, ) ensure FileUtils.rm_rf(image_dir) end |
.processor_id ⇒ Object
7 8 9 |
# File 'lib/coradoc/input/docx.rb', line 7 def self.processor_id :docx end |
.processor_match?(filename) ⇒ Boolean
11 12 13 |
# File 'lib/coradoc/input/docx.rb', line 11 def self.processor_match?(filename) %w[.docx .doc].any? { |i| filename.downcase.end_with?(i) } end |
.processor_postprocess(data, options) ⇒ Object
26 27 28 |
# File 'lib/coradoc/input/docx.rb', line 26 def self.processor_postprocess(data, ) Coradoc::Input::HTML.processor_postprocess(data, ) end |
.processor_wants_filenames ⇒ Object
This processor prefers to work on original files.
31 |
# File 'lib/coradoc/input/docx.rb', line 31 def self.processor_wants_filenames; true; end |