Sha256: 4852bb4bcb8bbf4761c3eda8d01b55226d150300114b4c714e95fd531a325182
Contents?: true
Size: 1.04 KB
Versions: 1
Compression:
Stored size: 1.04 KB
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" bbcode_only = false opts = OptionParser.new do |opts| opts.banner = "Usage: bbredcloth [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 opts.on("-b","--bbcode-only", "BBCode-Only") do |b| bbcode_only = b end end opts.parse! ARGV p bbcode_only red = RedCloth.new( ARGF.read, [(bbcode_only ? :bbcode_only : :bbcode)] ) 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
BBRedCloth-0.8.0 | bin/bbredcloth |