gollum-bibanon 1.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (164) hide show
  1. data/Gemfile +4 -0
  2. data/HISTORY.md +93 -0
  3. data/Home.md +3 -0
  4. data/LICENSE +21 -0
  5. data/README.md +483 -0
  6. data/Rakefile +138 -0
  7. data/bin/gollum +126 -0
  8. data/docs/sanitization.md +32 -0
  9. data/gollum.gemspec +212 -0
  10. data/lib/gollum.rb +40 -0
  11. data/lib/gollum/blob_entry.rb +78 -0
  12. data/lib/gollum/committer.rb +218 -0
  13. data/lib/gollum/file.rb +64 -0
  14. data/lib/gollum/frontend/app.rb +234 -0
  15. data/lib/gollum/frontend/public/css/dialog.css +141 -0
  16. data/lib/gollum/frontend/public/css/editor.css +537 -0
  17. data/lib/gollum/frontend/public/css/gollum.css +660 -0
  18. data/lib/gollum/frontend/public/css/ie7.css +69 -0
  19. data/lib/gollum/frontend/public/css/template.css +381 -0
  20. data/lib/gollum/frontend/public/images/icon-sprite.png +0 -0
  21. data/lib/gollum/frontend/public/javascript/editor/gollum.editor.js +1073 -0
  22. data/lib/gollum/frontend/public/javascript/editor/langs/asciidoc.js +167 -0
  23. data/lib/gollum/frontend/public/javascript/editor/langs/creole.js +104 -0
  24. data/lib/gollum/frontend/public/javascript/editor/langs/markdown.js +211 -0
  25. data/lib/gollum/frontend/public/javascript/editor/langs/org.js +173 -0
  26. data/lib/gollum/frontend/public/javascript/editor/langs/pod.js +111 -0
  27. data/lib/gollum/frontend/public/javascript/editor/langs/rdoc.js +74 -0
  28. data/lib/gollum/frontend/public/javascript/editor/langs/textile.js +175 -0
  29. data/lib/gollum/frontend/public/javascript/gollum.dialog.js +263 -0
  30. data/lib/gollum/frontend/public/javascript/gollum.js +161 -0
  31. data/lib/gollum/frontend/public/javascript/gollum.placeholder.js +54 -0
  32. data/lib/gollum/frontend/public/javascript/jquery.color.js +123 -0
  33. data/lib/gollum/frontend/public/javascript/jquery.js +7179 -0
  34. data/lib/gollum/frontend/templates/compare.mustache +53 -0
  35. data/lib/gollum/frontend/templates/create.mustache +15 -0
  36. data/lib/gollum/frontend/templates/edit.mustache +17 -0
  37. data/lib/gollum/frontend/templates/editor.mustache +116 -0
  38. data/lib/gollum/frontend/templates/error.mustache +8 -0
  39. data/lib/gollum/frontend/templates/history.mustache +60 -0
  40. data/lib/gollum/frontend/templates/layout.mustache +28 -0
  41. data/lib/gollum/frontend/templates/page.mustache +45 -0
  42. data/lib/gollum/frontend/templates/pages.mustache +35 -0
  43. data/lib/gollum/frontend/templates/search.mustache +36 -0
  44. data/lib/gollum/frontend/templates/searchbar.mustache +10 -0
  45. data/lib/gollum/frontend/views/compare.rb +94 -0
  46. data/lib/gollum/frontend/views/create.rb +44 -0
  47. data/lib/gollum/frontend/views/edit.rb +52 -0
  48. data/lib/gollum/frontend/views/editable.rb +13 -0
  49. data/lib/gollum/frontend/views/error.rb +7 -0
  50. data/lib/gollum/frontend/views/history.rb +44 -0
  51. data/lib/gollum/frontend/views/layout.rb +20 -0
  52. data/lib/gollum/frontend/views/page.rb +57 -0
  53. data/lib/gollum/frontend/views/pages.rb +19 -0
  54. data/lib/gollum/frontend/views/search.rb +20 -0
  55. data/lib/gollum/git_access.rb +248 -0
  56. data/lib/gollum/markup.rb +432 -0
  57. data/lib/gollum/page.rb +428 -0
  58. data/lib/gollum/pagination.rb +61 -0
  59. data/lib/gollum/sanitization.rb +161 -0
  60. data/lib/gollum/wiki.rb +636 -0
  61. data/templates/formatting.html +92 -0
  62. data/test/examples/empty.git/HEAD +1 -0
  63. data/test/examples/empty.git/config +5 -0
  64. data/test/examples/empty.git/description +1 -0
  65. data/test/examples/empty.git/hooks/applypatch-msg.sample +15 -0
  66. data/test/examples/empty.git/hooks/commit-msg.sample +24 -0
  67. data/test/examples/empty.git/hooks/post-commit.sample +8 -0
  68. data/test/examples/empty.git/hooks/post-receive.sample +15 -0
  69. data/test/examples/empty.git/hooks/post-update.sample +8 -0
  70. data/test/examples/empty.git/hooks/pre-applypatch.sample +14 -0
  71. data/test/examples/empty.git/hooks/pre-commit.sample +46 -0
  72. data/test/examples/empty.git/hooks/pre-rebase.sample +169 -0
  73. data/test/examples/empty.git/hooks/prepare-commit-msg.sample +36 -0
  74. data/test/examples/empty.git/hooks/update.sample +128 -0
  75. data/test/examples/empty.git/info/exclude +6 -0
  76. data/test/examples/lotr.git/COMMIT_EDITMSG +1 -0
  77. data/test/examples/lotr.git/HEAD +1 -0
  78. data/test/examples/lotr.git/config +12 -0
  79. data/test/examples/lotr.git/description +1 -0
  80. data/test/examples/lotr.git/index +0 -0
  81. data/test/examples/lotr.git/info/exclude +6 -0
  82. data/test/examples/lotr.git/logs/HEAD +3 -0
  83. data/test/examples/lotr.git/logs/refs/heads/master +3 -0
  84. data/test/examples/lotr.git/objects/06/131480411710c92a82fe2d1e76932c70feb2e5 +0 -0
  85. data/test/examples/lotr.git/objects/0a/de1e2916346d4c1f2fb63b863fd3c16808fe44 +0 -0
  86. data/test/examples/lotr.git/objects/0e/d8cbe0a25235bd867e65193c7d837c66b328ef +3 -0
  87. data/test/examples/lotr.git/objects/24/49c2681badfd3c189e8ed658dacffe8ba48fe5 +0 -0
  88. data/test/examples/lotr.git/objects/2c/b9156ad383914561a8502fc70f5a1d887e48ad +4 -0
  89. data/test/examples/lotr.git/objects/5d/cac289a8603188d2c5caf481dcba2985126aaa +0 -0
  90. data/test/examples/lotr.git/objects/60/f12f4254f58801b9ee7db7bca5fa8aeefaa56b +0 -0
  91. data/test/examples/lotr.git/objects/71/4323c104239440a5c66ab12a67ed07a83c404f +0 -0
  92. data/test/examples/lotr.git/objects/84/0ec5b1ba1320e8ec443f28f99566f615d5af10 +0 -0
  93. data/test/examples/lotr.git/objects/93/6b83ee0dd8837adb82511e40d5e4ebe59bb675 +0 -0
  94. data/test/examples/lotr.git/objects/94/523d7ae48aeba575099dd12926420d8fd0425d +2 -0
  95. data/test/examples/lotr.git/objects/96/97dc65e095658bbd1b8e8678e08881e86d32f1 +0 -0
  96. data/test/examples/lotr.git/objects/a3/1ca2a7c352c92531a8b99815d15843b259e814 +0 -0
  97. data/test/examples/lotr.git/objects/a8/ad3c09dd842a3517085bfadd37718856dee813 +0 -0
  98. data/test/examples/lotr.git/objects/aa/b61fe89d56f8614c0a8151da34f939dcedfa68 +0 -0
  99. data/test/examples/lotr.git/objects/c3/b43e9f08966b088e7a0192e436b7a884542e05 +0 -0
  100. data/test/examples/lotr.git/objects/dc/596d6b2dd89ab05c66f4abd7d5eb706bc17f19 +0 -0
  101. data/test/examples/lotr.git/objects/ec/da3205bee14520aab5a7bb307392064b938e83 +0 -0
  102. data/test/examples/lotr.git/objects/fa/e7ef5344202bba4129abdc13060d9297d99465 +3 -0
  103. data/test/examples/lotr.git/objects/info/packs +2 -0
  104. data/test/examples/lotr.git/objects/pack/pack-dcbeaf3f6ff6c5eb08ea2b0a2d83626e8763546b.idx +0 -0
  105. data/test/examples/lotr.git/objects/pack/pack-dcbeaf3f6ff6c5eb08ea2b0a2d83626e8763546b.pack +0 -0
  106. data/test/examples/lotr.git/packed-refs +2 -0
  107. data/test/examples/lotr.git/refs/heads/master +1 -0
  108. data/test/examples/lotr.git/refs/remotes/origin/HEAD +1 -0
  109. data/test/examples/page_file_dir.git/COMMIT_EDITMSG +1 -0
  110. data/test/examples/page_file_dir.git/HEAD +1 -0
  111. data/test/examples/page_file_dir.git/config +6 -0
  112. data/test/examples/page_file_dir.git/description +1 -0
  113. data/test/examples/page_file_dir.git/index +0 -0
  114. data/test/examples/page_file_dir.git/info/exclude +6 -0
  115. data/test/examples/page_file_dir.git/logs/HEAD +1 -0
  116. data/test/examples/page_file_dir.git/logs/refs/heads/master +1 -0
  117. data/test/examples/page_file_dir.git/objects/0c/7d27db1f575263efdcab3dc650f4502a2dbcbf +0 -0
  118. data/test/examples/page_file_dir.git/objects/22/b404803c966dd92865614d86ff22ca12e50c1e +0 -0
  119. data/test/examples/page_file_dir.git/objects/25/7cc5642cb1a054f08cc83f2d943e56fd3ebe99 +0 -0
  120. data/test/examples/page_file_dir.git/objects/57/16ca5987cbf97d6bb54920bea6adde242d87e6 +0 -0
  121. data/test/examples/page_file_dir.git/objects/5b/43e14e0a15fb6f08feab1773d1c0991e9f71e2 +0 -0
  122. data/test/examples/page_file_dir.git/refs/heads/master +1 -0
  123. data/test/examples/revert.git/COMMIT_EDITMSG +1 -0
  124. data/test/examples/revert.git/HEAD +1 -0
  125. data/test/examples/revert.git/config +12 -0
  126. data/test/examples/revert.git/description +1 -0
  127. data/test/examples/revert.git/index +0 -0
  128. data/test/examples/revert.git/info/exclude +6 -0
  129. data/test/examples/revert.git/logs/HEAD +2 -0
  130. data/test/examples/revert.git/logs/refs/heads/master +2 -0
  131. data/test/examples/revert.git/objects/20/2ced67cea93c7b6bd2928aa1daef8d1d55a20d +0 -0
  132. data/test/examples/revert.git/objects/41/76394bfa11222363c66ce7e84b5f154095b6d9 +0 -0
  133. data/test/examples/revert.git/objects/6a/69f92020f5df77af6e8813ff1232493383b708 +0 -0
  134. data/test/examples/revert.git/objects/b4/785957bc986dc39c629de9fac9df46972c00fc +0 -0
  135. data/test/examples/revert.git/objects/f4/03b791119f8232b7cb0ba455c624ac6435f433 +0 -0
  136. data/test/examples/revert.git/objects/info/packs +2 -0
  137. data/test/examples/revert.git/objects/pack/pack-a561f8437234f74d0bacb9e0eebe52d207f5770d.idx +0 -0
  138. data/test/examples/revert.git/objects/pack/pack-a561f8437234f74d0bacb9e0eebe52d207f5770d.pack +0 -0
  139. data/test/examples/revert.git/packed-refs +2 -0
  140. data/test/examples/revert.git/refs/heads/master +1 -0
  141. data/test/examples/revert.git/refs/remotes/origin/HEAD +1 -0
  142. data/test/examples/yubiwa.git/HEAD +1 -0
  143. data/test/examples/yubiwa.git/config +5 -0
  144. data/test/examples/yubiwa.git/description +1 -0
  145. data/test/examples/yubiwa.git/info/exclude +6 -0
  146. data/test/examples/yubiwa.git/objects/10/fa2ddc4e3b4009d8a453aace10bd6148c1ad00 +0 -0
  147. data/test/examples/yubiwa.git/objects/52/4b82874327ea7cbf730389964ba7cb3de966de +0 -0
  148. data/test/examples/yubiwa.git/objects/58/3fc201cb457fb3f1480f3e1e5999b119633835 +0 -0
  149. data/test/examples/yubiwa.git/objects/87/bc1dd46ab3d3874d4e898d45dd512cc20a7cc8 +1 -0
  150. data/test/examples/yubiwa.git/objects/89/64ed1b4e21aa90e831763bbce9034bfda81b70 +0 -0
  151. data/test/examples/yubiwa.git/objects/9f/f6dd0660da5fba2d3374adb2b84fa653bb538b +0 -0
  152. data/test/examples/yubiwa.git/objects/ac/e97abf2b177815a1972d7db22f229f58c83309 +0 -0
  153. data/test/examples/yubiwa.git/objects/b1/f443863a4816628807fbf86141ebef055dda34 +0 -0
  154. data/test/examples/yubiwa.git/refs/heads/master +1 -0
  155. data/test/helper.rb +66 -0
  156. data/test/test_app.rb +179 -0
  157. data/test/test_committer.rb +64 -0
  158. data/test/test_file.rb +27 -0
  159. data/test/test_git_access.rb +52 -0
  160. data/test/test_markup.rb +580 -0
  161. data/test/test_page.rb +166 -0
  162. data/test/test_page_revert.rb +45 -0
  163. data/test/test_wiki.rb +462 -0
  164. metadata +493 -0
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ gemspec
4
+ gem "rake", "~> 0.9.2"
data/HISTORY.md ADDED
@@ -0,0 +1,93 @@
1
+ # git
2
+
3
+ * Minor
4
+ * Add a way to configure the `#id_prefix` property of Sanitization
5
+ objects.
6
+ * Bug Fixes
7
+ * Include the language of the code snippet when making a uniquely
8
+ identifiable sha of a code snippet while rendering a page.
9
+
10
+ # 1.3.1 / 2011-07-21
11
+
12
+ * Major Enhancements
13
+ * Allow prefixed ID attributes in headers to support internal linking
14
+ (#146).
15
+ * Markdown pages are rendered through Redcarpet by default (#176).
16
+ * Minor Enhancements
17
+ * Remove Edit button on Preview pages (#164).
18
+ * Simplify Wiki#inspect and Page#inspect.
19
+ * Bug Fixes
20
+ * Fixed broken preview functionality (#157).
21
+ * Fixed sidebar/footer rendering problems related to whitespace (#145).
22
+
23
+ # 1.3.0 / 2011-04-25
24
+
25
+ * Major Enhancements
26
+ * Listing of all Pages
27
+ * Support for running Gollum under a separate branch.
28
+ * Minor Enhancements
29
+ * Fix a security issue with rendering Mathjax.
30
+
31
+ # 1.2.0 / 2011-03-11
32
+
33
+ * Major Enhancements
34
+ * Major HTML/CSS/JS overhaul.
35
+ * Add Sidebars (similar to Footers).
36
+ * Add commit reverts.
37
+ * Minor Enhancements
38
+ * Optimization in source code highlighting, resulting in a huge
39
+ decrease in rendering time.
40
+ * Security fixes related to source code highlighting.
41
+
42
+ * Major Enhancements
43
+ * Add Page sidebars, similar to Page footers.
44
+ * Add the ability to revert commits to the wiki.
45
+ * Add MediaWiki support.
46
+ * Minor Enhancements
47
+ * Add `:sanitization` and `:history_sanitization` options for customizing
48
+ how `Sanitize.clean` modifies formatted wiki content.
49
+ * Add `--config` option for the command line, to specify a ruby file that is
50
+ run during startup.
51
+ * Provide access to a parsed Nokogiri::DocumentFragment during markup
52
+ rendering for added customization.
53
+ * Bug Fixes
54
+ * Use `@wiki.page_class` in Gollum::Markup where appropriate (#63).
55
+ * Fix parsing of Org mode file links (#87).
56
+
57
+ # 1.1.0 / 2010-10-28
58
+
59
+ * Major Enhancements
60
+ * Optimize page write/update/delete to use Grit::Index::read_tree instead
61
+ of manually recreating entire index contents.
62
+ * Added --irb option for the gollum command.
63
+ * Update working dir (if present) when edited via the API (#6)
64
+ * Add basic `git grep` based search for repos.
65
+ * Minor Enhancements
66
+ * Support a `:gollum_path` Sinatra setting for `Precious::App`
67
+ * Add Wiki#size to efficiently count pages without loading them.
68
+ * Add the correct content type when serving files from the frontend.
69
+ * Add --host option and default it to 127.0.0.1.
70
+ * Allow anchors in page links, such as `[[Abc#header]]`.
71
+ * All pages retrieved with a SHA add `rel="nofollow"` to all
72
+ page links.
73
+ * Bug Fixes
74
+ * Increase minimum Sanitize version requirement to 1.1.0.
75
+ 1.0.x versions of Sanitize require Hpricot instead of Nokogiri
76
+ and have bugs that may allow non-whitelisted HTML to sneak
77
+ through.
78
+ * Introduce Ruby 1.9 compatibility fixes.
79
+ * Commit hashes are normalized so that missing author data is replaced with
80
+ anonymous info.
81
+ * Prevent `Gollum::Wiki#write_page` from clobbering existing pages.
82
+ * Handle duplicate page errors in frontend.
83
+ * Fix bugs trying to retrieve pages with invalid names.
84
+ * CGI escape page names in links and redirects.
85
+
86
+ # 1.0.1 / 2010-08-12
87
+
88
+ * Bug Fixes
89
+ * Force Grit dep to 2.1 or higher.
90
+
91
+ # 1.0.0 / 2010-08-12
92
+
93
+ * Open Source Birthday!
data/Home.md ADDED
@@ -0,0 +1,3 @@
1
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque vulputate tincidunt sollicitudin. Quisque sit amet leo sed nunc eleifend rhoncus in consectetur leo. Vivamus posuere semper convallis. Duis malesuada lacus sed erat lobortis tincidunt mattis ligula consectetur. Sed aliquam vulputate eros at euismod. Aenean egestas lorem ligula, quis faucibus turpis. Curabitur a eros in ipsum gravida ornare. Sed elementum enim vel mi scelerisque dapibus. Nulla id libero ligula, quis tempus sem. Morbi nec felis tortor, ac cursus risus. Mauris elementum tortor id lacus eleifend non lobortis tellus pharetra. Etiam posuere cursus vestibulum. $x \lt y$
2
+
3
+ Morbi tincidunt dolor vel massa dictum volutpat. Vestibulum quis nibh metus, id tincidunt nisl. Vivamus eget sem ac risus eleifend rhoncus at eu nisl. Nunc elit massa, vulputate ac gravida eget, condimentum quis justo. Integer scelerisque, libero vel consequat ultricies, eros libero sagittis libero, pellentesque bibendum quam massa ut orci. Maecenas sit amet urna eget quam aliquam posuere. Nulla facilisi. Duis imperdiet augue sit amet metus ornare et hendrerit dui feugiat. Aenean a lacus neque. Sed eu enim tincidunt dolor pharetra porttitor. Vestibulum ut felis dui, rutrum iaculis orci. Duis eu bibendum tortor. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Suspendisse mollis sagittis purus sit amet sollicitudin. Phasellus vel interdum erat.
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.
data/README.md ADDED
@@ -0,0 +1,483 @@
1
+ gollum -- A wiki built on top of Git
2
+ ====================================
3
+
4
+ ## DESCRIPTION
5
+
6
+ Gollum is a simple wiki system built on top of Git that powers GitHub Wikis.
7
+
8
+ Gollum wikis are simply Git repositories that adhere to a specific format.
9
+ Gollum pages may be written in a variety of formats and can be edited in a
10
+ number of ways depending on your needs. You can edit your wiki locally:
11
+
12
+ * With your favorite text editor or IDE (changes will be visible after committing).
13
+ * With the built-in web interface.
14
+ * With the Gollum Ruby API.
15
+
16
+ Gollum follows the rules of [Semantic Versioning](http://semver.org/) and uses
17
+ [TomDoc](http://tomdoc.org/) for inline documentation.
18
+
19
+ ### Bibanon
20
+
21
+ This is a fork of Gollum used by the Bibliotheca Anonoma. It adds some extra functionality:
22
+
23
+ * [OmniAuth integration](https://github.com/github/gollum/pull/181) - Adds support for OmniGollum.
24
+ * [OmniAuth User Commit Message](https://github.com/treeofsephiroth/gollum/commit/8400ad0749288f658f735625b7c39550134f7586) Adds the username from OmniAuth to a commit message.
25
+ * [Underscore support in filenames](https://github.com/treeofsephiroth/gollum/commit/9710718b287ee79861f196d01094ee0c9c361730) - Adds underscore support in filenames, essential for importing Mediawiki pages
26
+ * [Gollum Pull Request](https://github.com/github/gollum/pull/166)
27
+ * [Fix `undefined method 'new' for Redcarpet:Module`](https://github.com/github/gollum/pull/271) - Forces the gem to use a working copy of redcarpet, rather than the new one.
28
+ * Magnet links - Now allowed.
29
+
30
+ ### Wishlist
31
+
32
+ Functionalities we hope to implement in the future.
33
+
34
+ * Custom CSS - Instead of modding the CSS stylesheet bundled with Gollum, it would be nice to work like Ikiwiki and use a "local.css" file in the git repo, if it exists. It would also be cool if we made a tag that specified custom CSS for a single page.
35
+ * [Ikiwiki CSS extension](http://ikiwiki.info/css/)
36
+
37
+ * Extensions - Would make it possible to safely add extra functionality to wikilink tags, similar to that of Mediawiki Templates or ikiwiki plugins.
38
+ * [Basic support for extensions on Gollum](https://github.com/github/gollum/pull/58)
39
+ * [Gists embed implementation](https://github.com/github/gollum/issues/208)
40
+
41
+ * Shift JIS extension - Tag to tell gollum to use [monafont](http://monafont.sourceforge.net/index-e.html) on selected text. Should probably use @font-face.
42
+ * [Font Face Guide](http://sixrevisions.com/css/font-face-guide/)
43
+ * [Mozilla Font Face Guide](https://developer.mozilla.org/en/CSS/@font-face)
44
+ * It might help to see how [Google Webfont](https://www.google.com/webfonts) works and implement it in Gollum's CSS
45
+
46
+ * Page Locking - Would add ability to lock certain pages to editing. An example would be ikiwiki's page locking mechanism.
47
+ * [Ikiwiki Lockedit plugin](http://ikiwiki.info/plugins/lockedit/)
48
+ * File Uploading - Would add the ability to upload some files through the web interface, and implement restrictions to allow only certain extensions of a certain size.
49
+ * [Ikiwiki Attachments](http://ikiwiki.info/plugins/attachment/)
50
+ * [Ikiwiki File Checking](http://ikiwiki.info/plugins/filecheck/)
51
+ * Untrusted Git Push - Yes, this would be perfectly safe. Ikiwiki has the ability to accept commits from anyone in the world. What makes this safe is Ikiwiki's pre-commit checks, which check page locks and upload restrictions to block any change that cannot be done with the web interface.
52
+ * [Ikiwiki Implementation](http://ikiwiki.info/tips/untrusted_git_push/)
53
+
54
+ ## INSTALLATION
55
+
56
+ The best way to install Gollum is with RubyGems:
57
+
58
+ $ [sudo] gem install gollum
59
+
60
+ If you're installing from source, you can use [Bundler][bundler] to pick up all the
61
+ gems:
62
+
63
+ $ bundle install # ([more info](http://gembundler.com/bundle_install.html))
64
+
65
+ In order to use the various formats that Gollum supports, you will need to
66
+ separately install the necessary dependencies for each format. You only need
67
+ to install the dependencies for the formats that you plan to use.
68
+
69
+ * [ASCIIDoc](http://www.methods.co.nz/asciidoc/) -- `brew install asciidoc`
70
+ * [Creole](http://wikicreole.org/) -- `gem install creole`
71
+ * [Markdown](http://daringfireball.net/projects/markdown/) -- `gem install rdiscount`
72
+ * [Org](http://orgmode.org/) -- `gem install org-ruby`
73
+ * [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.
74
+ * [RDoc](http://rdoc.sourceforge.net/)
75
+ * [ReStructuredText](http://docutils.sourceforge.net/rst.html) -- `easy_install docutils`
76
+ * [Textile](http://www.textism.com/tools/textile/) -- `gem install RedCloth`
77
+ * [MediaWiki](http://www.mediawiki.org/wiki/Help:Formatting) -- `gem install wikicloth`
78
+
79
+ [bundler]: http://gembundler.com/
80
+
81
+ ## RUNNING
82
+
83
+ To view and edit your Gollum repository locally via the built in web
84
+ interface, simply install the Gollum gem, navigate to your repository via the
85
+ command line, and run the executable:
86
+
87
+ $ gollum
88
+
89
+ This will start up a web server running the Gollum frontend and you can view
90
+ and edit your wiki at http://localhost:4567. To get help on the command line
91
+ utility, you can run it like so:
92
+
93
+ $ gollum --help
94
+
95
+
96
+ ## REPO STRUCTURE
97
+
98
+ A Gollum repository's contents are designed to be human editable. Page content
99
+ is written in `page files` and may be organized into directories any way you
100
+ choose. Special footers can be created in `footer files`. Other content
101
+ (images, PDFs, etc) may also be present and organized in the same way.
102
+
103
+
104
+ ## PAGE FILES
105
+
106
+ Page files may be written in any format supported by
107
+ [GitHub-Markup](http://github.com/github/markup) (except roff). The
108
+ current list of formats and allowed extensions is:
109
+
110
+ * ASCIIDoc: .asciidoc
111
+ * Creole: .creole
112
+ * Markdown: .markdown, .mdown, .mkdn, .mkd, .md
113
+ * Org Mode: .org
114
+ * Pod: .pod
115
+ * RDoc: .rdoc
116
+ * ReStructuredText: .rest.txt, .rst.txt, .rest, .rst
117
+ * Textile: .textile
118
+ * MediaWiki: .mediawiki, .wiki
119
+
120
+ Gollum detects the page file format via the extension, so files must have one
121
+ of the supported extensions in order to be converted.
122
+
123
+ Page file names may contain any printable UTF-8 character except space
124
+ (U+0020) and forward slash (U+002F). If you commit a page file with any of
125
+ these characters in the name it will not be accessible via the web interface.
126
+
127
+ Even though page files may be placed in any directory, there is still only a
128
+ single namespace for page names, so all page files should have globally unique
129
+ names regardless of where they are located in the repository.
130
+
131
+ The special page file `Home.ext` (where the extension is one of the supported
132
+ formats) will be used as the entrance page to your wiki. If it is missing, an
133
+ automatically generated table of contents will be shown instead.
134
+
135
+ ## SIDEBAR FILES
136
+
137
+ Sidebar files allow you to add a simple sidebar to your wiki. Sidebar files
138
+ are named `_Sidebar.ext` where the extension is one of the supported formats.
139
+ Sidebars affect all pages in their directory and any subdirectories that do not
140
+ have a sidebar file of their own.
141
+
142
+ ## FOOTER FILES
143
+
144
+ Footer files allow you to add a simple footer to your wiki. Footer files must
145
+ be named `_Footer.ext` where the extension is one of the supported formats.
146
+ Like sidebars, footers affect all pages in their directory and any
147
+ subdirectories that do not have a footer file of their own.
148
+
149
+
150
+ ## HTML SANITIZATION
151
+
152
+ For security and compatibility reasons Gollum wikis may not contain custom CSS
153
+ or JavaScript. These tags will be stripped from the converted HTML. See
154
+ `docs/sanitization.md` for more details on what tags and attributes are
155
+ allowed.
156
+
157
+
158
+ ## BRACKET TAGS
159
+
160
+ A variety of Gollum tags use a double bracket syntax. For example:
161
+
162
+ [[Link]]
163
+
164
+ Some tags will accept attributes which are separated by pipe symbols. For
165
+ example:
166
+
167
+ [[Link|Page Title]]
168
+
169
+ In all cases, the first thing in the link is what is displayed on the page.
170
+ So, if the tag is an internal wiki link, the first thing in the tag will be
171
+ the link text displayed on the page. If the tag is an embedded image, the
172
+ first thing in the tag will be a path to an image file. Use this trick to
173
+ easily remember which order things should appear in tags.
174
+
175
+ Some formats, such as MediaWiki, support the opposite syntax:
176
+
177
+ [[Page Title|Link]]
178
+
179
+ ## PAGE LINKS
180
+
181
+ To link to another Gollum wiki page, use the Gollum Page Link Tag.
182
+
183
+ [[Frodo Baggins]]
184
+
185
+ The above tag will create a link to the corresponding page file named
186
+ `Frodo-Baggins.ext` where `ext` may be any of the allowed extension types. The
187
+ conversion is as follows:
188
+
189
+ 1. Replace any spaces (U+0020) with dashes (U+002D)
190
+ 2. Replace any slashes (U+002F) with dashes (U+002D)
191
+
192
+ If you'd like the link text to be something that doesn't map directly to the
193
+ page name, you can specify the actual page name after a pipe:
194
+
195
+ [[Frodo|Frodo Baggins]]
196
+
197
+ The above tag will link to `Frodo-Baggins.ext` using "Frodo" as the link text.
198
+
199
+ The page file may exist anywhere in the directory structure of the repository.
200
+ Gollum does a breadth first search and uses the first match that it finds.
201
+
202
+ Here are a few more examples:
203
+
204
+ [[J. R. R. Tolkien]] -> J.-R.-R.-Tolkien.ext
205
+ [[Movies / The Hobbit]] -> Movies---The-Hobbit.ext
206
+ [[モルドール]] -> モルドール.ext
207
+
208
+
209
+ ## EXTERNAL LINKS
210
+
211
+ As a convenience, simple external links can be placed within brackets and they
212
+ will be linked to the given URL with the URL as the link text. For example:
213
+
214
+ [[http://example.com]]
215
+
216
+ External links must begin with either "http://" or "https://". If you need
217
+ something more flexible, you can resort to the link syntax in the page's
218
+ underlying markup format.
219
+
220
+
221
+ ## ABSOLUTE VS. RELATIVE VS. EXTERNAL PATH
222
+
223
+ For Gollum tags that operate on static files (images, PDFs, etc), the paths
224
+ may be referenced as either relative, absolute, or external. Relative paths
225
+ point to a static file relative to the page file within the directory
226
+ structure of the Gollum repo (even though after conversion, all page files
227
+ appear to be top level). These paths are NOT prefixed with a slash. For
228
+ example:
229
+
230
+ gollum.pdf
231
+ docs/diagram.png
232
+
233
+ Absolute paths point to a static file relative to the Gollum repo's
234
+ root, regardless of where the page file is stored within the directory
235
+ structure. These paths ARE prefixed with a slash. For example:
236
+
237
+ /pdfs/gollum.pdf
238
+ /docs/diagram.png
239
+
240
+ External paths are full URLs. An external path must begin with either
241
+ "http://" or "https://". For example:
242
+
243
+ http://example.com/pdfs/gollum.pdf
244
+ http://example.com/images/diagram.png
245
+
246
+ All of the examples in this README use relative paths, but you may use
247
+ whatever works best in your situation.
248
+
249
+
250
+ ## FILE LINKS
251
+
252
+ To link to static files that are contained in the Gollum repository you should
253
+ use the Gollum File Link Tag.
254
+
255
+ [[Gollum|gollum.pdf]]
256
+
257
+ The first part of the tag is the link text. The path to the file appears after
258
+ the pipe.
259
+
260
+
261
+ ## IMAGES
262
+
263
+ To display images that are contained in the Gollum repository you should use
264
+ the Gollum Image Tag. This will display the actual image on the page.
265
+
266
+ [[gollum.png]]
267
+
268
+ In addition to the simple format, there are a variety of options that you
269
+ can specify between pipe delimiters.
270
+
271
+ To specify alt text, use the `alt=` option. Default is no alt text.
272
+
273
+ [[gollum.png|alt=Gollum and his precious wiki]]
274
+
275
+ To place the image in a frame, use the `frame` option. When combined with the
276
+ `alt=` option, the alt text will be used as a caption as well. Default is no
277
+ frame.
278
+
279
+ [[gollum.png|frame|alt=Gollum and his precious wiki]]
280
+
281
+ To specify the alignment of the image on the page, use the `align=` option.
282
+ Possible values are `left`, `center`, and `right`. Default is `left`.
283
+
284
+ [[gollum.png|align=center]]
285
+
286
+ To float an image so that text flows around it, use the `float` option. When
287
+ `float` is specified, only `left` and `right` are valid `align` options.
288
+ Default is not floating. When floating is activated but no alignment is
289
+ specified, default alignment is `left`.
290
+
291
+ [[gollum.png|float]]
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
+
319
+ ## SYNTAX HIGHLIGHTING
320
+
321
+ In page files you can get automatic syntax highlighting for a wide range of
322
+ languages (courtesy of [Pygments](http://pygments.org/) - must install
323
+ separately) by using the following syntax:
324
+
325
+ ```ruby
326
+ def foo
327
+ puts 'bar'
328
+ end
329
+ ```
330
+
331
+ The block must start with three backticks (as the first characters on the
332
+ line). After that comes the name of the language that is contained by the
333
+ block. The language must be one of the `short name` lexer strings supported by
334
+ Pygments. See the [list of lexers](http://pygments.org/docs/lexers/) for valid
335
+ options.
336
+
337
+ If the block contents are indented two spaces or one tab, then that whitespace
338
+ will be ignored (this makes the blocks easier to read in plaintext).
339
+
340
+ The block must end with three backticks as the first characters on a
341
+ line.
342
+
343
+
344
+ ## MATHEMATICAL EQUATIONS
345
+
346
+ Page files may contain mathematic equations in TeX syntax that will be nicely
347
+ typeset into the expected output. A block-style equation is delimited by `\[`
348
+ and `\]`. For example:
349
+
350
+ \[ P(E) = {n \choose k} p^k (1-p)^{ n-k} \]
351
+
352
+ Inline equations are delimited by `\(` and `\)`. These equations will appear
353
+ inline with regular text. For example:
354
+
355
+ The Pythagorean theorem is \( a^2 + b^2 = c^2 \).
356
+
357
+
358
+ ## API DOCUMENTATION
359
+
360
+ The Gollum API allows you to retrieve raw or formatted wiki content from a Git
361
+ repository, write new content to the repository, and collect various meta data
362
+ about the wiki as a whole.
363
+
364
+ Initialize the Gollum::Repo object:
365
+
366
+ # Require rubygems if necessary
367
+ require 'rubygems'
368
+
369
+ # Require the Gollum library
370
+ require 'gollum'
371
+
372
+ # Create a new Gollum::Wiki object by initializing it with the path to the
373
+ # Git repository.
374
+ wiki = Gollum::Wiki.new("my-gollum-repo.git")
375
+ # => <Gollum::Wiki>
376
+
377
+ By default, internal wiki links are all absolute from the root. To specify a different base path, you can specify the `:base_path` option:
378
+
379
+ wiki = Gollum::Wiki.new("my-gollum-repo.git", :base_path => "/wiki")
380
+
381
+ Get the latest version of the given human or canonical page name:
382
+
383
+ page = wiki.page('page-name')
384
+ # => <Gollum::Page>
385
+
386
+ page.raw_data
387
+ # => "# My wiki page"
388
+
389
+ page.formatted_data
390
+ # => "<h1>My wiki page</h1>"
391
+
392
+ page.format
393
+ # => :markdown
394
+
395
+ vsn = page.version
396
+ # => <Grit::Commit>
397
+
398
+ vsn.id
399
+ # => '3ca43e12377ea1e32ea5c9ce5992ec8bf266e3e5'
400
+
401
+ Get the footer (if any) for a given page:
402
+
403
+ page.footer
404
+ # => <Gollum::Page>
405
+
406
+ Get a list of versions for a given page:
407
+
408
+ vsns = wiki.page('page-name').versions
409
+ # => [<Grit::Commit, <Grit::Commit, <Grit::Commit>]
410
+
411
+ vsns.first.id
412
+ # => '3ca43e12377ea1e32ea5c9ce5992ec8bf266e3e5'
413
+
414
+ vsns.first.authored_date
415
+ # => Sun Mar 28 19:11:21 -0700 2010
416
+
417
+ Get a specific version of a given canonical page file:
418
+
419
+ wiki.page('page-name', '5ec521178e0eec4dc39741a8978a2ba6616d0f0a')
420
+
421
+ Get the latest version of a given static file:
422
+
423
+ file = wiki.file('asset.js')
424
+ # => <Gollum::File>
425
+
426
+ file.raw_data
427
+ # => "alert('hello');"
428
+
429
+ file.version
430
+ # => <Grit::Commit>
431
+
432
+ Get a specific version of a given static file:
433
+
434
+ wiki.file('asset.js', '5ec521178e0eec4dc39741a8978a2ba6616d0f0a')
435
+
436
+ Get an in-memory Page preview (useful for generating previews for web
437
+ interfaces):
438
+
439
+ preview = wiki.preview_page("My Page", "# Contents", :markdown)
440
+ preview.formatted_data
441
+ # => "<h1>Contents</h1>"
442
+
443
+ Methods that write to the repository require a Hash of commit data that takes
444
+ the following form:
445
+
446
+ commit = { :message => 'commit message',
447
+ :name => 'Tom Preston-Werner',
448
+ :email => 'tom@github.com' }
449
+
450
+ Write a new version of a page (the file will be created if it does not already
451
+ exist) and commit the change. The file will be written at the repo root.
452
+
453
+ wiki.write_page('Page Name', :markdown, 'Page contents', commit)
454
+
455
+ Update an existing page. If the format is different than the page's current
456
+ format, the file name will be changed to reflect the new format.
457
+
458
+ page = wiki.page('Page Name')
459
+ wiki.update_page(page, page.name, page.format, 'Page contents', commit)
460
+
461
+ To delete a page and commit the change:
462
+
463
+ wiki.delete_page(page, commit)
464
+
465
+
466
+ ## CONTRIBUTE
467
+
468
+ If you'd like to hack on Gollum, start by forking my repo on GitHub:
469
+
470
+ http://github.com/github/gollum
471
+
472
+ To get all of the dependencies, install the gem first. The best way to get
473
+ your changes merged back into core is as follows:
474
+
475
+ 1. Clone down your fork
476
+ 1. Create a thoughtfully named topic branch to contain your change
477
+ 1. Hack away
478
+ 1. Add tests and make sure everything still passes by running `rake`
479
+ 1. If you are adding new functionality, document it in the README
480
+ 1. Do not change the version number, I will do that on my end
481
+ 1. If necessary, rebase your commits into logical chunks, without errors
482
+ 1. Push the branch up to GitHub
483
+ 1. Send a pull request to the github/gollum project.