Fixed a subtle bug in RedclothForTex
This commit is contained in:
parent
41b3468a57
commit
4f04ff39e9
|
@ -68,8 +68,7 @@ class WikiController < ApplicationController
|
||||||
|
|
||||||
def export_tex
|
def export_tex
|
||||||
file_name = "#{@web.address}-tex-#{@web.revised_on.strftime('%Y-%m-%d-%H-%M-%S')}.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)
|
export_web_to_tex(file_path) unless FileTest.exists?(file_path)
|
||||||
send_file file_path
|
send_file file_path
|
||||||
end
|
end
|
||||||
|
@ -276,7 +275,7 @@ class WikiController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def export_web_to_tex(file_path)
|
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')) }
|
File.open(file_path, 'w') { |f| f.write(render_to_string('wiki/tex_web')) }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ end
|
||||||
|
|
||||||
|
|
||||||
def table_of_contents(text, pages)
|
def table_of_contents(text, pages)
|
||||||
text.gsub!( /^([#*]+? .*?)$(?![^#*])/m ) do |match|
|
text.gsub( /^([#*]+? .*?)$(?![^#*])/m ) do |match|
|
||||||
lines = match.split( /\n/ )
|
lines = match.split( /\n/ )
|
||||||
last_line = -1
|
last_line = -1
|
||||||
depth = []
|
depth = []
|
||||||
|
|
Loading…
Reference in a new issue