Last active
April 19, 2018 05:23
-
-
Save serihiro/d4c8ec45fb2ec7996f9c2c7f50df679b to your computer and use it in GitHub Desktop.
markdown2pukiwiki
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if ARGV.empty? | |
| puts 'Usage: ruby md2pukiwiki.rb input.md' | |
| exit 1; | |
| end | |
| input = File.open(File.expand_path(ARGV[0], File.join(__FILE__, '../'))).read rescue '' | |
| output = input.gsub(/\[(?<text>.+)\]\((?<url>.+)\)/,'[[\k<text>>\k<url>]]').gsub('#', '*').gsub(' ', '-') | |
| puts output |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment