gollum 2.4.13 → 2.4.14
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/README.md +18 -498
- data/gollum.gemspec +7 -6
- data/lib/gollum.rb +1 -1
- data/lib/gollum/app.rb +5 -4
- data/lib/gollum/helpers.rb +9 -2
- data/lib/gollum/public/gollum/css/template.css +2 -1
- data/lib/gollum/templates/page.mustache +1 -1
- data/lib/gollum/views/history.rb +1 -1
- metadata +36 -13
- checksums.yaml +0 -15
data/README.md
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
gollum -- A wiki built on top of Git
|
2
2
|
====================================
|
3
3
|
|
4
|
+
[![Gem Version](https://badge.fury.io/rb/gollum.png)](http://rubygems.org/gems/gollum)
|
4
5
|
[![Build Status](https://secure.travis-ci.org/gollum/gollum.png?branch=master)](http://travis-ci.org/gollum/gollum)
|
5
6
|
[![Dependency Status](https://gemnasium.com/gollum/gollum.png)](https://gemnasium.com/gollum/gollum)
|
6
7
|
|
@@ -63,6 +64,15 @@ to install the dependencies for the formats that you plan to use.
|
|
63
64
|
|
64
65
|
[bundler]: http://gembundler.com/
|
65
66
|
|
67
|
+
|
68
|
+
## SYNTAX
|
69
|
+
|
70
|
+
Gollum supports a variety of formats and extensions (Markdown, MediaWiki, Textile, …).
|
71
|
+
On top of these formats Gollum lets you insert headers, footers, links, image, math and more.
|
72
|
+
|
73
|
+
Check out the [Gollum Wiki](https://github.com/gollum/gollum/wiki) for all of Gollum's formats and syntactic options.
|
74
|
+
|
75
|
+
|
66
76
|
## RUNNING
|
67
77
|
|
68
78
|
To view and edit your Gollum repository locally via the built in web
|
@@ -83,500 +93,6 @@ $ gollum --help
|
|
83
93
|
|
84
94
|
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).
|
85
95
|
|
86
|
-
## REPO STRUCTURE
|
87
|
-
|
88
|
-
A Gollum repository's contents are designed to be human editable. Page content
|
89
|
-
is written in `page files` and may be organized into directories any way you
|
90
|
-
choose. Special footers can be created in `footer files`. Other content
|
91
|
-
(images, PDFs, etc) may also be present and organized in the same way.
|
92
|
-
|
93
|
-
## PAGE FILES
|
94
|
-
|
95
|
-
Page files may be written in any format supported by
|
96
|
-
[GitHub-Markup](http://github.com/github/markup) (except roff). By default,
|
97
|
-
Gollum recognizes the following extensions:
|
98
|
-
|
99
|
-
* ASCIIDoc: .asciidoc
|
100
|
-
* Creole: .creole
|
101
|
-
* Markdown: .markdown, .mdown, .mkdn, .mkd, .md
|
102
|
-
* Org Mode: .org
|
103
|
-
* Pod: .pod
|
104
|
-
* RDoc: .rdoc
|
105
|
-
* ReStructuredText: .rest.txt, .rst.txt, .rest, .rst
|
106
|
-
* Textile: .textile
|
107
|
-
* MediaWiki: .mediawiki, .wiki
|
108
|
-
|
109
|
-
You may also register your own extensions and parsers:
|
110
|
-
|
111
|
-
```ruby
|
112
|
-
Gollum::Markup.register(:angry, "Angry") do |content|
|
113
|
-
content.upcase
|
114
|
-
end
|
115
|
-
```
|
116
|
-
|
117
|
-
Gollum detects the page file format via the extension, so files must have one
|
118
|
-
of the default or registered extensions in order to be converted.
|
119
|
-
|
120
|
-
Page file names may contain any printable UTF-8 character except space
|
121
|
-
(U+0020) and forward slash (U+002F). If you commit a page file with any of
|
122
|
-
these characters in the name it will not be accessible via the web interface.
|
123
|
-
|
124
|
-
Even though page files may be placed in any directory, there is still only a
|
125
|
-
single namespace for page names, so all page files should have globally unique
|
126
|
-
names regardless of where they are located in the repository.
|
127
|
-
|
128
|
-
The special page file `Home.ext` (where the extension is one of the supported
|
129
|
-
formats) will be used as the entrance page to your wiki. If it is missing, an
|
130
|
-
automatically generated table of contents will be shown instead.
|
131
|
-
|
132
|
-
## SIDEBAR FILES
|
133
|
-
|
134
|
-
Sidebar files allow you to add a simple sidebar to your wiki. Sidebar files
|
135
|
-
are named `_Sidebar.ext` where the extension is one of the supported formats.
|
136
|
-
Sidebars affect all pages in their directory and any subdirectories that do not
|
137
|
-
have a sidebar file of their own.
|
138
|
-
|
139
|
-
## HEADER FILES
|
140
|
-
|
141
|
-
Header files allow you to add a simple header to your wiki. Header files must
|
142
|
-
be named `_Header.ext` where the extension is one of the supported formats.
|
143
|
-
Like sidebars, headers affect all pages in their directory and any
|
144
|
-
subdirectories that do not have a header file of their own.
|
145
|
-
|
146
|
-
## FOOTER FILES
|
147
|
-
|
148
|
-
Footer files allow you to add a simple footer to your wiki. Footer files must
|
149
|
-
be named `_Footer.ext` where the extension is one of the supported formats.
|
150
|
-
Like sidebars, footers affect all pages in their directory and any
|
151
|
-
subdirectories that do not have a footer file of their own.
|
152
|
-
|
153
|
-
## HTML SANITIZATION
|
154
|
-
|
155
|
-
For security and compatibility reasons Gollum wikis may not contain custom CSS
|
156
|
-
or JavaScript. These tags will be stripped from the converted HTML. See
|
157
|
-
`docs/sanitization.md` for more details on what tags and attributes are
|
158
|
-
allowed.
|
159
|
-
|
160
|
-
## TITLES
|
161
|
-
|
162
|
-
The first defined `h1` will override the default header on a page. There are
|
163
|
-
two ways to set a page title. The metadata syntax:
|
164
|
-
|
165
|
-
<!-- --- title: New Title -->
|
166
|
-
|
167
|
-
The first `h1` tag can be set to always override the page title, without
|
168
|
-
needing to use the metadata syntax. Start gollum with the `--h1-title` flag.
|
169
|
-
|
170
|
-
## BRACKET TAGS
|
171
|
-
|
172
|
-
A variety of Gollum tags use a double bracket syntax. For example:
|
173
|
-
|
174
|
-
[[Link]]
|
175
|
-
|
176
|
-
Some tags will accept attributes which are separated by pipe symbols. For
|
177
|
-
example:
|
178
|
-
|
179
|
-
[[Link|Page Title]]
|
180
|
-
|
181
|
-
In all cases, the first thing in the link is what is displayed on the page.
|
182
|
-
So, if the tag is an internal wiki link, the first thing in the tag will be
|
183
|
-
the link text displayed on the page. If the tag is an embedded image, the
|
184
|
-
first thing in the tag will be a path to an image file. Use this trick to
|
185
|
-
easily remember which order things should appear in tags.
|
186
|
-
|
187
|
-
Some formats, such as MediaWiki, support the opposite syntax:
|
188
|
-
|
189
|
-
[[Page Title|Link]]
|
190
|
-
|
191
|
-
## PAGE LINKS
|
192
|
-
|
193
|
-
To link to another Gollum wiki page, use the Gollum Page Link Tag.
|
194
|
-
|
195
|
-
[[Frodo Baggins]]
|
196
|
-
|
197
|
-
The above tag will create a link to the corresponding page file named
|
198
|
-
`Frodo-Baggins.ext` where `ext` may be any of the allowed extension types. The
|
199
|
-
conversion is as follows:
|
200
|
-
|
201
|
-
1. Replace any spaces (U+0020) with dashes (U+002D)
|
202
|
-
2. Replace any slashes (U+002F) with dashes (U+002D)
|
203
|
-
|
204
|
-
If you'd like the link text to be something that doesn't map directly to the
|
205
|
-
page name, you can specify the actual page name after a pipe:
|
206
|
-
|
207
|
-
[[Frodo|Frodo Baggins]]
|
208
|
-
|
209
|
-
The above tag will link to `Frodo-Baggins.ext` using "Frodo" as the link text.
|
210
|
-
|
211
|
-
The page file may exist anywhere in the directory structure of the repository.
|
212
|
-
Gollum does a breadth first search and uses the first match that it finds.
|
213
|
-
|
214
|
-
Here are a few more examples:
|
215
|
-
|
216
|
-
[[J. R. R. Tolkien]] -> J.-R.-R.-Tolkien.ext
|
217
|
-
[[Movies / The Hobbit]] -> Movies---The-Hobbit.ext
|
218
|
-
[[モルドール]] -> モルドール.ext
|
219
|
-
|
220
|
-
|
221
|
-
## EXTERNAL LINKS
|
222
|
-
|
223
|
-
As a convenience, simple external links can be placed within brackets and they
|
224
|
-
will be linked to the given URL with the URL as the link text. For example:
|
225
|
-
|
226
|
-
[[http://example.com]]
|
227
|
-
|
228
|
-
External links must begin with either "http://" or "https://". If you need
|
229
|
-
something more flexible, you can resort to the link syntax in the page's
|
230
|
-
underlying markup format.
|
231
|
-
|
232
|
-
|
233
|
-
## ABSOLUTE VS. RELATIVE VS. EXTERNAL PATH
|
234
|
-
|
235
|
-
For Gollum tags that operate on static files (images, PDFs, etc), the paths
|
236
|
-
may be referenced as either relative, absolute, or external. Relative paths
|
237
|
-
point to a static file relative to the page file within the directory
|
238
|
-
structure of the Gollum repo (even though after conversion, all page files
|
239
|
-
appear to be top level). These paths are NOT prefixed with a slash. For
|
240
|
-
example:
|
241
|
-
|
242
|
-
gollum.pdf
|
243
|
-
docs/diagram.png
|
244
|
-
|
245
|
-
Absolute paths point to a static file relative to the Gollum repo's
|
246
|
-
root, regardless of where the page file is stored within the directory
|
247
|
-
structure. These paths ARE prefixed with a slash. For example:
|
248
|
-
|
249
|
-
/pdfs/gollum.pdf
|
250
|
-
/docs/diagram.png
|
251
|
-
|
252
|
-
External paths are full URLs. An external path must begin with either
|
253
|
-
"http://" or "https://". For example:
|
254
|
-
|
255
|
-
http://example.com/pdfs/gollum.pdf
|
256
|
-
http://example.com/images/diagram.png
|
257
|
-
|
258
|
-
All of the examples in this README use relative paths, but you may use
|
259
|
-
whatever works best in your situation.
|
260
|
-
|
261
|
-
|
262
|
-
## FILE LINKS
|
263
|
-
|
264
|
-
To link to static files that are contained in the Gollum repository you should
|
265
|
-
use the Gollum File Link Tag.
|
266
|
-
|
267
|
-
[[Gollum|gollum.pdf]]
|
268
|
-
|
269
|
-
The first part of the tag is the link text. The path to the file appears after
|
270
|
-
the pipe.
|
271
|
-
|
272
|
-
|
273
|
-
## IMAGES
|
274
|
-
|
275
|
-
To display images that are contained in the Gollum repository you should use
|
276
|
-
the Gollum Image Tag. This will display the actual image on the page.
|
277
|
-
|
278
|
-
[[gollum.png]]
|
279
|
-
|
280
|
-
In addition to the simple format, there are a variety of options that you
|
281
|
-
can specify between pipe delimiters.
|
282
|
-
|
283
|
-
To specify alt text, use the `alt=` option. Default is no alt text.
|
284
|
-
|
285
|
-
[[gollum.png|alt=Gollum and his precious wiki]]
|
286
|
-
|
287
|
-
To place the image in a frame, use the `frame` option. When combined with the
|
288
|
-
`alt=` option, the alt text will be used as a caption as well. Default is no
|
289
|
-
frame.
|
290
|
-
|
291
|
-
[[gollum.png|frame|alt=Gollum and his precious wiki]]
|
292
|
-
|
293
|
-
To specify the alignment of the image on the page, use the `align=` option.
|
294
|
-
Possible values are `left`, `center`, and `right`. Default is `left`.
|
295
|
-
|
296
|
-
[[gollum.png|align=center]]
|
297
|
-
|
298
|
-
To float an image so that text flows around it, use the `float` option. When
|
299
|
-
`float` is specified, only `left` and `right` are valid `align` options.
|
300
|
-
Default is not floating. When floating is activated but no alignment is
|
301
|
-
specified, default alignment is `left`.
|
302
|
-
|
303
|
-
[[gollum.png|float]]
|
304
|
-
|
305
|
-
By default text will fill up all the space around the image. To control how
|
306
|
-
much should show up use this tag to stop and start a new block so that
|
307
|
-
additional content doesn't fill in.
|
308
|
-
|
309
|
-
[[_]]
|
310
|
-
|
311
|
-
To specify a max-width, use the `width=` option. Units must be specified in
|
312
|
-
either `px` or `em`.
|
313
|
-
|
314
|
-
[[gollum.png|width=400px]]
|
315
|
-
|
316
|
-
To specify a max-height, use the `height=` option. Units must be specified in
|
317
|
-
either `px` or `em`.
|
318
|
-
|
319
|
-
[[gollum.png|height=300px]]
|
320
|
-
|
321
|
-
Any of these options may be composed together by simply separating them with
|
322
|
-
pipes.
|
323
|
-
|
324
|
-
|
325
|
-
## ESCAPING GOLLUM TAGS
|
326
|
-
|
327
|
-
If you need the literal text of a wiki or static link to show up in your final
|
328
|
-
wiki page, simply preface the link with a single quote (like in LISP):
|
329
|
-
|
330
|
-
'[[Page Link]]
|
331
|
-
'[[File Link|file.pdf]]
|
332
|
-
'[[image.jpg]]
|
333
|
-
|
334
|
-
This is useful for writing about the link syntax in your wiki pages.
|
335
|
-
|
336
|
-
## TABLE OF CONTENTS
|
337
|
-
|
338
|
-
Gollum has a special tag to insert a table of contents (new in v2.1)
|
339
|
-
|
340
|
-
[[_TOC_]]
|
341
|
-
|
342
|
-
This tag is case sensitive, use all upper case. The TOC tag can be inserted
|
343
|
-
into the `_Header`, `_Footer` or `_Sidebar` files too.
|
344
|
-
|
345
|
-
There is also a wiki option `:universal_toc` which will display a
|
346
|
-
table of contents at the top of all your wiki pages if it is enabled.
|
347
|
-
The `:universal_toc` is not enabled by default. To set the option,
|
348
|
-
add the option to the `:wiki_options` hash before starting the
|
349
|
-
frontend app:
|
350
|
-
|
351
|
-
```ruby
|
352
|
-
Precious::App.set(:wiki_options, {:universal_toc => true})
|
353
|
-
```
|
354
|
-
|
355
|
-
## SYNTAX HIGHLIGHTING
|
356
|
-
|
357
|
-
In page files you can get automatic syntax highlighting for a wide range of
|
358
|
-
languages (courtesy of [Pygments](http://pygments.org/) - must install
|
359
|
-
separately) by using the following syntax:
|
360
|
-
|
361
|
-
```ruby
|
362
|
-
def foo
|
363
|
-
puts 'bar'
|
364
|
-
end
|
365
|
-
```
|
366
|
-
|
367
|
-
The block must start with three backticks, at the beginning of a line or
|
368
|
-
indented with any number of spaces or tabs.
|
369
|
-
After that comes the name of the language that is contained by the
|
370
|
-
block. The language must be one of the `short name` lexer strings supported by
|
371
|
-
Pygments. See the [list of lexers](http://pygments.org/docs/lexers/) for valid
|
372
|
-
options.
|
373
|
-
|
374
|
-
The block contents should be indented at the same level than the opening backticks.
|
375
|
-
If the block contents are indented with an additional two spaces or one tab,
|
376
|
-
then that whitespace will be ignored (this makes the blocks easier to read in plaintext).
|
377
|
-
|
378
|
-
The block must end with three backticks indented at the same level than the opening
|
379
|
-
backticks.
|
380
|
-
|
381
|
-
### GITHUB SYNTAX HIGHLIGHTING
|
382
|
-
|
383
|
-
As an extra feature, you can syntax highlight a file from your repository, allowing
|
384
|
-
you keep some of your sample code in the main repository. The code-snippet is
|
385
|
-
updated when the wiki is rebuilt. You include github code like this:
|
386
|
-
|
387
|
-
```html:github:gollum/gollum/master/test/file_view/1_file.txt```
|
388
|
-
|
389
|
-
This will make the builder look at the **gollum user**, in the **gollum project**,
|
390
|
-
in the **master branch**, at path **test/file_view/1_file.txt**. It will be
|
391
|
-
rewritten to:
|
392
|
-
|
393
|
-
```html
|
394
|
-
<ol class="tree">
|
395
|
-
<li class="file"><a href="0">0</a></li>
|
396
|
-
</ol>
|
397
|
-
```
|
398
|
-
|
399
|
-
Which will be parsed as HTML code during the Pygments run, and thereby coloured
|
400
|
-
appropriately.
|
401
|
-
|
402
|
-
## MATHEMATICAL EQUATIONS
|
403
|
-
|
404
|
-
Start gollum with the `--mathjax` flag. Read more about [MathJax](http://docs.mathjax.org/en/latest/index.html) on the web. Gollum uses the `TeX-AMS-MML_HTMLorMML` config with the `autoload-all` extension.
|
405
|
-
|
406
|
-
Inline math:
|
407
|
-
|
408
|
-
- \\(2^2\\)
|
409
|
-
|
410
|
-
Display math:
|
411
|
-
|
412
|
-
- $$2^2$$
|
413
|
-
- \\[2^2\\]
|
414
|
-
|
415
|
-
## SEQUENCE DIAGRAMS
|
416
|
-
|
417
|
-
You may imbed sequence diagrams into your wiki page (rendered by
|
418
|
-
[WebSequenceDiagrams](http://www.websequencediagrams.com) by using the
|
419
|
-
following syntax:
|
420
|
-
|
421
|
-
{{{{{{ blue-modern
|
422
|
-
alice->bob: Test
|
423
|
-
bob->alice: Test response
|
424
|
-
}}}}}}
|
425
|
-
|
426
|
-
You can replace the string "blue-modern" with any supported style.
|
427
|
-
|
428
|
-
## API DOCUMENTATION
|
429
|
-
|
430
|
-
The [Gollum API](https://github.com/gollum/gollum-lib/) allows you to retrieve
|
431
|
-
raw or formatted wiki content from a Git repository, write new content to the
|
432
|
-
repository, and collect various meta data about the wiki as a whole.
|
433
|
-
|
434
|
-
Initialize the `Gollum::Repo` object:
|
435
|
-
|
436
|
-
```ruby
|
437
|
-
# Require rubygems if necessary
|
438
|
-
require 'rubygems'
|
439
|
-
|
440
|
-
# Require the Gollum library
|
441
|
-
require 'gollum-lib'
|
442
|
-
|
443
|
-
# Create a new Gollum::Wiki object by initializing it with the path to the
|
444
|
-
# Git repository.
|
445
|
-
wiki = Gollum::Wiki.new("my-gollum-repo.git")
|
446
|
-
# => <Gollum::Wiki>
|
447
|
-
```
|
448
|
-
|
449
|
-
By default, internal wiki links are all absolute from the root. To specify a different
|
450
|
-
base path, you can specify the `:base_path` option:
|
451
|
-
|
452
|
-
```ruby
|
453
|
-
wiki = Gollum::Wiki.new("my-gollum-repo.git", :base_path => "/wiki")
|
454
|
-
```
|
455
|
-
|
456
|
-
Note that base_path just modifies the links. To map gollum to a non-root location:
|
457
|
-
|
458
|
-
- Use the gollum binary: `gollum path/to/wiki --base-path mywiki`
|
459
|
-
- Define config.ru with `map`. See [#532](https://github.com/gollum/gollum/issues/532) for an example.
|
460
|
-
|
461
|
-
> :base_path - String base path for all Wiki links.
|
462
|
-
>
|
463
|
-
> The String base path to prefix to internal links. For example, when set
|
464
|
-
> to "/wiki", the page "Hobbit" will be linked as "/wiki/Hobbit". Defaults
|
465
|
-
> to "/".
|
466
|
-
|
467
|
-
Get the latest version of the given human or canonical page name:
|
468
|
-
|
469
|
-
```ruby
|
470
|
-
page = wiki.page('page-name')
|
471
|
-
# => <Gollum::Page>
|
472
|
-
|
473
|
-
page.raw_data
|
474
|
-
# => "# My wiki page"
|
475
|
-
|
476
|
-
page.formatted_data
|
477
|
-
# => "<h1>My wiki page</h1>"
|
478
|
-
|
479
|
-
page.format
|
480
|
-
# => :markdown
|
481
|
-
|
482
|
-
vsn = page.version
|
483
|
-
# => <Grit::Commit>
|
484
|
-
|
485
|
-
vsn.id
|
486
|
-
# => '3ca43e12377ea1e32ea5c9ce5992ec8bf266e3e5'
|
487
|
-
```
|
488
|
-
|
489
|
-
Get the footer (if any) for a given page:
|
490
|
-
|
491
|
-
```ruby
|
492
|
-
page.footer
|
493
|
-
# => <Gollum::Page>
|
494
|
-
```
|
495
|
-
|
496
|
-
Get the header (if any) for a given page:
|
497
|
-
|
498
|
-
```ruby
|
499
|
-
page.header
|
500
|
-
# => <Gollum::Page>
|
501
|
-
```
|
502
|
-
|
503
|
-
Get a list of versions for a given page:
|
504
|
-
|
505
|
-
```ruby
|
506
|
-
vsns = wiki.page('page-name').versions
|
507
|
-
# => [<Grit::Commit, <Grit::Commit, <Grit::Commit>]
|
508
|
-
|
509
|
-
vsns.first.id
|
510
|
-
# => '3ca43e12377ea1e32ea5c9ce5992ec8bf266e3e5'
|
511
|
-
|
512
|
-
vsns.first.authored_date
|
513
|
-
# => Sun Mar 28 19:11:21 -0700 2010
|
514
|
-
```
|
515
|
-
|
516
|
-
Get a specific version of a given canonical page file:
|
517
|
-
|
518
|
-
```ruby
|
519
|
-
wiki.page('page-name', '5ec521178e0eec4dc39741a8978a2ba6616d0f0a')
|
520
|
-
```
|
521
|
-
|
522
|
-
Get the latest version of a given static file:
|
523
|
-
|
524
|
-
```ruby
|
525
|
-
file = wiki.file('asset.js')
|
526
|
-
# => <Gollum::File>
|
527
|
-
|
528
|
-
file.raw_data
|
529
|
-
# => "alert('hello');"
|
530
|
-
|
531
|
-
file.version
|
532
|
-
# => <Grit::Commit>
|
533
|
-
```
|
534
|
-
|
535
|
-
Get a specific version of a given static file:
|
536
|
-
|
537
|
-
```ruby
|
538
|
-
wiki.file('asset.js', '5ec521178e0eec4dc39741a8978a2ba6616d0f0a')
|
539
|
-
```
|
540
|
-
|
541
|
-
Get an in-memory Page preview (useful for generating previews for web
|
542
|
-
interfaces):
|
543
|
-
|
544
|
-
```ruby
|
545
|
-
preview = wiki.preview_page("My Page", "# Contents", :markdown)
|
546
|
-
preview.formatted_data
|
547
|
-
# => "<h1>Contents</h1>"
|
548
|
-
```
|
549
|
-
|
550
|
-
Methods that write to the repository require a Hash of commit data that takes
|
551
|
-
the following form:
|
552
|
-
|
553
|
-
```ruby
|
554
|
-
commit = { :message => 'commit message',
|
555
|
-
:name => 'Tom Preston-Werner',
|
556
|
-
:email => 'tom@github.com' }
|
557
|
-
```
|
558
|
-
|
559
|
-
Write a new version of a page (the file will be created if it does not already
|
560
|
-
exist) and commit the change. The file will be written at the repo root.
|
561
|
-
|
562
|
-
```ruby
|
563
|
-
wiki.write_page('Page Name', :markdown, 'Page contents', commit)
|
564
|
-
```
|
565
|
-
|
566
|
-
Update an existing page. If the format is different than the page's current
|
567
|
-
format, the file name will be changed to reflect the new format.
|
568
|
-
|
569
|
-
```ruby
|
570
|
-
page = wiki.page('Page Name')
|
571
|
-
wiki.update_page(page, page.name, page.format, 'Page contents', commit)
|
572
|
-
```
|
573
|
-
|
574
|
-
To delete a page and commit the change:
|
575
|
-
|
576
|
-
```ruby
|
577
|
-
wiki.delete_page(page, commit)
|
578
|
-
```
|
579
|
-
|
580
96
|
### RACK
|
581
97
|
|
582
98
|
You can also run gollum with any rack-compatible server by placing this config.ru
|
@@ -597,10 +113,6 @@ run Precious::App
|
|
597
113
|
|
598
114
|
Your Rack middleware can pass author details to Gollum in a Hash in the session under the 'gollum.author' key.
|
599
115
|
|
600
|
-
## WINDOWS FILENAME VALIDATION
|
601
|
-
|
602
|
-
Note that filenames on windows must not contain any of the following characters `\ / : * ? " < > |`. See [this support article](http://support.microsoft.com/kb/177506) for details.
|
603
|
-
|
604
116
|
## CONFIG FILE
|
605
117
|
|
606
118
|
Gollum optionally takes a `--config file`. See [config.rb](https://github.com/gollum/gollum/blob/master/config.rb) for an example.
|
@@ -611,6 +123,14 @@ The `--css` flag will inject `custom.css` from the root of your git repository i
|
|
611
123
|
|
612
124
|
The `--js` flag will inject `custom.js` from the root of your git repository into each page. `custom.js` must be commited to git or you will get a 302 redirect to the create page.
|
613
125
|
|
126
|
+
|
127
|
+
## API DOCUMENTATION
|
128
|
+
|
129
|
+
The [Gollum API](https://github.com/gollum/gollum-lib/) allows you to retrieve
|
130
|
+
raw or formatted wiki content from a Git repository, write new content to the
|
131
|
+
repository, and collect various meta data about the wiki as a whole.
|
132
|
+
|
133
|
+
|
614
134
|
## CONTRIBUTE
|
615
135
|
|
616
136
|
If you'd like to hack on Gollum, start by forking the repo on GitHub:
|
data/gollum.gemspec
CHANGED
@@ -5,9 +5,10 @@ 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.4.
|
9
|
-
s.date = '2013-
|
8
|
+
s.version = '2.4.14'
|
9
|
+
s.date = '2013-06-15'
|
10
10
|
s.rubyforge_project = 'gollum'
|
11
|
+
s.license = 'MIT'
|
11
12
|
|
12
13
|
s.summary = "A simple, Git-powered wiki."
|
13
14
|
s.description = "A simple, Git-powered wiki with a sweet API and local frontend."
|
@@ -23,14 +24,14 @@ Gem::Specification.new do |s|
|
|
23
24
|
s.rdoc_options = ["--charset=UTF-8"]
|
24
25
|
s.extra_rdoc_files = %w[README.md LICENSE]
|
25
26
|
|
26
|
-
s.add_dependency 'gollum-lib', '~> 1.0.
|
27
|
+
s.add_dependency 'gollum-lib', '~> 1.0.2'
|
27
28
|
s.add_dependency 'sinatra', '~> 1.4.2'
|
28
29
|
s.add_dependency 'mustache', ['>= 0.99.4', '< 1.0.0']
|
29
|
-
s.add_dependency 'useragent', '~> 0.
|
30
|
+
s.add_dependency 'useragent', '~> 0.6.0'
|
30
31
|
|
31
32
|
s.add_development_dependency 'rack-test', '~> 0.6.2'
|
32
|
-
s.add_development_dependency 'shoulda', '
|
33
|
-
s.add_development_dependency 'minitest-reporters', '~> 0.14.
|
33
|
+
s.add_development_dependency 'shoulda', ['>= 3.4.0', '< 3.5.0']
|
34
|
+
s.add_development_dependency 'minitest-reporters', '~> 0.14.16'
|
34
35
|
|
35
36
|
# = MANIFEST =
|
36
37
|
s.files = %w[
|
data/lib/gollum.rb
CHANGED
@@ -17,7 +17,7 @@ require File.expand_path('../gollum/uri_encode_component', __FILE__)
|
|
17
17
|
$KCODE = 'U' if RUBY_VERSION[0,3] == '1.8'
|
18
18
|
|
19
19
|
module Gollum
|
20
|
-
VERSION = '2.4.
|
20
|
+
VERSION = '2.4.14'
|
21
21
|
|
22
22
|
def self.assets_path
|
23
23
|
::File.expand_path('gollum/public', ::File.dirname(__FILE__))
|
data/lib/gollum/app.rb
CHANGED
@@ -101,7 +101,7 @@ module Precious
|
|
101
101
|
# name, path, version
|
102
102
|
def wiki_page(name, path = nil, version = nil, exact = true)
|
103
103
|
wiki = wiki_new
|
104
|
-
|
104
|
+
|
105
105
|
path = name if path.nil?
|
106
106
|
name = extract_name(name) || wiki.index_page
|
107
107
|
path = extract_path(path)
|
@@ -125,7 +125,7 @@ module Precious
|
|
125
125
|
wikip = wiki_page(params[:splat].first)
|
126
126
|
@name = wikip.name
|
127
127
|
@path = wikip.path
|
128
|
-
|
128
|
+
|
129
129
|
wiki = wikip.wiki
|
130
130
|
if page = wikip.page
|
131
131
|
if wiki.live_preview && page.format.to_s.include?('markdown') && supported_useragent?(request.user_agent)
|
@@ -222,6 +222,7 @@ module Precious
|
|
222
222
|
# not /docs/Home because write_page will append /docs
|
223
223
|
@path = @path.sub(page_dir, '/') if @path.start_with? page_dir
|
224
224
|
end
|
225
|
+
@path = clean_path(@path)
|
225
226
|
|
226
227
|
page = wikip.page
|
227
228
|
if page
|
@@ -393,14 +394,14 @@ module Precious
|
|
393
394
|
@page = page
|
394
395
|
@name = name
|
395
396
|
@content = page.formatted_data
|
396
|
-
|
397
|
+
|
397
398
|
# Extensions and layout data
|
398
399
|
@editable = true
|
399
400
|
@toc_content = wiki.universal_toc ? @page.toc_data : nil
|
400
401
|
@mathjax = wiki.mathjax
|
401
402
|
@h1_title = wiki.h1_title
|
402
403
|
@bar_side = wiki.bar_side
|
403
|
-
|
404
|
+
|
404
405
|
mustache :page
|
405
406
|
elsif file = wiki.file(fullpath)
|
406
407
|
content_type file.mime_type
|
data/lib/gollum/helpers.rb
CHANGED
@@ -15,8 +15,8 @@ module Precious
|
|
15
15
|
if file_path[-1, 1] == "/"
|
16
16
|
return nil
|
17
17
|
end
|
18
|
-
|
19
|
-
# File.basename is too eager to please and will return the last
|
18
|
+
|
19
|
+
# File.basename is too eager to please and will return the last
|
20
20
|
# component of the path even if it ends with a directory separator.
|
21
21
|
::File.basename(file_path)
|
22
22
|
end
|
@@ -25,6 +25,13 @@ module Precious
|
|
25
25
|
[nil,''].include?(param) ? nil : CGI.unescape(param)
|
26
26
|
end
|
27
27
|
|
28
|
+
# Ensure path begins with a single leading slash
|
29
|
+
def clean_path(path)
|
30
|
+
if path
|
31
|
+
(path[0] != '/' ? path.insert(0, '/') : path).gsub(/\/{2,}/,'/')
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
28
35
|
# Remove all slashes from the start of string.
|
29
36
|
# Remove all double slashes
|
30
37
|
def clean_url url
|
data/lib/gollum/views/history.rb
CHANGED
@@ -20,7 +20,7 @@ module Precious
|
|
20
20
|
:author => v.author.name.respond_to?(:force_encoding) ? v.author.name.force_encoding('UTF-8') : v.author.name,
|
21
21
|
:message => v.message.respond_to?(:force_encoding) ? v.message.force_encoding('UTF-8') : v.message,
|
22
22
|
:date => v.authored_date.strftime("%B %d, %Y"),
|
23
|
-
:gravatar => Digest::MD5.hexdigest(v.author.email),
|
23
|
+
:gravatar => Digest::MD5.hexdigest(v.author.email.strip.downcase),
|
24
24
|
:identicon => self._identicon_code(v.author.email),
|
25
25
|
:date_full=> v.authored_date,
|
26
26
|
}
|
metadata
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gollum
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.4.
|
4
|
+
version: 2.4.14
|
5
|
+
prerelease:
|
5
6
|
platform: ruby
|
6
7
|
authors:
|
7
8
|
- Tom Preston-Werner
|
@@ -9,25 +10,28 @@ authors:
|
|
9
10
|
autorequire:
|
10
11
|
bindir: bin
|
11
12
|
cert_chain: []
|
12
|
-
date: 2013-
|
13
|
+
date: 2013-06-15 00:00:00.000000000 Z
|
13
14
|
dependencies:
|
14
15
|
- !ruby/object:Gem::Dependency
|
15
16
|
name: gollum-lib
|
16
17
|
requirement: !ruby/object:Gem::Requirement
|
18
|
+
none: false
|
17
19
|
requirements:
|
18
20
|
- - ~>
|
19
21
|
- !ruby/object:Gem::Version
|
20
|
-
version: 1.0.
|
22
|
+
version: 1.0.2
|
21
23
|
type: :runtime
|
22
24
|
prerelease: false
|
23
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
24
27
|
requirements:
|
25
28
|
- - ~>
|
26
29
|
- !ruby/object:Gem::Version
|
27
|
-
version: 1.0.
|
30
|
+
version: 1.0.2
|
28
31
|
- !ruby/object:Gem::Dependency
|
29
32
|
name: sinatra
|
30
33
|
requirement: !ruby/object:Gem::Requirement
|
34
|
+
none: false
|
31
35
|
requirements:
|
32
36
|
- - ~>
|
33
37
|
- !ruby/object:Gem::Version
|
@@ -35,6 +39,7 @@ dependencies:
|
|
35
39
|
type: :runtime
|
36
40
|
prerelease: false
|
37
41
|
version_requirements: !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
38
43
|
requirements:
|
39
44
|
- - ~>
|
40
45
|
- !ruby/object:Gem::Version
|
@@ -42,6 +47,7 @@ dependencies:
|
|
42
47
|
- !ruby/object:Gem::Dependency
|
43
48
|
name: mustache
|
44
49
|
requirement: !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
45
51
|
requirements:
|
46
52
|
- - ! '>='
|
47
53
|
- !ruby/object:Gem::Version
|
@@ -52,6 +58,7 @@ dependencies:
|
|
52
58
|
type: :runtime
|
53
59
|
prerelease: false
|
54
60
|
version_requirements: !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
55
62
|
requirements:
|
56
63
|
- - ! '>='
|
57
64
|
- !ruby/object:Gem::Version
|
@@ -62,20 +69,23 @@ dependencies:
|
|
62
69
|
- !ruby/object:Gem::Dependency
|
63
70
|
name: useragent
|
64
71
|
requirement: !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
65
73
|
requirements:
|
66
74
|
- - ~>
|
67
75
|
- !ruby/object:Gem::Version
|
68
|
-
version: 0.
|
76
|
+
version: 0.6.0
|
69
77
|
type: :runtime
|
70
78
|
prerelease: false
|
71
79
|
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
none: false
|
72
81
|
requirements:
|
73
82
|
- - ~>
|
74
83
|
- !ruby/object:Gem::Version
|
75
|
-
version: 0.
|
84
|
+
version: 0.6.0
|
76
85
|
- !ruby/object:Gem::Dependency
|
77
86
|
name: rack-test
|
78
87
|
requirement: !ruby/object:Gem::Requirement
|
88
|
+
none: false
|
79
89
|
requirements:
|
80
90
|
- - ~>
|
81
91
|
- !ruby/object:Gem::Version
|
@@ -83,6 +93,7 @@ dependencies:
|
|
83
93
|
type: :development
|
84
94
|
prerelease: false
|
85
95
|
version_requirements: !ruby/object:Gem::Requirement
|
96
|
+
none: false
|
86
97
|
requirements:
|
87
98
|
- - ~>
|
88
99
|
- !ruby/object:Gem::Version
|
@@ -90,31 +101,41 @@ dependencies:
|
|
90
101
|
- !ruby/object:Gem::Dependency
|
91
102
|
name: shoulda
|
92
103
|
requirement: !ruby/object:Gem::Requirement
|
104
|
+
none: false
|
93
105
|
requirements:
|
94
|
-
- -
|
106
|
+
- - ! '>='
|
95
107
|
- !ruby/object:Gem::Version
|
96
108
|
version: 3.4.0
|
109
|
+
- - <
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: 3.5.0
|
97
112
|
type: :development
|
98
113
|
prerelease: false
|
99
114
|
version_requirements: !ruby/object:Gem::Requirement
|
115
|
+
none: false
|
100
116
|
requirements:
|
101
|
-
- -
|
117
|
+
- - ! '>='
|
102
118
|
- !ruby/object:Gem::Version
|
103
119
|
version: 3.4.0
|
120
|
+
- - <
|
121
|
+
- !ruby/object:Gem::Version
|
122
|
+
version: 3.5.0
|
104
123
|
- !ruby/object:Gem::Dependency
|
105
124
|
name: minitest-reporters
|
106
125
|
requirement: !ruby/object:Gem::Requirement
|
126
|
+
none: false
|
107
127
|
requirements:
|
108
128
|
- - ~>
|
109
129
|
- !ruby/object:Gem::Version
|
110
|
-
version: 0.14.
|
130
|
+
version: 0.14.16
|
111
131
|
type: :development
|
112
132
|
prerelease: false
|
113
133
|
version_requirements: !ruby/object:Gem::Requirement
|
134
|
+
none: false
|
114
135
|
requirements:
|
115
136
|
- - ~>
|
116
137
|
- !ruby/object:Gem::Version
|
117
|
-
version: 0.14.
|
138
|
+
version: 0.14.16
|
118
139
|
description: A simple, Git-powered wiki with a sweet API and local frontend.
|
119
140
|
email: tom@github.com
|
120
141
|
executables:
|
@@ -621,26 +642,28 @@ files:
|
|
621
642
|
- templates/formatting.html
|
622
643
|
- templates/helper_wiki.rb
|
623
644
|
homepage: http://github.com/gollum/gollum
|
624
|
-
licenses:
|
625
|
-
|
645
|
+
licenses:
|
646
|
+
- MIT
|
626
647
|
post_install_message:
|
627
648
|
rdoc_options:
|
628
649
|
- --charset=UTF-8
|
629
650
|
require_paths:
|
630
651
|
- lib
|
631
652
|
required_ruby_version: !ruby/object:Gem::Requirement
|
653
|
+
none: false
|
632
654
|
requirements:
|
633
655
|
- - ! '>='
|
634
656
|
- !ruby/object:Gem::Version
|
635
657
|
version: 1.8.7
|
636
658
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
659
|
+
none: false
|
637
660
|
requirements:
|
638
661
|
- - ! '>='
|
639
662
|
- !ruby/object:Gem::Version
|
640
663
|
version: '0'
|
641
664
|
requirements: []
|
642
665
|
rubyforge_project: gollum
|
643
|
-
rubygems_version:
|
666
|
+
rubygems_version: 1.8.25
|
644
667
|
signing_key:
|
645
668
|
specification_version: 2
|
646
669
|
summary: A simple, Git-powered wiki.
|
checksums.yaml
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
---
|
2
|
-
!binary "U0hBMQ==":
|
3
|
-
metadata.gz: !binary |-
|
4
|
-
MTMyMTE1ZTQ3Y2EwNjc0ODhlZDA5MDIwYTk1NWY4MzM4NzExMzI3Zg==
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
NDhkNDk3NGQ0YTg0NjNlNjQyM2I4ZTUwYTc1YTA0MDIwZGFhODQyMg==
|
7
|
-
!binary "U0hBNTEy":
|
8
|
-
metadata.gz: !binary |-
|
9
|
-
MTRlZmJjYmQxYzFlZTBjNDEwYTg2Y2Y0ZjczYzIzZjA0OGUxZmRkNmEyZDA5
|
10
|
-
OTk4Nzk3MzY5Njg4NzhmODc4Yjg5NzUzYmUwZDgxZDM0ZjAyM2I4NTJmMGZk
|
11
|
-
Zjk0Yzk2ZDc5NDI2MzY4MjAzOWQ2MzE2MmFkZTZkYzMzYzI5OWQ=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
ZWIxZjcyNDc4ODdmNzU1MDFhZWNkZmNlYzc4ZTMwMGJiZGIxZTZmMzViNTBh
|
14
|
-
OTU2MWQzMTcxMzNiNjUwNGUyMTEzNmU0MThjNThhOTBkYTFmZjM0OTU4ZjU4
|
15
|
-
ODM0Y2Y2NThmMjFhZWI2ZGQ5MzdmNDljMWI5OWY4MmFhM2I5ZDU=
|