Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 22 lines (16 sloc) 473 Bytes
#!/usr/bin/env ruby
#
# Converts Textile into Markdown for the given input
# (files or STDIN), and prints the result to STDOUT.
#
# Written in 2010 by Suraj N. Kurapati <https://github.com/sunaku>
print ARGF.read.
# links
gsub(/"([^"]+)":(\S+)(?=[,\.]\s)/, '[\1]( \2 )').
gsub(/"([^"]+)":(\S+)/, '[\1]( \2 )').
# code
gsub(/@(.+?)@/, '`\1`').
# bold
gsub(/\*[^\*]+\*/, '*\&*').
# list items
gsub(/^([ \t]*)(\*){2,}/) { $1 + (' ' * $2.length) + $2 }