read-only-gollum 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (176) hide show
  1. data/Gemfile +4 -0
  2. data/HISTORY.md +102 -0
  3. data/Home.md +3 -0
  4. data/LICENSE +21 -0
  5. data/README.md +477 -0
  6. data/Rakefile +142 -0
  7. data/bin/read-only-gollum +126 -0
  8. data/docs/sanitization.md +32 -0
  9. data/lib/gollum.rb +41 -0
  10. data/lib/gollum/blob_entry.rb +78 -0
  11. data/lib/gollum/committer.rb +218 -0
  12. data/lib/gollum/file.rb +64 -0
  13. data/lib/gollum/frontend/app.rb +225 -0
  14. data/lib/gollum/frontend/public/css/dialog.css +141 -0
  15. data/lib/gollum/frontend/public/css/editor.css +537 -0
  16. data/lib/gollum/frontend/public/css/gollum.css +660 -0
  17. data/lib/gollum/frontend/public/css/ie7.css +69 -0
  18. data/lib/gollum/frontend/public/css/template.css +381 -0
  19. data/lib/gollum/frontend/public/images/icon-sprite.png +0 -0
  20. data/lib/gollum/frontend/public/javascript/editor/gollum.editor.js +1096 -0
  21. data/lib/gollum/frontend/public/javascript/editor/langs/asciidoc.js +167 -0
  22. data/lib/gollum/frontend/public/javascript/editor/langs/creole.js +104 -0
  23. data/lib/gollum/frontend/public/javascript/editor/langs/markdown.js +211 -0
  24. data/lib/gollum/frontend/public/javascript/editor/langs/org.js +173 -0
  25. data/lib/gollum/frontend/public/javascript/editor/langs/pod.js +111 -0
  26. data/lib/gollum/frontend/public/javascript/editor/langs/rdoc.js +74 -0
  27. data/lib/gollum/frontend/public/javascript/editor/langs/textile.js +175 -0
  28. data/lib/gollum/frontend/public/javascript/gollum.dialog.js +263 -0
  29. data/lib/gollum/frontend/public/javascript/gollum.js +161 -0
  30. data/lib/gollum/frontend/public/javascript/gollum.placeholder.js +54 -0
  31. data/lib/gollum/frontend/public/javascript/jquery.color.js +123 -0
  32. data/lib/gollum/frontend/public/javascript/jquery.js +7179 -0
  33. data/lib/gollum/frontend/templates/compare.mustache +38 -0
  34. data/lib/gollum/frontend/templates/create.mustache +17 -0
  35. data/lib/gollum/frontend/templates/edit.mustache +17 -0
  36. data/lib/gollum/frontend/templates/editor.mustache +116 -0
  37. data/lib/gollum/frontend/templates/error.mustache +8 -0
  38. data/lib/gollum/frontend/templates/history.mustache +58 -0
  39. data/lib/gollum/frontend/templates/layout.mustache +28 -0
  40. data/lib/gollum/frontend/templates/page.mustache +37 -0
  41. data/lib/gollum/frontend/templates/pages.mustache +35 -0
  42. data/lib/gollum/frontend/templates/search.mustache +36 -0
  43. data/lib/gollum/frontend/templates/searchbar.mustache +10 -0
  44. data/lib/gollum/frontend/views/compare.rb +94 -0
  45. data/lib/gollum/frontend/views/create.rb +48 -0
  46. data/lib/gollum/frontend/views/edit.rb +52 -0
  47. data/lib/gollum/frontend/views/editable.rb +13 -0
  48. data/lib/gollum/frontend/views/error.rb +7 -0
  49. data/lib/gollum/frontend/views/history.rb +44 -0
  50. data/lib/gollum/frontend/views/layout.rb +20 -0
  51. data/lib/gollum/frontend/views/page.rb +57 -0
  52. data/lib/gollum/frontend/views/pages.rb +19 -0
  53. data/lib/gollum/frontend/views/search.rb +20 -0
  54. data/lib/gollum/git_access.rb +248 -0
  55. data/lib/gollum/markup.rb +489 -0
  56. data/lib/gollum/page.rb +430 -0
  57. data/lib/gollum/pagination.rb +61 -0
  58. data/lib/gollum/sanitization.rb +174 -0
  59. data/lib/gollum/tex.rb +89 -0
  60. data/lib/gollum/web_sequence_diagram.rb +43 -0
  61. data/lib/gollum/wiki.rb +636 -0
  62. data/read-only-gollum.gemspec +224 -0
  63. data/templates/formatting.html +92 -0
  64. data/test/examples/empty.git/HEAD +1 -0
  65. data/test/examples/empty.git/config +5 -0
  66. data/test/examples/empty.git/description +1 -0
  67. data/test/examples/empty.git/hooks/applypatch-msg.sample +15 -0
  68. data/test/examples/empty.git/hooks/commit-msg.sample +24 -0
  69. data/test/examples/empty.git/hooks/post-commit.sample +8 -0
  70. data/test/examples/empty.git/hooks/post-receive.sample +15 -0
  71. data/test/examples/empty.git/hooks/post-update.sample +8 -0
  72. data/test/examples/empty.git/hooks/pre-applypatch.sample +14 -0
  73. data/test/examples/empty.git/hooks/pre-commit.sample +46 -0
  74. data/test/examples/empty.git/hooks/pre-rebase.sample +169 -0
  75. data/test/examples/empty.git/hooks/prepare-commit-msg.sample +36 -0
  76. data/test/examples/empty.git/hooks/update.sample +128 -0
  77. data/test/examples/empty.git/info/exclude +6 -0
  78. data/test/examples/empty.git/objects/info/.gitkeep +0 -0
  79. data/test/examples/empty.git/objects/pack/.gitkeep +0 -0
  80. data/test/examples/empty.git/refs/heads/.gitkeep +0 -0
  81. data/test/examples/lotr.git/COMMIT_EDITMSG +1 -0
  82. data/test/examples/lotr.git/HEAD +1 -0
  83. data/test/examples/lotr.git/ORIG_HEAD +1 -0
  84. data/test/examples/lotr.git/config +12 -0
  85. data/test/examples/lotr.git/description +1 -0
  86. data/test/examples/lotr.git/index +0 -0
  87. data/test/examples/lotr.git/info/exclude +6 -0
  88. data/test/examples/lotr.git/logs/HEAD +3 -0
  89. data/test/examples/lotr.git/logs/refs/heads/master +3 -0
  90. data/test/examples/lotr.git/objects/06/131480411710c92a82fe2d1e76932c70feb2e5 +0 -0
  91. data/test/examples/lotr.git/objects/0a/de1e2916346d4c1f2fb63b863fd3c16808fe44 +0 -0
  92. data/test/examples/lotr.git/objects/0e/d8cbe0a25235bd867e65193c7d837c66b328ef +3 -0
  93. data/test/examples/lotr.git/objects/12/629d666c5e3178f82f533f543d61b53dc78c0b +0 -0
  94. data/test/examples/lotr.git/objects/1d/b89ebba7e2c14d93b94ff98cfa3708a4f0d4e3 +2 -0
  95. data/test/examples/lotr.git/objects/24/49c2681badfd3c189e8ed658dacffe8ba48fe5 +0 -0
  96. data/test/examples/lotr.git/objects/25/4bdc1ba27d8b8a794538a8522d9a2b56ec2dd9 +0 -0
  97. data/test/examples/lotr.git/objects/2c/b9156ad383914561a8502fc70f5a1d887e48ad +4 -0
  98. data/test/examples/lotr.git/objects/5d/cac289a8603188d2c5caf481dcba2985126aaa +0 -0
  99. data/test/examples/lotr.git/objects/60/f12f4254f58801b9ee7db7bca5fa8aeefaa56b +0 -0
  100. data/test/examples/lotr.git/objects/71/4323c104239440a5c66ab12a67ed07a83c404f +0 -0
  101. data/test/examples/lotr.git/objects/84/0ec5b1ba1320e8ec443f28f99566f615d5af10 +0 -0
  102. data/test/examples/lotr.git/objects/93/6b83ee0dd8837adb82511e40d5e4ebe59bb675 +0 -0
  103. data/test/examples/lotr.git/objects/94/523d7ae48aeba575099dd12926420d8fd0425d +2 -0
  104. data/test/examples/lotr.git/objects/96/97dc65e095658bbd1b8e8678e08881e86d32f1 +0 -0
  105. data/test/examples/lotr.git/objects/a3/1ca2a7c352c92531a8b99815d15843b259e814 +0 -0
  106. data/test/examples/lotr.git/objects/a6/59b3763b822dd97544621fd0beef162ea37b14 +4 -0
  107. data/test/examples/lotr.git/objects/a8/ad3c09dd842a3517085bfadd37718856dee813 +0 -0
  108. data/test/examples/lotr.git/objects/aa/b61fe89d56f8614c0a8151da34f939dcedfa68 +0 -0
  109. data/test/examples/lotr.git/objects/bc/4b5fc0ce2c2ba3acef6647e4f67256ee45ab60 +0 -0
  110. data/test/examples/lotr.git/objects/c3/b43e9f08966b088e7a0192e436b7a884542e05 +0 -0
  111. data/test/examples/lotr.git/objects/dc/596d6b2dd89ab05c66f4abd7d5eb706bc17f19 +0 -0
  112. data/test/examples/lotr.git/objects/ec/da3205bee14520aab5a7bb307392064b938e83 +0 -0
  113. data/test/examples/lotr.git/objects/f4/84ebb1f40f8eb20d1bcd8d1d71934d2b8ae961 +0 -0
  114. data/test/examples/lotr.git/objects/fa/e7ef5344202bba4129abdc13060d9297d99465 +3 -0
  115. data/test/examples/lotr.git/objects/info/packs +2 -0
  116. data/test/examples/lotr.git/objects/pack/pack-dcbeaf3f6ff6c5eb08ea2b0a2d83626e8763546b.idx +0 -0
  117. data/test/examples/lotr.git/objects/pack/pack-dcbeaf3f6ff6c5eb08ea2b0a2d83626e8763546b.pack +0 -0
  118. data/test/examples/lotr.git/packed-refs +2 -0
  119. data/test/examples/lotr.git/refs/heads/master +1 -0
  120. data/test/examples/lotr.git/refs/remotes/origin/HEAD +1 -0
  121. data/test/examples/page_file_dir.git/COMMIT_EDITMSG +1 -0
  122. data/test/examples/page_file_dir.git/HEAD +1 -0
  123. data/test/examples/page_file_dir.git/config +6 -0
  124. data/test/examples/page_file_dir.git/description +1 -0
  125. data/test/examples/page_file_dir.git/index +0 -0
  126. data/test/examples/page_file_dir.git/info/exclude +6 -0
  127. data/test/examples/page_file_dir.git/logs/HEAD +1 -0
  128. data/test/examples/page_file_dir.git/logs/refs/heads/master +1 -0
  129. data/test/examples/page_file_dir.git/objects/0c/7d27db1f575263efdcab3dc650f4502a2dbcbf +0 -0
  130. data/test/examples/page_file_dir.git/objects/22/b404803c966dd92865614d86ff22ca12e50c1e +0 -0
  131. data/test/examples/page_file_dir.git/objects/25/7cc5642cb1a054f08cc83f2d943e56fd3ebe99 +0 -0
  132. data/test/examples/page_file_dir.git/objects/57/16ca5987cbf97d6bb54920bea6adde242d87e6 +0 -0
  133. data/test/examples/page_file_dir.git/objects/5b/43e14e0a15fb6f08feab1773d1c0991e9f71e2 +0 -0
  134. data/test/examples/page_file_dir.git/refs/heads/master +1 -0
  135. data/test/examples/revert.git/COMMIT_EDITMSG +1 -0
  136. data/test/examples/revert.git/HEAD +1 -0
  137. data/test/examples/revert.git/config +12 -0
  138. data/test/examples/revert.git/description +1 -0
  139. data/test/examples/revert.git/index +0 -0
  140. data/test/examples/revert.git/info/exclude +6 -0
  141. data/test/examples/revert.git/logs/HEAD +2 -0
  142. data/test/examples/revert.git/logs/refs/heads/master +2 -0
  143. data/test/examples/revert.git/objects/20/2ced67cea93c7b6bd2928aa1daef8d1d55a20d +0 -0
  144. data/test/examples/revert.git/objects/41/76394bfa11222363c66ce7e84b5f154095b6d9 +0 -0
  145. data/test/examples/revert.git/objects/6a/69f92020f5df77af6e8813ff1232493383b708 +0 -0
  146. data/test/examples/revert.git/objects/b4/785957bc986dc39c629de9fac9df46972c00fc +0 -0
  147. data/test/examples/revert.git/objects/f4/03b791119f8232b7cb0ba455c624ac6435f433 +0 -0
  148. data/test/examples/revert.git/objects/info/packs +2 -0
  149. data/test/examples/revert.git/objects/pack/pack-a561f8437234f74d0bacb9e0eebe52d207f5770d.idx +0 -0
  150. data/test/examples/revert.git/objects/pack/pack-a561f8437234f74d0bacb9e0eebe52d207f5770d.pack +0 -0
  151. data/test/examples/revert.git/packed-refs +2 -0
  152. data/test/examples/revert.git/refs/heads/master +1 -0
  153. data/test/examples/revert.git/refs/remotes/origin/HEAD +1 -0
  154. data/test/examples/yubiwa.git/HEAD +1 -0
  155. data/test/examples/yubiwa.git/config +5 -0
  156. data/test/examples/yubiwa.git/description +1 -0
  157. data/test/examples/yubiwa.git/info/exclude +6 -0
  158. data/test/examples/yubiwa.git/objects/10/fa2ddc4e3b4009d8a453aace10bd6148c1ad00 +0 -0
  159. data/test/examples/yubiwa.git/objects/52/4b82874327ea7cbf730389964ba7cb3de966de +0 -0
  160. data/test/examples/yubiwa.git/objects/58/3fc201cb457fb3f1480f3e1e5999b119633835 +0 -0
  161. data/test/examples/yubiwa.git/objects/87/bc1dd46ab3d3874d4e898d45dd512cc20a7cc8 +1 -0
  162. data/test/examples/yubiwa.git/objects/89/64ed1b4e21aa90e831763bbce9034bfda81b70 +0 -0
  163. data/test/examples/yubiwa.git/objects/9f/f6dd0660da5fba2d3374adb2b84fa653bb538b +0 -0
  164. data/test/examples/yubiwa.git/objects/ac/e97abf2b177815a1972d7db22f229f58c83309 +0 -0
  165. data/test/examples/yubiwa.git/objects/b1/f443863a4816628807fbf86141ebef055dda34 +0 -0
  166. data/test/examples/yubiwa.git/refs/heads/master +1 -0
  167. data/test/helper.rb +66 -0
  168. data/test/test_app.rb +169 -0
  169. data/test/test_committer.rb +64 -0
  170. data/test/test_file.rb +27 -0
  171. data/test/test_git_access.rb +52 -0
  172. data/test/test_markup.rb +628 -0
  173. data/test/test_page.rb +166 -0
  174. data/test/test_page_revert.rb +45 -0
  175. data/test/test_wiki.rb +462 -0
  176. metadata +470 -0
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ gemspec
4
+ gem "rake", "~> 0.9.2"
@@ -0,0 +1,102 @@
1
+ # 1.4.0 / 2012-04-10
2
+
3
+ * Minor
4
+ * Add a way to configure the `#id_prefix` property of Sanitization
5
+ objects.
6
+ * Add web sequence diagrams support
7
+ * Support for updating wysiwyg components when markup language changes
8
+ * Support RedCarpet 2.0
9
+ * Allow ftp and irc links in wiki markup
10
+ * Minor ui fixups
11
+
12
+ * Bug Fixes
13
+ * Include the language of the code snippet when making a uniquely
14
+ identifiable sha of a code snippet while rendering a page.
15
+ * Pygments lexer forces utf8 encoding
16
+ * Remove MathJax, this created problems in production for us.
17
+ We'll look at bringing it back in future releases
18
+
19
+ # 1.3.1 / 2011-07-21
20
+
21
+ * Major Enhancements
22
+ * Allow prefixed ID attributes in headers to support internal linking
23
+ (#146).
24
+ * Markdown pages are rendered through Redcarpet by default (#176).
25
+ * Minor Enhancements
26
+ * Remove Edit button on Preview pages (#164).
27
+ * Simplify Wiki#inspect and Page#inspect.
28
+ * Bug Fixes
29
+ * Fixed broken preview functionality (#157).
30
+ * Fixed sidebar/footer rendering problems related to whitespace (#145).
31
+
32
+ # 1.3.0 / 2011-04-25
33
+
34
+ * Major Enhancements
35
+ * Listing of all Pages
36
+ * Support for running Gollum under a separate branch.
37
+ * Minor Enhancements
38
+ * Fix a security issue with rendering Mathjax.
39
+
40
+ # 1.2.0 / 2011-03-11
41
+
42
+ * Major Enhancements
43
+ * Major HTML/CSS/JS overhaul.
44
+ * Add Sidebars (similar to Footers).
45
+ * Add commit reverts.
46
+ * Minor Enhancements
47
+ * Optimization in source code highlighting, resulting in a huge
48
+ decrease in rendering time.
49
+ * Security fixes related to source code highlighting.
50
+
51
+ * Major Enhancements
52
+ * Add Page sidebars, similar to Page footers.
53
+ * Add the ability to revert commits to the wiki.
54
+ * Add MediaWiki support.
55
+ * Minor Enhancements
56
+ * Add `:sanitization` and `:history_sanitization` options for customizing
57
+ how `Sanitize.clean` modifies formatted wiki content.
58
+ * Add `--config` option for the command line, to specify a ruby file that is
59
+ run during startup.
60
+ * Provide access to a parsed Nokogiri::DocumentFragment during markup
61
+ rendering for added customization.
62
+ * Bug Fixes
63
+ * Use `@wiki.page_class` in Gollum::Markup where appropriate (#63).
64
+ * Fix parsing of Org mode file links (#87).
65
+
66
+ # 1.1.0 / 2010-10-28
67
+
68
+ * Major Enhancements
69
+ * Optimize page write/update/delete to use Grit::Index::read_tree instead
70
+ of manually recreating entire index contents.
71
+ * Added --irb option for the gollum command.
72
+ * Update working dir (if present) when edited via the API (#6)
73
+ * Add basic `git grep` based search for repos.
74
+ * Minor Enhancements
75
+ * Support a `:gollum_path` Sinatra setting for `Precious::App`
76
+ * Add Wiki#size to efficiently count pages without loading them.
77
+ * Add the correct content type when serving files from the frontend.
78
+ * Add --host option and default it to 127.0.0.1.
79
+ * Allow anchors in page links, such as `[[Abc#header]]`.
80
+ * All pages retrieved with a SHA add `rel="nofollow"` to all
81
+ page links.
82
+ * Bug Fixes
83
+ * Increase minimum Sanitize version requirement to 1.1.0.
84
+ 1.0.x versions of Sanitize require Hpricot instead of Nokogiri
85
+ and have bugs that may allow non-whitelisted HTML to sneak
86
+ through.
87
+ * Introduce Ruby 1.9 compatibility fixes.
88
+ * Commit hashes are normalized so that missing author data is replaced with
89
+ anonymous info.
90
+ * Prevent `Gollum::Wiki#write_page` from clobbering existing pages.
91
+ * Handle duplicate page errors in frontend.
92
+ * Fix bugs trying to retrieve pages with invalid names.
93
+ * CGI escape page names in links and redirects.
94
+
95
+ # 1.0.1 / 2010-08-12
96
+
97
+ * Bug Fixes
98
+ * Force Grit dep to 2.1 or higher.
99
+
100
+ # 1.0.0 / 2010-08-12
101
+
102
+ * 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.
@@ -0,0 +1,477 @@
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
+
20
+ ## INSTALLATION
21
+
22
+ The best way to install Gollum is with RubyGems:
23
+
24
+ $ [sudo] gem install gollum
25
+
26
+ If you're installing from source, you can use [Bundler][bundler] to pick up all the
27
+ gems:
28
+
29
+ $ bundle install
30
+
31
+ In order to use the various formats that Gollum supports, you will need to
32
+ separately install the necessary dependencies for each format. You only need
33
+ to install the dependencies for the formats that you plan to use.
34
+
35
+ * [ASCIIDoc](http://www.methods.co.nz/asciidoc/) -- `brew install asciidoc`
36
+ * [Creole](http://wikicreole.org/) -- `gem install creole`
37
+ * [Markdown](http://daringfireball.net/projects/markdown/) -- `gem install redcarpet`
38
+ * [GitHub Flavored Markdown](http://github.github.com/github-flavored-markdown/) -- `gem install github-markdown`
39
+ * [Org](http://orgmode.org/) -- `gem install org-ruby`
40
+ * [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.
41
+ * [RDoc](http://rdoc.sourceforge.net/)
42
+ * [ReStructuredText](http://docutils.sourceforge.net/rst.html) -- `easy_install docutils`
43
+ * [Textile](http://www.textism.com/tools/textile/) -- `gem install RedCloth`
44
+ * [MediaWiki](http://www.mediawiki.org/wiki/Help:Formatting) -- `gem install wikicloth`
45
+
46
+ [bundler]: http://gembundler.com/
47
+
48
+ ## RUNNING
49
+
50
+ To view and edit your Gollum repository locally via the built in web
51
+ interface, simply install the Gollum gem, navigate to your repository via the
52
+ command line, and run the executable:
53
+
54
+ $ gollum
55
+
56
+ This will start up a web server running the Gollum frontend and you can view
57
+ and edit your wiki at http://localhost:4567. To get help on the command line
58
+ utility, you can run it like so:
59
+
60
+ $ gollum --help
61
+
62
+
63
+ ## REPO STRUCTURE
64
+
65
+ A Gollum repository's contents are designed to be human editable. Page content
66
+ is written in `page files` and may be organized into directories any way you
67
+ choose. Special footers can be created in `footer files`. Other content
68
+ (images, PDFs, etc) may also be present and organized in the same way.
69
+
70
+
71
+ ## PAGE FILES
72
+
73
+ Page files may be written in any format supported by
74
+ [GitHub-Markup](http://github.com/github/markup) (except roff). The
75
+ current list of formats and allowed extensions is:
76
+
77
+ * ASCIIDoc: .asciidoc
78
+ * Creole: .creole
79
+ * Markdown: .markdown, .mdown, .mkdn, .mkd, .md
80
+ * Org Mode: .org
81
+ * Pod: .pod
82
+ * RDoc: .rdoc
83
+ * ReStructuredText: .rest.txt, .rst.txt, .rest, .rst
84
+ * Textile: .textile
85
+ * MediaWiki: .mediawiki, .wiki
86
+
87
+ Gollum detects the page file format via the extension, so files must have one
88
+ of the supported extensions in order to be converted.
89
+
90
+ Page file names may contain any printable UTF-8 character except space
91
+ (U+0020) and forward slash (U+002F). If you commit a page file with any of
92
+ these characters in the name it will not be accessible via the web interface.
93
+
94
+ Even though page files may be placed in any directory, there is still only a
95
+ single namespace for page names, so all page files should have globally unique
96
+ names regardless of where they are located in the repository.
97
+
98
+ The special page file `Home.ext` (where the extension is one of the supported
99
+ formats) will be used as the entrance page to your wiki. If it is missing, an
100
+ automatically generated table of contents will be shown instead.
101
+
102
+ ## SIDEBAR FILES
103
+
104
+ Sidebar files allow you to add a simple sidebar to your wiki. Sidebar files
105
+ are named `_Sidebar.ext` where the extension is one of the supported formats.
106
+ Sidebars affect all pages in their directory and any subdirectories that do not
107
+ have a sidebar file of their own.
108
+
109
+ ## FOOTER FILES
110
+
111
+ Footer files allow you to add a simple footer to your wiki. Footer files must
112
+ be named `_Footer.ext` where the extension is one of the supported formats.
113
+ Like sidebars, footers affect all pages in their directory and any
114
+ subdirectories that do not have a footer file of their own.
115
+
116
+
117
+ ## HTML SANITIZATION
118
+
119
+ For security and compatibility reasons Gollum wikis may not contain custom CSS
120
+ or JavaScript. These tags will be stripped from the converted HTML. See
121
+ `docs/sanitization.md` for more details on what tags and attributes are
122
+ allowed.
123
+
124
+
125
+ ## BRACKET TAGS
126
+
127
+ A variety of Gollum tags use a double bracket syntax. For example:
128
+
129
+ [[Link]]
130
+
131
+ Some tags will accept attributes which are separated by pipe symbols. For
132
+ example:
133
+
134
+ [[Link|Page Title]]
135
+
136
+ In all cases, the first thing in the link is what is displayed on the page.
137
+ So, if the tag is an internal wiki link, the first thing in the tag will be
138
+ the link text displayed on the page. If the tag is an embedded image, the
139
+ first thing in the tag will be a path to an image file. Use this trick to
140
+ easily remember which order things should appear in tags.
141
+
142
+ Some formats, such as MediaWiki, support the opposite syntax:
143
+
144
+ [[Page Title|Link]]
145
+
146
+ ## PAGE LINKS
147
+
148
+ To link to another Gollum wiki page, use the Gollum Page Link Tag.
149
+
150
+ [[Frodo Baggins]]
151
+
152
+ The above tag will create a link to the corresponding page file named
153
+ `Frodo-Baggins.ext` where `ext` may be any of the allowed extension types. The
154
+ conversion is as follows:
155
+
156
+ 1. Replace any spaces (U+0020) with dashes (U+002D)
157
+ 2. Replace any slashes (U+002F) with dashes (U+002D)
158
+
159
+ If you'd like the link text to be something that doesn't map directly to the
160
+ page name, you can specify the actual page name after a pipe:
161
+
162
+ [[Frodo|Frodo Baggins]]
163
+
164
+ The above tag will link to `Frodo-Baggins.ext` using "Frodo" as the link text.
165
+
166
+ The page file may exist anywhere in the directory structure of the repository.
167
+ Gollum does a breadth first search and uses the first match that it finds.
168
+
169
+ Here are a few more examples:
170
+
171
+ [[J. R. R. Tolkien]] -> J.-R.-R.-Tolkien.ext
172
+ [[Movies / The Hobbit]] -> Movies---The-Hobbit.ext
173
+ [[モルドール]] -> モルドール.ext
174
+
175
+
176
+ ## EXTERNAL LINKS
177
+
178
+ As a convenience, simple external links can be placed within brackets and they
179
+ will be linked to the given URL with the URL as the link text. For example:
180
+
181
+ [[http://example.com]]
182
+
183
+ External links must begin with either "http://" or "https://". If you need
184
+ something more flexible, you can resort to the link syntax in the page's
185
+ underlying markup format.
186
+
187
+
188
+ ## ABSOLUTE VS. RELATIVE VS. EXTERNAL PATH
189
+
190
+ For Gollum tags that operate on static files (images, PDFs, etc), the paths
191
+ may be referenced as either relative, absolute, or external. Relative paths
192
+ point to a static file relative to the page file within the directory
193
+ structure of the Gollum repo (even though after conversion, all page files
194
+ appear to be top level). These paths are NOT prefixed with a slash. For
195
+ example:
196
+
197
+ gollum.pdf
198
+ docs/diagram.png
199
+
200
+ Absolute paths point to a static file relative to the Gollum repo's
201
+ root, regardless of where the page file is stored within the directory
202
+ structure. These paths ARE prefixed with a slash. For example:
203
+
204
+ /pdfs/gollum.pdf
205
+ /docs/diagram.png
206
+
207
+ External paths are full URLs. An external path must begin with either
208
+ "http://" or "https://". For example:
209
+
210
+ http://example.com/pdfs/gollum.pdf
211
+ http://example.com/images/diagram.png
212
+
213
+ All of the examples in this README use relative paths, but you may use
214
+ whatever works best in your situation.
215
+
216
+
217
+ ## FILE LINKS
218
+
219
+ To link to static files that are contained in the Gollum repository you should
220
+ use the Gollum File Link Tag.
221
+
222
+ [[Gollum|gollum.pdf]]
223
+
224
+ The first part of the tag is the link text. The path to the file appears after
225
+ the pipe.
226
+
227
+
228
+ ## IMAGES
229
+
230
+ To display images that are contained in the Gollum repository you should use
231
+ the Gollum Image Tag. This will display the actual image on the page.
232
+
233
+ [[gollum.png]]
234
+
235
+ In addition to the simple format, there are a variety of options that you
236
+ can specify between pipe delimiters.
237
+
238
+ To specify alt text, use the `alt=` option. Default is no alt text.
239
+
240
+ [[gollum.png|alt=Gollum and his precious wiki]]
241
+
242
+ To place the image in a frame, use the `frame` option. When combined with the
243
+ `alt=` option, the alt text will be used as a caption as well. Default is no
244
+ frame.
245
+
246
+ [[gollum.png|frame|alt=Gollum and his precious wiki]]
247
+
248
+ To specify the alignment of the image on the page, use the `align=` option.
249
+ Possible values are `left`, `center`, and `right`. Default is `left`.
250
+
251
+ [[gollum.png|align=center]]
252
+
253
+ To float an image so that text flows around it, use the `float` option. When
254
+ `float` is specified, only `left` and `right` are valid `align` options.
255
+ Default is not floating. When floating is activated but no alignment is
256
+ specified, default alignment is `left`.
257
+
258
+ [[gollum.png|float]]
259
+
260
+ To specify a max-width, use the `width=` option. Units must be specified in
261
+ either `px` or `em`.
262
+
263
+ [[gollum.png|width=400px]]
264
+
265
+ To specify a max-height, use the `height=` option. Units must be specified in
266
+ either `px` or `em`.
267
+
268
+ [[gollum.png|height=300px]]
269
+
270
+ Any of these options may be composed together by simply separating them with
271
+ pipes.
272
+
273
+
274
+ ## ESCAPING GOLLUM TAGS
275
+
276
+ If you need the literal text of a wiki or static link to show up in your final
277
+ wiki page, simply preface the link with a single quote (like in LISP):
278
+
279
+ '[[Page Link]]
280
+ '[[File Link|file.pdf]]
281
+ '[[image.jpg]]
282
+
283
+ This is useful for writing about the link syntax in your wiki pages.
284
+
285
+
286
+ ## SYNTAX HIGHLIGHTING
287
+
288
+ In page files you can get automatic syntax highlighting for a wide range of
289
+ languages (courtesy of [Pygments](http://pygments.org/) - must install
290
+ separately) by using the following syntax:
291
+
292
+ ```ruby
293
+ def foo
294
+ puts 'bar'
295
+ end
296
+ ```
297
+
298
+ The block must start with three backticks, at the beginning of a line or
299
+ indented with any number of spaces or tabs.
300
+ After that comes the name of the language that is contained by the
301
+ block. The language must be one of the `short name` lexer strings supported by
302
+ Pygments. See the [list of lexers](http://pygments.org/docs/lexers/) for valid
303
+ options.
304
+
305
+ The block contents should be indented at the same level than the opening backticks.
306
+ If the block contents are indented with an additional two spaces or one tab,
307
+ then that whitespace will be ignored (this makes the blocks easier to read in plaintext).
308
+
309
+ The block must end with three backticks indented at the same level than the opening
310
+ backticks.
311
+
312
+ ## MATHEMATICAL EQUATIONS
313
+
314
+ Page files may contain mathematic equations in TeX syntax that will be nicely
315
+ typeset into the expected output. A block-style equation is delimited by `\[`
316
+ and `\]`. For example:
317
+
318
+ \[ P(E) = {n \choose k} p^k (1-p)^{ n-k} \]
319
+
320
+ Inline equations are delimited by `\(` and `\)`. These equations will appear
321
+ inline with regular text. For example:
322
+
323
+ The Pythagorean theorem is \( a^2 + b^2 = c^2 \).
324
+
325
+
326
+ ## SEQUENCE DIAGRAMS
327
+
328
+ You may imbed sequence diagrams into your wiki page (rendered by
329
+ [WebSequenceDiagrams](http://www.websequencediagrams.com) by using the
330
+ following syntax:
331
+
332
+ {{{ blue-modern
333
+ alice->bob: Test
334
+ bob->alice: Test response
335
+ }}}
336
+
337
+ You can replace the string "blue-modern" with any supported style.
338
+
339
+ ## API DOCUMENTATION
340
+
341
+ The Gollum API allows you to retrieve raw or formatted wiki content from a Git
342
+ repository, write new content to the repository, and collect various meta data
343
+ about the wiki as a whole.
344
+
345
+ Initialize the Gollum::Repo object:
346
+
347
+ # Require rubygems if necessary
348
+ require 'rubygems'
349
+
350
+ # Require the Gollum library
351
+ require 'gollum'
352
+
353
+ # Create a new Gollum::Wiki object by initializing it with the path to the
354
+ # Git repository.
355
+ wiki = Gollum::Wiki.new("my-gollum-repo.git")
356
+ # => <Gollum::Wiki>
357
+
358
+ By default, internal wiki links are all absolute from the root. To specify a different base path, you can specify the `:base_path` option:
359
+
360
+ wiki = Gollum::Wiki.new("my-gollum-repo.git", :base_path => "/wiki")
361
+
362
+ Get the latest version of the given human or canonical page name:
363
+
364
+ page = wiki.page('page-name')
365
+ # => <Gollum::Page>
366
+
367
+ page.raw_data
368
+ # => "# My wiki page"
369
+
370
+ page.formatted_data
371
+ # => "<h1>My wiki page</h1>"
372
+
373
+ page.format
374
+ # => :markdown
375
+
376
+ vsn = page.version
377
+ # => <Grit::Commit>
378
+
379
+ vsn.id
380
+ # => '3ca43e12377ea1e32ea5c9ce5992ec8bf266e3e5'
381
+
382
+ Get the footer (if any) for a given page:
383
+
384
+ page.footer
385
+ # => <Gollum::Page>
386
+
387
+ Get a list of versions for a given page:
388
+
389
+ vsns = wiki.page('page-name').versions
390
+ # => [<Grit::Commit, <Grit::Commit, <Grit::Commit>]
391
+
392
+ vsns.first.id
393
+ # => '3ca43e12377ea1e32ea5c9ce5992ec8bf266e3e5'
394
+
395
+ vsns.first.authored_date
396
+ # => Sun Mar 28 19:11:21 -0700 2010
397
+
398
+ Get a specific version of a given canonical page file:
399
+
400
+ wiki.page('page-name', '5ec521178e0eec4dc39741a8978a2ba6616d0f0a')
401
+
402
+ Get the latest version of a given static file:
403
+
404
+ file = wiki.file('asset.js')
405
+ # => <Gollum::File>
406
+
407
+ file.raw_data
408
+ # => "alert('hello');"
409
+
410
+ file.version
411
+ # => <Grit::Commit>
412
+
413
+ Get a specific version of a given static file:
414
+
415
+ wiki.file('asset.js', '5ec521178e0eec4dc39741a8978a2ba6616d0f0a')
416
+
417
+ Get an in-memory Page preview (useful for generating previews for web
418
+ interfaces):
419
+
420
+ preview = wiki.preview_page("My Page", "# Contents", :markdown)
421
+ preview.formatted_data
422
+ # => "<h1>Contents</h1>"
423
+
424
+ Methods that write to the repository require a Hash of commit data that takes
425
+ the following form:
426
+
427
+ commit = { :message => 'commit message',
428
+ :name => 'Tom Preston-Werner',
429
+ :email => 'tom@github.com' }
430
+
431
+ Write a new version of a page (the file will be created if it does not already
432
+ exist) and commit the change. The file will be written at the repo root.
433
+
434
+ wiki.write_page('Page Name', :markdown, 'Page contents', commit)
435
+
436
+ Update an existing page. If the format is different than the page's current
437
+ format, the file name will be changed to reflect the new format.
438
+
439
+ page = wiki.page('Page Name')
440
+ wiki.update_page(page, page.name, page.format, 'Page contents', commit)
441
+
442
+ To delete a page and commit the change:
443
+
444
+ wiki.delete_page(page, commit)
445
+
446
+ ### RACK
447
+
448
+ You can also run gollum with any rack-compatible server by placing this config.ru
449
+ file inside your wiki repository. This allows you to utilize any Rack middleware
450
+ like Rack::Auth, OmniAuth, etc.
451
+
452
+ #!/usr/bin/env ruby
453
+ require 'rubygems'
454
+ require 'gollum/frontend/app'
455
+
456
+ gollum_path = File.expand_path(File.dirname(__FILE__)) # CHANGE THIS TO POINT TO YOUR OWN WIKI REPO
457
+ Precious::App.set(:default_markup, :markdown) # set your favorite markup language
458
+ run Precious::App
459
+
460
+ ## CONTRIBUTE
461
+
462
+ If you'd like to hack on Gollum, start by forking my repo on GitHub:
463
+
464
+ http://github.com/github/gollum
465
+
466
+ To get all of the dependencies, install the gem first. The best way to get
467
+ your changes merged back into core is as follows:
468
+
469
+ 1. Clone down your fork
470
+ 1. Create a thoughtfully named topic branch to contain your change
471
+ 1. Hack away
472
+ 1. Add tests and make sure everything still passes by running `rake`
473
+ 1. If you are adding new functionality, document it in the README
474
+ 1. Do not change the version number, I will do that on my end
475
+ 1. If necessary, rebase your commits into logical chunks, without errors
476
+ 1. Push the branch up to GitHub
477
+ 1. Send a pull request to the github/gollum project.