gollum 4.0.1 → 4.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/CONTRIBUTING.md +91 -0
- data/HISTORY.md +6 -0
- data/README.md +17 -75
- data/bin/gollum +21 -5
- data/gollum.gemspec +8 -5
- data/lib/gollum.rb +1 -1
- data/lib/gollum/app.rb +38 -4
- data/lib/gollum/helpers.rb +13 -0
- data/lib/gollum/public/gollum/css/_styles.css +16 -1
- data/lib/gollum/public/gollum/css/gollum.css +6 -0
- data/lib/gollum/public/gollum/images/fileview/trashcan.png +0 -0
- data/lib/gollum/public/gollum/javascript/editor/langs/markdown.js +5 -0
- data/lib/gollum/views/page.rb +2 -4
- data/lib/gollum/views/pages.rb +2 -1
- metadata +45 -15
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
NzIwMWEzNDBjM2U1NDRlYWY5YTUyNzUxMTI5YzM3ZjdiYzdiMTYwMw==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 553d5d852ae4e6dedfbe979f1918fc601dfd7d51
|
4
|
+
data.tar.gz: 312cb841cf55423cdd11db5e23a775449f5283d7
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
YThkMWFiYjc1NjFlMjhiOTMyODM3Y2JmZTgwZTE4ZDBiOWQxNmFiNTA3NDlj
|
11
|
-
YzliMWRkMWRiOWRjNGJkZGE1M2MxYWI0Zjc5ZDlhODJkOTJmYTQ=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
YjFlYTZmMDBkNTM0ZTg3ZDQ0MmUzYTc5M2RiYmRmNmNmYzM1MTZmNDliNTNi
|
14
|
-
ZTQ4N2UyMmNiZDI5ZDQ1N2Y4MTAxYmIyN2MwMzYwMjQ0MzRhYjUwMGFhOTVm
|
15
|
-
ZGY0NWY2NDVjMGVlYzcwYjE5OWZmODZjNTNlZGQ0OTljYjJkMDY=
|
6
|
+
metadata.gz: 7f66b32c3386b8856889d67a573d65a9d15f041908336c769af2481dbe06e9942b65010b543a7ff2e4a3192afe8115a6a8a1c1b8f648a8b1ff437593d89f1f42
|
7
|
+
data.tar.gz: 36434afe0a04bb7249bbcb48b65dd3f8cdec56a543ad8cb86af63c3a0550327c5e268296921d79f1f2155dcf9c263912f8e37aec9d5f8a696d1d15bf3197be39
|
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,91 @@
|
|
1
|
+
# Contributing to Gollum
|
2
|
+
|
3
|
+
Thanks for your interest in the gollum project!
|
4
|
+
|
5
|
+
## Submitting an Issue
|
6
|
+
|
7
|
+
Please note that the issue tracker is meant for:
|
8
|
+
|
9
|
+
1. Bug reports.
|
10
|
+
2. Feature requests.
|
11
|
+
|
12
|
+
If your have problems using or installing the software which stem from bugs in the software or a lack of documentation, we are always happy to help out! However, **for ordinary usage questions, please consider asking elsewhere**, for instance on [StackOverflow](http://stackoverflow.com/questions/tagged/gollum-wiki).
|
13
|
+
|
14
|
+
Gollum supports [custom macros](https://github.com/gollum/gollum/wiki#macros) for the creation of additional wiki markup tags. Please **do not** use this tracker to request macros specific to your situation. However, if you have or are working on a macro that you think may be useful to more users, you can share it as a GitHub [gist](https://gist.github.com) and link to it in the [wiki](https://github.com/gollum/gollum/wiki/Custom-macros).
|
15
|
+
|
16
|
+
Before submitting an issue, **please carefully look through the following places** to make sure your problem is not already addressed:
|
17
|
+
|
18
|
+
1. The issue tracker.
|
19
|
+
1. The [README](https://github.com/gollum/gollum/blob/master/README.md).
|
20
|
+
1. The project's [wiki](https://github.com/gollum/gollum/wiki).
|
21
|
+
|
22
|
+
Lastly, please **consider helping out** by opening a Pull Request!
|
23
|
+
|
24
|
+
## Opening a Pull Request
|
25
|
+
|
26
|
+
Pull Requests fixing bugs, implementing new features, or updating documentation and dependencies are all very welcome! If you would like to help out with the project, you can pick an open issue from the issue tracker. We're more than happy to help you get started! Here's how you can proceed:
|
27
|
+
|
28
|
+
1. Fork and clone Gollum.
|
29
|
+
2. Create a thoughtfully named topic branch to contain your changes.
|
30
|
+
3. If you haven't installed dependencies yet, navigate to your clone and execute:
|
31
|
+
```
|
32
|
+
[sudo] bundle install
|
33
|
+
```
|
34
|
+
4. Hack away.
|
35
|
+
5. Add your own tests and make sure they're all still passing.
|
36
|
+
6. If some of your changes deserve a mention on Gollum's home page, edit the README accordingly.
|
37
|
+
7. If necessary, rebase your commits into logical chunks, without errors.
|
38
|
+
8. Push the branch to your fork on GitHub.
|
39
|
+
9. Create a pull request for Gollum.
|
40
|
+
|
41
|
+
**Notes:**
|
42
|
+
* Do not change Gollum's version numbers, we will do that on our own.
|
43
|
+
|
44
|
+
### Running tests
|
45
|
+
|
46
|
+
1. Install [Bundler](http://bundler.io/).
|
47
|
+
2. Navigate to the cloned source of Gollum.
|
48
|
+
3. Install dependencies:
|
49
|
+
```
|
50
|
+
[sudo] bundle install
|
51
|
+
```
|
52
|
+
4. Run the tests:
|
53
|
+
```
|
54
|
+
bundle exec rake test
|
55
|
+
```
|
56
|
+
|
57
|
+
### Working with test repositories
|
58
|
+
|
59
|
+
An example of how to add a test file to the bare repository lotr.git.
|
60
|
+
|
61
|
+
```
|
62
|
+
mkdir tmp
|
63
|
+
cd tmp
|
64
|
+
git clone ../lotr.git/
|
65
|
+
git log
|
66
|
+
echo "test" > test.md
|
67
|
+
git add .
|
68
|
+
git commit -am "Add test"
|
69
|
+
git push ../lotr.git/ master
|
70
|
+
```
|
71
|
+
|
72
|
+
## Releasing the gem
|
73
|
+
|
74
|
+
Gollum uses [Semantic Versioning](http://semver.org/).
|
75
|
+
|
76
|
+
x.y.z
|
77
|
+
|
78
|
+
For z releases:
|
79
|
+
|
80
|
+
```
|
81
|
+
rake bump
|
82
|
+
rake release
|
83
|
+
```
|
84
|
+
|
85
|
+
For x.y releases:
|
86
|
+
|
87
|
+
```
|
88
|
+
# First update VERSION in lib/gollum.rb and then:
|
89
|
+
rake gemspec
|
90
|
+
rake release
|
91
|
+
```
|
data/HISTORY.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
# 4.1.0 /2016-03-09
|
2
|
+
|
3
|
+
* Added file deletion functionality to file view
|
4
|
+
* Various performance improvements
|
5
|
+
* Emoji support
|
6
|
+
|
1
7
|
# 4.0.0 /2015-04-11
|
2
8
|
|
3
9
|
* Now compatible with JRuby (via the [rjgit](https://github.com/repotag/rjgit) [adapter](https://github.com/repotag/gollum-lib_rjgit_adapter))
|
data/README.md
CHANGED
@@ -23,9 +23,15 @@ For more information on Gollum's capabilities and pitfalls:
|
|
23
23
|
3. [Troubleshoot guide](https://github.com/gollum/gollum/wiki/Troubleshoot-guide).
|
24
24
|
4. [Security overview](https://github.com/gollum/gollum/wiki/Security).
|
25
25
|
|
26
|
+
### Videos
|
27
|
+
|
28
|
+
* [Quick impression of gollum](https://www.youtube.com/watch?v=gj1qqK3Oku8)
|
29
|
+
* [Gollum overview and simple markdown tutorial (german with english subtitles)](https://www.youtube.com/watch?v=wfWgDRmcbU4)
|
30
|
+
* [Advanced features in action](https://www.youtube.com/watch?v=EauxgxsLDC4)
|
31
|
+
|
26
32
|
## SYSTEM REQUIREMENTS
|
27
33
|
|
28
|
-
| Operating System | Ruby | Adapters | Supported |
|
34
|
+
| Operating System | Ruby | Adapters | Supported |
|
29
35
|
| ---------------- | -------------- | ------------------ | --------- |
|
30
36
|
| Unix/Linux-like | Ruby 1.9.3+ | all except [RJGit](https://github.com/repotag/rjgit) | yes |
|
31
37
|
| Unix/Linux-like | [JRuby](https://github.com/jruby/jruby) (1.9.3+ compatible) | [RJGit](https://github.com/repotag/rjgit) | yes |
|
@@ -67,7 +73,7 @@ Installation examples for individual systems can be seen [here](https://github.c
|
|
67
73
|
```
|
68
74
|
* And install:
|
69
75
|
```
|
70
|
-
[sudo] gem install --no-
|
76
|
+
[sudo] gem install --no-document pkg/gollum*.gem
|
71
77
|
```
|
72
78
|
|
73
79
|
### Markups
|
@@ -79,7 +85,6 @@ Gollum presently ships with support for the following markups:
|
|
79
85
|
Since all markups are rendered by the [github-markup](https://github.com/github/markup) gem, you can easily add support for other markups by additional installation:
|
80
86
|
* [AsciiDoc](http://asciidoctor.org/docs/asciidoc-syntax-quick-reference/) -- `[sudo] gem install asciidoctor`
|
81
87
|
* [Creole](http://www.wikicreole.org/wiki/CheatSheet) -- `[sudo] gem install creole`
|
82
|
-
* [GitHub Flavored Markdown](https://help.github.com/articles/github-flavored-markdown) -- `[sudo] gem install github-markdown`
|
83
88
|
* [MediaWiki](http://www.mediawiki.org/wiki/Help:Formatting) -- `[sudo] gem install wikicloth`
|
84
89
|
* [Org](http://orgmode.org/worg/dev/org-syntax.html) -- `[sudo] gem install org-ruby`
|
85
90
|
* [Pod](http://perldoc.perl.org/perlpod.html) -- requires Perl >= 5.10 (the `perl` command must be available on your command line)
|
@@ -98,13 +103,16 @@ Simply:
|
|
98
103
|
2. Run: `gollum`.
|
99
104
|
3. Open `http://localhost:4567` in your browser.
|
100
105
|
|
101
|
-
|
106
|
+
This will start up a web server (WEBrick) running Gollum with a web interface, where you can view and edit your wiki.
|
102
107
|
|
103
|
-
|
104
|
-
2. Run: `bundle exec bin/gollum`
|
105
|
-
3. Open `http://localhost:4567` in your browser.
|
108
|
+
### Running from source
|
106
109
|
|
107
|
-
|
110
|
+
1. `git clone https://github.com/gollum/gollum`
|
111
|
+
2. `cd gollum`
|
112
|
+
3. `[sudo] bundle install` (may not always be necessary).
|
113
|
+
4. `bundle exec bin/gollum`
|
114
|
+
* Like that, gollum assumes the target wiki (git repository) is the project repository itself. If it's not, execute `bundle exec bin/gollum <path-to-wiki>` instead.
|
115
|
+
5. Open `http://localhost:4567` in your browser.
|
108
116
|
|
109
117
|
### Rack
|
110
118
|
|
@@ -138,6 +146,7 @@ Gollum comes with the following command line options:
|
|
138
146
|
| --page-file-dir | [PATH] | Specify the subdirectory for all pages. If set, Gollum will only serve pages from this directory and its subdirectories. Default: repository root. |
|
139
147
|
| --css | none | Tell Gollum to inject custom CSS into each page. Uses `custom.css` from repository root.<sup>3,5</sup> |
|
140
148
|
| --js | none | Tell Gollum to inject custom JS into each page. Uses `custom.js` from repository root.<sup>3,5</sup> |
|
149
|
+
| --emoji | none | Parse and interpret emoji tags (e.g. :heart:). |
|
141
150
|
| --no-edit | none | Disable the feature of editing pages. |
|
142
151
|
| --live-preview | none | Enable the live preview feature in page editor. |
|
143
152
|
| --no-live-preview | none | Disable the live preview feature in page editor. |
|
@@ -166,70 +175,3 @@ Gollum comes with the following command line options:
|
|
166
175
|
When `--config` option is used, certain inner parts of Gollum can be customized. This is used throughout our wiki for certain user-level alterations, among which [customizing supported markups](https://github.com/gollum/gollum/wiki/Formats-and-extensions) will probably stand out.
|
167
176
|
|
168
177
|
**All of the mentioned alterations work both for Gollum's config file (`config.rb`) and Rack's config file (`config.ru`).**
|
169
|
-
|
170
|
-
## HOW TO CONTRIBUTE
|
171
|
-
|
172
|
-
1. Fork and clone Gollum.
|
173
|
-
2. Create a thoughtfully named topic branch to contain your changes.
|
174
|
-
3. If you haven't installed dependencies yet, navigate to your clone and execute:
|
175
|
-
```
|
176
|
-
[sudo] bundle install
|
177
|
-
```
|
178
|
-
4. Hack away.
|
179
|
-
5. Add your own tests and make sure they're all still passing.
|
180
|
-
6. If some of your changes deserve a mention on Gollum's home page, edit the README accordingly.
|
181
|
-
7. If necessary, rebase your commits into logical chunks, without errors.
|
182
|
-
8. Push the branch to your fork on GitHub.
|
183
|
-
9. Create a pull request for Gollum.
|
184
|
-
|
185
|
-
**Notes:**
|
186
|
-
* Do not change Gollum's version numbers, we will do that on our own.
|
187
|
-
|
188
|
-
### Running tests
|
189
|
-
|
190
|
-
1. Install [Bundler](http://bundler.io/).
|
191
|
-
2. Navigate to the cloned source of Gollum.
|
192
|
-
3. Install dependencies:
|
193
|
-
```
|
194
|
-
[sudo] bundle install
|
195
|
-
```
|
196
|
-
4. Run the tests:
|
197
|
-
```
|
198
|
-
bundle exec rake test
|
199
|
-
```
|
200
|
-
|
201
|
-
### Working with test repositories
|
202
|
-
|
203
|
-
An example of how to add a test file to the bare repository lotr.git.
|
204
|
-
|
205
|
-
```
|
206
|
-
mkdir tmp
|
207
|
-
cd tmp
|
208
|
-
git clone ../lotr.git/
|
209
|
-
git log
|
210
|
-
echo "test" > test.md
|
211
|
-
git add .
|
212
|
-
git commit -am "Add test"
|
213
|
-
git push ../lotr.git/ master
|
214
|
-
```
|
215
|
-
|
216
|
-
## RELEASING
|
217
|
-
|
218
|
-
Gollum uses [Semantic Versioning](http://semver.org/).
|
219
|
-
|
220
|
-
x.y.z
|
221
|
-
|
222
|
-
For z releases:
|
223
|
-
|
224
|
-
```
|
225
|
-
rake bump
|
226
|
-
rake release
|
227
|
-
```
|
228
|
-
|
229
|
-
For x.y releases:
|
230
|
-
|
231
|
-
```
|
232
|
-
# First update VERSION in lib/gollum.rb and then:
|
233
|
-
rake gemspec
|
234
|
-
rake release
|
235
|
-
```
|
data/bin/gollum
CHANGED
@@ -71,10 +71,8 @@ opts = OptionParser.new do |opts|
|
|
71
71
|
"Example: setting this to '/wiki' will make the wiki accessible under 'http://localhost:4567/wiki/'.") do |base_path|
|
72
72
|
|
73
73
|
# first trim a leading slash, if any
|
74
|
-
|
75
|
-
|
76
|
-
end
|
77
|
-
|
74
|
+
base_path.sub!(/^\/+/, '')
|
75
|
+
|
78
76
|
# make a backup of the option and sanitize it
|
79
77
|
base_path_original = base_path.dup
|
80
78
|
base_path = CGI.escape(base_path)
|
@@ -101,6 +99,9 @@ MSG
|
|
101
99
|
opts.on("--js", "Inject custom JavaScript into each page. The '<git-repo>/custom.js' file is used (must be committed).") do
|
102
100
|
wiki_options[:js] = true
|
103
101
|
end
|
102
|
+
opts.on("--emoji", "Parse and interpret emoji tags (e.g. :heart:).") do
|
103
|
+
wiki_options[:emoji] = true
|
104
|
+
end
|
104
105
|
opts.on("--no-edit", "Disable the feature of editing pages.") do
|
105
106
|
wiki_options[:allow_editing] = false
|
106
107
|
end
|
@@ -144,6 +145,9 @@ MSG
|
|
144
145
|
"If not specified, uses the '<git-repo>/mathjax.config.js' file.") do |file|
|
145
146
|
wiki_options[:mathjax_config] = file || 'mathjax.config.js'
|
146
147
|
end
|
148
|
+
opts.on("--plantuml-url [URL]", "Sets the PlantUML server endpoint.") do |url|
|
149
|
+
wiki_options[:plantuml_url] = url
|
150
|
+
end
|
147
151
|
opts.on("--template-dir [PATH]", "Specify custom mustache template directory.") do |path|
|
148
152
|
wiki_options[:template_dir] = path
|
149
153
|
end
|
@@ -161,7 +165,6 @@ MSG
|
|
161
165
|
end
|
162
166
|
|
163
167
|
opts.separator ""
|
164
|
-
|
165
168
|
end
|
166
169
|
|
167
170
|
# Read command line options into `options` hash
|
@@ -207,6 +210,12 @@ if options[:irb]
|
|
207
210
|
if !wiki.exist? then
|
208
211
|
raise Gollum::InvalidGitRepositoryError
|
209
212
|
end
|
213
|
+
if wiki_options[:plantuml_url]
|
214
|
+
Gollum::Filter::PlantUML.configure do |config|
|
215
|
+
puts "Using #{wiki_options[:plantuml_url]} as PlantUML endpoint"
|
216
|
+
config.url = wiki_options[:plantuml_url]
|
217
|
+
end
|
218
|
+
end
|
210
219
|
puts
|
211
220
|
puts "Loaded Gollum wiki at:"
|
212
221
|
puts "#{File.expand_path(gollum_path).inspect}"
|
@@ -242,6 +251,13 @@ else
|
|
242
251
|
require cfg
|
243
252
|
end
|
244
253
|
|
254
|
+
if wiki_options[:plantuml_url]
|
255
|
+
Gollum::Filter::PlantUML.configure do |config|
|
256
|
+
puts "Using #{wiki_options[:plantuml_url]} as PlantUML endpoint"
|
257
|
+
config.url = wiki_options[:plantuml_url]
|
258
|
+
end
|
259
|
+
end
|
260
|
+
|
245
261
|
base_path = wiki_options[:base_path]
|
246
262
|
|
247
263
|
if base_path.nil?
|
data/gollum.gemspec
CHANGED
@@ -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 = '4.0
|
9
|
-
s.date = '
|
8
|
+
s.version = '4.1.0'
|
9
|
+
s.date = '2017-03-09'
|
10
10
|
s.rubyforge_project = 'gollum'
|
11
11
|
s.license = 'MIT'
|
12
12
|
|
@@ -25,21 +25,23 @@ Gem::Specification.new do |s|
|
|
25
25
|
s.extra_rdoc_files = %w[README.md LICENSE]
|
26
26
|
|
27
27
|
s.add_dependency 'gollum-lib', '~> 4.0', '>= 4.0.1'
|
28
|
-
s.add_dependency 'kramdown', '~> 1.
|
28
|
+
s.add_dependency 'kramdown', '~> 1.9.0'
|
29
29
|
s.add_dependency 'sinatra', '~> 1.4', '>= 1.4.4'
|
30
30
|
s.add_dependency 'mustache', ['>= 0.99.5', '< 1.0.0']
|
31
|
-
s.add_dependency 'useragent', '~> 0.
|
31
|
+
s.add_dependency 'useragent', '~> 0.16.2'
|
32
|
+
s.add_dependency 'gemojione', '~> 2'
|
32
33
|
|
33
34
|
s.add_development_dependency 'rack-test', '~> 0.6.2'
|
34
35
|
s.add_development_dependency 'shoulda', '~> 3.5.0'
|
35
36
|
s.add_development_dependency 'minitest-reporters', '~> 0.14.16'
|
36
37
|
s.add_development_dependency 'twitter_cldr', '~> 3.2.0'
|
37
38
|
s.add_development_dependency 'mocha', '~> 1.1.0'
|
38
|
-
s.add_development_dependency 'test-unit', '~> 3.1.0'
|
39
|
+
s.add_development_dependency 'test-unit', '~> 3.1.0'
|
39
40
|
s.add_development_dependency 'webrick', '~> 1.3.1'
|
40
41
|
|
41
42
|
# = MANIFEST =
|
42
43
|
s.files = %w[
|
44
|
+
CONTRIBUTING.md
|
43
45
|
Gemfile
|
44
46
|
HISTORY.md
|
45
47
|
LICENSE
|
@@ -73,6 +75,7 @@ Gem::Specification.new do |s|
|
|
73
75
|
lib/gollum/public/gollum/images/fileview/folder-horizontal.png
|
74
76
|
lib/gollum/public/gollum/images/fileview/toggle-small-expand.png
|
75
77
|
lib/gollum/public/gollum/images/fileview/toggle-small.png
|
78
|
+
lib/gollum/public/gollum/images/fileview/trashcan.png
|
76
79
|
lib/gollum/public/gollum/images/icon-sprite.png
|
77
80
|
lib/gollum/public/gollum/images/man_24.png
|
78
81
|
lib/gollum/public/gollum/images/para.png
|
data/lib/gollum.rb
CHANGED
@@ -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 = '4.0
|
19
|
+
VERSION = '4.1.0'
|
20
20
|
|
21
21
|
def self.assets_path
|
22
22
|
::File.expand_path('gollum/public', ::File.dirname(__FILE__))
|
data/lib/gollum/app.rb
CHANGED
@@ -49,7 +49,7 @@ module Precious
|
|
49
49
|
class App < Sinatra::Base
|
50
50
|
register Mustache::Sinatra
|
51
51
|
include Precious::Helpers
|
52
|
-
|
52
|
+
|
53
53
|
dir = File.dirname(File.expand_path(__FILE__))
|
54
54
|
|
55
55
|
# Detect unsupported browsers.
|
@@ -59,6 +59,7 @@ module Precious
|
|
59
59
|
Browser.new('Internet Explorer', '10.0'),
|
60
60
|
Browser.new('Chrome', '7.0'),
|
61
61
|
Browser.new('Firefox', '4.0'),
|
62
|
+
Browser.new('Safari', '9.0')
|
62
63
|
]
|
63
64
|
|
64
65
|
def supported_useragent?(user_agent)
|
@@ -95,7 +96,6 @@ module Precious
|
|
95
96
|
before do
|
96
97
|
settings.wiki_options[:allow_editing] = settings.wiki_options.fetch(:allow_editing, true)
|
97
98
|
@allow_editing = settings.wiki_options[:allow_editing]
|
98
|
-
forbid unless @allow_editing || request.request_method == "GET"
|
99
99
|
Precious::App.set(:mustache, {:templates => settings.wiki_options[:template_dir]}) if settings.wiki_options[:template_dir]
|
100
100
|
@base_url = url('/', false).chomp('/')
|
101
101
|
@page_dir = settings.wiki_options[:page_file_dir].to_s
|
@@ -130,6 +130,14 @@ module Precious
|
|
130
130
|
Gollum::Wiki.new(settings.gollum_path, settings.wiki_options)
|
131
131
|
end
|
132
132
|
|
133
|
+
get '/emoji/:name' do
|
134
|
+
begin
|
135
|
+
[200, {'Content-Type' => 'image/png'}, emoji(params['name'])]
|
136
|
+
rescue ArgumentError
|
137
|
+
not_found
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
133
141
|
get '/data/*' do
|
134
142
|
if page = wiki_page(params[:splat].first).page
|
135
143
|
page.raw_data
|
@@ -164,6 +172,8 @@ module Precious
|
|
164
172
|
end
|
165
173
|
|
166
174
|
post '/uploadFile' do
|
175
|
+
forbid unless @allow_editing
|
176
|
+
|
167
177
|
wiki = wiki_new
|
168
178
|
|
169
179
|
unless wiki.allow_uploads
|
@@ -179,7 +189,7 @@ module Precious
|
|
179
189
|
halt 500 unless tempfile.is_a? Tempfile
|
180
190
|
|
181
191
|
# Remove page file dir prefix from upload path if necessary -- committer handles this itself
|
182
|
-
dir = wiki.per_page_uploads ? params[:upload_dest].
|
192
|
+
dir = wiki.per_page_uploads ? params[:upload_dest] : ::File.join([wiki.page_file_dir, 'uploads'].compact)
|
183
193
|
ext = ::File.extname(fullname)
|
184
194
|
format = ext.split('.').last || 'txt'
|
185
195
|
filename = ::File.basename(fullname, ext)
|
@@ -212,7 +222,22 @@ module Precious
|
|
212
222
|
end
|
213
223
|
end
|
214
224
|
|
225
|
+
post '/deleteFile/*' do
|
226
|
+
forbid unless @allow_editing
|
227
|
+
wiki = wiki_new
|
228
|
+
filepath = params[:splat].first
|
229
|
+
unless filepath.nil?
|
230
|
+
commit = commit_message
|
231
|
+
commit[:message] = "Deleted #{filepath}"
|
232
|
+
wiki.delete_file(filepath, commit)
|
233
|
+
end
|
234
|
+
|
235
|
+
redirect to('/fileview')
|
236
|
+
end
|
237
|
+
|
215
238
|
post '/rename/*' do
|
239
|
+
forbid unless @allow_editing
|
240
|
+
|
216
241
|
wikip = wiki_page(params[:splat].first)
|
217
242
|
halt 500 if wikip.nil?
|
218
243
|
wiki = wikip.wiki
|
@@ -249,6 +274,8 @@ module Precious
|
|
249
274
|
end
|
250
275
|
|
251
276
|
post '/edit/*' do
|
277
|
+
forbid unless @allow_editing
|
278
|
+
|
252
279
|
path = '/' + clean_url(sanitize_empty_params(params[:path])).to_s
|
253
280
|
page_name = CGI.unescape(params[:page])
|
254
281
|
wiki = wiki_new
|
@@ -308,6 +335,8 @@ module Precious
|
|
308
335
|
end
|
309
336
|
|
310
337
|
post '/create' do
|
338
|
+
forbid unless @allow_editing
|
339
|
+
|
311
340
|
name = params[:page].to_url
|
312
341
|
path = sanitize_empty_params(params[:path]) || ''
|
313
342
|
format = params[:format].intern
|
@@ -327,6 +356,8 @@ module Precious
|
|
327
356
|
end
|
328
357
|
|
329
358
|
post '/revert/*/:sha1/:sha2' do
|
359
|
+
forbid unless @allow_editing
|
360
|
+
|
330
361
|
wikip = wiki_page(params[:splat].first)
|
331
362
|
@path = wikip.path
|
332
363
|
@name = wikip.name
|
@@ -350,6 +381,8 @@ module Precious
|
|
350
381
|
end
|
351
382
|
|
352
383
|
post '/preview' do
|
384
|
+
forbid unless @allow_editing
|
385
|
+
|
353
386
|
wiki = wiki_new
|
354
387
|
@name = params[:page] || "Preview"
|
355
388
|
@page = wiki.preview_page(@name, params[:content], params[:format])
|
@@ -358,6 +391,7 @@ module Precious
|
|
358
391
|
@mathjax = wiki.mathjax
|
359
392
|
@h1_title = wiki.h1_title
|
360
393
|
@editable = false
|
394
|
+
@bar_side = wiki.bar_side
|
361
395
|
@allow_uploads = wiki.allow_uploads
|
362
396
|
mustache :page
|
363
397
|
end
|
@@ -495,7 +529,7 @@ module Precious
|
|
495
529
|
|
496
530
|
# Extensions and layout data
|
497
531
|
@editable = true
|
498
|
-
@page_exists = !page.
|
532
|
+
@page_exists = !page.last_version.nil?
|
499
533
|
@toc_content = wiki.universal_toc ? @page.toc_data : nil
|
500
534
|
@mathjax = wiki.mathjax
|
501
535
|
@h1_title = wiki.h1_title
|
data/lib/gollum/helpers.rb
CHANGED
@@ -1,6 +1,11 @@
|
|
1
1
|
# ~*~ encoding: utf-8 ~*~
|
2
|
+
require 'gemojione'
|
3
|
+
|
2
4
|
module Precious
|
3
5
|
module Helpers
|
6
|
+
|
7
|
+
EMOJI_PATHNAME = Pathname.new(Gemojione.index.images_path).freeze
|
8
|
+
|
4
9
|
# Extract the path string that Gollum::Wiki expects
|
5
10
|
def extract_path(file_path)
|
6
11
|
return nil if file_path.nil?
|
@@ -51,5 +56,13 @@ module Precious
|
|
51
56
|
return mustache :error
|
52
57
|
end
|
53
58
|
|
59
|
+
def emoji(name)
|
60
|
+
if emoji = Gemojione.index.find_by_name(name)
|
61
|
+
IO.read(EMOJI_PATHNAME.join("#{emoji['unicode']}.png"))
|
62
|
+
else
|
63
|
+
fail ArgumentError, "emoji `#{name}' not found"
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
54
67
|
end
|
55
68
|
end
|
@@ -85,6 +85,22 @@ ol.tree
|
|
85
85
|
margin-right: 7px;
|
86
86
|
vertical-align: text-top;
|
87
87
|
}
|
88
|
+
li.file form
|
89
|
+
{
|
90
|
+
vertical-align:middle;
|
91
|
+
display: inline-block;
|
92
|
+
}
|
93
|
+
li.file form button
|
94
|
+
{
|
95
|
+
vertical-align:middle;
|
96
|
+
height: 20px;
|
97
|
+
padding-left: 36px;
|
98
|
+
padding-right: 10px;
|
99
|
+
border: 0px solid #000000;
|
100
|
+
background: url("../images/fileview/trashcan.png") no-repeat 16px center;
|
101
|
+
cursor: pointer;
|
102
|
+
}
|
103
|
+
}
|
88
104
|
li.file a[href *= '.pdf'] span.icon { background: url(../images/fileview/document.png) 0 0 no-repeat; }
|
89
105
|
li.file a[href *= '.html'] span.icon { background: url(../images/fileview/document.png) 0 0 no-repeat; }
|
90
106
|
li.file a[href $= '.css'] span.icon { background: url(../images/fileview/document.png) 0 0 no-repeat; }
|
@@ -125,4 +141,3 @@ ol.tree
|
|
125
141
|
}
|
126
142
|
li input:checked + ol > li { display: block; margin: 0 0 0.125em; /* 2px */}
|
127
143
|
li input:checked + ol > li:last-child { margin: 0 0 0.063em; /* 1px */ }
|
128
|
-
|
Binary file
|
@@ -211,6 +211,11 @@ var MarkDownHelp = [
|
|
211
211
|
{
|
212
212
|
menuName: 'Escaping',
|
213
213
|
data: '<p>If you want to use a special Markdown character in your document (such as displaying literal asterisks), you can escape the character with the backslash (<code>\\</code>). Markdown will ignore the character directly after a backslash.'
|
214
|
+
},
|
215
|
+
|
216
|
+
{
|
217
|
+
menuName: 'Emoji',
|
218
|
+
data: '<p>See the <a href="http://emojione.com/demo/" target="_blank">EmojiOne demo</a> for all available emoji. To include one, wrap the emoji name in colons and use underscores instead of spaces (e.g. :heart: or :point_up:).'
|
214
219
|
}
|
215
220
|
]
|
216
221
|
}
|
data/lib/gollum/views/page.rb
CHANGED
@@ -22,15 +22,13 @@ module Precious
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def author
|
25
|
-
|
26
|
-
first = page_versions ? page_versions.first : false
|
25
|
+
first = page.last_version
|
27
26
|
return DEFAULT_AUTHOR unless first
|
28
27
|
first.author.name.respond_to?(:force_encoding) ? first.author.name.force_encoding('UTF-8') : first.author.name
|
29
28
|
end
|
30
29
|
|
31
30
|
def date
|
32
|
-
|
33
|
-
first = page_versions ? page_versions.first : false
|
31
|
+
first = page.last_version
|
34
32
|
return Time.now.strftime(DATE_FORMAT) unless first
|
35
33
|
first.authored_date.strftime(DATE_FORMAT)
|
36
34
|
end
|
data/lib/gollum/views/pages.rb
CHANGED
@@ -36,7 +36,8 @@ module Precious
|
|
36
36
|
|
37
37
|
# 1012: Folders and Pages need to be separated
|
38
38
|
@results.each do |page|
|
39
|
-
page_path = page.path
|
39
|
+
page_path = page.path
|
40
|
+
page_path = page_path.sub(/^#{Regexp.escape(@path)}\//, '') unless @path.nil?
|
40
41
|
|
41
42
|
if page_path.include?('/')
|
42
43
|
folder = page_path.split('/').first
|
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: 4.0
|
4
|
+
version: 4.1.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:
|
12
|
+
date: 2017-03-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: gollum-lib
|
@@ -18,7 +18,7 @@ dependencies:
|
|
18
18
|
- - ~>
|
19
19
|
- !ruby/object:Gem::Version
|
20
20
|
version: '4.0'
|
21
|
-
- -
|
21
|
+
- - '>='
|
22
22
|
- !ruby/object:Gem::Version
|
23
23
|
version: 4.0.1
|
24
24
|
type: :runtime
|
@@ -28,7 +28,7 @@ dependencies:
|
|
28
28
|
- - ~>
|
29
29
|
- !ruby/object:Gem::Version
|
30
30
|
version: '4.0'
|
31
|
-
- -
|
31
|
+
- - '>='
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: 4.0.1
|
34
34
|
- !ruby/object:Gem::Dependency
|
@@ -37,14 +37,14 @@ dependencies:
|
|
37
37
|
requirements:
|
38
38
|
- - ~>
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 1.
|
40
|
+
version: 1.9.0
|
41
41
|
type: :runtime
|
42
42
|
prerelease: false
|
43
43
|
version_requirements: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - ~>
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 1.
|
47
|
+
version: 1.9.0
|
48
48
|
- !ruby/object:Gem::Dependency
|
49
49
|
name: sinatra
|
50
50
|
requirement: !ruby/object:Gem::Requirement
|
@@ -52,7 +52,7 @@ dependencies:
|
|
52
52
|
- - ~>
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '1.4'
|
55
|
-
- -
|
55
|
+
- - '>='
|
56
56
|
- !ruby/object:Gem::Version
|
57
57
|
version: 1.4.4
|
58
58
|
type: :runtime
|
@@ -62,14 +62,14 @@ dependencies:
|
|
62
62
|
- - ~>
|
63
63
|
- !ruby/object:Gem::Version
|
64
64
|
version: '1.4'
|
65
|
-
- -
|
65
|
+
- - '>='
|
66
66
|
- !ruby/object:Gem::Version
|
67
67
|
version: 1.4.4
|
68
68
|
- !ruby/object:Gem::Dependency
|
69
69
|
name: mustache
|
70
70
|
requirement: !ruby/object:Gem::Requirement
|
71
71
|
requirements:
|
72
|
-
- -
|
72
|
+
- - '>='
|
73
73
|
- !ruby/object:Gem::Version
|
74
74
|
version: 0.99.5
|
75
75
|
- - <
|
@@ -79,7 +79,7 @@ dependencies:
|
|
79
79
|
prerelease: false
|
80
80
|
version_requirements: !ruby/object:Gem::Requirement
|
81
81
|
requirements:
|
82
|
-
- -
|
82
|
+
- - '>='
|
83
83
|
- !ruby/object:Gem::Version
|
84
84
|
version: 0.99.5
|
85
85
|
- - <
|
@@ -91,14 +91,28 @@ dependencies:
|
|
91
91
|
requirements:
|
92
92
|
- - ~>
|
93
93
|
- !ruby/object:Gem::Version
|
94
|
-
version: 0.
|
94
|
+
version: 0.16.2
|
95
95
|
type: :runtime
|
96
96
|
prerelease: false
|
97
97
|
version_requirements: !ruby/object:Gem::Requirement
|
98
98
|
requirements:
|
99
99
|
- - ~>
|
100
100
|
- !ruby/object:Gem::Version
|
101
|
-
version: 0.
|
101
|
+
version: 0.16.2
|
102
|
+
- !ruby/object:Gem::Dependency
|
103
|
+
name: gemojione
|
104
|
+
requirement: !ruby/object:Gem::Requirement
|
105
|
+
requirements:
|
106
|
+
- - ~>
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
version: '2'
|
109
|
+
type: :runtime
|
110
|
+
prerelease: false
|
111
|
+
version_requirements: !ruby/object:Gem::Requirement
|
112
|
+
requirements:
|
113
|
+
- - ~>
|
114
|
+
- !ruby/object:Gem::Version
|
115
|
+
version: '2'
|
102
116
|
- !ruby/object:Gem::Dependency
|
103
117
|
name: rack-test
|
104
118
|
requirement: !ruby/object:Gem::Requirement
|
@@ -169,6 +183,20 @@ dependencies:
|
|
169
183
|
- - ~>
|
170
184
|
- !ruby/object:Gem::Version
|
171
185
|
version: 1.1.0
|
186
|
+
- !ruby/object:Gem::Dependency
|
187
|
+
name: test-unit
|
188
|
+
requirement: !ruby/object:Gem::Requirement
|
189
|
+
requirements:
|
190
|
+
- - ~>
|
191
|
+
- !ruby/object:Gem::Version
|
192
|
+
version: 3.1.0
|
193
|
+
type: :development
|
194
|
+
prerelease: false
|
195
|
+
version_requirements: !ruby/object:Gem::Requirement
|
196
|
+
requirements:
|
197
|
+
- - ~>
|
198
|
+
- !ruby/object:Gem::Version
|
199
|
+
version: 3.1.0
|
172
200
|
- !ruby/object:Gem::Dependency
|
173
201
|
name: webrick
|
174
202
|
requirement: !ruby/object:Gem::Requirement
|
@@ -192,6 +220,7 @@ extra_rdoc_files:
|
|
192
220
|
- README.md
|
193
221
|
- LICENSE
|
194
222
|
files:
|
223
|
+
- CONTRIBUTING.md
|
195
224
|
- Gemfile
|
196
225
|
- HISTORY.md
|
197
226
|
- LICENSE
|
@@ -225,6 +254,7 @@ files:
|
|
225
254
|
- lib/gollum/public/gollum/images/fileview/folder-horizontal.png
|
226
255
|
- lib/gollum/public/gollum/images/fileview/toggle-small-expand.png
|
227
256
|
- lib/gollum/public/gollum/images/fileview/toggle-small.png
|
257
|
+
- lib/gollum/public/gollum/images/fileview/trashcan.png
|
228
258
|
- lib/gollum/public/gollum/images/icon-sprite.png
|
229
259
|
- lib/gollum/public/gollum/images/man_24.png
|
230
260
|
- lib/gollum/public/gollum/images/para.png
|
@@ -1242,17 +1272,17 @@ require_paths:
|
|
1242
1272
|
- lib
|
1243
1273
|
required_ruby_version: !ruby/object:Gem::Requirement
|
1244
1274
|
requirements:
|
1245
|
-
- -
|
1275
|
+
- - '>='
|
1246
1276
|
- !ruby/object:Gem::Version
|
1247
1277
|
version: '1.9'
|
1248
1278
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
1249
1279
|
requirements:
|
1250
|
-
- -
|
1280
|
+
- - '>='
|
1251
1281
|
- !ruby/object:Gem::Version
|
1252
1282
|
version: '0'
|
1253
1283
|
requirements: []
|
1254
1284
|
rubyforge_project: gollum
|
1255
|
-
rubygems_version: 2.
|
1285
|
+
rubygems_version: 2.2.2
|
1256
1286
|
signing_key:
|
1257
1287
|
specification_version: 2
|
1258
1288
|
summary: A simple, Git-powered wiki.
|