lib/gollum/frontend/app.rb in gollum-1.3.1 vs lib/gollum/frontend/app.rb in gollum-1.4.2
- old
+ new
@@ -11,14 +11,14 @@
register Mustache::Sinatra
dir = File.dirname(File.expand_path(__FILE__))
# We want to serve public assets for now
+ set :public_folder, "#{dir}/public"
+ set :static, true
+ set :default_markup, :markdown
- set :public, "#{dir}/public"
- set :static, true
-
set :mustache, {
# Tell mustache where the Views constant lives
:namespace => Precious,
# Mustache templates live here
@@ -76,11 +76,11 @@
format = params[:format].intern
begin
wiki.write_page(name, format, params[:content], commit_message)
- redirect "/#{CGI.escape(name)}"
+ redirect "/#{CGI.escape(Gollum::Page.cname(name))}"
rescue Gollum::DuplicatePageError => e
@message = "Duplicate page: #{e.message}"
mustache :error
end
end
@@ -143,10 +143,16 @@
diffs = wiki.repo.diff(@versions.first, @versions.last, @page.path)
@diff = diffs.first
mustache :compare
end
+ get '/_tex.png' do
+ content_type 'image/png'
+ formula = Base64.decode64(params[:data])
+ Gollum::Tex.render_formula(formula)
+ end
+
get %r{^/(javascript|css|images)} do
halt 404
end
get %r{/(.+?)/([0-9a-f]{40})} do
@@ -198,10 +204,10 @@
mustache :create
end
end
def update_wiki_page(wiki, page, content, commit_message, name = nil, format = nil)
- return if !page ||
+ return if !page ||
((!content || page.raw_data == content) && page.format == format)
name ||= page.name
format = (format || page.format).to_sym
content ||= page.raw_data
wiki.update_page(page, name, format, content.to_s, commit_message)