Compare commits

...

14 Commits

Author SHA1 Message Date
bootstraponline 1c7a481ed9 Release 2.4.11 2013-01-08 16:59:47 -05:00
bootstraponline c3dedcbba5 Disable metadata 2013-01-08 16:58:21 -05:00
bootstraponline 1c767a0e9f Release 2.4.10 2012-12-20 19:43:48 -07:00
bootstraponline f3b0ba49e0 Fix #612 2012-12-20 19:41:28 -07:00
bootstraponline 31dfcbaa9e Release 2.4.9 2012-12-20 19:30:04 -07:00
bootstraponline 8e11c5f46d Fix create 2012-12-20 19:26:26 -07:00
bootstraponline 70793ff559 Release 2.4.8 2012-12-20 19:14:13 -07:00
bootstraponline 6621e71e6c Fix home #491 2012-12-20 19:12:02 -07:00
bootstraponline 2af164ee9e Release 2.4.7 2012-12-20 18:11:44 -07:00
bootstraponline 9227f0a195 Fix tests
File names do not have spaces.
2012-12-20 18:08:21 -07:00
bootstraponline f18330b494 Fix #611 2012-12-20 18:02:26 -07:00
bootstraponline bb32339ab4 Fix spaces in dir #611 2012-12-20 17:45:39 -07:00
bootstraponline ddf4378dfe More work on #491
@teohm pointed out that add_to_index in gollum/committer.rb already appends @wiki.page_file_dir
2012-12-18 20:07:24 -07:00
bootstraponline 2a607e209b Fix #491 2012-12-18 19:01:43 -07:00
8 changed files with 36 additions and 30 deletions
+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.4.6'
s.date = '2012-12-18'
s.version = '2.4.11'
s.date = '2013-01-08'
s.rubyforge_project = 'gollum'
s.summary = "A simple, Git-powered wiki."
+1 -1
View File
@@ -28,7 +28,7 @@ require File.expand_path('../gollum/frontend/uri_encode_component', __FILE__)
$KCODE = 'U' if RUBY_VERSION[0,3] == '1.8'
module Gollum
VERSION = '2.4.6'
VERSION = '2.4.11'
def self.assets_path
::File.expand_path('gollum/frontend/public', ::File.dirname(__FILE__))
+4
View File
@@ -85,6 +85,10 @@ module Gollum
#
# Returns nothing (modifies the Index in place).
def add_to_index(dir, name, format, data, allow_same_ext = false)
# spaces must be dashes
dir.gsub!(' ', '-')
name.gsub!(' ', '-')
path = @wiki.page_file_name(name, format)
dir = '/' if dir.strip.empty?
+15 -11
View File
@@ -88,7 +88,8 @@ module Precious
end
get '/' do
redirect ::File.join(@base_url, 'Home')
page_dir = settings.wiki_options[:page_file_dir].to_s
redirect clean_url(::File.join(@base_url, page_dir, 'Home'))
end
# path is set to name if path is nil.
@@ -179,9 +180,18 @@ module Precious
@name = wikip.name.to_url
@path = wikip.path
page_dir = settings.wiki_options[:page_file_dir].to_s
unless page_dir.empty?
# --page-file-dir docs
# /docs/Home should be created in /Home
# not /docs/Home because write_page will append /docs
@path = @path.sub(page_dir, '/') if @path.start_with? page_dir
end
page = wikip.page
if page
redirect to("/#{page.escaped_url_path}")
page_dir = settings.wiki_options[:page_file_dir].to_s
redirect to("/#{clean_url(::File.join(page_dir, page.escaped_url_path))}")
else
mustache :create
end
@@ -191,16 +201,13 @@ module Precious
name = params[:page].to_url
path = sanitize_empty_params(params[:path]) || ''
format = params[:format].intern
# ensure pages are created in page_file_dir
page_dir = settings.wiki_options[:page_file_dir].to_s
path = clean_url(::File.join(page_dir, path)) unless path.start_with?(page_dir)
wiki = wiki_new
begin
wiki.write_page(name, format, params[:content], commit_message, path)
redirect to("/#{clean_url(::File.join(path,name))}")
page_dir = settings.wiki_options[:page_file_dir].to_s
redirect to("/#{clean_url(::File.join(page_dir, path, name))}")
rescue Gollum::DuplicatePageError => e
@message = "Duplicate page: #{e.message}"
mustache :error
@@ -345,9 +352,6 @@ module Precious
path = extract_path(fullpath) || '/'
wiki = wiki_new
page_dir = settings.wiki_options[:page_file_dir].to_s
path = ::File.join(page_dir, path) unless path.start_with?(page_dir)
if page = wiki.paged(name, path, exact = true)
@page = page
@name = name
@@ -38,7 +38,9 @@
$.GollumEditor.Placeholder.add($('#gollum-editor-edit-summary input'));
$('#gollum-editor form[name="gollum-editor"]').submit(function( e ) {
e.preventDefault();
$.GollumEditor.Placeholder.clearAll();
// Do not clear default place holder text
// Updated home (markdown)
// $.GollumEditor.Placeholder.clearAll();
debug('submitting');
$(this).unbind('submit');
$(this).submit();
+3 -11
View File
@@ -420,7 +420,7 @@ module Gollum
path = cname[0..slash]
page = @wiki.paged(name, path)
else
page = @wiki.paged(cname, '/')
page = @wiki.paged(cname, '/') || @wiki.page(cname)
end
if page
@@ -636,16 +636,8 @@ module Gollum
#
# Returns the String of formatted data with metadata removed.
def extract_metadata(data)
@metadata ||= {}
# The markers are `<!-- ---` and `-->`
data.gsub(/\<\!--+\s+---(.*?)--+\>/m) do
yaml = @wiki.sanitizer.clean($1)
hash = YAML.load(yaml)
if Hash === hash
@metadata.update(hash)
end
''
end
@metadata = {}
data
end
# Hook for getting the formatted value of extracted tag data.
+4
View File
@@ -287,6 +287,10 @@ module Gollum
# Returns the String SHA1 of the newly written version, or the
# Gollum::Committer instance if this is part of a batch update.
def write_page(name, format, data, commit = {}, dir = '')
# spaces must be dashes
name.gsub!(' ', '-')
dir.gsub!(' ', '-')
multi_commit = false
committer = if obj = commit[:committer]
+4 -4
View File
@@ -305,7 +305,7 @@ context "Wiki page writing with whitespace (filename contains whitespace)" do
assert_equal :textile, @wiki.page("Samwise Gamgee").format
assert_equal "h1. Samwise Gamgee2", @wiki.page("Samwise Gamgee").raw_data
assert_equal "Samwise Gamgee.textile", @wiki.page("Samwise Gamgee").filename
assert_equal "Samwise-Gamgee.textile", @wiki.page("Samwise Gamgee").filename
end
test "update page with format change, verify non-canonicalization of filename, where filename contains Whitespace" do
@@ -317,7 +317,7 @@ context "Wiki page writing with whitespace (filename contains whitespace)" do
assert_equal :textile, @wiki.page("Samwise Gamgee").format
assert_equal "h1. Samwise Gamgee", @wiki.page("Samwise Gamgee").raw_data
assert_equal "Samwise Gamgee.textile", @wiki.page("Samwise Gamgee").filename
assert_equal "Samwise-Gamgee.textile", @wiki.page("Samwise Gamgee").filename
end
test "update page with name change, verify canonicalization of filename, where filename contains Whitespace" do
@@ -424,8 +424,8 @@ context "Wiki sync with working directory (filename contains whitespace)" do
test "update a page with same name and different format" do
page = @wiki.page("Samwise Gamgee")
@wiki.update_page(page, page.name, :textile, "What we need is a few good taters.", commit_details)
assert_equal "What we need is a few good taters.", File.read(File.join(@path, "Samwise Gamgee.textile"))
assert !File.exist?(File.join(@path, "Samwise Gamgee.mediawiki"))
assert_equal "What we need is a few good taters.", File.read(File.join(@path, "Samwise-Gamgee.textile"))
assert !File.exist?(File.join(@path, "Samwise-Gamgee.mediawiki"))
end
test "update a page with different name and different format" do