gollum 2.6.0 → 2.7.0

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.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4f1fd022c60a1f76f6089b8abf1ce266c614c0c5
4
- data.tar.gz: acd811fd1f8208bbce1c0478d76fbadf01384c70
3
+ metadata.gz: cfff52d8969895eec3a33d0af52d563f551e2dac
4
+ data.tar.gz: de29e6aac5aba83a16f867d318e15f96620ef675
5
5
  SHA512:
6
- metadata.gz: dab40d9d3d84550c9d3ee33189645d95d63cd60b4b98e5dc4ee4e9a00d24e11ccf0fccac1eb9a0efe3df22a29e3f382b640cacc4f85ce3a9045c6b1cc906f898
7
- data.tar.gz: 840edf30f8f864272f7a241d642d7553589b4d5f4527a00724ae8eb27e62381fda76f8a3b0391dc43568544ff76711e9a73f31e334693f13f16fcad805a33839
6
+ metadata.gz: ecfb6ba982e9f881ede96b39efe47a852ab4f118fa8db1dfa1a5f3d2bb7801151519bb18c87231f25982b24b774ec87da4fb1695e7b076818e3ec18bfc0d410d
7
+ data.tar.gz: 1638d6809a62ad4c56b63117b2d15bd0703d4b8eeaaf4ae8d123a249501ff32ae32aaf66f72534e8ed7c70f7513bb248d1accf93502ccfc32a1cb29f5c2b6c34
data/README.md CHANGED
@@ -7,7 +7,7 @@ gollum -- A wiki built on top of Git
7
7
 
8
8
  ## DESCRIPTION
9
9
 
10
- Gollum is a simple wiki system built on top of Git that powers GitHub Wikis.
10
+ Gollum is a simple wiki system built on top of Git.
11
11
 
12
12
  Gollum wikis are simply Git repositories that adhere to a specific format.
13
13
  Gollum pages may be written in a variety of formats and can be edited in a
