Skip to content

Instantly share code, notes, and snippets.

@masaki925
Created July 31, 2013 06:38
Show Gist options
  • Save masaki925/6119846 to your computer and use it in GitHub Desktop.
Save masaki925/6119846 to your computer and use it in GitHub Desktop.
convert from textile to pukiwiki
#!/usr/bin/ruby
filename = ARGV.shift
File.open(filename, 'r').each_line do |line|
puts line.sub(
/^<pre>/ , '#highlighter(){{').gsub(
/^<\/pre>/ , '}}').gsub(
'{{toc}}' , '#contents').gsub(
/^# / , '+ ' ).gsub(
/^##. / , '++ ' ).gsub(
/^### / , '+++ ').gsub(
/^\* / , '- ' ).gsub(
/^\*\* / , '-- ' ).gsub(
/^\*\*\* /, '--- ').gsub(
/^h1. / , '* ' ).gsub(
/^h2. / , '** ' ).gsub(
/^h3. / , '*** ')
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment