7月
10
2013
分類:
最近更新:
2013-07-10
RedCloth textile convert to HTML
RedCloth: http://redcloth.org/
#!/usr/bin/ruby
#
# redcloth2html
# required packages: ruby libredcloth-ruby
#
require 'redcloth'
if (ARGV.size < 2) then
print "redcloth2html <input> <output>\n"
print "note: - means stdin or stdout.\n"
exit 0
end
if ARGV[0] == '-' then
infilepath = '/dev/stdin'
else
infilepath = ARGV[0]
end
if ARGV[1] == '-' then
outfilepath = '/dev/stdout'
else
outfilepath = ARGV[1]
end
raw = IO.read infilepath
rc = RedCloth.new raw
File.open outfilepath, 'w' do |outf|
outf.write rc.to_html
end
樂多舊網址: http://blog.roodo.com/rocksaying/archives/25360474.html