Skip to content

Instantly share code, notes, and snippets.

@labocho
Created October 5, 2011 08:53
Show Gist options
  • Save labocho/1263962 to your computer and use it in GitHub Desktop.
Save labocho/1263962 to your computer and use it in GitHub Desktop.
Convert TSV to WikiTable (TextMate Bundle Command)
#!/usr/bin/env ruby
# Convert TSV to WikiTable (TextMate Bundle Command)
#
# Input: Selected Text or Line
# Output: Replace Selected Text
s = STDIN.readlines.map{|line| line.gsub(/\t/, " || ").gsub(/^/, "| ").strip }.join("\n|-\n")
puts "{|class=\"wikitable\"\n#{s}\n|}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment