Added assertions for the response content in pdf action; changed all output file names to include seconds
This commit is contained in:
parent
01c5a65405
commit
bd8e725578
3 changed files with 69 additions and 17 deletions
|
@ -80,16 +80,16 @@ class WikiController < ApplicationController
|
|||
end
|
||||
|
||||
def export_pdf
|
||||
file_name = "#{web.address}-tex-#{web.revised_on.strftime('%Y-%m-%d-%H-%M')}"
|
||||
file_name = "#{web.address}-tex-#{web.revised_on.strftime('%Y-%m-%d-%H-%M-%S')}"
|
||||
file_path = WikiService.storage_path + file_name
|
||||
|
||||
export_web_to_tex(file_path + ".tex") unless FileTest.exists?(file_path + ".tex")
|
||||
convert_tex_to_pdf(file_path + ".tex")
|
||||
send_export(file_name + ".pdf", file_path + ".pdf")
|
||||
export_web_to_tex "#{file_path}.tex" unless FileTest.exists? "#{file_path}.tex"
|
||||
convert_tex_to_pdf "#{file_path}.tex"
|
||||
send_export("#{file_name}.tex", "#{file_path}.tex")
|
||||
end
|
||||
|
||||
def export_tex
|
||||
file_name = "#{web.address}-tex-#{web.revised_on.strftime('%Y-%m-%d-%H-%M')}.tex"
|
||||
file_name = "#{web.address}-tex-#{web.revised_on.strftime('%Y-%m-%d-%H-%M-%S')}.tex"
|
||||
file_path = WikiService.storage_path + file_name
|
||||
|
||||
export_web_to_tex(file_path) unless FileTest.exists?(file_path)
|
||||
|
@ -182,7 +182,7 @@ class WikiController < ApplicationController
|
|||
def pdf
|
||||
page = wiki.read_page(@web_name, @page_name)
|
||||
safe_page_name = @page.name.gsub(/\W/, '')
|
||||
file_name = "#{safe_page_name}-#{@web.address}-#{@page.created_at.strftime("%Y-%m-%d-%H-%M")}"
|
||||
file_name = "#{safe_page_name}-#{@web.address}-#{@page.created_at.strftime('%Y-%m-%d-%H-%M-%S')}"
|
||||
file_path = WikiService.storage_path + file_name
|
||||
|
||||
export_page_to_tex(file_path + '.tex') unless FileTest.exists?(file_path + '.tex')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue