From 4f04ff39e99792b3726acb97c4563829735ea9c5 Mon Sep 17 00:00:00 2001 From: Alexey Verkhovsky Date: Thu, 7 Apr 2005 05:15:46 +0000 Subject: [PATCH] Fixed a subtle bug in RedclothForTex --- app/controllers/wiki_controller.rb | 5 ++--- lib/redcloth_for_tex.rb | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/app/controllers/wiki_controller.rb b/app/controllers/wiki_controller.rb index f11d5dc5..33ac665a 100644 --- a/app/controllers/wiki_controller.rb +++ b/app/controllers/wiki_controller.rb @@ -68,8 +68,7 @@ class WikiController < ApplicationController def export_tex file_name = "#{@web.address}-tex-#{@web.revised_on.strftime('%Y-%m-%d-%H-%M-%S')}.tex" - file_path = @wiki.storage_path + file_name - + file_path = File.join(@wiki.storage_path, file_name) export_web_to_tex(file_path) unless FileTest.exists?(file_path) send_file file_path end @@ -276,7 +275,7 @@ class WikiController < ApplicationController end def export_web_to_tex(file_path) - @tex_content = table_of_contents(@web.pages['HomePage'].content.dup, render_tex_web) + @tex_content = table_of_contents(@web.pages['HomePage'].content, render_tex_web) File.open(file_path, 'w') { |f| f.write(render_to_string('wiki/tex_web')) } end diff --git a/lib/redcloth_for_tex.rb b/lib/redcloth_for_tex.rb index c238ed7c..6bfb6a0f 100644 --- a/lib/redcloth_for_tex.rb +++ b/lib/redcloth_for_tex.rb @@ -13,7 +13,7 @@ end def table_of_contents(text, pages) - text.gsub!( /^([#*]+? .*?)$(?![^#*])/m ) do |match| + text.gsub( /^([#*]+? .*?)$(?![^#*])/m ) do |match| lines = match.split( /\n/ ) last_line = -1 depth = []