From 8554654ee96925f49c966703efca05e6e7ba2f85 Mon Sep 17 00:00:00 2001 From: Arran Cudbard-Bell Date: Thu, 7 Jun 2012 10:40:52 +0200 Subject: [PATCH 1/2] Add option to disable livepreview from settings --- lib/gollum/frontend/app.rb | 2 +- lib/gollum/wiki.rb | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/gollum/frontend/app.rb b/lib/gollum/frontend/app.rb index eb432db7..82415c68 100644 --- a/lib/gollum/frontend/app.rb +++ b/lib/gollum/frontend/app.rb @@ -76,7 +76,7 @@ module Precious @name = params[:splat].first wiki = Gollum::Wiki.new(settings.gollum_path, settings.wiki_options) if page = wiki.page(@name) - if page.format.to_s.include?('markdown') && supported_useragent?(request.user_agent) + if settings.wiki_options[:live_preview] && page.format.to_s.include?('markdown') && supported_useragent?(request.user_agent) redirect '/livepreview/index.html?page=' + encodeURIComponent(@name) else @page = page diff --git a/lib/gollum/wiki.rb b/lib/gollum/wiki.rb index c584d0ea..c9c1308a 100644 --- a/lib/gollum/wiki.rb +++ b/lib/gollum/wiki.rb @@ -139,6 +139,7 @@ module Gollum # site. # options - Optional Hash: # :universal_toc - Table of contents on all pages. Default: false + # :live_preview - Livepreview editing for markdown files. Default: true # :base_path - String base path for all Wiki links. # Default: "/" # :page_class - The page Class. Default: Gollum::Page @@ -173,6 +174,7 @@ module Gollum self.class.default_ws_subs @history_sanitization = options[:history_sanitization] || self.class.history_sanitization + @live_preview = options.fetch(:live_preview, true) @universal_toc = options.fetch(:universal_toc, false) @mathjax = options[:mathjax] || true end From 3c709a27ac565e3926f6e4c48dd16e9e86d95ea5 Mon Sep 17 00:00:00 2001 From: Arran Cudbard-Bell Date: Thu, 7 Jun 2012 18:05:15 +0200 Subject: [PATCH 2/2] Add commandline option for disabling livepreview --- bin/gollum | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bin/gollum b/bin/gollum index f3dd829b..a496e5bd 100755 --- a/bin/gollum +++ b/bin/gollum @@ -57,6 +57,10 @@ opts = OptionParser.new do |opts| wiki_options[:ref] = ref end + opts.on("--no-live-preview", "Disables livepreview.") do + wiki_options[:live_preview] = false + end + opts.on("--no-mathjax", "Disables mathjax.") do options['mathjax'] = false end