module Swordfish

Swordfish::Document is the internal representation of a parsed document.

Swordfish::DOCX defines a parser for .docx (Office OpenXML) formats

Superclass for all Swordfish::Node objects

A foonote node

A header node

A hyperlink node.

An image node Actual image data is stored at the document level, and can be retrieved by calling get_image(image_image) on the document object.

A linebreak node

A list node

A list item node

A paragraph node

A raw content node This node simply outputs its content as-is, with no attempts to reformat or escape text

A table node

A table cell node

A table row node

A generic text node

Swordfish::Stylesheet represents formatting applied to a node

Public Class Methods

open(filepath, opts={}) click to toggle source

Main entry point into the parser. Pass in a filepath and return a parsed document.

# File lib/swordfish.rb, line 7
def self.open(filepath, opts={})
  extension = (opts[:extension] || filepath.split('.').last).downcase.to_sym
  case extension
    when :docx
      Swordfish::DOCX::Document.open(filepath)
    else
      raise UnsupportedFormatError, "'#{extension}' is not a recognized file format"
  end
end