Compare commits
31 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2ed262cacd | |||
| 29a1ef8f8a | |||
| 772d18ee62 | |||
| dd604d9942 | |||
| 85abc83427 | |||
| 6d8220629c | |||
| 6ff7ada096 | |||
| 8575049de5 | |||
| bb6fb0c253 | |||
| eb2ad9f840 | |||
| d0dd23fc11 | |||
| 7ae4acbdb0 | |||
| 881590ab37 | |||
| 5e479dc5d9 | |||
| 7db9c2e762 | |||
| ce6b0ac095 | |||
| 420bb06988 | |||
| 20566f8acf | |||
| 1d5f69704a | |||
| 0da664299e | |||
| 6e8fb2b457 | |||
| d1c72a4ff3 | |||
| 0bf05392e4 | |||
| 7ecef0c045 | |||
| 33ca329253 | |||
| 01fa4770cb | |||
| b76257c49c | |||
| e2fbf22f38 | |||
| 134432d029 | |||
| 8d4d6e80b8 | |||
| 3767a11d21 |
@@ -528,8 +528,8 @@ your changes merged back into core is as follows:
|
|||||||
$ gem push gollum-X.Y.Z.gem
|
$ gem push gollum-X.Y.Z.gem
|
||||||
|
|
||||||
## BUILDING THE GEM FROM MASTER
|
## BUILDING THE GEM FROM MASTER
|
||||||
$ gem uninstall -aix gollum
|
$ gem uninstall -ax gollum
|
||||||
$ git clone https://github.com/github/gollum.git
|
$ git clone https://github.com/github/gollum.git
|
||||||
$ cd gollum
|
$ cd gollum
|
||||||
gollum$ rake build
|
gollum$ rake build
|
||||||
gollum$ gem install pkg/gollum*.gem
|
gollum$ gem install --no-ri --no-rdoc pkg/gollum*.gem
|
||||||
|
|||||||
+2
-2
@@ -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.1.5'
|
s.version = '2.1.9'
|
||||||
s.date = '2012-08-22'
|
s.date = '2012-08-30'
|
||||||
s.rubyforge_project = 'gollum'
|
s.rubyforge_project = 'gollum'
|
||||||
|
|
||||||
s.summary = "A simple, Git-powered wiki."
|
s.summary = "A simple, Git-powered wiki."
|
||||||
|
|||||||
+2
-1
@@ -20,9 +20,10 @@ require File.expand_path('../gollum/markup', __FILE__)
|
|||||||
require File.expand_path('../gollum/sanitization', __FILE__)
|
require File.expand_path('../gollum/sanitization', __FILE__)
|
||||||
require File.expand_path('../gollum/tex', __FILE__)
|
require File.expand_path('../gollum/tex', __FILE__)
|
||||||
require File.expand_path('../gollum/web_sequence_diagram', __FILE__)
|
require File.expand_path('../gollum/web_sequence_diagram', __FILE__)
|
||||||
|
require File.expand_path('../gollum/frontend/uri_encode_component', __FILE__)
|
||||||
|
|
||||||
module Gollum
|
module Gollum
|
||||||
VERSION = '2.1.5'
|
VERSION = '2.1.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__))
|
||||||
|
|||||||
@@ -100,9 +100,13 @@ module Gollum
|
|||||||
|
|
||||||
tree.blobs.each do |blob|
|
tree.blobs.each do |blob|
|
||||||
next if page_path_scheduled_for_deletion?(index.tree, fullpath)
|
next if page_path_scheduled_for_deletion?(index.tree, fullpath)
|
||||||
file = blob.name.downcase.sub(/\.\w+$/, '')
|
|
||||||
file_ext = ::File.extname(blob.name).sub(/^\./, '')
|
existing_file = blob.name.downcase.sub(/\.\w+$/, '')
|
||||||
if downpath == file && !(allow_same_ext && file_ext == ext)
|
existing_file_ext = ::File.extname(blob.name).sub(/^\./, '')
|
||||||
|
|
||||||
|
new_file_ext = ::File.extname(path).sub(/^\./, '')
|
||||||
|
|
||||||
|
if downpath == existing_file && !(allow_same_ext && new_file_ext == existing_file_ext)
|
||||||
raise DuplicatePageError.new(dir, blob.name, path)
|
raise DuplicatePageError.new(dir, blob.name, path)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
+23
-15
@@ -9,7 +9,6 @@ require 'gollum/frontend/views/layout'
|
|||||||
require 'gollum/frontend/views/editable'
|
require 'gollum/frontend/views/editable'
|
||||||
require 'gollum/frontend/views/has_page'
|
require 'gollum/frontend/views/has_page'
|
||||||
|
|
||||||
require File.expand_path '../uri_encode_component', __FILE__
|
|
||||||
require File.expand_path '../helpers', __FILE__
|
require File.expand_path '../helpers', __FILE__
|
||||||
|
|
||||||
# Fix to_url
|
# Fix to_url
|
||||||
@@ -90,19 +89,26 @@ module Precious
|
|||||||
redirect File.join(settings.wiki_options[:base_path].to_s, 'Home')
|
redirect File.join(settings.wiki_options[:base_path].to_s, 'Home')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Removes all slashes from the start of string.
|
||||||
|
def clean_url url
|
||||||
|
return url if url.nil?
|
||||||
|
url.gsub('%2F','/').gsub(/^\/+/,'')
|
||||||
|
end
|
||||||
|
|
||||||
# path is set to name if path is nil.
|
# path is set to name if path is nil.
|
||||||
# if path is 'a/b' and a and b are dirs, then
|
# if path is 'a/b' and a and b are dirs, then
|
||||||
# path must have a trailing slash 'a/b/' or
|
# path must have a trailing slash 'a/b/' or
|
||||||
# extract_path will trim path to 'a'
|
# extract_path will trim path to 'a'
|
||||||
# name, path, version
|
# name, path, version
|
||||||
def wiki_page( name, path = nil, version = nil)
|
def wiki_page(name, path = nil, version = nil, exact = true)
|
||||||
path = name if path.nil?
|
path = name if path.nil?
|
||||||
name = extract_name(name)
|
name = extract_name(name)
|
||||||
path = extract_path(path)
|
path = extract_path(path)
|
||||||
|
path = '/' if exact && path.nil?
|
||||||
|
|
||||||
wiki = wiki_new
|
wiki = wiki_new
|
||||||
|
|
||||||
OpenStruct.new(:wiki => wiki, :page => wiki.paged(name, path, version),
|
OpenStruct.new(:wiki => wiki, :page => wiki.paged(name, path, exact, version),
|
||||||
:name => name, :path => path)
|
:name => name, :path => path)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -141,14 +147,14 @@ module Precious
|
|||||||
end
|
end
|
||||||
|
|
||||||
post '/edit/*' do
|
post '/edit/*' do
|
||||||
wikip = wiki_page(CGI.unescape(params[:page]), sanitize_empty_params(params[:path]))
|
path = '/' + clean_url(sanitize_empty_params(params[:path])).to_s
|
||||||
path = wikip.path
|
page_name = CGI.unescape(params[:page])
|
||||||
wiki = wikip.wiki
|
wiki = wiki_new
|
||||||
page = wikip.page
|
page = wiki.paged(page_name, path, exact = true)
|
||||||
rename = params[:rename].to_url if params[:rename]
|
rename = params[:rename].to_url if params[:rename]
|
||||||
name = rename || page.name
|
name = rename || page.name
|
||||||
committer = Gollum::Committer.new(wiki, commit_message)
|
committer = Gollum::Committer.new(wiki, commit_message)
|
||||||
commit = {:committer => committer}
|
commit = {:committer => committer}
|
||||||
|
|
||||||
update_wiki_page(wiki, page, params[:content], commit, name, params[:format])
|
update_wiki_page(wiki, page, params[:content], commit, name, params[:format])
|
||||||
update_wiki_page(wiki, page.header, params[:header], commit) if params[:header]
|
update_wiki_page(wiki, page.header, params[:header], commit) if params[:header]
|
||||||
@@ -187,6 +193,7 @@ module Precious
|
|||||||
post '/create' do
|
post '/create' do
|
||||||
name = params[:page].to_url
|
name = params[:page].to_url
|
||||||
path = sanitize_empty_params(params[:path])
|
path = sanitize_empty_params(params[:path])
|
||||||
|
path = '' if path.nil?
|
||||||
format = params[:format].intern
|
format = params[:format].intern
|
||||||
|
|
||||||
# write_page is not directory aware so use wiki_options to emulate dir support.
|
# write_page is not directory aware so use wiki_options to emulate dir support.
|
||||||
@@ -195,8 +202,7 @@ module Precious
|
|||||||
|
|
||||||
begin
|
begin
|
||||||
wiki.write_page(name, format, params[:content], commit_message)
|
wiki.write_page(name, format, params[:content], commit_message)
|
||||||
page = wiki.page(name)
|
redirect to("/#{clean_url(CGI.escape(::File.join(path,name)))}")
|
||||||
redirect to("/#{page.escaped_url_path}") unless page.nil?
|
|
||||||
rescue Gollum::DuplicatePageError => e
|
rescue Gollum::DuplicatePageError => e
|
||||||
@message = "Duplicate page: #{e.message}"
|
@message = "Duplicate page: #{e.message}"
|
||||||
mustache :error
|
mustache :error
|
||||||
@@ -341,7 +347,9 @@ module Precious
|
|||||||
path = extract_path(fullpath)
|
path = extract_path(fullpath)
|
||||||
wiki = wiki_new
|
wiki = wiki_new
|
||||||
|
|
||||||
if page = wiki.paged(name, path)
|
path = '/' if path.nil?
|
||||||
|
|
||||||
|
if page = wiki.paged(name, path, exact = true)
|
||||||
@page = page
|
@page = page
|
||||||
@name = name
|
@name = name
|
||||||
@editable = true
|
@editable = true
|
||||||
@@ -354,7 +362,7 @@ module Precious
|
|||||||
file.raw_data
|
file.raw_data
|
||||||
else
|
else
|
||||||
page_path = [path, name].compact.join('/')
|
page_path = [path, name].compact.join('/')
|
||||||
redirect to("/create/#{encodeURIComponent(page_path).gsub('%2F','/')}")
|
redirect to("/create/#{clean_url(encodeURIComponent(page_path))}")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
<a id='toggle' class='edit' href='javascript:void(0)' onclick='jsm.toggleLeftRight();'><img src='images/lr_24.png' alt='Toggle left to right' title='Toggle left to right'></a>
|
<a id='toggle' class='edit' href='javascript:void(0)' onclick='jsm.toggleLeftRight();'><img src='images/lr_24.png' alt='Toggle left to right' title='Toggle left to right'></a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class='editor_bg'></div>
|
<div id='editor_bg' class='editor_bg'></div>
|
||||||
<div class='toolpanel_bg'></div>
|
<div class='toolpanel_bg'></div>
|
||||||
|
|
||||||
<div id='commenttoolpanel' class='toolpanel edit' style='width: 500px; right: 0px; '>
|
<div id='commenttoolpanel' class='toolpanel edit' style='width: 500px; right: 0px; '>
|
||||||
|
|||||||
@@ -62,9 +62,10 @@ initAce( commentEditor, commentEditorSession );
|
|||||||
var baseUrl = location.pathname.split('/').slice(0,-2).join('/');
|
var baseUrl = location.pathname.split('/').slice(0,-2).join('/');
|
||||||
|
|
||||||
// RegExp from http://stackoverflow.com/questions/901115/get-query-string-values-in-javascript
|
// RegExp from http://stackoverflow.com/questions/901115/get-query-string-values-in-javascript
|
||||||
|
// Returns value on success and undefined on failure.
|
||||||
$.key = function( key ) {
|
$.key = function( key ) {
|
||||||
var value = new RegExp( '[\\?&]' + key + '=([^&#]*)' ).exec( location.href );
|
var value = new RegExp( '[\\?&]' + key + '=([^&#]*)' ).exec( location.href );
|
||||||
return ( !value ) ? 0 : value[ 1 ] || 0;
|
return ( !value ) ? undefined : value[ 1 ] || undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
// True if &create=true
|
// True if &create=true
|
||||||
@@ -73,10 +74,6 @@ var create = $.key( 'create' );
|
|||||||
var pageName = $.key( 'page' );
|
var pageName = $.key( 'page' );
|
||||||
var pathName = $.key( 'path' );
|
var pathName = $.key( 'path' );
|
||||||
|
|
||||||
if ( pathName === 0 ) {
|
|
||||||
pathName = undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
defaultCommitMessage = function() {
|
defaultCommitMessage = function() {
|
||||||
var msg = pageName + ' (markdown)';
|
var msg = pageName + ' (markdown)';
|
||||||
|
|
||||||
@@ -99,13 +96,21 @@ $.save = function( commitMessage ) {
|
|||||||
var msg = defaultCommitMessage();
|
var msg = defaultCommitMessage();
|
||||||
var newLocation = baseUrl;
|
var newLocation = baseUrl;
|
||||||
|
|
||||||
|
function clean( str ) {
|
||||||
|
return str.replace(/^\/+/, '/');
|
||||||
|
}
|
||||||
|
|
||||||
// 'a%2Fb' => a/b
|
// 'a%2Fb' => a/b
|
||||||
if (pathName) {
|
if ( pathName ) {
|
||||||
newLocation += '/' + unescape(pathName);
|
pathName = unescape( pathName );
|
||||||
|
newLocation += '/' + pathName;
|
||||||
pathName = pathName + '/'; // pathName must end with /
|
pathName = pathName + '/'; // pathName must end with /
|
||||||
|
|
||||||
|
pathName = clean( pathName );
|
||||||
}
|
}
|
||||||
|
|
||||||
newLocation += '/' + pageName;
|
newLocation += '/' + pageName;
|
||||||
|
newLocation = clean( newLocation );
|
||||||
|
|
||||||
// if &create=true then handle create instead of edit.
|
// if &create=true then handle create instead of edit.
|
||||||
if ( create ) {
|
if ( create ) {
|
||||||
@@ -333,10 +338,23 @@ var applyTimeout = function () {
|
|||||||
/* Load markdown from /data/page into the ace editor.
|
/* Load markdown from /data/page into the ace editor.
|
||||||
~-1 == false; !~-1 == true;
|
~-1 == false; !~-1 == true;
|
||||||
*/
|
*/
|
||||||
if ( !~location.host.indexOf('github.com') ) {
|
if ( !~ location.host.indexOf( 'github.com' ) ) {
|
||||||
|
|
||||||
|
// returns unescaped key with leading slashes removed
|
||||||
|
function key_no_leading_slash( key ) {
|
||||||
|
return unescape( $.key( key ) || '' ).replace( /^\/+/, '' );
|
||||||
|
}
|
||||||
|
|
||||||
|
// ensure leading / is removed from path and that it ends with /
|
||||||
|
var path = key_no_leading_slash( 'path' );
|
||||||
|
// don't append '/' if path is empty from removing leading slash
|
||||||
|
if ( path !== '' && path.charAt( path.length - 1 ) !== '/' ) {
|
||||||
|
path += '/';
|
||||||
|
}
|
||||||
|
|
||||||
jQuery.ajax( {
|
jQuery.ajax( {
|
||||||
type: 'GET',
|
type: 'GET',
|
||||||
url: baseUrl + '/data/' + $.key( 'page' ),
|
url: baseUrl + '/data/' + path + key_no_leading_slash( 'page' ),
|
||||||
success: function( data ) {
|
success: function( data ) {
|
||||||
editorSession.setValue( data );
|
editorSession.setValue( data );
|
||||||
}
|
}
|
||||||
@@ -447,6 +465,11 @@ var applyTimeout = function () {
|
|||||||
|
|
||||||
win.jsm.resize = resize;
|
win.jsm.resize = resize;
|
||||||
|
|
||||||
|
// remove editor_bg after loading because
|
||||||
|
// it'll cause problems if toggle left right is used
|
||||||
|
var ebg = doc.getElementById('editor_bg');
|
||||||
|
ebg.parentNode.removeChild(ebg);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Resize can be called an absurd amount of times
|
Resize can be called an absurd amount of times
|
||||||
and will crash the page without debouncing.
|
and will crash the page without debouncing.
|
||||||
|
|||||||
@@ -6,6 +6,11 @@ module Precious
|
|||||||
|
|
||||||
attr_reader :page, :content
|
attr_reader :page, :content
|
||||||
|
|
||||||
|
# return path set in app.rb not @page.path
|
||||||
|
def path
|
||||||
|
@path
|
||||||
|
end
|
||||||
|
|
||||||
def title
|
def title
|
||||||
"#{@page.title}"
|
"#{@page.title}"
|
||||||
end
|
end
|
||||||
|
|||||||
+17
-5
@@ -94,6 +94,7 @@ module Gollum
|
|||||||
anchor = Nokogiri::XML::Node.new('a', doc)
|
anchor = Nokogiri::XML::Node.new('a', doc)
|
||||||
anchor['class'] = 'anchor'
|
anchor['class'] = 'anchor'
|
||||||
anchor['id'] = id
|
anchor['id'] = id
|
||||||
|
# % -> %25 so anchors work on Firefox. See issue #475
|
||||||
anchor['href'] = '#' + id.gsub('%', '%25')
|
anchor['href'] = '#' + id.gsub('%', '%25')
|
||||||
h.add_child(anchor)
|
h.add_child(anchor)
|
||||||
|
|
||||||
@@ -112,7 +113,8 @@ module Gollum
|
|||||||
tail_level -= 1
|
tail_level -= 1
|
||||||
end
|
end
|
||||||
node = Nokogiri::XML::Node.new('li', doc)
|
node = Nokogiri::XML::Node.new('li', doc)
|
||||||
node.add_child("<a href='##{id}'>#{h.content}</a>")
|
# % -> %25 so anchors work on Firefox. See issue #475
|
||||||
|
node.add_child("<a href='##{id.gsub('%', '%25')}'>#{h.content}</a>")
|
||||||
tail.add_child(node)
|
tail.add_child(node)
|
||||||
end
|
end
|
||||||
toc = toc.to_xhtml if toc != nil
|
toc = toc.to_xhtml if toc != nil
|
||||||
@@ -226,7 +228,7 @@ module Gollum
|
|||||||
if is_preformatted?(data, id)
|
if is_preformatted?(data, id)
|
||||||
data.gsub!(id, "[[#{tag}]]")
|
data.gsub!(id, "[[#{tag}]]")
|
||||||
else
|
else
|
||||||
data.gsub!(id, process_tag(tag))
|
data.gsub!(id, process_tag(tag).gsub('%2F', '/'))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
data
|
data
|
||||||
@@ -439,13 +441,23 @@ module Gollum
|
|||||||
# Find a page from a given cname. If the page has an anchor (#) and has
|
# Find a page from a given cname. If the page has an anchor (#) and has
|
||||||
# no match, strip the anchor and try again.
|
# no match, strip the anchor and try again.
|
||||||
#
|
#
|
||||||
# cname - The String canonical page name.
|
# cname - The String canonical page name including path.
|
||||||
#
|
#
|
||||||
# Returns a Gollum::Page instance if a page is found, or an Array of
|
# Returns a Gollum::Page instance if a page is found, or an Array of
|
||||||
# [Gollum::Page, String extra] if a page without the extra anchor data
|
# [Gollum::Page, String extra] if a page without the extra anchor data
|
||||||
# is found.
|
# is found.
|
||||||
def find_page_from_name(cname)
|
def find_page_from_name(cname)
|
||||||
if page = @wiki.page(cname)
|
slash = cname.rindex('/')
|
||||||
|
|
||||||
|
unless slash.nil?
|
||||||
|
name = cname[slash+1..-1]
|
||||||
|
path = cname[0..slash]
|
||||||
|
page = @wiki.paged(name, path)
|
||||||
|
else
|
||||||
|
page = @wiki.paged(cname, '/')
|
||||||
|
end
|
||||||
|
|
||||||
|
if page
|
||||||
return page
|
return page
|
||||||
end
|
end
|
||||||
if pos = cname.index('#')
|
if pos = cname.index('#')
|
||||||
@@ -579,7 +591,7 @@ module Gollum
|
|||||||
#########################################################################
|
#########################################################################
|
||||||
|
|
||||||
# Extract metadata for data and build metadata table. Metadata
|
# Extract metadata for data and build metadata table. Metadata
|
||||||
# is content found between `<!-- ---` and `-->` markers, and must
|
# is content found between ` <!-- --- ` and ` --> ` markers, and must
|
||||||
# be a valid YAML mapping.
|
# be a valid YAML mapping.
|
||||||
#
|
#
|
||||||
# Returns the String of formatted data with metadata removed.
|
# Returns the String of formatted data with metadata removed.
|
||||||
|
|||||||
+6
-4
@@ -327,7 +327,7 @@ module Gollum
|
|||||||
# Returns the String canonical name.
|
# Returns the String canonical name.
|
||||||
def self.cname(name, char_white_sub = '-', char_other_sub = '-')
|
def self.cname(name, char_white_sub = '-', char_other_sub = '-')
|
||||||
name.respond_to?(:gsub) ?
|
name.respond_to?(:gsub) ?
|
||||||
name.gsub(%r{\s},char_white_sub).gsub(%r{[/<>+]}, char_other_sub) :
|
name.gsub(%r{\s},char_white_sub).gsub(%r{[<>+]}, char_other_sub) :
|
||||||
''
|
''
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -372,9 +372,9 @@ module Gollum
|
|||||||
# version - The String version ID to find.
|
# version - The String version ID to find.
|
||||||
#
|
#
|
||||||
# Returns a Gollum::Page or nil if the page could not be found.
|
# Returns a Gollum::Page or nil if the page could not be found.
|
||||||
def find(name, version, dir = nil)
|
def find(name, version, dir = nil, exact = false)
|
||||||
map = @wiki.tree_map_for(version.to_s)
|
map = @wiki.tree_map_for(version.to_s)
|
||||||
if page = find_page_in_tree(map, name, dir)
|
if page = find_page_in_tree(map, name, dir, exact)
|
||||||
page.version = version.is_a?(Grit::Commit) ?
|
page.version = version.is_a?(Grit::Commit) ?
|
||||||
version : @wiki.commit_for(version)
|
version : @wiki.commit_for(version)
|
||||||
page.historical = page.version.to_s == version.to_s
|
page.historical = page.version.to_s == version.to_s
|
||||||
@@ -391,12 +391,14 @@ module Gollum
|
|||||||
# to be in. The string should
|
# to be in. The string should
|
||||||
#
|
#
|
||||||
# Returns a Gollum::Page or nil if the page could not be found.
|
# Returns a Gollum::Page or nil if the page could not be found.
|
||||||
def find_page_in_tree(map, name, checked_dir = nil)
|
def find_page_in_tree(map, name, checked_dir = nil, exact = false)
|
||||||
return nil if !map || name.to_s.empty?
|
return nil if !map || name.to_s.empty?
|
||||||
if checked_dir = BlobEntry.normalize_dir(checked_dir)
|
if checked_dir = BlobEntry.normalize_dir(checked_dir)
|
||||||
checked_dir.downcase!
|
checked_dir.downcase!
|
||||||
end
|
end
|
||||||
|
|
||||||
|
checked_dir = '' if exact && checked_dir.nil?
|
||||||
|
|
||||||
map.each do |entry|
|
map.each do |entry|
|
||||||
next if entry.name.to_s.empty?
|
next if entry.name.to_s.empty?
|
||||||
next unless checked_dir.nil? || entry.dir.downcase == checked_dir
|
next unless checked_dir.nil? || entry.dir.downcase == checked_dir
|
||||||
|
|||||||
+4
-4
@@ -196,9 +196,9 @@ module Gollum
|
|||||||
# dir - The directory String relative to the repo.
|
# dir - The directory String relative to the repo.
|
||||||
#
|
#
|
||||||
# Returns a Gollum::Page or nil if no matching page was found.
|
# Returns a Gollum::Page or nil if no matching page was found.
|
||||||
def page(name, version = @ref, dir = nil)
|
def page(name, version = @ref, dir = nil, exact = false)
|
||||||
version = @ref if version.nil?
|
version = @ref if version.nil?
|
||||||
@page_class.new(self).find(name, version, dir)
|
@page_class.new(self).find(name, version, dir, exact)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Public: Convenience method instead of calling page(name, nil, dir).
|
# Public: Convenience method instead of calling page(name, nil, dir).
|
||||||
@@ -208,8 +208,8 @@ module Gollum
|
|||||||
# dir - The directory String relative to the repo.
|
# dir - The directory String relative to the repo.
|
||||||
#
|
#
|
||||||
# Returns a Gollum::Page or nil if no matching page was found.
|
# Returns a Gollum::Page or nil if no matching page was found.
|
||||||
def paged(name, dir = nil, version = @ref)
|
def paged(name, dir = nil, exact = false, version = @ref)
|
||||||
page(name, version, dir)
|
page(name, version, dir, exact)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Public: Get the static file for a given name.
|
# Public: Get the static file for a given name.
|
||||||
|
|||||||
@@ -50,6 +50,14 @@ context "Frontend" do
|
|||||||
assert_not_equal page_1.version.sha, page_2.version.sha
|
assert_not_equal page_1.version.sha, page_2.version.sha
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test "edit page with slash" do
|
||||||
|
page_1 = @wiki.page('A')
|
||||||
|
post "/edit/A", :content => 'abc', :page => 'A', :path => '/////',
|
||||||
|
:format => page_1.format, :message => 'def'
|
||||||
|
follow_redirect!
|
||||||
|
assert last_response.ok?
|
||||||
|
end
|
||||||
|
|
||||||
test "edits page header footer and sidebar" do
|
test "edits page header footer and sidebar" do
|
||||||
commits = @wiki.repo.commits('master').size
|
commits = @wiki.repo.commits('master').size
|
||||||
page_1 = @wiki.page('A')
|
page_1 = @wiki.page('A')
|
||||||
@@ -176,6 +184,7 @@ context "Frontend" do
|
|||||||
name = "A"
|
name = "A"
|
||||||
post "/create", :content => 'abc', :page => name,
|
post "/create", :content => 'abc', :page => name,
|
||||||
:format => 'markdown', :message => 'def'
|
:format => 'markdown', :message => 'def'
|
||||||
|
follow_redirect!
|
||||||
assert last_response.ok?
|
assert last_response.ok?
|
||||||
|
|
||||||
@wiki.clear_cache
|
@wiki.clear_cache
|
||||||
|
|||||||
+2
-1
@@ -99,7 +99,8 @@ context "Page" do
|
|||||||
test "cname" do
|
test "cname" do
|
||||||
assert_equal "Foo", Gollum::Page.cname("Foo")
|
assert_equal "Foo", Gollum::Page.cname("Foo")
|
||||||
assert_equal "Foo-Bar", Gollum::Page.cname("Foo Bar")
|
assert_equal "Foo-Bar", Gollum::Page.cname("Foo Bar")
|
||||||
assert_equal "Foo---Bar", Gollum::Page.cname("Foo / Bar")
|
# / is now a directory delimiter so it must be preserved
|
||||||
|
assert_equal "Foo-/-Bar", Gollum::Page.cname("Foo / Bar")
|
||||||
assert_equal "José", Gollum::Page.cname("José")
|
assert_equal "José", Gollum::Page.cname("José")
|
||||||
assert_equal "モルドール", Gollum::Page.cname("モルドール")
|
assert_equal "モルドール", Gollum::Page.cname("モルドール")
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user