Compare commits

...

9 Commits

Author SHA1 Message Date
bootstraponline d0527f1aeb Release 2.3.3 2012-10-23 22:58:41 -06:00
bootstraponline 75083c5b56 Fix collapse tree 2012-10-23 22:36:17 -06:00
bootstraponline 82526594db Add attr reader for collapse tree 2012-10-23 22:22:56 -06:00
bootstraponline 941d39800c Merge pull request #556 from adiknoth/fileview
Documentation and usability enhancement of recent fileview fix
2012-10-23 21:20:28 -07:00
bootstraponline a1ae2e8bc0 Fix #554 2012-10-23 22:14:45 -06:00
bootstraponline 4af6f366ca Fix show_all /pages 2012-10-23 22:09:27 -06:00
Adrian Knoth c7a9534ed9 Add --collapse-tree command line option 2012-10-23 14:27:15 +02:00
Adrian Knoth 00bcbbf72b File View: Add option to collapse file trees.
For potentially large repositories, starting with a collapsed tree may
be beneficial.
2012-10-23 14:27:12 +02:00
Adrian Knoth ed2254ff9f Add missing documentation for --show-all 2012-10-23 14:22:54 +02:00
8 changed files with 28 additions and 16 deletions
+4
View File
@@ -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
View File
@@ -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
View File
@@ -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
View File
@@ -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
+5 -4
View File
@@ -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>
+4 -2
View File
@@ -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
+3 -1
View File
@@ -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
+7
View File
@@ -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.