Class: PandocRuby
- Inherits:
-
Object
- Object
- PandocRuby
- Defined in:
- lib/pandoc-ruby.rb
Constant Summary
- EXECUTABLES =
pandoc markdown2pdf html2markdown hsmarkdown
- READERS =
{ 'rst' => 'reStructuredText', 'markdown' => 'markdown', 'html' => 'HTML', 'latex' => 'LaTeX' }
- WRITERS =
{ 'markdown' => 'markdown', 'rst' => 'reStructuredText', 'html' => 'HTML', 'latex' => 'LaTeX', 'context' => 'ConTeXt', 'man' => 'groff man', 'mediawiki' => 'MediaWiki markup', 'texinfo' => 'GNU Texinfo', 'docbook' => 'DocBook XML', 'opendocument' => 'OpenDocument XML', 's5' => 'S5 HTML and javascript slide show', 'rtf' => 'rich text format' }
- @@bin_path =
nil- @@allow_file_paths =
false
Class Method Summary (collapse)
Instance Method Summary (collapse)
- - (Object) convert(*args) (also: #to_s)
-
- (PandocRuby) initialize(*args)
constructor
A new instance of PandocRuby.
Constructor Details
- (PandocRuby) initialize(*args)
A new instance of PandocRuby
48 49 50 51 52 53 54 55 56 57 |
# File 'lib/pandoc-ruby.rb', line 48 def initialize(*args) target = args.shift @target = if @@allow_file_paths && File.exists?(target) File.read(target) else target rescue target end @executable = EXECUTABLES.include?(args[0]) ? args.shift : 'pandoc' @options = args end |
Class Method Details
+ (Object) allow_file_paths=(value)
40 41 42 |
# File 'lib/pandoc-ruby.rb', line 40 def self.allow_file_paths=(value) @@allow_file_paths = value end |
+ (Object) bin_path=(path)
36 37 38 |
# File 'lib/pandoc-ruby.rb', line 36 def self.bin_path=(path) @@bin_path = path end |
+ (Object) convert(*args)
44 45 46 |
# File 'lib/pandoc-ruby.rb', line 44 def self.convert(*args) new(*args).convert end |
Instance Method Details
- (Object) convert(*args) Also known as: to_s
59 60 61 62 |
# File 'lib/pandoc-ruby.rb', line 59 def convert(*args) executable = @@bin_path ? File.join(@@bin_path, @executable) : @executable execute executable + (args) end |