Revert "Merge pull request #379 from pipex/latex-dollar-sign"

This reverts commit b53c961db2, reversing
changes made to 9c40cbea76.
This commit is contained in:
bootstraponline
2012-07-02 10:27:30 -06:00
parent 41cd43ebc6
commit 20dd0816a6
+1 -14
View File
@@ -124,30 +124,17 @@ module Gollum
#
# Returns the placeholder'd String data.
def extract_tex(data)
# Random string to escape the `$` character (might be overkill)
esc = "/%%/"
data.gsub(/\\\[\s*(.*?)\s*\\\]/m) do
tag = CGI.escapeHTML($1)
id = Digest::SHA1.hexdigest(tag)
@texmap[id] = [:block, tag]
id
end.gsub(/'\$/, esc). # Replace `'$` with the `esc` string in order to escape it
gsub(/\$\$\s*(.*?)\s*\$\$/m) do
tag = CGI.escapeHTML($1)
id = Digest::SHA1.hexdigest(tag)
@texmap[id] = [:block, tag]
id
end.gsub(/\\\(\s*(.*?)\s*\\\)/m) do
tag = CGI.escapeHTML($1)
id = Digest::SHA1.hexdigest(tag)
@texmap[id] = [:inline, tag]
id
end.gsub(/\$\s*(.*?)\s*\$/m) do # match inline $<formula>$
tag = CGI.escapeHTML($1)
id = Digest::SHA1.hexdigest(tag)
@texmap[id] = [:inline, tag]
id
end.gsub(/#{esc}/, '$') # replace the `esc` string back to `$`
end
end
# Process all TeX from the texmap and replace the placeholders with the