From 13b7e1d766b4ef3e59fe926fb60bf56a043d7439 Mon Sep 17 00:00:00 2001 From: Jacques Distler Date: Sat, 17 Jan 2009 00:28:38 -0600 Subject: [PATCH] A Real Fix For the "Backslashes in Included Equations" Bug Ruby's String.sub!(pattern, replacement) routine is fundamentally broken. But the block version works fine. Using the broken routine in the Chunk handler was a subtle mistake. --- lib/chunks/chunk.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/chunks/chunk.rb b/lib/chunks/chunk.rb index 9beb0e6c..02b2eb9a 100644 --- a/lib/chunks/chunk.rb +++ b/lib/chunks/chunk.rb @@ -61,7 +61,7 @@ module Chunk end def unmask - @content.sub!(mask, @unmask_text) + @content.sub!(/#{mask}/){|s| s.replace @unmask_text} end def rendered? @@ -73,7 +73,7 @@ module Chunk end def revert - @content.sub!(mask, @text) + @content.sub!(/#{mask}/){|s| s.replace @text} # unregister @content.delete_chunk(self) end