Merge branch 'bzr/golem' of /Users/distler/Sites/code/instiki

This commit is contained in:
Jacques Distler 2010-10-10 13:29:03 -05:00
commit a4776060a6
2 changed files with 6 additions and 7 deletions

View file

@ -189,7 +189,9 @@ EOL
return unless is_post
if [:markdownMML, :markdownPNG, :markdown].include?(@web.markup)
@tex_content = ''
params.each do |name, p|
# Ruby 1.9.x has ordered hashes; 1.8.x doesn't. So let's just parse the query ourselves.
ordered_params = ActiveSupport::OrderedHash[*request.raw_post.split('&').collect {|k_v| k_v.split('=').each {|x| CGI::unescape(x)}}.flatten]
ordered_params.each do |name, p|
if p == 'tex' && @web.has_page?(name)
@tex_content << "\\section*\{#{name}\}\n\n".as_utf8
@tex_content << Maruku.new(@web.page(name).content).to_latex
@ -303,11 +305,7 @@ EOL
def save
render(:status => 404, :text => 'Undefined page name', :layout => 'error') and return if @page_name.nil?
unless (request.post? || Rails.env.test?)
headers['Allow'] = 'POST'
render(:status => 405, :text => 'You must use an HTTP POST', :layout => 'error')
return
end
return unless is_post
author_name = params['author'].purify
author_name = 'AnonymousCoward' if author_name =~ /^\s*$/

View file

@ -1349,7 +1349,8 @@ Page2 contents $\mathbb{01234}$.
@wiki.write_page('wiki1', 'Page2',
"Page2 contents $\\mathbb{01234}$.\n",
Time.now, Author.new('AnotherAuthor', '127.0.0.2'), x_test_renderer)
r = process('tex_list', 'web' => 'wiki1', 'Page2' => 'tex', 'BogusPage'=> 'tex', 'HomePage' => 'tex')
@request.env['RAW_POST_DATA'] = "_form_key=353106ff8c8466727ee5338baaa0640c87c9b0d6&Page2=tex&BogusPage=tex&HomePage=tex&commit=Export"
r = process('tex_list', 'web' => 'wiki1', 'Page2' => 'tex', 'BogusPage'=> 'tex', 'HomePage' => 'tex')
assert_response(:success)
assert_equal @tex_header1 + "\\usepackage{mathbbol}\n" + @tex_header2 + %q!\section*{Page2}