Created
January 1, 2011 15:31
-
-
Save ybenjo/761809 to your computer and use it in GitHub Desktop.
convert hatena-tex to google chart api's tex
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
| require 'cgi' | |
| google_url = "http://chart.apis.google.com/chart?cht=tx&chl=" | |
| $<.each{|l| | |
| l.chomp! | |
| l.scan(/(\[tex:(.*?)\]){1,}/).each do |e| | |
| math = e[1] | |
| url_math = CGI.escape(math) | |
| l.sub!(/#{Regexp.quote(e[0])}/,"<img src=\"#{google_url}#{url_math}\">") | |
| end | |
| puts l | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment