Compare commits
14 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| be366f8103 | |||
| 2d13bd796f | |||
| 523f8f80ca | |||
| b76fef9143 | |||
| e935af83d5 | |||
| d4e019ef42 | |||
| 2e738828c6 | |||
| fd7dc93778 | |||
| 3df407d9ee | |||
| 6fbba84725 | |||
| 37d20fa9cc | |||
| 410cd912ac | |||
| d234bbd861 | |||
| 43d2143506 |
@@ -520,8 +520,10 @@ your changes merged back into core is as follows:
|
||||
1. Send a pull request to the github/gollum project.
|
||||
|
||||
## RELEASING
|
||||
|
||||
Update VERSION in lib/gollum.rb
|
||||
$ rake gemspec
|
||||
$ git tag vX.Y.Z
|
||||
$ git push origin vX.Y.Z
|
||||
$ gem build gollum.gemspec
|
||||
$ gem push gollum-X.Y.Z.gem
|
||||
|
||||
|
||||
+2
-2
@@ -5,8 +5,8 @@ Gem::Specification.new do |s|
|
||||
s.required_ruby_version = ">= 1.8.7"
|
||||
|
||||
s.name = 'gollum'
|
||||
s.version = '2.1.2'
|
||||
s.date = '2012-08-06'
|
||||
s.version = '2.1.4'
|
||||
s.date = '2012-08-15'
|
||||
s.rubyforge_project = 'gollum'
|
||||
|
||||
s.summary = "A simple, Git-powered wiki."
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@ require File.expand_path('../gollum/tex', __FILE__)
|
||||
require File.expand_path('../gollum/web_sequence_diagram', __FILE__)
|
||||
|
||||
module Gollum
|
||||
VERSION = '2.1.2'
|
||||
VERSION = '2.1.4'
|
||||
|
||||
def self.assets_path
|
||||
::File.expand_path('gollum/frontend/public', ::File.dirname(__FILE__))
|
||||
|
||||
@@ -82,12 +82,12 @@ module Precious
|
||||
end
|
||||
|
||||
before do
|
||||
@base_url = url('/', false)
|
||||
@base_url = url('/', false).chomp('/')
|
||||
settings.wiki_options.merge!({ :base_path => @base_url }) unless settings.wiki_options.has_key? :base_path
|
||||
end
|
||||
|
||||
get '/' do
|
||||
show_page_or_file('Home')
|
||||
redirect File.join(settings.wiki_options[:base_path].to_s, 'Home')
|
||||
end
|
||||
|
||||
# path is set to name if path is nil.
|
||||
|
||||
@@ -277,7 +277,7 @@
|
||||
}
|
||||
|
||||
// attempt to load the definition for this language
|
||||
var script_uri = '.' + baseUrl + '/javascript/editor/langs/' + markup_name + '.js';
|
||||
var script_uri = baseUrl + '/javascript/editor/langs/' + markup_name + '.js';
|
||||
$.ajax({
|
||||
url: script_uri,
|
||||
dataType: 'script',
|
||||
|
||||
@@ -4,7 +4,7 @@ $(document).ready(function() {
|
||||
var ok = confirm($(this).data('confirm'));
|
||||
if ( ok ) {
|
||||
var loc = window.location;
|
||||
loc = baseUrl + 'delete' + loc.pathname
|
||||
loc = baseUrl + '/delete' + loc.pathname
|
||||
window.location = loc;
|
||||
}
|
||||
// Don't navigate on cancel.
|
||||
@@ -138,7 +138,7 @@ $(document).ready(function() {
|
||||
var msg = 'Renamed ' + oldName + ' to ' + newName;
|
||||
jQuery.ajax( {
|
||||
type: 'POST',
|
||||
url: baseUrl + 'edit/' + oldName,
|
||||
url: baseUrl + '/edit/' + oldName,
|
||||
data: { path: path, rename: newName, page: oldName, message: msg },
|
||||
success: function() {
|
||||
window.location = baseUrl + encodeURIComponent(newName);
|
||||
|
||||
@@ -6,11 +6,11 @@
|
||||
<li class="minibutton">
|
||||
{{>searchbar}}
|
||||
</li>
|
||||
<li class="minibutton"><a href="{{base_url}}{{escaped_url_path}}"
|
||||
<li class="minibutton"><a href="{{base_url}}/{{escaped_url_path}}"
|
||||
class="action-view-page">View Page</a></li>
|
||||
<li class="minibutton"><a href="{{base_url}}edit/{{escaped_url_path}}"
|
||||
<li class="minibutton"><a href="{{base_url}}/edit/{{escaped_url_path}}"
|
||||
class="action-edit-page">Edit Page</a></li>
|
||||
<li class="minibutton"><a href="{{base_url}}history/{{escaped_url_path}}"
|
||||
<li class="minibutton"><a href="{{base_url}}/history/{{escaped_url_path}}"
|
||||
class="action-page-history">Page History</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
@@ -23,10 +23,10 @@
|
||||
|
||||
{{#show_revert}}
|
||||
<ul class="actions">
|
||||
<li class="minibutton"><a href="{{base_url}}history/{{escaped_url_path}}"
|
||||
<li class="minibutton"><a href="{{base_url}}/history/{{escaped_url_path}}"
|
||||
class="action-page-history">Back to Page History</a></li>
|
||||
<li class="minibutton">
|
||||
<form name="gollum-revert" action="{{base_url}}revert/{{escaped_url_path}}/{{before}}/{{after}}" method="post" id="gollum-revert-form">
|
||||
<form name="gollum-revert" action="{{base_url}}/revert/{{escaped_url_path}}/{{before}}/{{after}}" method="post" id="gollum-revert-form">
|
||||
<a href="#" class="gollum-revert-button">Revert Changes</a>
|
||||
</form>
|
||||
</li>
|
||||
@@ -49,7 +49,7 @@
|
||||
</div>
|
||||
<div id="footer">
|
||||
<ul class="actions">
|
||||
<li class="minibutton"><a href="{{base_url}}history/{{escaped_url_path}}"
|
||||
<li class="minibutton"><a href="{{base_url}}/history/{{escaped_url_path}}"
|
||||
class="action-page-history">Back to Page History</a></li>
|
||||
{{#show_revert}}
|
||||
<li class="minibutton">
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
<div id="head">
|
||||
<h1>Editing <strong>{{title}}</strong></h1>
|
||||
<ul class="actions">
|
||||
<li class="minibutton"><a href="{{base_url}}{{escaped_url_path}}"
|
||||
<li class="minibutton"><a href="{{base_url}}/{{escaped_url_path}}"
|
||||
class="action-view-page">View Page</a></li>
|
||||
<li class="minibutton"><a href="{{base_url}}history/{{escaped_url_path}}"
|
||||
<li class="minibutton"><a href="{{base_url}}/history/{{escaped_url_path}}"
|
||||
class="action-page-history">Page History</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<div id="gollum-editor" data-escaped-name="{{escaped_name}}" class="{{#is_create_page}}create{{/is_create_page}}{{#is_edit_page}}edit{{/is_edit_page}}">
|
||||
{{#is_create_page}}
|
||||
<form name="gollum-editor" action="{{base_url}}create" method="post">
|
||||
<form name="gollum-editor" action="{{base_url}}/create" method="post">
|
||||
{{/is_create_page}}
|
||||
{{#is_edit_page}}
|
||||
<form name="gollum-editor" action="{{base_url}}edit/{{escaped_name}}" method="post">
|
||||
<form name="gollum-editor" action="{{base_url}}/edit/{{escaped_name}}" method="post">
|
||||
{{/is_edit_page}}
|
||||
<fieldset id="gollum-editor-fields">
|
||||
{{#is_create_page}}
|
||||
@@ -126,7 +126,7 @@
|
||||
|
||||
<span class="jaws"><br></span>
|
||||
<input type="submit" id="gollum-editor-submit" value="Save" title="Save current changes">
|
||||
<a href="{{base_url}}preview" id="gollum-editor-preview" class="minibutton" title="Preview this Page">Preview</a>
|
||||
<a href="{{base_url}}/preview" id="gollum-editor-preview" class="minibutton" title="Preview this Page">Preview</a>
|
||||
</fieldset>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-type" content="text/html;charset=utf-8">
|
||||
<link rel="stylesheet" type="text/css" href="{{base_url}}css/gollum.css" media="all">
|
||||
<link rel="stylesheet" type="text/css" href="{{base_url}}css/template.css" media="all">
|
||||
<link rel="stylesheet" type="text/css" href="{{base_url}}css/_styles.css" media="all">
|
||||
<link rel="stylesheet" type="text/css" href="{{base_url}}/css/gollum.css" media="all">
|
||||
<link rel="stylesheet" type="text/css" href="{{base_url}}/css/template.css" media="all">
|
||||
<link rel="stylesheet" type="text/css" href="{{base_url}}/css/_styles.css" media="all">
|
||||
<title>{{title}}</title>
|
||||
</head>
|
||||
<body>
|
||||
@@ -12,7 +12,7 @@
|
||||
<div id="home_button">
|
||||
<ul class="actions">
|
||||
<li class="minibutton">
|
||||
<a href="{{base_url}}" class="action-edit-page">Home</a>
|
||||
<a href="{{base_url}}/" class="action-edit-page">Home</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
<li class="minibutton">
|
||||
{{>searchbar}}
|
||||
</li>
|
||||
<li class="minibutton"><a href="{{base_url}}{{escaped_url_path}}"
|
||||
<li class="minibutton"><a href="{{base_url}}/{{escaped_url_path}}"
|
||||
class="action-view-page">View Page</a></li>
|
||||
<li class="minibutton"><a href="{{base_url}}edit/{{escaped_url_path}}"
|
||||
<li class="minibutton"><a href="{{base_url}}/edit/{{escaped_url_path}}"
|
||||
class="action-edit-page">Edit Page</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
@@ -19,7 +19,7 @@
|
||||
</ul>
|
||||
|
||||
<form name="compare-versions" id="version-form" method="post"
|
||||
action="{{base_url}}compare/{{escaped_url_path}}">
|
||||
action="{{base_url}}/compare/{{escaped_url_path}}">
|
||||
<fieldset>
|
||||
<table>
|
||||
<tbody>
|
||||
@@ -39,7 +39,7 @@
|
||||
<td class="commit-name">
|
||||
<span class="time-elapsed">{{date}}:</span>
|
||||
{{message}}
|
||||
[<a href="{{base_url}}{{escaped_url_path}}/{{id}}" title="View commit">{{id7}}</a>]
|
||||
[<a href="{{base_url}}/{{escaped_url_path}}/{{id}}" title="View commit">{{id7}}</a>]
|
||||
</td>
|
||||
</tr>
|
||||
{{/versions}}
|
||||
|
||||
@@ -2,22 +2,22 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-type" content="text/html;charset=utf-8">
|
||||
<link rel="stylesheet" type="text/css" href="{{base_url}}css/gollum.css" media="all">
|
||||
<link rel="stylesheet" type="text/css" href="{{base_url}}css/editor.css" media="all">
|
||||
<link rel="stylesheet" type="text/css" href="{{base_url}}css/dialog.css" media="all">
|
||||
<link rel="stylesheet" type="text/css" href="{{base_url}}css/template.css" media="all">
|
||||
<link rel="stylesheet" type="text/css" href="{{base_url}}/css/gollum.css" media="all">
|
||||
<link rel="stylesheet" type="text/css" href="{{base_url}}/css/editor.css" media="all">
|
||||
<link rel="stylesheet" type="text/css" href="{{base_url}}/css/dialog.css" media="all">
|
||||
<link rel="stylesheet" type="text/css" href="{{base_url}}/css/template.css" media="all">
|
||||
|
||||
<!--[if IE 7]>
|
||||
<link rel="stylesheet" type="text/css" href="{{base_url}}css/ie7.css" media="all">
|
||||
<link rel="stylesheet" type="text/css" href="{{base_url}}/css/ie7.css" media="all">
|
||||
<![endif]-->
|
||||
|
||||
<script>var baseUrl = '{{base_url}}'</script>
|
||||
<script type="text/javascript" src="{{base_url}}javascript/jquery-1.7.2.min.js"></script>
|
||||
<script type="text/javascript" src="{{base_url}}javascript/mousetrap.min.js"></script>
|
||||
<script type="text/javascript" src="{{base_url}}javascript/gollum.js"></script>
|
||||
<script type="text/javascript" src="{{base_url}}javascript/gollum.dialog.js"></script>
|
||||
<script type="text/javascript" src="{{base_url}}javascript/gollum.placeholder.js"></script>
|
||||
<script type="text/javascript" src="{{base_url}}javascript/editor/gollum.editor.js"></script>
|
||||
<script type="text/javascript" src="{{base_url}}/javascript/jquery-1.7.2.min.js"></script>
|
||||
<script type="text/javascript" src="{{base_url}}/javascript/mousetrap.min.js"></script>
|
||||
<script type="text/javascript" src="{{base_url}}/javascript/gollum.js"></script>
|
||||
<script type="text/javascript" src="{{base_url}}/javascript/gollum.dialog.js"></script>
|
||||
<script type="text/javascript" src="{{base_url}}/javascript/gollum.placeholder.js"></script>
|
||||
<script type="text/javascript" src="{{base_url}}/javascript/editor/gollum.editor.js"></script>
|
||||
{{#mathjax}}<script>(function(d,j){
|
||||
j = d.createElement('script');
|
||||
j.src = 'https://c328740.ssl.cf1.rackcdn.com/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML';
|
||||
|
||||
@@ -5,21 +5,21 @@
|
||||
<li class="minibutton">
|
||||
{{>searchbar}}
|
||||
</li>
|
||||
<li class="minibutton"><a href="{{base_url}}"
|
||||
<li class="minibutton"><a href="{{base_url}}/"
|
||||
class="action-edit-page">Home</a></li>
|
||||
<li class="minibutton"><a href="{{base_url}}pages"
|
||||
<li class="minibutton"><a href="{{base_url}}/pages"
|
||||
class="action-all-pages">All</a></li>
|
||||
<li class="minibutton"><a href="{{base_url}}fileview"
|
||||
<li class="minibutton"><a href="{{base_url}}/fileview"
|
||||
class="action-all-pages">Files</a></li>
|
||||
<li class="minibutton" class="jaws">
|
||||
<a href="#" id="minibutton-new-page">New</a></li>
|
||||
<li class="minibutton" class="jaws">
|
||||
<a href="#" id="minibutton-rename-page">Rename</a></li>
|
||||
{{#editable}}
|
||||
<li class="minibutton"><a href="{{base_url}}edit/{{escaped_url_path}}"
|
||||
<li class="minibutton"><a href="{{base_url}}/edit/{{escaped_url_path}}"
|
||||
class="action-edit-page">Edit</a></li>
|
||||
{{/editable}}
|
||||
<li class="minibutton"><a href="{{base_url}}history/{{escaped_url_path}}"
|
||||
<li class="minibutton"><a href="{{base_url}}/history/{{escaped_url_path}}"
|
||||
class="action-page-history">History</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
@@ -62,7 +62,7 @@
|
||||
<div id="footer">
|
||||
<p id="last-edit">Last edited by <b>{{author}}</b>, {{date}}</p>
|
||||
<p>
|
||||
<a id="delete-link" href="{{base_url}}{{escaped_url_path}}" data-confirm="Are you sure you want to delete this page?"><span>Delete this Page</span></a>
|
||||
<a id="delete-link" href="{{base_url}}/{{escaped_url_path}}" data-confirm="Are you sure you want to delete this page?"><span>Delete this Page</span></a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<li class="minibutton">
|
||||
{{>searchbar}}
|
||||
</li>
|
||||
<li class="minibutton"><a href="{{base_url}}"
|
||||
<li class="minibutton"><a href="{{base_url}}/"
|
||||
class="action-edit-page">Home</a></li>
|
||||
<li class="minibutton" class="jaws">
|
||||
<a href="#" id="minibutton-new-page">New</a>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<li class="minibutton">
|
||||
{{>searchbar}}
|
||||
</li>
|
||||
<li class="minibutton"><a href="{{base_url}}"
|
||||
<li class="minibutton"><a href="{{base_url}}/"
|
||||
class="action-edit-page">Home</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
@@ -15,7 +15,7 @@
|
||||
<ul>
|
||||
{{#results}}
|
||||
<li>
|
||||
<a href="{{base_url}}{{name}}">{{name}}</a>
|
||||
<a href="{{base_url}}/{{name}}">{{name}}</a>
|
||||
<span class="count">({{count}} matches)</span>
|
||||
</li>
|
||||
{{/results}}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<div id="searchbar">
|
||||
<form action="{{base_url}}search" method="get" id="search-form">
|
||||
<form action="{{base_url}}/search" method="get" id="search-form">
|
||||
<div id="searchbar-fauxtext">
|
||||
<input type="text" name="q" id="search-query" value="Search…" autocomplete="off">
|
||||
<a href="#" id="search-submit" title="Search this wiki">
|
||||
|
||||
@@ -5,6 +5,10 @@ module Precious
|
||||
class Pages < Layout
|
||||
attr_reader :results, :ref
|
||||
|
||||
def prefix
|
||||
@base_url ? @base_url.chomp('/') + '/' : '/'
|
||||
end
|
||||
|
||||
def title
|
||||
"All pages in #{@ref}"
|
||||
end
|
||||
@@ -12,14 +16,14 @@ module Precious
|
||||
def breadcrumb
|
||||
if @path
|
||||
path = Pathname.new(@path)
|
||||
breadcrumb = [%{<a href="#{@base_url}pages/">Home</a>}]
|
||||
breadcrumb = [%{<a href="#{prefix}pages/">Home</a>}]
|
||||
path.descend do |crumb|
|
||||
title = crumb.basename
|
||||
|
||||
if title == path.basename
|
||||
breadcrumb << title
|
||||
else
|
||||
breadcrumb << %{<a href="#{@base_url}pages/#{crumb}/">#{title}</a>}
|
||||
breadcrumb << %{<a href="#{prefix}pages/#{crumb}/">#{title}</a>}
|
||||
end
|
||||
end
|
||||
|
||||
@@ -39,7 +43,7 @@ module Precious
|
||||
if page_path.include?('/')
|
||||
folder = page_path.split('/').first
|
||||
folder_path = @path ? "#{@path}/#{folder}" : folder
|
||||
folder_link = %{<li><a href="#{@base_url}pages/#{folder_path}/" class="folder">#{folder}</a></li>}
|
||||
folder_link = %{<li><a href="#{prefix}pages/#{folder_path}/" class="folder">#{folder}</a></li>}
|
||||
|
||||
unless folder_links.include?(folder_link)
|
||||
folder_links << folder_link
|
||||
@@ -47,7 +51,7 @@ module Precious
|
||||
folder_link
|
||||
end
|
||||
elsif page_path != ".gitkeep"
|
||||
%{<li><a href="#{@base_url}#{page.escaped_url_path}" class="file">#{page.name}</a></li>}
|
||||
%{<li><a href="#{prefix}#{page.escaped_url_path}" class="file">#{page.name}</a></li>}
|
||||
end
|
||||
}.compact.join("\n")
|
||||
else
|
||||
|
||||
@@ -3,6 +3,9 @@ require 'cgi'
|
||||
require 'pygments'
|
||||
require 'base64'
|
||||
|
||||
# initialize Pygments
|
||||
Pygments.start
|
||||
|
||||
module Gollum
|
||||
|
||||
class Markup
|
||||
|
||||
+30
-3
@@ -142,13 +142,14 @@ context "Frontend" do
|
||||
assert last_response.ok?
|
||||
end
|
||||
|
||||
test "page create and edit with dash" do
|
||||
test "page create and edit with dash & page rev" do
|
||||
page = 'c-d-e'
|
||||
path = 'a/b/' # path must end with /
|
||||
|
||||
post '/create', :content => 'create_msg', :page => page,
|
||||
:path => path, :format => 'markdown', :message => ''
|
||||
assert_equal 'create_msg', @wiki.paged(page, path).raw_data
|
||||
page_c = @wiki.paged(page, path)
|
||||
assert_equal 'create_msg', page_c.raw_data
|
||||
|
||||
# must clear or create_msg will be returned
|
||||
@wiki.clear_cache
|
||||
@@ -156,7 +157,19 @@ context "Frontend" do
|
||||
# post '/edit' fails. post '/edit/' works.
|
||||
post '/edit/', :content => 'edit_msg',
|
||||
:page => page, :path => path, :message => ''
|
||||
assert_equal 'edit_msg', @wiki.paged(page, path).raw_data
|
||||
page_e = @wiki.paged(page, path)
|
||||
assert_equal 'edit_msg', page_e.raw_data
|
||||
|
||||
@wiki.clear_cache
|
||||
|
||||
# test `get %r{/(.+?)/([0-9a-f]{40})} do` in app.rb
|
||||
get '/' + page_c.escaped_url_path + '/' + page_c.version.to_s
|
||||
assert last_response.ok?
|
||||
assert_match /create_msg/, last_response.body
|
||||
|
||||
get '/' + page_e.escaped_url_path + '/' + page_e.version.to_s
|
||||
assert last_response.ok?
|
||||
assert_match /edit_msg/, last_response.body
|
||||
end
|
||||
|
||||
test "guards against creation of existing page" do
|
||||
@@ -236,6 +249,20 @@ context "Frontend" do
|
||||
assert_equal page1.version.sha, page2.version.sha
|
||||
end
|
||||
|
||||
test "redirects from 'base_path' or 'base_path/' to 'base_path/Home'" do
|
||||
Precious::App.set(:wiki_options, {})
|
||||
get "/"
|
||||
assert_match "http://example.org/Home", last_response.headers['Location']
|
||||
|
||||
Precious::App.set(:wiki_options, { :base_path => '/wiki' })
|
||||
get "/"
|
||||
assert_match "http://example.org/wiki/Home", last_response.headers['Location']
|
||||
|
||||
Precious::App.set(:wiki_options, { :base_path => '/wiki/' })
|
||||
get "/"
|
||||
assert_match "http://example.org/wiki/Home", last_response.headers['Location']
|
||||
end
|
||||
|
||||
def app
|
||||
Precious::App
|
||||
end
|
||||
|
||||
@@ -34,4 +34,13 @@ context "Precious::Views::Pages" do
|
||||
@page.instance_variable_set("@results", results)
|
||||
assert_equal %{<li><a href="/Mordor/Eye-Of-Sauron" class="file">Eye Of Sauron</a></li>\n<li><a href="/pages/Mordor/Orc/" class="folder">Orc</a></li>}, @page.files_folders
|
||||
end
|
||||
|
||||
test "base url" do
|
||||
# based on test "files_folders"
|
||||
@page.instance_variable_set("@path", "Mordor")
|
||||
@page.instance_variable_set("@base_url", "/wiki")
|
||||
results = [FakeResult.new("Mordor/Eye-Of-Sauron.md"), FakeResult.new("Mordor/Orc/Saruman.md"), FakeResult.new("Mordor/.gitkeep")]
|
||||
@page.instance_variable_set("@results", results)
|
||||
assert_equal %{<li><a href="/wiki/Mordor/Eye-Of-Sauron" class="file">Eye Of Sauron</a></li>\n<li><a href="/wiki/pages/Mordor/Orc/" class="folder">Orc</a></li>}, @page.files_folders
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user