Skip to content

Instantly share code, notes, and snippets.

@ongaeshi
Created March 3, 2011 14:10
Show Gist options
  • Select an option

  • Save ongaeshi/852819 to your computer and use it in GitHub Desktop.

Select an option

Save ongaeshi/852819 to your computer and use it in GitHub Desktop.
tw2hatena.rb
# -*- coding: utf-8 -*-
#
# @file
# @brief convert link, TiddlyWiki 2 Hatena
# @author ongaeshi
# @date 2011/03/03
def tw2hatena(line)
# h1, h2, h3..
line = line.gsub(/^\!/, "*")
line = line.gsub(/^\!\!/, "**")
line = line.gsub(/^\!\!\!/, "***")
# link
line = line.gsub(/\[\[(.*)\|(.*)\]\]/, '[\2:title=\1]')
end
while line = gets
print tw2hatena(line)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment