Compare commits
20 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 1c767a0e9f | |||
| f3b0ba49e0 | |||
| 31dfcbaa9e | |||
| 8e11c5f46d | |||
| 70793ff559 | |||
| 6621e71e6c | |||
| 2af164ee9e | |||
| 9227f0a195 | |||
| f18330b494 | |||
| bb32339ab4 | |||
| ddf4378dfe | |||
| 2a607e209b | |||
| a3d85ae8c3 | |||
| fef62b63cb | |||
| 93ec80f773 | |||
| 8e3795c317 | |||
| cb1a633dc5 | |||
| ace4db6938 | |||
| b770062788 | |||
| 4c4dc5398a |
@@ -5,5 +5,3 @@ notifications:
|
||||
disabled: true
|
||||
before_install:
|
||||
- sudo apt-get update
|
||||
- sudo apt-get install -y --force-yes asciidoc
|
||||
- ASCIIDOC=1; export ASCIIDOC
|
||||
|
||||
+2
-2
@@ -5,8 +5,8 @@ Gem::Specification.new do |s|
|
||||
s.required_ruby_version = ">= 1.8.7"
|
||||
|
||||
s.name = 'gollum'
|
||||
s.version = '2.4.5'
|
||||
s.date = '2012-12-10'
|
||||
s.version = '2.4.10'
|
||||
s.date = '2012-12-20'
|
||||
s.rubyforge_project = 'gollum'
|
||||
|
||||
s.summary = "A simple, Git-powered wiki."
|
||||
|
||||
+2
-2
@@ -25,10 +25,10 @@ require File.expand_path('../gollum/frontend/uri_encode_component', __FILE__)
|
||||
|
||||
# Set ruby to UTF-8 mode
|
||||
# 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
|
||||
VERSION = '2.4.5'
|
||||
VERSION = '2.4.10'
|
||||
|
||||
def self.assets_path
|
||||
::File.expand_path('gollum/frontend/public', ::File.dirname(__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
@@ -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
|
||||
|
||||
@@ -699,14 +699,14 @@ ul.actions {
|
||||
|
||||
#pages li a.file,
|
||||
#pages li a.folder {
|
||||
background-image: url(/images/fileview/document.png);
|
||||
background-image: url(../images/fileview/document.png);
|
||||
background-position: 0 1px;
|
||||
background-repeat: no-repeat;
|
||||
padding-left: 20px;
|
||||
}
|
||||
|
||||
#pages li a.folder {
|
||||
background-image: url(/images/fileview/folder-horizontal.png);
|
||||
background-image: url(../images/fileview/folder-horizontal.png);
|
||||
}
|
||||
|
||||
#pages .breadcrumb {
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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
|
||||
@@ -475,7 +475,7 @@ module Gollum
|
||||
#
|
||||
# Returns the placeholder'd String 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_start = $2 # ~~~
|
||||
m_lang = $3
|
||||
@@ -504,7 +504,7 @@ module Gollum
|
||||
"#{m_indent}#{id}" # print the SHA1 ID with the proper indentation
|
||||
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
|
||||
id = Digest::SHA1.hexdigest("#{lang}.#{$3}")
|
||||
cached = check_cache(:code, id)
|
||||
|
||||
@@ -45,7 +45,8 @@ module Gollum
|
||||
# Default whitelisted protocols for URLs.
|
||||
PROTOCOLS = {
|
||||
'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
|
||||
|
||||
ADD_ATTRIBUTES = lambda do |env, node|
|
||||
|
||||
@@ -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
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user