Compare commits

...

18 Commits

Author SHA1 Message Date
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
bootstraponline a3d85ae8c3 Release 2.4.6 2012-12-18 18:30:17 -07:00
bootstraponline fef62b63cb ASCIIDOC tests don't run on Travis
Tests that use to be green now fail when rerun. The issue is with the travis configuration and asciidoc.

https://travis-ci.org/github/gollum/jobs/3603171
2012-12-18 18:25:41 -07:00
bootstraponline 93ec80f773 Fix #607 2012-12-18 17:41:57 -07:00
bootstraponline 8e3795c317 Update 2012-12-18 17:20:49 -07:00
bootstraponline cb1a633dc5 Fix #607 2012-12-14 19:16:19 -07:00
bootstraponline ace4db6938 Merge pull request #605 from dekimsey/pages-images-now-respect-baseurl
Fix /pages css to the correct path for images
2012-12-11 17:35:03 -08:00
Daniel Kimsey b770062788 Fix /pages css to the correct path for images 2012-12-11 13:00:55 -05:00
bootstraponline 4c4dc5398a Update 1.8 check 2012-12-10 18:41:01 -07:00
10 changed files with 38 additions and 27 deletions
-2
View File
@@ -5,5 +5,3 @@ notifications:
disabled: true disabled: true
before_install: before_install:
- sudo apt-get update - sudo apt-get update
- sudo apt-get install -y --force-yes asciidoc
- ASCIIDOC=1; export ASCIIDOC
+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.4.5' s.version = '2.4.9'
s.date = '2012-12-10' s.date = '2012-12-20'
s.rubyforge_project = 'gollum' s.rubyforge_project = 'gollum'
s.summary = "A simple, Git-powered wiki." s.summary = "A simple, Git-powered wiki."
+2 -2
View File
@@ -25,10 +25,10 @@ require File.expand_path('../gollum/frontend/uri_encode_component', __FILE__)
# Set ruby to UTF-8 mode # Set ruby to UTF-8 mode
# This is required for Ruby 1.8.7 which gollum still supports. # This is required for Ruby 1.8.7 which gollum still supports.
$KCODE = 'U' if RUBY_VERSION[2,1] == '8' $KCODE = 'U' if RUBY_VERSION[0,3] == '1.8'
module Gollum module Gollum
VERSION = '2.4.5' VERSION = '2.4.9'
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__))
+4
View File
@@ -85,6 +85,10 @@ module Gollum
# #
# Returns nothing (modifies the Index in place). # Returns nothing (modifies the Index in place).
def add_to_index(dir, name, format, data, allow_same_ext = false) 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) path = @wiki.page_file_name(name, format)
dir = '/' if dir.strip.empty? dir = '/' if dir.strip.empty?
+15 -11
View File
@@ -88,7 +88,8 @@ module Precious
end end
get '/' do 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 end
# path is set to name if path is nil. # path is set to name if path is nil.
@@ -179,9 +180,18 @@ module Precious
@name = wikip.name.to_url @name = wikip.name.to_url
@path = wikip.path @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 page = wikip.page
if 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 else
mustache :create mustache :create
end end
@@ -191,16 +201,13 @@ module Precious
name = params[:page].to_url name = params[:page].to_url
path = sanitize_empty_params(params[:path]) || '' path = sanitize_empty_params(params[:path]) || ''
format = params[:format].intern 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 wiki = wiki_new
begin begin
wiki.write_page(name, format, params[:content], commit_message, path) 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 rescue Gollum::DuplicatePageError => e
@message = "Duplicate page: #{e.message}" @message = "Duplicate page: #{e.message}"
mustache :error mustache :error
@@ -345,9 +352,6 @@ module Precious
path = extract_path(fullpath) || '/' path = extract_path(fullpath) || '/'
wiki = wiki_new 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) if page = wiki.paged(name, path, exact = true)
@page = page @page = page
@name = name @name = name
@@ -699,14 +699,14 @@ ul.actions {
#pages li a.file, #pages li a.file,
#pages li a.folder { #pages li a.folder {
background-image: url(/images/fileview/document.png); background-image: url(../images/fileview/document.png);
background-position: 0 1px; background-position: 0 1px;
background-repeat: no-repeat; background-repeat: no-repeat;
padding-left: 20px; padding-left: 20px;
} }
#pages li a.folder { #pages li a.folder {
background-image: url(/images/fileview/folder-horizontal.png); background-image: url(../images/fileview/folder-horizontal.png);
} }
#pages .breadcrumb { #pages .breadcrumb {
+3 -3
View File
@@ -420,7 +420,7 @@ module Gollum
path = cname[0..slash] path = cname[0..slash]
page = @wiki.paged(name, path) page = @wiki.paged(name, path)
else else
page = @wiki.paged(cname, '/') page = @wiki.paged(cname, '/') || @wiki.page(cname)
end end
if page if page
@@ -475,7 +475,7 @@ module Gollum
# #
# Returns the placeholder'd String data. # Returns the placeholder'd String data.
def extract_code(data) def extract_code(data)
data.gsub!(/^([ \t]*)(~~~+) ?([^\r\n]+)?\r?\n(.+?)\r?\n\1(~~~+)\r?$/m) do data.gsub!(/^([ \t]*)(~~~+) ?([^\r\n]+)?\r?\n(.+?)\r?\n\1(~~~+)[ \t\r]*$/m) do
m_indent = $1 m_indent = $1
m_start = $2 # ~~~ m_start = $2 # ~~~
m_lang = $3 m_lang = $3
@@ -504,7 +504,7 @@ module Gollum
"#{m_indent}#{id}" # print the SHA1 ID with the proper indentation "#{m_indent}#{id}" # print the SHA1 ID with the proper indentation
end end
data.gsub!(/^([ \t]*)``` ?([^\r\n]+)?\r?\n(.+?)\r?\n\1```\r?$/m) do data.gsub!(/^([ \t]*)``` ?([^\r\n]+)?\r?\n(.+?)\r?\n\1```[ \t]*\r?$/m) do
lang = $2 ? $2.strip : nil lang = $2 ? $2.strip : nil
id = Digest::SHA1.hexdigest("#{lang}.#{$3}") id = Digest::SHA1.hexdigest("#{lang}.#{$3}")
cached = check_cache(:code, id) cached = check_cache(:code, id)
+2 -1
View File
@@ -45,7 +45,8 @@ module Gollum
# Default whitelisted protocols for URLs. # Default whitelisted protocols for URLs.
PROTOCOLS = { PROTOCOLS = {
'a' => {'href' => ['http', 'https', 'mailto', 'ftp', 'irc', 'apt', :relative]}, 'a' => {'href' => ['http', 'https', 'mailto', 'ftp', 'irc', 'apt', :relative]},
'img' => {'src' => ['http', 'https', :relative]} 'img' => {'src' => ['http', 'https', :relative]},
'form' => {'action' => ['http', 'https', :relative]}
}.freeze }.freeze
ADD_ATTRIBUTES = lambda do |env, node| ADD_ATTRIBUTES = lambda do |env, node|
+4
View File
@@ -287,6 +287,10 @@ module Gollum
# Returns the String SHA1 of the newly written version, or the # Returns the String SHA1 of the newly written version, or the
# Gollum::Committer instance if this is part of a batch update. # Gollum::Committer instance if this is part of a batch update.
def write_page(name, format, data, commit = {}, dir = '') def write_page(name, format, data, commit = {}, dir = '')
# spaces must be dashes
name.gsub!(' ', '-')
dir.gsub!(' ', '-')
multi_commit = false multi_commit = false
committer = if obj = commit[:committer] 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 :textile, @wiki.page("Samwise Gamgee").format
assert_equal "h1. Samwise Gamgee2", @wiki.page("Samwise Gamgee").raw_data 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 end
test "update page with format change, verify non-canonicalization of filename, where filename contains Whitespace" do 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 :textile, @wiki.page("Samwise Gamgee").format
assert_equal "h1. Samwise Gamgee", @wiki.page("Samwise Gamgee").raw_data 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 end
test "update page with name change, verify canonicalization of filename, where filename contains Whitespace" do 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 test "update a page with same name and different format" do
page = @wiki.page("Samwise Gamgee") page = @wiki.page("Samwise Gamgee")
@wiki.update_page(page, page.name, :textile, "What we need is a few good taters.", commit_details) @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_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 !File.exist?(File.join(@path, "Samwise-Gamgee.mediawiki"))
end end
test "update a page with different name and different format" do test "update a page with different name and different format" do