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