Sha256: 53e9ff4a2f4870c1cb48701dfbe714ed6bc016035483668f4e221aa55619c931
Contents?: true
Size: 854 Bytes
Versions: 1
Compression:
Stored size: 854 Bytes
Contents
require 'propaganda/renderer' require 'propaganda/formatter' module Propaganda def self.convert(input, output, title=nil, template=nil, engine=nil, format=nil, verbose=false) title ||= File.basename(input, File.extname(input)) engine ||= detect(input) format ||= 'pdf' text = IO.read(input) formatter = Formatter.new text = formatter.format(text, title, engine) return !File.open(output, 'w') {|f| f.write(text) }.nil? if format == 'html' fop = Renderer.new(verbose) fop.render(text, output, template) end def self.detect(input) case File.extname(input) when '.textile' 'textile' when '.markdown', '.md' 'markdown' when '.html', '.xhtml' 'none' else raise "Unknown format for #{input}, use .html, .textile or .markdown extension" end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
propaganda-0.5.0 | lib/propaganda.rb |