Compare commits

...

5 Commits

Author SHA1 Message Date
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
10 changed files with 68 additions and 8 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}"
+4
View File
@@ -68,6 +68,10 @@ 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
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.2'
s.date = '2012-10-21' s.date = '2012-10-22'
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.2'
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__))
+20
View File
@@ -13,6 +13,26 @@ 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 = if self.path.include?('/')
self.path.sub(/\/[^\/]+$/, '/')
else
''
end
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.
+15 -2
View File
@@ -5,8 +5,12 @@ 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, show_all = false
@pages = pages @pages = pages
@show_all = show_all
end end
def enclose_tree string def enclose_tree string
@@ -39,7 +43,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
+5 -1
View File
@@ -323,13 +323,17 @@ 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
@results = show_all ? Gollum::FileView.new(wiki.pages + wiki.files, show_all).render_files :
Gollum::FileView.new(wiki.pages).render_files
@ref = wiki.ref @ref = wiki.ref
mustache :file_view, { :layout => false } mustache :file_view, { :layout => false }
end end
+5
View File
@@ -180,6 +180,7 @@ 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
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 +589,10 @@ 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
# 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