Class: Pandoku::Formats::ODT
- Inherits:
-
Pandoku::Format
- Object
- Pandoku::Format
- Pandoku::Formats::ODT
- Includes:
- OutputFormat
- Defined in:
- lib/pandoku/formats/odt.rb
Overview
ODT (OpenOffice text document) format.
Available Options
:toc
-
Include an automatically generated table of contents.
Instance Attribute Summary
Attributes inherited from Pandoku::Format
Class Method Summary collapse
Instance Method Summary collapse
- #cliopts ⇒ Object
-
#compile(document, file = false) ⇒ Object
Compiles the given
document
to the format.
Methods inherited from Pandoku::Format
Constructor Details
This class inherits a constructor from Pandoku::Format
Class Method Details
.default_options ⇒ Object
17 18 19 |
# File 'lib/pandoku/formats/odt.rb', line 17 def self. { :toc => false } end |
.name ⇒ Object
13 14 15 |
# File 'lib/pandoku/formats/odt.rb', line 13 def self.name :odt end |
Instance Method Details
#cliopts ⇒ Object
21 22 23 24 |
# File 'lib/pandoku/formats/odt.rb', line 21 def cliopts @tmpfile = @tmpfile || _tmpfile super + ["--output=#{@tmpfile}"] end |
#compile(document, file = false) ⇒ Object
Compiles the given document
to the format. If a second argument file
is true
, returns File
instead of String
.
Note that it creates a temporary file for the result. If file
is false
, the temporary file become deleted.
31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/pandoku/formats/odt.rb', line 31 def compile(document, file = false) @tmpfile = _tmpfile ps = IO.popen(document.command_for(self), 'w') ps.print(document.text) ps.close f = File.new(@tmpfile, 'r') return f if file result = f.read f.close File.unlink(@tmpfile) return result end |