Revert "Merge pull request #379 from pipex/latex-dollar-sign"
This reverts commitb53c961db2, reversing changes made to9c40cbea76.
This commit is contained in:
+1
-14
@@ -124,30 +124,17 @@ module Gollum
|
|||||||
#
|
#
|
||||||
# Returns the placeholder'd String data.
|
# Returns the placeholder'd String data.
|
||||||
def extract_tex(data)
|
def extract_tex(data)
|
||||||
# Random string to escape the `$` character (might be overkill)
|
|
||||||
esc = "/%%/"
|
|
||||||
data.gsub(/\\\[\s*(.*?)\s*\\\]/m) do
|
data.gsub(/\\\[\s*(.*?)\s*\\\]/m) do
|
||||||
tag = CGI.escapeHTML($1)
|
tag = CGI.escapeHTML($1)
|
||||||
id = Digest::SHA1.hexdigest(tag)
|
id = Digest::SHA1.hexdigest(tag)
|
||||||
@texmap[id] = [:block, tag]
|
@texmap[id] = [:block, tag]
|
||||||
id
|
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
|
end.gsub(/\\\(\s*(.*?)\s*\\\)/m) do
|
||||||
tag = CGI.escapeHTML($1)
|
tag = CGI.escapeHTML($1)
|
||||||
id = Digest::SHA1.hexdigest(tag)
|
id = Digest::SHA1.hexdigest(tag)
|
||||||
@texmap[id] = [:inline, tag]
|
@texmap[id] = [:inline, tag]
|
||||||
id
|
id
|
||||||
end.gsub(/\$\s*(.*?)\s*\$/m) do # match inline $<formula>$
|
end
|
||||||
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
|
# Process all TeX from the texmap and replace the placeholders with the
|
||||||
|
|||||||
Reference in New Issue
Block a user