Migrate from vendor/plugins and vendor/gems to Gemfile
IHG: added vendor/gems/bluecloth/tests/data/antsugar.txt
This commit is contained in:
83
vendor/gems/bluecloth/bin/bluecloth
vendored
Executable file
83
vendor/gems/bluecloth/bin/bluecloth
vendored
Executable file
@@ -0,0 +1,83 @@
|
||||
#!/usr/bin/ruby
|
||||
#
|
||||
# = bluecloth
|
||||
#
|
||||
# Format one or more text files with the markdown formatter.
|
||||
#
|
||||
# = Synopsis
|
||||
#
|
||||
# bluecloth [OPTIONS] [FILES]
|
||||
#
|
||||
#
|
||||
#
|
||||
|
||||
BEGIN {
|
||||
require 'bluecloth'
|
||||
require 'optparse'
|
||||
}
|
||||
|
||||
DocumentWrapper = %{
|
||||
<html>
|
||||
<head><title>%s</title></head>
|
||||
<body>
|
||||
%s
|
||||
</body>
|
||||
</html>
|
||||
}
|
||||
|
||||
def main
|
||||
fragment = false
|
||||
destination = '.'
|
||||
|
||||
ARGV.options do |oparser|
|
||||
|
||||
oparser.banner = "Usage: #$0 [OPTIONS] FILES"
|
||||
|
||||
# Debug mode
|
||||
oparser.on( "--debug", "-d", TrueClass, "Turn debugging output on" ) {
|
||||
$DEBUG = true
|
||||
}
|
||||
|
||||
# 'Fragment' mode
|
||||
oparser.on( "--fragment", "-f", TrueClass,
|
||||
"Output HTML fragments instead of whole documents" ) {
|
||||
fragment = true
|
||||
}
|
||||
|
||||
# Output destination
|
||||
#oparser.on( "--output=DESTINATION", "-o DESTINATION", String,
|
||||
# "Write output to DESTINATION instead of the current directory" ) {|arg|
|
||||
# destination = arg
|
||||
#}
|
||||
|
||||
oparser.parse!
|
||||
end
|
||||
|
||||
# Filter mode if no arguments
|
||||
ARGV.push( "-" ) if ARGV.empty?
|
||||
|
||||
ARGV.each {|file|
|
||||
if file == '-'
|
||||
contents = $stdin.readlines(nil)
|
||||
else
|
||||
contents = File::readlines( file, nil )
|
||||
end
|
||||
|
||||
bc = BlueCloth::new( contents.join )
|
||||
|
||||
if fragment
|
||||
$stdout.puts bc.to_html
|
||||
else
|
||||
$stdout.puts DocumentWrapper % [ file, bc.to_html ]
|
||||
end
|
||||
}
|
||||
|
||||
rescue => err
|
||||
$stderr.puts "Aborting: Fatal error: %s" % err.message
|
||||
exit 255
|
||||
end
|
||||
|
||||
|
||||
|
||||
main
|
||||
|
||||
Reference in New Issue
Block a user