Class: Treat::Workers::Formatters::Readers::ABW

Inherits:
Object
  • Object
show all
Defined in:
lib/treat/workers/formatters/readers/abw.rb

Overview

A wrapper for a small utility written by Mark Watson to read AbiWord files. Released under the GPL.

Original project website: www.markwatson.com/opensource/

Todo: reimplement with Nokogiri and use XML node information to better translate the format of the text.

Defined Under Namespace

Classes: ABWXmlHandler

Class Method Summary collapse

Class Method Details

.read(document, options = {}) ⇒ Object

Extract the readable text from an AbiWord file.

Options: none.



21
22
23
24
25
26
27
28
29
30
31
# File 'lib/treat/workers/formatters/readers/abw.rb', line 21

def self.read(document, options = {})

  xml_h = ABWXmlHandler.new
  REXML::Document.parse_stream(
  IO.read(document.file), xml_h)

  document.value = xml_h.plain_text
  document.set :format, 'abw'
  document

end