Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d0527f1aeb | |||
| 75083c5b56 | |||
| 82526594db | |||
| 941d39800c | |||
| a1ae2e8bc0 | |||
| 4af6f366ca | |||
| c7a9534ed9 | |||
| 00bcbbf72b | |||
| ed2254ff9f |
@@ -72,6 +72,10 @@ opts = OptionParser.new do |opts|
|
||||
opts.on("--show-all", "Shows all files in file view. By default only valid pages are shown.") do
|
||||
wiki_options[:show_all] = true
|
||||
end
|
||||
|
||||
opts.on("--collapse-tree", "Collapse file view tree. By default, expanded tree is shown.") do
|
||||
wiki_options[:collapse_tree] = true
|
||||
end
|
||||
end
|
||||
|
||||
# Read command line options into `options` hash
|
||||
|
||||
+2
-2
@@ -5,8 +5,8 @@ Gem::Specification.new do |s|
|
||||
s.required_ruby_version = ">= 1.8.7"
|
||||
|
||||
s.name = 'gollum'
|
||||
s.version = '2.3.2'
|
||||
s.date = '2012-10-22'
|
||||
s.version = '2.3.3'
|
||||
s.date = '2012-10-23'
|
||||
s.rubyforge_project = 'gollum'
|
||||
|
||||
s.summary = "A simple, Git-powered wiki."
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@ require File.expand_path('../gollum/web_sequence_diagram', __FILE__)
|
||||
require File.expand_path('../gollum/frontend/uri_encode_component', __FILE__)
|
||||
|
||||
module Gollum
|
||||
VERSION = '2.3.2'
|
||||
VERSION = '2.3.3'
|
||||
|
||||
def self.assets_path
|
||||
::File.expand_path('gollum/frontend/public', ::File.dirname(__FILE__))
|
||||
|
||||
+2
-6
@@ -17,12 +17,8 @@ module Gollum
|
||||
#
|
||||
# Returns the String url_path
|
||||
def url_path
|
||||
path = if self.path.include?('/')
|
||||
self.path.sub(/\/[^\/]+$/, '/')
|
||||
else
|
||||
''
|
||||
end
|
||||
|
||||
path = self.path
|
||||
path = path.sub(/\/[^\/]+$/, '/') if path.include?('/')
|
||||
path
|
||||
end
|
||||
|
||||
|
||||
@@ -8,9 +8,10 @@ module Gollum
|
||||
# common use cases:
|
||||
# set pages to wiki.pages and show_all to false
|
||||
# set pages to wiki.pages + wiki.files and show_all to true
|
||||
def initialize pages, show_all = false
|
||||
def initialize pages, options = {}
|
||||
@pages = pages
|
||||
@show_all = show_all
|
||||
@show_all = options[:show_all] || false
|
||||
@checked = options[:collapse_tree] ? '' : "checked"
|
||||
end
|
||||
|
||||
def enclose_tree string
|
||||
@@ -30,7 +31,7 @@ module Gollum
|
||||
def new_sub_folder path
|
||||
<<-HTML
|
||||
<li>
|
||||
<label>#{path}</label> <input type="checkbox" checked />
|
||||
<label>#{path}</label> <input type="checkbox" #{@checked} />
|
||||
<ol>
|
||||
HTML
|
||||
end
|
||||
@@ -87,7 +88,7 @@ module Gollum
|
||||
url = url_for_page page
|
||||
html += <<-HTML
|
||||
<li>
|
||||
<label>#{::File.dirname(page.path)}</label> <input type="checkbox" checked />
|
||||
<label>#{::File.dirname(page.path)}</label> <input type="checkbox" #{@checked} />
|
||||
<ol>
|
||||
<li class="file"><a href="#{url}">#{name}</a></li>
|
||||
</ol>
|
||||
|
||||
@@ -332,8 +332,10 @@ module Precious
|
||||
wiki = Gollum::Wiki.new(settings.gollum_path, settings.wiki_options)
|
||||
show_all = settings.wiki_options[:show_all]
|
||||
# if showing all files include wiki.files
|
||||
@results = show_all ? Gollum::FileView.new(wiki.pages + wiki.files, show_all).render_files :
|
||||
Gollum::FileView.new(wiki.pages).render_files
|
||||
# must pass wiki_options for both because
|
||||
# --show-all and --collapse-tree can be set.
|
||||
@results = show_all ? Gollum::FileView.new(wiki.pages + wiki.files, settings.wiki_options).render_files :
|
||||
Gollum::FileView.new(wiki.pages, settings.wiki_options).render_files
|
||||
@ref = wiki.ref
|
||||
mustache :file_view, { :layout => false }
|
||||
end
|
||||
|
||||
@@ -543,7 +543,9 @@ module Gollum
|
||||
blocks.each do |lang, code|
|
||||
encoding ||= 'utf-8'
|
||||
begin
|
||||
hl_code = Pygments.highlight(code, :lexer => lang, :options => {:encoding => encoding.to_s})
|
||||
# must set startinline to true for php to be highlighted without <?
|
||||
# http://pygments.org/docs/lexers/
|
||||
hl_code = Pygments.highlight(code, :lexer => lang, :options => {:encoding => encoding.to_s, :startinline => true})
|
||||
rescue
|
||||
hl_code = code
|
||||
end
|
||||
|
||||
@@ -154,6 +154,9 @@ module Gollum
|
||||
# :ref - String the repository ref to retrieve pages from
|
||||
# :ws_subs - Array of chars to sub for ws in filenames.
|
||||
# :mathjax - Set to false to disable mathjax.
|
||||
# :show_all - Show all files in file view, not just valid pages.
|
||||
# Default: false
|
||||
# :collapse_tree - Start with collapsed file view. Default: false
|
||||
#
|
||||
# Returns a fresh Gollum::Repo.
|
||||
def initialize(path, options = {})
|
||||
@@ -181,6 +184,7 @@ module Gollum
|
||||
@universal_toc = options.fetch(:universal_toc, false)
|
||||
@mathjax = options[:mathjax] || false
|
||||
@show_all = options[:show_all] || false
|
||||
@collapse_tree = options[:collapse_tree] || false
|
||||
end
|
||||
|
||||
# Public: check whether the wiki's git repo exists on the filesystem.
|
||||
@@ -593,6 +597,9 @@ module Gollum
|
||||
# When false, only valid pages in the git repo are displayed.
|
||||
attr_reader :show_all
|
||||
|
||||
# Start with collapsed file view. Default: false
|
||||
attr_reader :collapse_tree
|
||||
|
||||
# Normalize the data.
|
||||
#
|
||||
# data - The String data to be normalized.
|
||||
|
||||
Reference in New Issue
Block a user