@@ -23,7 +23,7 @@ Gollum follows the rules of [Semantic Versioning](http://semver.org/) and uses
23
23
  ## SYSTEM REQUIREMENTS
24
24
 
25
25
  - Python 2.5+ (2.7.3 recommended)
26
- - Ruby 1.8.7+ (1.9.3 recommended)
26
+ - Ruby 1.9.3+ (1.9.3 recommended)
27
27
  - Unix like operating system (OS X, Ubuntu, Debian, and more)
28
28
  - Will not work on Windows (because of [grit](https://github.com/github/grit))
29
29
 
@@ -91,6 +91,32 @@ utility, you can run it like so:
91
91
  $ gollum --help
92
92
  ```
93
93
 
94
+ This will show you the options you can pass as arguments to the `gollum` command:
95
+
96
+ ```bash
97
+ Options:
98
+ --port [PORT] Bind port (default 4567).
99
+ --host [HOST] Hostname or IP address to listen on (default 0.0.0.0).
100
+ --version Display current version.
101
+ --config [CONFIG] Path to additional configuration file
102
+ --irb Start an irb process with gollum loaded for the current wiki.
103
+ --css Inject custom css. Uses custom.css from root repository
104
+ --js Inject custom js. Uses custom.js from root repository
105
+ --template-dir [PATH] Specify custom template directory
106
+ --page-file-dir [PATH] Specify the sub directory for all page files (default: repository root).
107
+ --base-path [PATH] Specify the base path.
108
+ --gollum-path [PATH] Specify the gollum path.
109
+ --ref [REF] Specify the repository ref to use (default: master).
110
+ --no-live-preview Disables livepreview.
111
+ --live-preview Enables livepreview.
112
+ --allow-uploads Allows file uploads.
113
+ --mathjax Enables mathjax.
114
+ --user-icons [SOURCE] Set the history user icons. Valid values: gravatar, identicon, none. Default: none.
115
+ --show-all Shows all files in file view. By default only valid pages are shown.
116
+ --collapse-tree Collapse file view tree. By default, expanded tree is shown.
117
+ --h1-title Sets page title to value of first h1
118
+ ```
119
+
94
120
  Note that the gollum server will not run on Windows because of [an issue](https://github.com/rtomayko/posix-spawn/issues/9) with posix-spawn (which is used by Grit).
95
121
 
96
122
  ### RACK
data/bin/gollum CHANGED
@@ -84,8 +84,9 @@ opts = OptionParser.new do |opts|
84
84
  wiki_options[:live_preview] = true
85
85
  end
86
86
 
87
- opts.on("--allow-uploads", "Allows file uploads.") do
87
+ opts.on("--allow-uploads [MODE]", [:dir, :page], "Allows file uploads. Modes: dir (default, store all uploads in the same directory), page (store each upload at the same location as the page).") do |mode|
88
88
  wiki_options[:allow_uploads] = true
89
+ wiki_options[:per_page_uploads] = true if mode == :page
89
90
  end
90
91
 
91
92
  opts.on("--mathjax", "Enables mathjax.") do
@@ -2,31 +2,32 @@ Sanitization Rules
2
2
  ==================
3
3
 
4
4
  Gollum uses the [Sanitize](http://wonko.com/post/sanitize) gem for HTML
5
- sanitization.
5
+ sanitization. Below you find the default allowed tags, attributes, and protocols, as well as directions to customize these settings.
6
6
 
7
- See `lib/gollum.rb` for actual settings.
7
+ # Default Settings
8
8
 
9
9
  ## ALLOWED TAGS
10
10
 
11
- a, abbr, acronym, address, area, b, big, blockquote, br, button, caption,
12
- center, cite, code, col, colgroup, dd, del, dfn, dir, div, dl, dt, em,
13
- fieldset, font, form, h1, h2, h3, h4, h5, h6, hr, i, img, input, ins, kbd,
14
- label, legend, li, map, menu, ol, optgroup, option, p, pre, q, s, samp,
15
- select, small, span, strike, strong, sub, sup, table, tbody, td, textarea,
16
- tfoot, th, thead, tr, tt, u, ul, var
11
+ a, abbr, acronym, address, area, b, big, blockquote, br, button, caption, center, cite, code, col, colgroup, dd, del, dfn, dir, div, dl, dt, em, fieldset, font, form, h1, h2, h3, h4, h5, h6, hr, i, img, input, ins, kbd, label, legend, li, map, menu, ol, optgroup, option, p, pre, q, s, samp, select, small, span, strike, strong, sub, sup, table, tbody, td, textarea, tfoot, th, thead, tr, tt, u, ul, var
17
12
 
18
13
  ## ALLOWED ATTRIBUTES
19
14
 
20
- abbr, accept, accept-charset, accesskey, action, align, alt, axis, border,
21
- cellpadding, cellspacing, char, charoff, charset, checked, cite, class, clear,
22
- cols, colspan, color, compact, coords, datetime, dir, disabled, enctype, for,
23
- frame, headers, height, href, hreflang, hspace, id, ismap, label, lang,
24
- longdesc, maxlength, media, method, multiple, name, nohref, noshade, nowrap,
25
- prompt, readonly, rel, rev, rows, rowspan, rules, scope, selected, shape,
26
- size, span, src, start, summary, tabindex, target, title, type, usemap,
27
- valign, value, vspace, width
15
+ a href, abbr, accept, accept-charset, accesskey, action, align, alt, axis, border, cellpadding, cellspacing, char, charoff, class, charset, checked, cite, clear, cols, colspan, color, compact, coords, datetime, dir, disabled, enctype, for, frame, headers, height, hreflang, hspace, id, img src, ismap, label, lang, longdesc, maxlength, media, method, multiple, name, nohref, noshade, nowrap, prompt, readonly, rel, rev, rows, rowspan, rules, scope, selected, shape, size, span, start, summary, tabindex, target, title, type, usemap, valign, value, vspace, width
28
16
 
29
17
  ## ALLOWED PROTOCOLS
30
18
 
31
- a href: http, https, mailto
32
- img src: http, https
19
+ * a href: http, https, mailto, ftp, irc, apt, :relative
20
+ * img src: http, https, :relative
21
+ * form action: http, https, :relative
22
+
23
+ # Customizing
24
+
25
+ To customize these settings, edit your `config.rb` file along the following lines (be sure to run gollum with the `--config` option):
26
+
27
+ ```ruby
28
+ sanitizer = Gollum::Sanitization.new
29
+ sanitizer.protocols['a']['href'].concat ['ssh', 'vnc'] # Protocols
30
+ sanitizer.elements.concat ['customtag1', 'customtag2'] # Tags
31
+ sanitizer.attributes['a'].push 'target' # Attributes
32
+ Precious::App.set(:wiki_options, {:sanitization => sanitizer})
33
+ ```
@@ -5,8 +5,8 @@ Gem::Specification.new do |s|
5
5
  s.required_ruby_version = ">= 1.9"
6
6
 
7
7
  s.name = 'gollum'
8
- s.version = '2.6.0'
9
- s.date = '2014-01-02'
8
+ s.version = '2.7.0'
9
+ s.date = '2014-02-20'
10
10
  s.rubyforge_project = 'gollum'
11
11
  s.license = 'MIT'
12
12
 
@@ -24,7 +24,7 @@ Gem::Specification.new do |s|
24
24
  s.rdoc_options = ["--charset=UTF-8"]
25
25
  s.extra_rdoc_files = %w[README.md LICENSE]
26
26
 
27
- s.add_dependency 'gollum-lib', '~> 1.0', '>= 1.0.9'
27
+ s.add_dependency 'gollum-lib', '~> 2.0'
28
28
  s.add_dependency 'github-markdown', '~> 0.5.5'
29
29
  s.add_dependency 'sinatra', '~> 1.4', '>= 1.4.3'
30
30
  s.add_dependency 'mustache', ['>= 0.99.4', '< 1.0.0']
@@ -53,6 +53,7 @@ Gem::Specification.new do |s|
53
53
  lib/gollum/public/gollum/css/editor.css
54
54
  lib/gollum/public/gollum/css/gollum.css
55
55
  lib/gollum/public/gollum/css/ie7.css
56
+ lib/gollum/public/gollum/css/print.css
56
57
  lib/gollum/public/gollum/css/template.css
57
58
  lib/gollum/public/gollum/images/dirty-shade.png
58
59
  lib/gollum/public/gollum/images/fileview/document.png
@@ -16,7 +16,7 @@ require File.expand_path('../gollum/uri_encode_component', __FILE__)
16
16
  $KCODE = 'U' if RUBY_VERSION[0,3] == '1.8'
17
17
 
18
18
  module Gollum
19
- VERSION = '2.6.0'
19
+ VERSION = '2.7.0'
20
20
 
21
21
  def self.assets_path
22
22
  ::File.expand_path('gollum/public', ::File.dirname(__FILE__))
@@ -163,7 +163,7 @@ module Precious
163
163
  tempfile = params[:file][:tempfile]
164
164
  end
165
165
 
166
- dir = 'uploads'
166
+ dir = wiki.per_page_uploads ? params[:upload_dest] : 'uploads'
167
167
  ext = ::File.extname(fullname)
168
168
  format = ext.split('.').last || 'txt'
169
169
  filename = ::File.basename(fullname, ext)
@@ -173,7 +173,7 @@ module Precious
173
173
  head = wiki.repo.head
174
174
 
175
175
  options = {
176
- :message => "Uploaded file to uploads/#{reponame}",
176
+ :message => "Uploaded file to #{dir}/#{reponame}",
177
177
  :parent => wiki.repo.head.commit,
178
178
  }
179
179
  author = session['gollum.author']
@@ -189,7 +189,7 @@ module Precious
189
189
  committer.update_working_dir(dir, filename, format)
190
190
  end
191
191
  committer.commit
192
- redirect to('/')
192
+ redirect to(request.referer)
193
193
  rescue Gollum::DuplicatePageError => e
194
194
  @message = "Duplicate page: #{e.message}"
195
195
  mustache :error
@@ -255,7 +255,9 @@ module Precious
255
255
  name = wikip.name
256
256
  wiki = wikip.wiki
257
257
  page = wikip.page
258
- wiki.delete_page(page, { :message => "Destroyed #{name} (#{page.format})" })
258
+ unless page.nil?
259
+ wiki.delete_page(page, { :message => "Destroyed #{name} (#{page.format})" })
260
+ end
259
261
 
260
262
  redirect to('/')
261
263
  end
@@ -341,8 +343,12 @@ module Precious
341
343
  get '/history/*' do
342
344
  @page = wiki_page(params[:splat].first).page
343
345
  @page_num = [params[:page].to_i, 1].max
344
- @versions = @page.versions :page => @page_num
345
- mustache :history
346
+ unless @page.nil?
347
+ @versions = @page.versions :page => @page_num
348
+ mustache :history
349
+ else
350
+ redirect to("/")
351
+ end
346
352
  end
347
353
 
348
354
  post '/compare/*' do
@@ -447,9 +453,14 @@ module Precious
447
453
  @page = page
448
454
  @name = name
449
455
  @content = page.formatted_data
456
+ @upload_dest = settings.wiki_options[:allow_uploads] ?
457
+ (settings.wiki_options[:per_page_uploads] ?
458
+ "#{path}/#{@name}".sub(/^\/\//, '') : 'uploads'
459
+ ) : ''
450
460
 
451
461
  # Extensions and layout data
452
462
  @editable = true
463
+ @page_exists = !page.versions.empty?
453
464
  @toc_content = wiki.universal_toc ? @page.toc_data : nil
454
465
  @mathjax = wiki.mathjax
455
466
  @h1_title = wiki.h1_title
@@ -0,0 +1,14 @@
1
+
2
+ /*
3
+ print.css
4
+ Removes the action buttons at the top and
5
+ the delete link at the bottom for better printing.
6
+ */
7
+
8
+ ul.actions {
9
+ display: none;
10
+ }
11
+
12
+ #delete-link {
13
+ display: none;
14
+ }
@@ -241,7 +241,7 @@ a.absent {
241
241
  .markdown-body table tr th,
242
242
  .markdown-body table tr td {
243
243
  border: 1px solid #ccc;
244
- text-align: left;
244
+ text-align: none;
245
245
  margin: 0;
246
246
  padding: 6px 13px;
247
247
  }
@@ -99,6 +99,8 @@
99
99
 
100
100
  html += '<form method=post enctype="multipart/form-data" ' +
101
101
  'action="' + action + '" ' + 'id="' + id + '">';
102
+ html += '<input type="hidden" name="upload_dest" value="' +
103
+ uploadDest + '">';
102
104
  html += '<input type=file name="' + name + '">';
103
105
  html += '</form>';
104
106
 
@@ -155,7 +155,7 @@ $(document).ready(function() {
155
155
  fields: [
156
156
  {
157
157
  type: 'file',
158
- context: 'Your uploaded file will be accessible at /uploads/[filename]',
158
+ context: 'Your uploaded file will be accessible at<br>/'+uploadDest+'/[filename]',
159
159
  action: baseUrl + '/uploadFile'
160
160
  }
161
161
  ],
@@ -6,6 +6,7 @@
6
6
  <link rel="stylesheet" type="text/css" href="{{base_url}}/css/editor.css" media="all">
7
7
  <link rel="stylesheet" type="text/css" href="{{base_url}}/css/dialog.css" media="all">
8
8
  <link rel="stylesheet" type="text/css" href="{{base_url}}/css/template.css" media="all">
9
+ <link rel="stylesheet" type="text/css" href="{{base_url}}/css/print.css" media="print">
9
10
  {{#css}}<link rel="stylesheet" type="text/css" href="{{base_url}}/custom.css" media="all">{{/css}}
10
11
  {{#noindex}}<meta name="robots" content="noindex, nofollow" />{{/noindex}}
11
12
 
@@ -17,6 +18,7 @@
17
18
  var baseUrl = '{{base_url}}';
18
19
  {{#page}}
19
20
  var pageFullPath = '{{url_path_display}}';
21
+ var uploadDest = '{{upload_dest}}';
20
22
  {{/page}}
21
23
  </script>
22
24
  <script type="text/javascript" src="{{base_url}}/javascript/jquery-1.7.2.min.js"></script>
@@ -30,8 +30,11 @@ Mousetrap.bind(['e'], function( e ) {
30
30
  <li class="minibutton"><a href="{{base_url}}/edit/{{escaped_url_path}}"
31
31
  class="action-edit-page">Edit</a></li>
32
32
  {{/editable}}
33
+ {{#page_exists}}
34
+ <li class="minibutton jaws">
33
35
  <li class="minibutton"><a href="{{base_url}}/history/{{escaped_url_path}}"
34
36
  class="action-page-history">History</a></li>
37
+ {{/page_exists}}
35
38
  </ul>
36
39
  </div>
37
40
  <div id="wiki-content">
@@ -43,9 +43,17 @@ module Precious
43
43
  @editable
44
44
  end
45
45
 
46
+ def page_exists
47
+ @page_exists
48
+ end
49
+
46
50
  def allow_uploads
47
51
  @allow_uploads
48
52
  end
53
+
54
+ def upload_dest
55
+ @upload_dest
56
+ end
49
57
 
50
58
  def has_header
51
59
  @header = (@page.header || false) if @header.nil?
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.6.0
4
+ version: 2.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Preston-Werner
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-01-02 00:00:00.000000000 Z
12
+ date: 2014-02-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: gollum-lib
@@ -17,20 +17,14 @@ dependencies:
17
17
  requirements:
18
18
  - - ~>
19
19
  - !ruby/object:Gem::Version
20
- version: '1.0'
21
- - - '>='
22
- - !ruby/object:Gem::Version
23
- version: 1.0.9
20
+ version: '2.0'
24
21
  type: :runtime
25
22
  prerelease: false
26
23
  version_requirements: !ruby/object:Gem::Requirement
27
24
  requirements:
28
25
  - - ~>
29
26
  - !ruby/object:Gem::Version
30
- version: '1.0'
31
- - - '>='
32
- - !ruby/object:Gem::Version
33
- version: 1.0.9
27
+ version: '2.0'
34
28
  - !ruby/object:Gem::Dependency
35
29
  name: github-markdown
36
30
  requirement: !ruby/object:Gem::Requirement
@@ -167,6 +161,7 @@ files:
167
161
  - lib/gollum/public/gollum/css/editor.css
168
162
  - lib/gollum/public/gollum/css/gollum.css
169
163
  - lib/gollum/public/gollum/css/ie7.css
164
+ - lib/gollum/public/gollum/css/print.css
170
165
  - lib/gollum/public/gollum/css/template.css
171
166
  - lib/gollum/public/gollum/images/dirty-shade.png
172
167
  - lib/gollum/public/gollum/images/fileview/document.png
@@ -674,4 +669,3 @@ signing_key:
674
669
  specification_version: 2
675
670
  summary: A simple, Git-powered wiki.
676
671
  test_files: []
677
- has_rdoc: