Sha256: 038ba8bc78001925019475835e363b006cd9a966d1e4f9f5d1dfe296d1557d14
Contents?: true
Size: 903 Bytes
Versions: 9
Compression:
Stored size: 903 Bytes
Contents
#! /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby $:.unshift(File.dirname(__FILE__) + '/../lib/') require 'optparse' require 'redcloth' if %w(--version -v).include? ARGV.first puts "#{RedCloth::NAME} #{RedCloth::VERSION}" exit(0) end output_as = "html" opts = OptionParser.new do |opts| opts.banner = "Usage: redcloth [options] [redcloth_formatted.txt]" opts.separator "If no file specified, STDIN will be used. If you are typing input, you can send an EOF by pressing ^D (^Z on Windows)" opts.separator "" opts.on("-o", "--output STYLE", "Output format (defaults to #{output_as})") do |o| output_as = o end end opts.parse! ARGV red = RedCloth.new( ARGF.read ) out_meth = "to_#{ output_as }" if red.respond_to? out_meth puts red.method( out_meth ).call else abort "** No to_#{ output_as } method found for the `#{ output_as }' format" end
Version data entries
9 entries across 9 versions & 1 rubygems