Last active
February 27, 2016 07:56
-
-
Save karthikselva/96d4755ed56800fa3e1a to your computer and use it in GitHub Desktop.
Octopress to Jekyll Code tag converter
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
| src = /{% include_code\s+([A-Za-z0-9\._]+)\s+%}/ | |
| files = Dir['_posts/*'] | |
| files.each do |e| | |
| content =nil | |
| File.open(e) do |f| | |
| content = f.read | |
| end | |
| dest = content.gsub(src) {|m| | |
| "{% highlight ruby %} | |
| {% include {{page.permalink}}/downloads/code/#{$1} %} | |
| {% endhighlight %}" | |
| } | |
| next if dest.eql?(content) | |
| File.open(e,'w') do |f| | |
| f.write dest | |
| end | |
| p dest | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment