fix ability to have ' and " in comments
authorgc <gc>
Sun, 6 Mar 2005 13:25:07 +0000 (13:25 +0000)
committergc <gc>
Sun, 6 Mar 2005 13:25:07 +0000 (13:25 +0000)
booh
html_merges.rb

diff --git a/booh b/booh
index 95d9254639a48a75f3817c1ae4ae597ea3e10016..15c7e3ba81c8c22153d78763e7c1c423fd1aa956 100755 (executable)
--- a/booh
+++ b/booh
@@ -426,7 +426,8 @@ def walk_source_dir
         #- image.html (page with fullscreen images)
         html = $html_images.collect { |l| l.clone }
         images4js = fullscreen_images.collect { |e| "\"#{e}\"" }.join(', ')
-        captions4js = find_captions(dir, images).collect { |e| "\"#{e}\"" }.join(', ')
+        #- don't ask me why I need so many backslashes... the aim is to print \\\" for each " in the javascript source
+        captions4js = find_captions(dir, images).collect { |e| e ? '"' + e.gsub('"', '\\\\\\\\\\\\\\\\\"' ) + '"' : '""' }.join(', ')
         find_captions(dir, videos)  #- dummy for --captions-skel
         for i in html
             i.sub!(/~~images~~/, images4js)
index 318a1dc7b3332332b1f9cb56ea1e6f3007cd7b16..dd8a1df819928e53bdac0d29c48a327a0f297b9b 100644 (file)
@@ -160,7 +160,7 @@ function show_current_text() {
         eval("document.getElementById('image_counter')" +
                      ".firstChild.data = '" + ( current + 1 ) + "/" + images.length + "'");
         eval("document.getElementById('main_text')" +
-                     ".firstChild.data = '" + ( captions[current] || images[current] ) + "'");
+                     ".firstChild.data = \"" + ( captions[current] || images[current] ) + "\"");
         set_cursor("default");
     } else {
         setTimeout("show_current_text()", 100);