gollum 2.1.7 → 2.1.8
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of gollum might be problematic. Click here for more details.
- data/gollum.gemspec +2 -2
- data/lib/gollum.rb +2 -1
- data/lib/gollum/committer.rb +7 -3
- data/lib/gollum/frontend/app.rb +0 -1
- data/lib/gollum/frontend/public/gollum/livepreview/index.html +1 -1
- data/lib/gollum/frontend/public/gollum/livepreview/js/livepreview.js +23 -8
- data/lib/gollum/frontend/views/edit.rb +5 -0
- metadata +2 -2
data/gollum.gemspec
CHANGED
@@ -5,8 +5,8 @@ Gem::Specification.new do |s|
|
|
5
5
|
s.required_ruby_version = ">= 1.8.7"
|
6
6
|
|
7
7
|
s.name = 'gollum'
|
8
|
-
s.version = '2.1.
|
9
|
-
s.date = '2012-08-
|
8
|
+
s.version = '2.1.8'
|
9
|
+
s.date = '2012-08-30'
|
10
10
|
s.rubyforge_project = 'gollum'
|
11
11
|
|
12
12
|
s.summary = "A simple, Git-powered wiki."
|
data/lib/gollum.rb
CHANGED
@@ -20,9 +20,10 @@ require File.expand_path('../gollum/markup', __FILE__)
|
|
20
20
|
require File.expand_path('../gollum/sanitization', __FILE__)
|
21
21
|
require File.expand_path('../gollum/tex', __FILE__)
|
22
22
|
require File.expand_path('../gollum/web_sequence_diagram', __FILE__)
|
23
|
+
require File.expand_path('../gollum/frontend/uri_encode_component', __FILE__)
|
23
24
|
|
24
25
|
module Gollum
|
25
|
-
VERSION = '2.1.
|
26
|
+
VERSION = '2.1.8'
|
26
27
|
|
27
28
|
def self.assets_path
|
28
29
|
::File.expand_path('gollum/frontend/public', ::File.dirname(__FILE__))
|
data/lib/gollum/committer.rb
CHANGED
@@ -100,9 +100,13 @@ module Gollum
|
|
100
100
|
|
101
101
|
tree.blobs.each do |blob|
|
102
102
|
next if page_path_scheduled_for_deletion?(index.tree, fullpath)
|
103
|
-
|
104
|
-
|
105
|
-
|
103
|
+
|
104
|
+
existing_file = blob.name.downcase.sub(/\.\w+$/, '')
|
105
|
+
existing_file_ext = ::File.extname(blob.name).sub(/^\./, '')
|
106
|
+
|
107
|
+
new_file_ext = ::File.extname(path).sub(/^\./, '')
|
108
|
+
|
109
|
+
if downpath == existing_file && !(allow_same_ext && new_file_ext == existing_file_ext)
|
106
110
|
raise DuplicatePageError.new(dir, blob.name, path)
|
107
111
|
end
|
108
112
|
end
|
data/lib/gollum/frontend/app.rb
CHANGED
@@ -16,7 +16,7 @@
|
|
16
16
|
<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>
|
17
17
|
</div>
|
18
18
|
|
19
|
-
<div class='editor_bg'></div>
|
19
|
+
<div id='editor_bg' class='editor_bg'></div>
|
20
20
|
<div class='toolpanel_bg'></div>
|
21
21
|
|
22
22
|
<div id='commenttoolpanel' class='toolpanel edit' style='width: 500px; right: 0px; '>
|
@@ -62,9 +62,10 @@ initAce( commentEditor, commentEditorSession );
|
|
62
62
|
var baseUrl = location.pathname.split('/').slice(0,-2).join('/');
|
63
63
|
|
64
64
|
// RegExp from http://stackoverflow.com/questions/901115/get-query-string-values-in-javascript
|
65
|
+
// Returns value on success and undefined on failure.
|
65
66
|
$.key = function( key ) {
|
66
67
|
var value = new RegExp( '[\\?&]' + key + '=([^&#]*)' ).exec( location.href );
|
67
|
-
return ( !value ) ?
|
68
|
+
return ( !value ) ? undefined : value[ 1 ] || undefined;
|
68
69
|
}
|
69
70
|
|
70
71
|
// True if &create=true
|
@@ -73,10 +74,6 @@ var create = $.key( 'create' );
|
|
73
74
|
var pageName = $.key( 'page' );
|
74
75
|
var pathName = $.key( 'path' );
|
75
76
|
|
76
|
-
if ( pathName === 0 ) {
|
77
|
-
pathName = undefined;
|
78
|
-
}
|
79
|
-
|
80
77
|
defaultCommitMessage = function() {
|
81
78
|
var msg = pageName + ' (markdown)';
|
82
79
|
|
@@ -100,7 +97,7 @@ $.save = function( commitMessage ) {
|
|
100
97
|
var newLocation = baseUrl;
|
101
98
|
|
102
99
|
function clean( str ) {
|
103
|
-
return str.replace(
|
100
|
+
return str.replace(/^\/+/, '/');
|
104
101
|
}
|
105
102
|
|
106
103
|
// 'a%2Fb' => a/b
|
@@ -341,10 +338,23 @@ var applyTimeout = function () {
|
|
341
338
|
/* Load markdown from /data/page into the ace editor.
|
342
339
|
~-1 == false; !~-1 == true;
|
343
340
|
*/
|
344
|
-
if ( !~location.host.indexOf('github.com') ) {
|
341
|
+
if ( !~ location.host.indexOf( 'github.com' ) ) {
|
342
|
+
|
343
|
+
// returns unescaped key with leading slashes removed
|
344
|
+
function key_no_leading_slash( key ) {
|
345
|
+
return unescape( $.key( key ) || '' ).replace( /^\/+/, '' );
|
346
|
+
}
|
347
|
+
|
348
|
+
// ensure leading / is removed from path and that it ends with /
|
349
|
+
var path = key_no_leading_slash( 'path' );
|
350
|
+
// don't append '/' if path is empty from removing leading slash
|
351
|
+
if ( path !== '' && path.charAt( path.length - 1 ) !== '/' ) {
|
352
|
+
path += '/';
|
353
|
+
}
|
354
|
+
|
345
355
|
jQuery.ajax( {
|
346
356
|
type: 'GET',
|
347
|
-
url: baseUrl + '/data/' +
|
357
|
+
url: baseUrl + '/data/' + path + key_no_leading_slash( 'page' ),
|
348
358
|
success: function( data ) {
|
349
359
|
editorSession.setValue( data );
|
350
360
|
}
|
@@ -455,6 +465,11 @@ var applyTimeout = function () {
|
|
455
465
|
|
456
466
|
win.jsm.resize = resize;
|
457
467
|
|
468
|
+
// remove editor_bg after loading because
|
469
|
+
// it'll cause problems if toggle left right is used
|
470
|
+
var ebg = doc.getElementById('editor_bg');
|
471
|
+
ebg.parentNode.removeChild(ebg);
|
472
|
+
|
458
473
|
/*
|
459
474
|
Resize can be called an absurd amount of times
|
460
475
|
and will crash the page without debouncing.
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gollum
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.8
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-08-
|
13
|
+
date: 2012-08-30 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: grit
|