gollum-lib 0.0.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of gollum-lib might be problematic. Click here for more details.

@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ YTAyOTk5OTcxZDkyNzQ2NmQzMDg4ZjBhMmQ1ZWE3NWJiYjcyNGFiMQ==
5
+ data.tar.gz: !binary |-
6
+ ZGU3YmFiYTRmZjIwMmEwMDcyMGRmODJmNjU3NDU2ZDQ2MGE3NGQzYg==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ ZDQ0OTg4MmMyZmZlM2ExZmVkMWRkZWJiNTZiNmMyMWQ5NDExNDY0NjcyZDY5
10
+ ZDRiOTVhNjgwMmVjMzAyMmViNTM5NjZmMTc3Zjc3ZTcxOTY2Y2E2ODMyMmY0
11
+ ZjE2NTQwMDNjZGZjOTU2OGY1Y2Y3OTZkNTM4NDZiMWM3YzMyYTc=
12
+ data.tar.gz: !binary |-
13
+ YTFlNjVmOTllYTk4ZjRiOTRhZDgxNGE5MDcyN2IzYzIyNTc5N2JmMmE1NjAw
14
+ OGNhYjlhNzFkYWY2OGQ5ODIzNmE5ZTM1ODY0ZmZlNWQ1NzgzOTY2MjAzZjJk
15
+ OTI4ZDdiMGIyNzBiYmExZmE3MjdjMTM0ZGQ3YTJkNjg0ODVmNTQ=
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+ gem 'rake', '~> 10.0.3'
@@ -0,0 +1,106 @@
1
+ # 2.4.11 / 2013-01-08
2
+
3
+ * Numerous security issues have been fixed. Please update to `2.4.11`
4
+
5
+ # 1.4.0 / 2012-04-10
6
+
7
+ * Minor
8
+ * Add a way to configure the `#id_prefix` property of Sanitization
9
+ objects.
10
+ * Add web sequence diagrams support
11
+ * Support for updating wysiwyg components when markup language changes
12
+ * Support RedCarpet 2.0
13
+ * Allow ftp and irc links in wiki markup
14
+ * Minor ui fixups
15
+
16
+ * Bug Fixes
17
+ * Include the language of the code snippet when making a uniquely
18
+ identifiable sha of a code snippet while rendering a page.
19
+ * Pygments lexer forces utf8 encoding
20
+ * Remove MathJax, this created problems in production for us.
21
+ We'll look at bringing it back in future releases
22
+
23
+ # 1.3.1 / 2011-07-21
24
+
25
+ * Major Enhancements
26
+ * Allow prefixed ID attributes in headers to support internal linking
27
+ (#146).
28
+ * Markdown pages are rendered through Redcarpet by default (#176).
29
+ * Minor Enhancements
30
+ * Remove Edit button on Preview pages (#164).
31
+ * Simplify Wiki#inspect and Page#inspect.
32
+ * Bug Fixes
33
+ * Fixed broken preview functionality (#157).
34
+ * Fixed sidebar/footer rendering problems related to whitespace (#145).
35
+
36
+ # 1.3.0 / 2011-04-25
37
+
38
+ * Major Enhancements
39
+ * Listing of all Pages
40
+ * Support for running Gollum under a separate branch.
41
+ * Minor Enhancements
42
+ * Fix a security issue with rendering Mathjax.
43
+
44
+ # 1.2.0 / 2011-03-11
45
+
46
+ * Major Enhancements
47
+ * Major HTML/CSS/JS overhaul.
48
+ * Add Sidebars (similar to Footers).
49
+ * Add commit reverts.
50
+ * Minor Enhancements
51
+ * Optimization in source code highlighting, resulting in a huge
52
+ decrease in rendering time.
53
+ * Security fixes related to source code highlighting.
54
+
55
+ * Major Enhancements
56
+ * Add Page sidebars, similar to Page footers.
57
+ * Add the ability to revert commits to the wiki.
58
+ * Add MediaWiki support.
59
+ * Minor Enhancements
60
+ * Add `:sanitization` and `:history_sanitization` options for customizing
61
+ how `Sanitize.clean` modifies formatted wiki content.
62
+ * Add `--config` option for the command line, to specify a ruby file that is
63
+ run during startup.
64
+ * Provide access to a parsed Nokogiri::DocumentFragment during markup
65
+ rendering for added customization.
66
+ * Bug Fixes
67
+ * Use `@wiki.page_class` in Gollum::Markup where appropriate (#63).
68
+ * Fix parsing of Org mode file links (#87).
69
+
70
+ # 1.1.0 / 2010-10-28
71
+
72
+ * Major Enhancements
73
+ * Optimize page write/update/delete to use Grit::Index::read_tree instead
74
+ of manually recreating entire index contents.
75
+ * Added --irb option for the gollum command.
76
+ * Update working dir (if present) when edited via the API (#6)
77
+ * Add basic `git grep` based search for repos.
78
+ * Minor Enhancements
79
+ * Support a `:gollum_path` Sinatra setting for `Precious::App`
80
+ * Add Wiki#size to efficiently count pages without loading them.
81
+ * Add the correct content type when serving files from the frontend.
82
+ * Add --host option and default it to 127.0.0.1.
83
+ * Allow anchors in page links, such as `[[Abc#header]]`.
84
+ * All pages retrieved with a SHA add `rel="nofollow"` to all
85
+ page links.
86
+ * Bug Fixes
87
+ * Increase minimum Sanitize version requirement to 1.1.0.
88
+ 1.0.x versions of Sanitize require Hpricot instead of Nokogiri
89
+ and have bugs that may allow non-whitelisted HTML to sneak
90
+ through.
91
+ * Introduce Ruby 1.9 compatibility fixes.
92
+ * Commit hashes are normalized so that missing author data is replaced with
93
+ anonymous info.
94
+ * Prevent `Gollum::Wiki#write_page` from clobbering existing pages.
95
+ * Handle duplicate page errors in frontend.
96
+ * Fix bugs trying to retrieve pages with invalid names.
97
+ * CGI escape page names in links and redirects.
98
+
99
+ # 1.0.1 / 2010-08-12
100
+
101
+ * Bug Fixes
102
+ * Force Grit dep to 2.1 or higher.
103
+
104
+ # 1.0.0 / 2010-08-12
105
+
106
+ * Open Source Birthday!
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ (The MIT License)
2
+
3
+ Copyright (c) Tom Preston-Werner, Rick Olson
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the 'Software'), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,617 @@
1
+ gollum -- A wiki built on top of Git
2
+ ====================================
3
+
4
+ [![Build Status](https://travis-ci.org/gollum/gollum-lib.png)](https://travis-ci.org/gollum/gollum-lib)
5
+ [![Dependency Status](https://gemnasium.com/gollum/gollum-lib.png)](https://gemnasium.com/gollum/gollum-lib)
6
+
7
+ ## DESCRIPTION
8
+
9
+ Gollum is a simple wiki system built on top of Git that powers GitHub Wikis.
10
+
11
+ Gollum wikis are simply Git repositories that adhere to a specific format.
12
+ Gollum pages may be written in a variety of formats and can be edited in a
13
+ number of ways depending on your needs. You can edit your wiki locally:
14
+
15
+ * With your favorite text editor or IDE (changes will be visible after committing).
16
+ * With the built-in web interface.
17
+ * With the Gollum Ruby API.
18
+
19
+ Gollum follows the rules of [Semantic Versioning](http://semver.org/) and uses
20
+ [TomDoc](http://tomdoc.org/) for inline documentation.
21
+
22
+ ## SYSTEM REQUIREMENTS
23
+ - Python 2.5+ (2.7.3 recommended)
24
+ - Ruby 1.8.7+ (1.9.3 recommended)
25
+ - Unix like operating system (OS X, Ubuntu, Debian, and more)
26
+ - Will not work on Windows (because of [grit](https://github.com/github/grit))
27
+
28
+ ## INSTALLATION
29
+
30
+ The best way to install Gollum is with RubyGems:
31
+
32
+ $ [sudo] gem install gollum
33
+
34
+ If you're installing from source, you can use [Bundler][bundler] to pick up all the
35
+ gems:
36
+
37
+ $ bundle install
38
+
39
+ In order to use the various formats that Gollum supports, you will need to
40
+ separately install the necessary dependencies for each format. You only need
41
+ to install the dependencies for the formats that you plan to use.
42
+
43
+ * [ASCIIDoc](http://www.methods.co.nz/asciidoc/) -- `brew install asciidoc` on mac or `apt-get install -y asciidoc` on Ubuntu
44
+ * [Creole](http://wikicreole.org/) -- `gem install creole`
45
+ * [Markdown](http://daringfireball.net/projects/markdown/) -- `gem install redcarpet`
46
+ * [GitHub Flavored Markdown](https://help.github.com/articles/github-flavored-markdown) -- `gem install github-markdown`
47
+ * [Org](http://orgmode.org/) -- `gem install org-ruby`
48
+ * [Pod](http://search.cpan.org/dist/perl/pod/perlpod.pod) -- `Pod::Simple::HTML` comes with Perl >= 5.10. Lower versions should install Pod::Simple from CPAN.
49
+ * [RDoc](http://rdoc.sourceforge.net/)
50
+ * [ReStructuredText](http://docutils.sourceforge.net/rst.html) -- `easy_install docutils`
51
+ * [Textile](http://www.textism.com/tools/textile/) -- `gem install RedCloth`
52
+ * [MediaWiki](http://www.mediawiki.org/wiki/Help:Formatting) -- `gem install wikicloth`
53
+
54
+ [bundler]: http://gembundler.com/
55
+
56
+ ## RUNNING
57
+
58
+ To view and edit your Gollum repository locally via the built in web
59
+ interface, simply install the Gollum gem, navigate to your repository via the
60
+ command line, and run the executable:
61
+
62
+ $ gollum
63
+
64
+ This will start up a web server running the Gollum frontend and you can view
65
+ and edit your wiki at http://localhost:4567. To get help on the command line
66
+ utility, you can run it like so:
67
+
68
+ $ gollum --help
69
+
70
+ 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).
71
+
72
+ ## REPO STRUCTURE
73
+
74
+ A Gollum repository's contents are designed to be human editable. Page content
75
+ is written in `page files` and may be organized into directories any way you
76
+ choose. Special footers can be created in `footer files`. Other content
77
+ (images, PDFs, etc) may also be present and organized in the same way.
78
+
79
+
80
+ ## PAGE FILES
81
+
82
+ Page files may be written in any format supported by
83
+ [GitHub-Markup](http://github.com/github/markup) (except roff). By default,
84
+ Gollum recognizes the following extensions:
85
+
86
+ * ASCIIDoc: .asciidoc
87
+ * Creole: .creole
88
+ * Markdown: .markdown, .mdown, .mkdn, .mkd, .md
89
+ * Org Mode: .org
90
+ * Pod: .pod
91
+ * RDoc: .rdoc
92
+ * ReStructuredText: .rest.txt, .rst.txt, .rest, .rst
93
+ * Textile: .textile
94
+ * MediaWiki: .mediawiki, .wiki
95
+
96
+ You may also register your own extensions and parsers:
97
+
98
+ Gollum::Markup.register(:angry, "Angry") do |content|
99
+ content.upcase
100
+ end
101
+
102
+ Gollum detects the page file format via the extension, so files must have one
103
+ of the default or registered extensions in order to be converted.
104
+
105
+ Page file names may contain any printable UTF-8 character except space
106
+ (U+0020) and forward slash (U+002F). If you commit a page file with any of
107
+ these characters in the name it will not be accessible via the web interface.
108
+
109
+ Even though page files may be placed in any directory, there is still only a
110
+ single namespace for page names, so all page files should have globally unique
111
+ names regardless of where they are located in the repository.
112
+
113
+ The special page file `Home.ext` (where the extension is one of the supported
114
+ formats) will be used as the entrance page to your wiki. If it is missing, an
115
+ automatically generated table of contents will be shown instead.
116
+
117
+ ## SIDEBAR FILES
118
+
119
+ Sidebar files allow you to add a simple sidebar to your wiki. Sidebar files
120
+ are named `_Sidebar.ext` where the extension is one of the supported formats.
121
+ Sidebars affect all pages in their directory and any subdirectories that do not
122
+ have a sidebar file of their own.
123
+
124
+ ## HEADER FILES
125
+
126
+ Header files allow you to add a simple header to your wiki. Header files must
127
+ be named `_Header.ext` where the extension is one of the supported formats.
128
+ Like sidebars, headers affect all pages in their directory and any
129
+ subdirectories that do not have a header file of their own.
130
+
131
+ ## FOOTER FILES
132
+
133
+ Footer files allow you to add a simple footer to your wiki. Footer files must
134
+ be named `_Footer.ext` where the extension is one of the supported formats.
135
+ Like sidebars, footers affect all pages in their directory and any
136
+ subdirectories that do not have a footer file of their own.
137
+
138
+ ## HTML SANITIZATION
139
+
140
+ For security and compatibility reasons Gollum wikis may not contain custom CSS
141
+ or JavaScript. These tags will be stripped from the converted HTML. See
142
+ `docs/sanitization.md` for more details on what tags and attributes are
143
+ allowed.
144
+
145
+ ## TITLES
146
+
147
+ The first defined `h1` will override the default header on a page. There are two ways to set a page title. The metadata syntax:
148
+
149
+ `<!-- --- title: New Title -->`
150
+
151
+ The first `h1` tag can be set to always override the page title, without needing to use the metadata syntax. Start gollum with the `--h1-title` flag.
152
+ ## BRACKET TAGS
153
+
154
+ A variety of Gollum tags use a double bracket syntax. For example:
155
+
156
+ [[Link]]
157
+
158
+ Some tags will accept attributes which are separated by pipe symbols. For
159
+ example:
160
+
161
+ [[Link|Page Title]]
162
+
163
+ In all cases, the first thing in the link is what is displayed on the page.
164
+ So, if the tag is an internal wiki link, the first thing in the tag will be
165
+ the link text displayed on the page. If the tag is an embedded image, the
166
+ first thing in the tag will be a path to an image file. Use this trick to
167
+ easily remember which order things should appear in tags.
168
+
169
+ Some formats, such as MediaWiki, support the opposite syntax:
170
+
171
+ [[Page Title|Link]]
172
+
173
+ ## PAGE LINKS
174
+
175
+ To link to another Gollum wiki page, use the Gollum Page Link Tag.
176
+
177
+ [[Frodo Baggins]]
178
+
179
+ The above tag will create a link to the corresponding page file named
180
+ `Frodo-Baggins.ext` where `ext` may be any of the allowed extension types. The
181
+ conversion is as follows:
182
+
183
+ 1. Replace any spaces (U+0020) with dashes (U+002D)
184
+ 2. Replace any slashes (U+002F) with dashes (U+002D)
185
+
186
+ If you'd like the link text to be something that doesn't map directly to the
187
+ page name, you can specify the actual page name after a pipe:
188
+
189
+ [[Frodo|Frodo Baggins]]
190
+
191
+ The above tag will link to `Frodo-Baggins.ext` using "Frodo" as the link text.
192
+
193
+ The page file may exist anywhere in the directory structure of the repository.
194
+ Gollum does a breadth first search and uses the first match that it finds.
195
+
196
+ Here are a few more examples:
197
+
198
+ [[J. R. R. Tolkien]] -> J.-R.-R.-Tolkien.ext
199
+ [[Movies / The Hobbit]] -> Movies---The-Hobbit.ext
200
+ [[モルドール]] -> モルドール.ext
201
+
202
+
203
+ ## EXTERNAL LINKS
204
+
205
+ As a convenience, simple external links can be placed within brackets and they
206
+ will be linked to the given URL with the URL as the link text. For example:
207
+
208
+ [[http://example.com]]
209
+
210
+ External links must begin with either "http://" or "https://". If you need
211
+ something more flexible, you can resort to the link syntax in the page's
212
+ underlying markup format.
213
+
214
+
215
+ ## ABSOLUTE VS. RELATIVE VS. EXTERNAL PATH
216
+
217
+ For Gollum tags that operate on static files (images, PDFs, etc), the paths
218
+ may be referenced as either relative, absolute, or external. Relative paths
219
+ point to a static file relative to the page file within the directory
220
+ structure of the Gollum repo (even though after conversion, all page files
221
+ appear to be top level). These paths are NOT prefixed with a slash. For
222
+ example:
223
+
224
+ gollum.pdf
225
+ docs/diagram.png
226
+
227
+ Absolute paths point to a static file relative to the Gollum repo's
228
+ root, regardless of where the page file is stored within the directory
229
+ structure. These paths ARE prefixed with a slash. For example:
230
+
231
+ /pdfs/gollum.pdf
232
+ /docs/diagram.png
233
+
234
+ External paths are full URLs. An external path must begin with either
235
+ "http://" or "https://". For example:
236
+
237
+ http://example.com/pdfs/gollum.pdf
238
+ http://example.com/images/diagram.png
239
+
240
+ All of the examples in this README use relative paths, but you may use
241
+ whatever works best in your situation.
242
+
243
+
244
+ ## FILE LINKS
245
+
246
+ To link to static files that are contained in the Gollum repository you should
247
+ use the Gollum File Link Tag.
248
+
249
+ [[Gollum|gollum.pdf]]
250
+
251
+ The first part of the tag is the link text. The path to the file appears after
252
+ the pipe.
253
+
254
+
255
+ ## IMAGES
256
+
257
+ To display images that are contained in the Gollum repository you should use
258
+ the Gollum Image Tag. This will display the actual image on the page.
259
+
260
+ [[gollum.png]]
261
+
262
+ In addition to the simple format, there are a variety of options that you
263
+ can specify between pipe delimiters.
264
+
265
+ To specify alt text, use the `alt=` option. Default is no alt text.
266
+
267
+ [[gollum.png|alt=Gollum and his precious wiki]]
268
+
269
+ To place the image in a frame, use the `frame` option. When combined with the
270
+ `alt=` option, the alt text will be used as a caption as well. Default is no
271
+ frame.
272
+
273
+ [[gollum.png|frame|alt=Gollum and his precious wiki]]
274
+
275
+ To specify the alignment of the image on the page, use the `align=` option.
276
+ Possible values are `left`, `center`, and `right`. Default is `left`.
277
+
278
+ [[gollum.png|align=center]]
279
+
280
+ To float an image so that text flows around it, use the `float` option. When
281
+ `float` is specified, only `left` and `right` are valid `align` options.
282
+ Default is not floating. When floating is activated but no alignment is
283
+ specified, default alignment is `left`.
284
+
285
+ [[gollum.png|float]]
286
+
287
+ By default text will fill up all the space around the image. To control how
288
+ much should show up use this tag to stop and start a new block so that
289
+ additional content doesn't fill in.
290
+
291
+ [[_]]
292
+
293
+ To specify a max-width, use the `width=` option. Units must be specified in
294
+ either `px` or `em`.
295
+
296
+ [[gollum.png|width=400px]]
297
+
298
+ To specify a max-height, use the `height=` option. Units must be specified in
299
+ either `px` or `em`.
300
+
301
+ [[gollum.png|height=300px]]
302
+
303
+ Any of these options may be composed together by simply separating them with
304
+ pipes.
305
+
306
+
307
+ ## ESCAPING GOLLUM TAGS
308
+
309
+ If you need the literal text of a wiki or static link to show up in your final
310
+ wiki page, simply preface the link with a single quote (like in LISP):
311
+
312
+ '[[Page Link]]
313
+ '[[File Link|file.pdf]]
314
+ '[[image.jpg]]
315
+
316
+ This is useful for writing about the link syntax in your wiki pages.
317
+
318
+ ## TABLE OF CONTENTS
319
+
320
+ Gollum has a special tag to insert a table of contents (new in v2.1)
321
+
322
+ [[_TOC_]]
323
+
324
+ This tag is case sensitive, use all upper case. The TOC tag can be inserted
325
+ into the `_Header`, `_Footer` or `_Sidebar` files too.
326
+
327
+ There is also a wiki option `:universal_toc` which will display a
328
+ table of contents at the top of all your wiki pages if it is enabled.
329
+ The `:universal_toc` is not enabled by default. To set the option,
330
+ add the option to the `:wiki_options` hash before starting the
331
+ frontend app:
332
+
333
+ Precious::App.set(:wiki_options, {:universal_toc => true})
334
+
335
+ ## SYNTAX HIGHLIGHTING
336
+
337
+ In page files you can get automatic syntax highlighting for a wide range of
338
+ languages (courtesy of [Pygments](http://pygments.org/) - must install
339
+ separately) by using the following syntax:
340
+
341
+ ```ruby
342
+ def foo
343
+ puts 'bar'
344
+ end
345
+ ```
346
+
347
+ The block must start with three backticks, at the beginning of a line or
348
+ indented with any number of spaces or tabs.
349
+ After that comes the name of the language that is contained by the
350
+ block. The language must be one of the `short name` lexer strings supported by
351
+ Pygments. See the [list of lexers](http://pygments.org/docs/lexers/) for valid
352
+ options.
353
+
354
+ The block contents should be indented at the same level than the opening backticks.
355
+ If the block contents are indented with an additional two spaces or one tab,
356
+ then that whitespace will be ignored (this makes the blocks easier to read in plaintext).
357
+
358
+ The block must end with three backticks indented at the same level than the opening
359
+ backticks.
360
+
361
+ ### GITHUB SYNTAX HIGHLIGHTING
362
+
363
+ As an extra feature, you can syntax highlight a file from your repository, allowing
364
+ you keep some of your sample code in the main repository. The code-snippet is
365
+ updated when the wiki is rebuilt. You include github code like this:
366
+
367
+ ```html:gollum/gollum/master/test/file_view/1_file.txt```
368
+
369
+ This will make the builder look at the **github user**, in the **gollum project**,
370
+ in the **master branch**, at path **test/file_view/1_file.txt**. It will be
371
+ rewritten to:
372
+
373
+ ```html
374
+ <ol class="tree">
375
+ <li class="file"><a href="0">0</a></li>
376
+ </ol>
377
+ ```
378
+
379
+ Which will be parsed as HTML code during the Pygments run, and thereby coloured
380
+ appropriately.
381
+
382
+ ## MATHEMATICAL EQUATIONS
383
+
384
+ 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.
385
+
386
+ Inline math:
387
+
388
+ - $2^2$
389
+ - `\\(2^2\\)`
390
+
391
+ Display math:
392
+
393
+ - $$2^2$$
394
+ - [2^2]
395
+
396
+ ## SEQUENCE DIAGRAMS
397
+
398
+ You may imbed sequence diagrams into your wiki page (rendered by
399
+ [WebSequenceDiagrams](http://www.websequencediagrams.com) by using the
400
+ following syntax:
401
+
402
+ {{{{{{ blue-modern
403
+ alice->bob: Test
404
+ bob->alice: Test response
405
+ }}}}}}
406
+
407
+ You can replace the string "blue-modern" with any supported style.
408
+
409
+ ## API DOCUMENTATION
410
+
411
+ The Gollum API allows you to retrieve raw or formatted wiki content from a Git
412
+ repository, write new content to the repository, and collect various meta data
413
+ about the wiki as a whole.
414
+
415
+ Initialize the Gollum::Repo object:
416
+
417
+ # Require rubygems if necessary
418
+ require 'rubygems'
419
+
420
+ # Require the Gollum library
421
+ require 'gollum'
422
+
423
+ # Create a new Gollum::Wiki object by initializing it with the path to the
424
+ # Git repository.
425
+ wiki = Gollum::Wiki.new("my-gollum-repo.git")
426
+ # => <Gollum::Wiki>
427
+
428
+ By default, internal wiki links are all absolute from the root. To specify a different base path, you can specify the `:base_path` option:
429
+
430
+ wiki = Gollum::Wiki.new("my-gollum-repo.git", :base_path => "/wiki")
431
+
432
+ Note that base_path just modifies the links. To map gollum to a non-root location:
433
+
434
+ - Use the gollum binary: `gollum path/to/wiki --base-path mywiki`
435
+ - Define config.ru with `map`. See [#532](https://github.com/gollum/gollum/issues/532) for an example.
436
+
437
+ > :base_path - String base path for all Wiki links.
438
+ >
439
+ > The String base path to prefix to internal links. For example, when set
440
+ > to "/wiki", the page "Hobbit" will be linked as "/wiki/Hobbit". Defaults
441
+ > to "/".
442
+
443
+ Get the latest version of the given human or canonical page name:
444
+
445
+ page = wiki.page('page-name')
446
+ # => <Gollum::Page>
447
+
448
+ page.raw_data
449
+ # => "# My wiki page"
450
+
451
+ page.formatted_data
452
+ # => "<h1>My wiki page</h1>"
453
+
454
+ page.format
455
+ # => :markdown
456
+
457
+ vsn = page.version
458
+ # => <Grit::Commit>
459
+
460
+ vsn.id
461
+ # => '3ca43e12377ea1e32ea5c9ce5992ec8bf266e3e5'
462
+
463
+ Get the footer (if any) for a given page:
464
+
465
+ page.footer
466
+ # => <Gollum::Page>
467
+
468
+ Get the header (if any) for a given page:
469
+
470
+ page.header
471
+ # => <Gollum::Page>
472
+
473
+ Get a list of versions for a given page:
474
+
475
+ vsns = wiki.page('page-name').versions
476
+ # => [<Grit::Commit, <Grit::Commit, <Grit::Commit>]
477
+
478
+ vsns.first.id
479
+ # => '3ca43e12377ea1e32ea5c9ce5992ec8bf266e3e5'
480
+
481
+ vsns.first.authored_date
482
+ # => Sun Mar 28 19:11:21 -0700 2010
483
+
484
+ Get a specific version of a given canonical page file:
485
+
486
+ wiki.page('page-name', '5ec521178e0eec4dc39741a8978a2ba6616d0f0a')
487
+
488
+ Get the latest version of a given static file:
489
+
490
+ file = wiki.file('asset.js')
491
+ # => <Gollum::File>
492
+
493
+ file.raw_data
494
+ # => "alert('hello');"
495
+
496
+ file.version
497
+ # => <Grit::Commit>
498
+
499
+ Get a specific version of a given static file:
500
+
501
+ wiki.file('asset.js', '5ec521178e0eec4dc39741a8978a2ba6616d0f0a')
502
+
503
+ Get an in-memory Page preview (useful for generating previews for web
504
+ interfaces):
505
+
506
+ preview = wiki.preview_page("My Page", "# Contents", :markdown)
507
+ preview.formatted_data
508
+ # => "<h1>Contents</h1>"
509
+
510
+ Methods that write to the repository require a Hash of commit data that takes
511
+ the following form:
512
+
513
+ commit = { :message => 'commit message',
514
+ :name => 'Tom Preston-Werner',
515
+ :email => 'tom@github.com' }
516
+
517
+ Write a new version of a page (the file will be created if it does not already
518
+ exist) and commit the change. The file will be written at the repo root.
519
+
520
+ wiki.write_page('Page Name', :markdown, 'Page contents', commit)
521
+
522
+ Update an existing page. If the format is different than the page's current
523
+ format, the file name will be changed to reflect the new format.
524
+
525
+ page = wiki.page('Page Name')
526
+ wiki.update_page(page, page.name, page.format, 'Page contents', commit)
527
+
528
+ To delete a page and commit the change:
529
+
530
+ wiki.delete_page(page, commit)
531
+
532
+ ### RACK
533
+
534
+ You can also run gollum with any rack-compatible server by placing this config.ru
535
+ file inside your wiki repository. This allows you to utilize any Rack middleware
536
+ like Rack::Auth, OmniAuth, etc.
537
+
538
+ #!/usr/bin/env ruby
539
+ require 'rubygems'
540
+ require 'gollum/frontend/app'
541
+
542
+ gollum_path = File.expand_path(File.dirname(__FILE__)) # CHANGE THIS TO POINT TO YOUR OWN WIKI REPO
543
+ Precious::App.set(:gollum_path, gollum_path)
544
+ Precious::App.set(:default_markup, :markdown) # set your favorite markup language
545
+ Precious::App.set(:wiki_options, {:universal_toc => false})
546
+ run Precious::App
547
+
548
+ Your Rack middleware can pass author details to Gollum in a Hash in the session under the 'gollum.author' key.
549
+
550
+ ## WINDOWS FILENAME VALIDATION
551
+ 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.
552
+
553
+ ## CONFIG FILE
554
+
555
+ Gollum optionally takes a `--config file`. See [config.rb](https://github.com/gollum/gollum/blob/master/config.rb) for an example.
556
+
557
+ ## CUSTOM CSS
558
+
559
+ The `--css` flag will inject `custom.css` from the root of your git repository into each page. `custom.css` must be commited to git or you will get a 302 redirect to the create page.
560
+
561
+ ## CONTRIBUTE
562
+
563
+ If you'd like to hack on Gollum, start by forking the repo on GitHub:
564
+
565
+ http://github.com/gollum/gollum
566
+
567
+ To get all of the dependencies, install the gem first. The best way to get
568
+ your changes merged back into core is as follows:
569
+
570
+ 1. Clone down your fork
571
+ 1. Create a thoughtfully named topic branch to contain your change
572
+ 1. Hack away
573
+ 1. Add tests and make sure everything still passes by running `rake`
574
+ 1. If you are adding new functionality, document it in the README
575
+ 1. Do not change the version number, I will do that on my end
576
+ 1. If necessary, rebase your commits into logical chunks, without errors
577
+ 1. Push the branch up to GitHub
578
+ 1. Send a pull request to the gollum/gollum project.
579
+
580
+ ## RELEASING
581
+ x.y.z
582
+
583
+ For z releases:
584
+ $ rake bump
585
+ $ rake release
586
+
587
+ For x.y releases:
588
+ Update VERSION in lib/gollum.rb
589
+ $ rake gemspec
590
+ $ rake release
591
+
592
+ ## BUILDING THE GEM FROM MASTER
593
+ $ gem uninstall -aIx gollum
594
+ $ git clone https://github.com/gollum/gollum.git
595
+ $ cd gollum
596
+ gollum$ rake build
597
+ gollum$ gem install --no-ri --no-rdoc pkg/gollum*.gem
598
+
599
+ ## RUN THE TESTS
600
+
601
+ bundle install
602
+ bundle exec rake test
603
+
604
+ ## WORK WITH TEST REPOS
605
+
606
+ An example of how to add a test file to the bare repository lotr.git.
607
+
608
+ ```bash
609
+ $ mkdir tmp; cd tmp
610
+ $ git clone ../lotr.git/ .
611
+ Cloning into '.'...
612
+ done.
613
+ $ git log
614
+ $ echo "test" > test.md
615
+ $ git add . ; git commit -am "Add test"
616
+ $ git push ../lotr.git/ master
617
+ ```