Compare commits

..

14 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
bootstraponline b6633f0ecb Release 2.3.2 2012-10-22 19:21:10 -06:00
bootstraponline e08d2d3052 Enable show_all for /pages 2012-10-22 19:10:40 -06:00
bootstraponline fbc0548b43 Add --show-all
--show-all will show all files in file view (not just valid pages). Default is false.
2012-10-22 19:03:21 -06:00
bootstraponline a9807bd1e1 Update math note 2012-10-21 17:22:31 -06:00
bootstraponline 554b80b39d Add MathJax examples 2012-10-21 17:21:24 -06:00
11 changed files with 83 additions and 11 deletions
+11 -1
View File
@@ -363,7 +363,17 @@ appropriately.
## MATHEMATICAL EQUATIONS ## MATHEMATICAL EQUATIONS
Start gollum with the `--mathjax` flag. Read more about [MathJax](http://docs.mathjax.org/en/latest/index.html) on the web. Gollum uses the `TeX-AMS-MML_HTMLorMML` config with the autoload-all extension. Start gollum with the `--mathjax` flag. Read more about [MathJax](http://docs.mathjax.org/en/latest/index.html) on the web. Gollum uses the `TeX-AMS-MML_HTMLorMML` config with the `autoload-all` extension.
Inline math:
- $2^2$
- `\\(2^2\\)`
Display math:
- $$2^2$$
- [2^2]
## SEQUENCE DIAGRAMS ## SEQUENCE DIAGRAMS
+1 -1
View File
@@ -113,8 +113,8 @@ task :release => :build do
puts "You must be on the master branch to release!" puts "You must be on the master branch to release!"
exit! exit!
end end
sh "git pull"
sh "git commit --allow-empty -a -m 'Release #{version}'" sh "git commit --allow-empty -a -m 'Release #{version}'"
sh "git pull"
sh "git tag v#{version}" sh "git tag v#{version}"
sh "git push origin master" sh "git push origin master"
sh "git push origin v#{version}" sh "git push origin v#{version}"
+8
View File
@@ -68,6 +68,14 @@ opts = OptionParser.new do |opts|
opts.on("--mathjax", "Enables mathjax.") do opts.on("--mathjax", "Enables mathjax.") do
wiki_options[:mathjax] = true wiki_options[:mathjax] = true
end end
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 end
# Read command line options into `options` hash # 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.required_ruby_version = ">= 1.8.7"
s.name = 'gollum' s.name = 'gollum'
s.version = '2.3.1' s.version = '2.3.3'
s.date = '2012-10-21' 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
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__) require File.expand_path('../gollum/frontend/uri_encode_component', __FILE__)
module Gollum module Gollum
VERSION = '2.3.1' 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__))
+16
View File
@@ -13,6 +13,22 @@ module Gollum
@path = nil @path = nil
end end
# Public: The url path required to reach this page within the repo.
#
# Returns the String url_path
def url_path
path = self.path
path = path.sub(/\/[^\/]+$/, '/') if path.include?('/')
path
end
# Public: The url_path, but CGI escaped.
#
# Returns the String url_path
def escaped_url_path
CGI.escape(self.url_path).gsub('%2F','/')
end
# Public: The on-disk filename of the file. # Public: The on-disk filename of the file.
# #
# Returns the String name. # Returns the String name.
+18 -4
View File
@@ -5,8 +5,13 @@ module Gollum
- Then all the folders are sorted and processed - Then all the folders are sorted and processed
=end =end
class FileView class FileView
def initialize pages # 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, options = {}
@pages = pages @pages = pages
@show_all = options[:show_all] || false
@checked = options[:collapse_tree] ? '' : "checked"
end end
def enclose_tree string def enclose_tree string
@@ -26,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
@@ -39,7 +44,16 @@ module Gollum
end end
def url_for_page page def url_for_page page
url = ::File.join(::File.dirname(page.path), page.filename_stripped) url = ''
if @show_all
# Remove ext for valid pages.
filename = page.filename
filename = Page::valid_page_name?(filename) ? filename.chomp(::File.extname(filename)) : filename
url = ::File.join(::File.dirname(page.path), filename)
else
url = ::File.join(::File.dirname(page.path), page.filename_stripped)
end
url = url[2..-1] if url[0,2] == './' url = url[2..-1] if url[0,2] == './'
url url
end end
@@ -74,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>
+7 -1
View File
@@ -323,13 +323,19 @@ module Precious
wiki_options = settings.wiki_options.merge({ :page_file_dir => @path }) wiki_options = settings.wiki_options.merge({ :page_file_dir => @path })
wiki = Gollum::Wiki.new(settings.gollum_path, wiki_options) wiki = Gollum::Wiki.new(settings.gollum_path, wiki_options)
@results = wiki.pages @results = wiki.pages
@results += wiki.files if settings.wiki_options[:show_all]
@ref = wiki.ref @ref = wiki.ref
mustache :pages mustache :pages
end end
get '/fileview' do get '/fileview' do
wiki = Gollum::Wiki.new(settings.gollum_path, settings.wiki_options) wiki = Gollum::Wiki.new(settings.gollum_path, settings.wiki_options)
@results = Gollum::FileView.new(wiki.pages).render_files show_all = settings.wiki_options[:show_all]
# if showing all files include wiki.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 @ref = wiki.ref
mustache :file_view, { :layout => false } mustache :file_view, { :layout => false }
end end
+3 -1
View File
@@ -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
+12
View File
@@ -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 = {})
@@ -180,6 +183,8 @@ module Gollum
@live_preview = options.fetch(:live_preview, true) @live_preview = options.fetch(:live_preview, true)
@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
@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.
@@ -588,6 +593,13 @@ module Gollum
# Toggles mathjax. # Toggles mathjax.
attr_reader :mathjax attr_reader :mathjax
# Toggles showing all files in files view. Default is false.
# 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. # Normalize the data.
# #
# data - The String data to be normalized. # data - The String data to be normalized.
+4
View File
@@ -12,6 +12,10 @@ class FakePage
::File.basename(@filepath, ::File.extname(@filepath)) ::File.basename(@filepath, ::File.extname(@filepath))
end end
def filename
::File.basename(@filepath)
end
def path def path
return @filepath return @filepath
end end