From 4e9111976eb3b237ab8a5309670c628698a86d5b Mon Sep 17 00:00:00 2001 From: Dave Hulihan Date: Thu, 22 Dec 2011 20:20:03 -0700 Subject: [PATCH] Make default markup changeable through sinatra settings --- README.md | 13 +++++++++++++ lib/gollum/frontend/app.rb | 3 ++- lib/gollum/frontend/templates/create.mustache | 6 ++++-- lib/gollum/frontend/views/create.rb | 4 ++++ 4 files changed, 23 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 632cf234..f436ef58 100644 --- a/README.md +++ b/README.md @@ -428,7 +428,20 @@ To delete a page and commit the change: wiki.delete_page(page, commit) +### RACK +You can also run gollum with any rack-compatible server by placing this config.ru +file inside your wiki repository. This allows you to utilize any Rack middleware +like Rack::Auth, OmniAuth, etc. + + #!/usr/bin/env ruby + require 'rubygems' + require 'gollum/frontend/app' + + gollum_path = File.expand_path(File.dirname(__FILE__)) # CHANGE THIS TO POINT TO YOUR OWN WIKI REPO + Precious::App.set(:default_markup, :markdown) # set your favorite markup language + run Precious::App + ## CONTRIBUTE If you'd like to hack on Gollum, start by forking my repo on GitHub: diff --git a/lib/gollum/frontend/app.rb b/lib/gollum/frontend/app.rb index f14eb4d0..7c2b7e6c 100644 --- a/lib/gollum/frontend/app.rb +++ b/lib/gollum/frontend/app.rb @@ -15,7 +15,8 @@ module Precious # We want to serve public assets for now set :public_folder, "#{dir}/public" set :static, true - + set :default_markup, :markdown + set :mustache, { # Tell mustache where the Views constant lives :namespace => Precious, diff --git a/lib/gollum/frontend/templates/create.mustache b/lib/gollum/frontend/templates/create.mustache index 4dc7457a..c24c09ae 100644 --- a/lib/gollum/frontend/templates/create.mustache +++ b/lib/gollum/frontend/templates/create.mustache @@ -10,6 +10,8 @@ \ No newline at end of file + + +{{something}} \ No newline at end of file diff --git a/lib/gollum/frontend/views/create.rb b/lib/gollum/frontend/views/create.rb index 93e88987..c8f9ab38 100755 --- a/lib/gollum/frontend/views/create.rb +++ b/lib/gollum/frontend/views/create.rb @@ -39,6 +39,10 @@ module Precious def formats super(:markdown) end + + def default_markup + Precious::App.settings.default_markup + end end end end