gollum 2.0.0 → 2.1.0

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

Potentially problematic release.


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

Files changed (454) hide show
  1. data/README.md +44 -7
  2. data/Rakefile +1 -1
  3. data/bin/gollum +20 -1
  4. data/gollum.gemspec +400 -5
  5. data/lib/gollum.rb +2 -1
  6. data/lib/gollum/blob_entry.rb +13 -1
  7. data/lib/gollum/committer.rb +10 -1
  8. data/lib/gollum/file.rb +15 -2
  9. data/lib/gollum/file_view.rb +145 -0
  10. data/lib/gollum/frontend/app.rb +217 -69
  11. data/lib/gollum/frontend/helpers.rb +21 -0
  12. data/lib/gollum/frontend/public/gollum/css/_styles.css +121 -0
  13. data/lib/gollum/frontend/public/gollum/css/editor.css +17 -8
  14. data/lib/gollum/frontend/public/gollum/css/gollum.css +440 -402
  15. data/lib/gollum/frontend/public/gollum/css/template.css +540 -289
  16. data/lib/gollum/frontend/public/gollum/images/dirty-shade.png +0 -0
  17. data/lib/gollum/frontend/public/gollum/images/fileview/document.png +0 -0
  18. data/lib/gollum/frontend/public/gollum/images/fileview/folder-horizontal.png +0 -0
  19. data/lib/gollum/frontend/public/gollum/images/fileview/toggle-small-expand.png +0 -0
  20. data/lib/gollum/frontend/public/gollum/images/fileview/toggle-small.png +0 -0
  21. data/lib/gollum/frontend/public/gollum/images/para.png +0 -0
  22. data/lib/gollum/frontend/public/gollum/images/pin-16.png +0 -0
  23. data/lib/gollum/frontend/public/gollum/images/pin-20.png +0 -0
  24. data/lib/gollum/frontend/public/gollum/images/pin-24.png +0 -0
  25. data/lib/gollum/frontend/public/gollum/images/pin-32.png +0 -0
  26. data/lib/gollum/frontend/public/gollum/javascript/editor/gollum.editor.js +31 -7
  27. data/lib/gollum/frontend/public/gollum/javascript/editor/langs/asciidoc.js +2 -1
  28. data/lib/gollum/frontend/public/gollum/javascript/editor/langs/creole.js +2 -1
  29. data/lib/gollum/frontend/public/gollum/javascript/editor/langs/markdown.js +18 -6
  30. data/lib/gollum/frontend/public/gollum/javascript/editor/langs/org.js +2 -1
  31. data/lib/gollum/frontend/public/gollum/javascript/editor/langs/pod.js +2 -1
  32. data/lib/gollum/frontend/public/gollum/javascript/editor/langs/textile.js +2 -1
  33. data/lib/gollum/frontend/public/gollum/javascript/gollum.dialog.js +3 -0
  34. data/lib/gollum/frontend/public/gollum/javascript/gollum.js +78 -16
  35. data/lib/gollum/frontend/public/gollum/javascript/jquery-1.7.2.min.js +4 -0
  36. data/lib/gollum/frontend/public/gollum/javascript/mousetrap.min.js +8 -0
  37. data/lib/gollum/frontend/public/gollum/livepreview/css/custom.css +107 -0
  38. data/lib/gollum/frontend/public/gollum/livepreview/images/cancel_24.png +0 -0
  39. data/lib/gollum/frontend/public/gollum/livepreview/images/lr_24.png +0 -0
  40. data/lib/gollum/frontend/public/gollum/livepreview/images/save_24.png +0 -0
  41. data/lib/gollum/frontend/public/gollum/livepreview/images/savecomment_24.png +0 -0
  42. data/lib/gollum/frontend/public/gollum/livepreview/index.html +46 -0
  43. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/ace.js +103 -0
  44. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/anchor.js +254 -0
  45. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/anchor_test.js +184 -0
  46. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/background_tokenizer.js +261 -0
  47. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/background_tokenizer_test.js +92 -0
  48. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/commands/command_manager.js +121 -0
  49. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/commands/command_manager_test.js +193 -0
  50. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/commands/default_commands.js +460 -0
  51. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/commands/multi_select_commands.js +101 -0
  52. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/config.js +124 -0
  53. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/css/codefolding-fold-button-states.png +0 -0
  54. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/css/editor.css +327 -0
  55. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/css/expand-marker.png +0 -0
  56. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/document.js +617 -0
  57. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/document_test.js +314 -0
  58. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/edit_session.js +2419 -0
  59. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/edit_session/bracket_match.js +252 -0
  60. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/edit_session/fold.js +116 -0
  61. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/edit_session/fold_line.js +276 -0
  62. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/edit_session/folding.js +759 -0
  63. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/edit_session_test.js +981 -0
  64. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/editor.js +2163 -0
  65. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/editor_change_document_test.js +195 -0
  66. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/editor_highlight_selected_word_test.js +231 -0
  67. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/editor_navigation_test.js +171 -0
  68. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/editor_text_edit_test.js +562 -0
  69. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/ext/static.css +22 -0
  70. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/ext/static_highlight.js +98 -0
  71. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/ext/static_highlight_test.js +81 -0
  72. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/ext/textarea.js +536 -0
  73. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/keyboard/emacs.js +367 -0
  74. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/keyboard/hash_handler.js +170 -0
  75. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/keyboard/keybinding.js +143 -0
  76. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/keyboard/state_handler.js +257 -0
  77. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/keyboard/textinput.js +315 -0
  78. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/keyboard/vim.js +122 -0
  79. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/keyboard/vim/commands.js +556 -0
  80. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/keyboard/vim/maps/aliases.js +101 -0
  81. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/keyboard/vim/maps/motions.js +611 -0
  82. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/keyboard/vim/maps/operators.js +193 -0
  83. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/keyboard/vim/maps/util.js +134 -0
  84. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/keyboard/vim/registers.js +49 -0
  85. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/layer/cursor.js +202 -0
  86. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/layer/gutter.js +187 -0
  87. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/layer/marker.js +214 -0
  88. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/layer/text.js +595 -0
  89. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/layer/text_test.js +106 -0
  90. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/lib/browser_focus.js +105 -0
  91. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/lib/dom.js +292 -0
  92. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/lib/es5-shim.js +1059 -0
  93. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/lib/event.js +317 -0
  94. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/lib/event_emitter.js +121 -0
  95. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/lib/event_emitter_test.js +72 -0
  96. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/lib/fixoldbrowsers.js +19 -0
  97. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/lib/keys.js +129 -0
  98. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/lib/lang.js +164 -0
  99. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/lib/net.js +62 -0
  100. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/lib/oop.js +61 -0
  101. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/lib/regexp.js +113 -0
  102. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/lib/useragent.js +105 -0
  103. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/behaviour.js +98 -0
  104. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/behaviour/cstyle.js +225 -0
  105. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/behaviour/html.js +98 -0
  106. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/behaviour/xml.js +113 -0
  107. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/behaviour/xquery.js +68 -0
  108. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/c9search.js +74 -0
  109. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/c9search_highlight_rules.js +66 -0
  110. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/c_cpp.js +132 -0
  111. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/c_cpp_highlight_rules.js +180 -0
  112. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/clojure.js +121 -0
  113. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/clojure_highlight_rules.js +235 -0
  114. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coffee.js +121 -0
  115. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coffee/coffee-script.js +63 -0
  116. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coffee/helpers.js +100 -0
  117. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coffee/lexer.js +739 -0
  118. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coffee/nodes.js +2756 -0
  119. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coffee/parser.js +603 -0
  120. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coffee/parser_test.js +68 -0
  121. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coffee/rewriter.js +342 -0
  122. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coffee/scope.js +154 -0
  123. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coffee_highlight_rules.js +227 -0
  124. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coffee_highlight_rules_test.js +72 -0
  125. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coffee_worker.js +92 -0
  126. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coldfusion.js +71 -0
  127. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coldfusion_highlight_rules.js +135 -0
  128. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coldfusion_test.js +74 -0
  129. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/csharp.js +58 -0
  130. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/csharp_highlight_rules.js +104 -0
  131. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/css.js +110 -0
  132. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/css/csslint.js +9014 -0
  133. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/css_highlight_rules.js +242 -0
  134. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/css_highlight_rules_test.js +99 -0
  135. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/css_test.js +85 -0
  136. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/css_worker.js +66 -0
  137. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/css_worker_test.js +75 -0
  138. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/diff.js +58 -0
  139. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/diff_highlight_rules.js +108 -0
  140. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/doc_comment_highlight_rules.js +93 -0
  141. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/c9search.js +83 -0
  142. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/coffee.js +127 -0
  143. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/coffee_test.js +108 -0
  144. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/cstyle.js +95 -0
  145. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/cstyle_test.js +92 -0
  146. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/diff.js +76 -0
  147. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/fold_mode.js +115 -0
  148. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/html.js +86 -0
  149. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/html_test.js +169 -0
  150. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/mixed.js +88 -0
  151. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/pythonic.js +65 -0
  152. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/pythonic_test.js +105 -0
  153. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/xml.js +262 -0
  154. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/xml_test.js +117 -0
  155. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/golang.js +81 -0
  156. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/golang_highlight_rules.js +129 -0
  157. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/groovy.js +24 -0
  158. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/groovy_highlight_rules.js +183 -0
  159. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/haxe.js +58 -0
  160. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/haxe_highlight_rules.js +104 -0
  161. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/html.js +83 -0
  162. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/html_highlight_rules.js +159 -0
  163. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/html_highlight_rules_test.js +93 -0
  164. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/html_test.js +74 -0
  165. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/java.js +25 -0
  166. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/java_highlight_rules.js +144 -0
  167. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/javascript.js +164 -0
  168. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/javascript_highlight_rules.js +471 -0
  169. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/javascript_highlight_rules_test.js +225 -0
  170. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/javascript_test.js +165 -0
  171. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/javascript_worker.js +88 -0
  172. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/javascript_worker_test.js +99 -0
  173. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/json.js +100 -0
  174. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/json/json_parse.js +346 -0
  175. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/json_highlight_rules.js +111 -0
  176. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/json_worker.js +103 -0
  177. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/json_worker_test.js +108 -0
  178. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/jsx.js +53 -0
  179. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/jsx_highlight_rules.js +122 -0
  180. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/latex.js +57 -0
  181. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/latex_highlight_rules.js +38 -0
  182. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/less.js +87 -0
  183. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/less_highlight_rules.js +279 -0
  184. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/liquid.js +116 -0
  185. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/liquid_highlight_rules.js +220 -0
  186. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/liquid_highlight_rules_test.js +91 -0
  187. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/lua.js +87 -0
  188. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/lua_highlight_rules.js +436 -0
  189. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/luapage.js +22 -0
  190. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/luapage_highlight_rules.js +42 -0
  191. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/markdown.js +81 -0
  192. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/markdown_highlight_rules.js +195 -0
  193. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/matching_brace_outdent.js +81 -0
  194. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/matching_parens_outdent.js +81 -0
  195. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/ocaml.js +103 -0
  196. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/ocaml_highlight_rules.js +355 -0
  197. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/perl.js +117 -0
  198. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/perl_highlight_rules.js +168 -0
  199. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/pgsql.js +78 -0
  200. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/pgsql_highlight_rules.js +583 -0
  201. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/php.js +119 -0
  202. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/php_highlight_rules.js +1165 -0
  203. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/powershell.js +58 -0
  204. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/powershell_highlight_rules.js +138 -0
  205. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/python.js +147 -0
  206. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/python_highlight_rules.js +182 -0
  207. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/python_test.js +86 -0
  208. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/ruby.js +116 -0
  209. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/ruby_highlight_rules.js +194 -0
  210. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/ruby_highlight_rules_test.js +116 -0
  211. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/scad.js +132 -0
  212. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/scad_highlight_rules.js +168 -0
  213. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/scala.js +25 -0
  214. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/scala_highlight_rules.js +179 -0
  215. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/scss.js +86 -0
  216. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/scss_highlight_rules.js +304 -0
  217. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/sh.js +144 -0
  218. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/sh_highlight_rules.js +145 -0
  219. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/sql.js +70 -0
  220. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/sql_highlight_rules.js +89 -0
  221. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/svg.js +78 -0
  222. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/svg_highlight_rules.js +71 -0
  223. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/text.js +159 -0
  224. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/text_highlight_rules.js +109 -0
  225. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/text_test.js +71 -0
  226. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/textile.js +73 -0
  227. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/textile_highlight_rules.js +100 -0
  228. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xml.js +65 -0
  229. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xml_highlight_rules.js +109 -0
  230. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xml_highlight_rules_test.js +103 -0
  231. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xml_test.js +82 -0
  232. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xml_util.js +120 -0
  233. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery.js +202 -0
  234. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/Position.js +59 -0
  235. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/Readme.md +6 -0
  236. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/StringLexer.js +1686 -0
  237. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/XMLLexer.js +2993 -0
  238. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/XQDTLexer.js +69 -0
  239. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/XQDTParser.js +63 -0
  240. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/XQueryLexer.js +10363 -0
  241. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/XQueryParser.js +42525 -0
  242. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/XQuerySemanticHighlighter.js +165 -0
  243. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/antlr3-all.js +6177 -0
  244. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/xquery.js +55 -0
  245. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery_highlight_rules.js +158 -0
  246. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery_worker.js +86 -0
  247. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/yaml.js +64 -0
  248. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/yaml_highlight_rules.js +116 -0
  249. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/model/editor.js +70 -0
  250. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mouse/default_gutter_handler.js +73 -0
  251. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mouse/default_handlers.js +354 -0
  252. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mouse/dragdrop.js +105 -0
  253. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mouse/fold_handler.js +71 -0
  254. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mouse/mouse_event.js +140 -0
  255. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mouse/mouse_handler.js +158 -0
  256. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mouse/multi_select_handler.js +163 -0
  257. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/multi_select.js +762 -0
  258. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/multi_select_test.js +171 -0
  259. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/narcissus/definitions.js +696 -0
  260. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/narcissus/lexer.js +598 -0
  261. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/narcissus/options.js +61 -0
  262. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/narcissus/parser.js +2072 -0
  263. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/placeholder.js +278 -0
  264. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/placeholder_test.js +164 -0
  265. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/range.js +581 -0
  266. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/range_list.js +230 -0
  267. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/range_list_test.js +170 -0
  268. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/range_test.js +198 -0
  269. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/renderloop.js +93 -0
  270. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/requirejs/text.js +58 -0
  271. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/scrollbar.js +142 -0
  272. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/search.js +398 -0
  273. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/search_highlight.js +87 -0
  274. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/search_test.js +451 -0
  275. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/selection.js +886 -0
  276. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/selection_test.js +472 -0
  277. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/split.js +411 -0
  278. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/test/all.js +42 -0
  279. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/test/all_browser.js +136 -0
  280. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/test/assertions.js +63 -0
  281. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/test/asyncjs/assert.js +313 -0
  282. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/test/asyncjs/async.js +529 -0
  283. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/test/asyncjs/index.js +13 -0
  284. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/test/asyncjs/test.js +195 -0
  285. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/test/asyncjs/utils.js +65 -0
  286. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/test/benchmark.js +85 -0
  287. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/test/mockdom.js +10 -0
  288. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/test/mockrenderer.js +204 -0
  289. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/test/tests.html +46 -0
  290. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/chrome.css +159 -0
  291. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/chrome.js +46 -0
  292. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/clouds.css +118 -0
  293. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/clouds.js +46 -0
  294. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/clouds_midnight.css +119 -0
  295. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/clouds_midnight.js +46 -0
  296. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/cobalt.css +145 -0
  297. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/cobalt.js +46 -0
  298. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/crimson_editor.css +151 -0
  299. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/crimson_editor.js +46 -0
  300. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/dawn.css +149 -0
  301. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/dawn.js +46 -0
  302. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/dreamweaver.css +182 -0
  303. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/dreamweaver.js +45 -0
  304. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/eclipse.css +102 -0
  305. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/eclipse.js +48 -0
  306. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/github.css +133 -0
  307. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/github.js +46 -0
  308. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/idle_fingers.css +137 -0
  309. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/idle_fingers.js +46 -0
  310. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/kr_theme.css +140 -0
  311. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/kr_theme.js +46 -0
  312. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/merbivore.css +140 -0
  313. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/merbivore.js +46 -0
  314. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/merbivore_soft.css +146 -0
  315. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/merbivore_soft.js +46 -0
  316. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/mono_industrial.css +148 -0
  317. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/mono_industrial.js +46 -0
  318. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/monokai.css +145 -0
  319. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/monokai.js +46 -0
  320. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/pastel_on_dark.css +150 -0
  321. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/pastel_on_dark.js +46 -0
  322. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/solarized_dark.css +131 -0
  323. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/solarized_dark.js +46 -0
  324. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/solarized_light.css +130 -0
  325. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/solarized_light.js +46 -0
  326. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/textmate.css +165 -0
  327. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/textmate.js +47 -0
  328. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow.css +164 -0
  329. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow.js +46 -0
  330. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow_night.css +164 -0
  331. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow_night.js +46 -0
  332. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow_night_blue.css +164 -0
  333. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow_night_blue.js +46 -0
  334. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow_night_bright.css +164 -0
  335. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow_night_bright.js +46 -0
  336. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow_night_eighties.css +160 -0
  337. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow_night_eighties.js +46 -0
  338. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/twilight.css +162 -0
  339. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/twilight.js +46 -0
  340. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/vibrant_ink.css +141 -0
  341. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/vibrant_ink.js +46 -0
  342. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/token_iterator.js +162 -0
  343. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/token_iterator_test.js +219 -0
  344. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/tokenizer.js +195 -0
  345. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/undomanager.js +142 -0
  346. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/unicode.js +107 -0
  347. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/virtual_renderer.js +1402 -0
  348. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/virtual_renderer_test.js +93 -0
  349. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/worker/jshint.js +4469 -0
  350. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/worker/jslint.js +6396 -0
  351. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/worker/mirror.js +43 -0
  352. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/worker/worker.js +138 -0
  353. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/worker/worker_client.js +176 -0
  354. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/worker/worker_sourcemint.js +73 -0
  355. data/lib/gollum/frontend/public/gollum/livepreview/js/jquery.ba-throttle-debounce.min.js +2 -0
  356. data/lib/gollum/frontend/public/gollum/livepreview/js/livepreview.js +456 -0
  357. data/lib/gollum/frontend/public/gollum/livepreview/js/md_sundown.js +22 -0
  358. data/lib/gollum/frontend/public/gollum/livepreview/js/requirejs.min.js +35 -0
  359. data/lib/gollum/frontend/public/gollum/livepreview/js/sundown.js +1 -0
  360. data/lib/gollum/frontend/public/gollum/livepreview/licenses/ace/LICENSE.txt +476 -0
  361. data/lib/gollum/frontend/public/gollum/livepreview/licenses/bootstraponline_gollum/LICENSE.txt +9 -0
  362. data/lib/gollum/frontend/public/gollum/livepreview/licenses/debounce/LICENSE-MIT.txt +22 -0
  363. data/lib/gollum/frontend/public/gollum/livepreview/licenses/gollum/LICENSE.txt +21 -0
  364. data/lib/gollum/frontend/public/gollum/livepreview/licenses/jquery/MIT-LICENSE.txt +20 -0
  365. data/lib/gollum/frontend/public/gollum/livepreview/licenses/licenses.txt +59 -0
  366. data/lib/gollum/frontend/public/gollum/livepreview/licenses/notepages/LICENSE.txt +19 -0
  367. data/lib/gollum/frontend/public/gollum/livepreview/licenses/requirejs/LICENSE.txt +58 -0
  368. data/lib/gollum/frontend/public/gollum/livepreview/licenses/retina_display_icon_set/by_sa_3.0_unported_legalcode.txt +359 -0
  369. data/lib/gollum/frontend/public/gollum/livepreview/licenses/sizzle/LICENSE.txt +148 -0
  370. data/lib/gollum/frontend/public/gollum/livepreview/licenses/sundown/sundown.txt +4 -0
  371. data/lib/gollum/frontend/public/gollum/livepreview/readme.md +44 -0
  372. data/lib/gollum/frontend/templates/compare.mustache +9 -9
  373. data/lib/gollum/frontend/templates/create.mustache +4 -1
  374. data/lib/gollum/frontend/templates/edit.mustache +6 -3
  375. data/lib/gollum/frontend/templates/editor.mustache +30 -14
  376. data/lib/gollum/frontend/templates/file_view.mustache +32 -0
  377. data/lib/gollum/frontend/templates/history.mustache +8 -8
  378. data/lib/gollum/frontend/templates/layout.mustache +21 -14
  379. data/lib/gollum/frontend/templates/page.mustache +37 -14
  380. data/lib/gollum/frontend/templates/pages.mustache +14 -10
  381. data/lib/gollum/frontend/templates/search.mustache +2 -2
  382. data/lib/gollum/frontend/templates/searchbar.mustache +1 -1
  383. data/lib/gollum/frontend/uri_encode_component.rb +172 -0
  384. data/lib/gollum/frontend/views/compare.rb +2 -4
  385. data/lib/gollum/frontend/views/create.rb +5 -0
  386. data/lib/gollum/frontend/views/edit.rb +12 -0
  387. data/lib/gollum/frontend/views/file_view.rb +19 -0
  388. data/lib/gollum/frontend/views/has_page.rb +15 -0
  389. data/lib/gollum/frontend/views/history.rb +8 -4
  390. data/lib/gollum/frontend/views/layout.rb +9 -1
  391. data/lib/gollum/frontend/views/page.rb +37 -10
  392. data/lib/gollum/frontend/views/pages.rb +48 -0
  393. data/lib/gollum/git_access.rb +2 -2
  394. data/lib/gollum/markup.rb +115 -19
  395. data/lib/gollum/page.rb +79 -9
  396. data/lib/gollum/tex.rb +319 -42
  397. data/lib/gollum/wiki.rb +92 -12
  398. data/licenses/css_tree_menu_thecssninja/license.txt +50 -0
  399. data/licenses/licenses.txt +23 -0
  400. data/licenses/unity_asset_pool/COPYRIGHT +286 -0
  401. data/test/examples/lotr.git/config +1 -1
  402. data/test/examples/lotr.git/logs/HEAD +4 -0
  403. data/test/examples/lotr.git/logs/refs/heads/master +4 -0
  404. data/test/examples/lotr.git/objects/0d/c9016ca928c78d5421a99a53b379b53929221e +0 -0
  405. data/test/examples/lotr.git/objects/1c/79ddc69707f7b164bc2ea58beb5d8965ff6bd0 +0 -0
  406. data/test/examples/lotr.git/objects/27/680b0fce1abfbc528e7aa53d92645852d52eb6 +0 -0
  407. data/test/examples/lotr.git/objects/45/3b250f979c7bd6dfb62640c944c982ae6721ee +0 -0
  408. data/test/examples/lotr.git/objects/45/f319ee12f2b551b901b22e72602963c366fff1 +0 -0
  409. data/test/examples/lotr.git/objects/46/a697caf435815bb07bbce947fc2d58be15f087 +0 -0
  410. data/test/examples/lotr.git/objects/4c/45c2b4e297a726c3d3f66886f35373e48fe1c5 +2 -0
  411. data/test/examples/lotr.git/objects/4e/023f460ce466e154ca09d8774c79ad5a53fc15 +0 -0
  412. data/test/examples/lotr.git/objects/62/9aa678272b017a4d136d35e77ac94d80b08dc2 +1 -0
  413. data/test/examples/lotr.git/objects/6e/48abfc56565574859e081ee58eae655d48cf71 +0 -0
  414. data/test/examples/lotr.git/objects/7b/60c5a20a501a70f2317fa0ef763e1e2ce22d6b +0 -0
  415. data/test/examples/lotr.git/objects/7d/981cd984ad589e3cf00d8122170c6f7d685979 +0 -0
  416. data/test/examples/lotr.git/objects/94/9a9cc3119b9c98817f375e976d2bb5e2a42809 +0 -0
  417. data/test/examples/lotr.git/objects/9b/e95b960ac388d4e7db55f610f828e9c31344e6 +0 -0
  418. data/test/examples/lotr.git/objects/b0/de6e794dfdc7ef3400e894225bfe23308aae5c +0 -0
  419. data/test/examples/lotr.git/objects/b1/6b3d9fad9d78e5a669e7f33d94c96da374eccd +0 -0
  420. data/test/examples/lotr.git/objects/c9/6a7645db5d4c76389e77cd103ef3ed77d81e4c +0 -0
  421. data/test/examples/lotr.git/objects/ca/7355dc497e9729fbaf0c0e3f424b86afef5614 +0 -0
  422. data/test/examples/lotr.git/objects/cf/ea406f5f77afc7fb673a43e97721234385b1bd +2 -0
  423. data/test/examples/lotr.git/objects/d5/29304506d37f544675244c335d85cab5d29966 +0 -0
  424. data/test/examples/lotr.git/objects/fb/c5dd7d807707b4a0a97c1182fecfef1eced5df +1 -0
  425. data/test/examples/lotr.git/objects/fc/3eee516ff72dc9099ba00d4611eb02e5c9e634 +0 -0
  426. data/test/examples/lotr.git/objects/ff/6f7de62644369380ba73b4e4297c1a2d6f0b66 +0 -0
  427. data/test/examples/lotr.git/refs/heads/master +1 -1
  428. data/test/examples/revert.git/COMMIT_EDITMSG +1 -1
  429. data/test/examples/revert.git/index +0 -0
  430. data/test/examples/revert.git/logs/HEAD +1 -0
  431. data/test/examples/revert.git/logs/refs/heads/master +1 -0
  432. data/test/examples/revert.git/objects/10/2685c42018f802557f05db171f44443e8dacab +0 -0
  433. data/test/examples/revert.git/objects/8e/83f898e5e16ae400db59dda1017acad540f3aa +0 -0
  434. data/test/examples/revert.git/objects/ed/6c9f63b98acf73c25b5ffbb38da557d3682023 +3 -0
  435. data/test/examples/revert.git/refs/heads/master +1 -1
  436. data/test/file_view/1_file.txt +3 -0
  437. data/test/file_view/1_file_1_folder.txt +8 -0
  438. data/test/file_view/1_folder.txt +8 -0
  439. data/test/file_view/2_files_2_folders.txt +12 -0
  440. data/test/file_view/2_files_2_folders_1_root.txt +13 -0
  441. data/test/file_view/nested_folders.txt +28 -0
  442. data/test/test_app.rb +162 -12
  443. data/test/test_app_helpers.rb +13 -0
  444. data/test/test_committer.rb +1 -1
  445. data/test/test_file_view.rb +102 -0
  446. data/test/test_git_access.rb +3 -2
  447. data/test/test_markup.rb +45 -12
  448. data/test/test_page.rb +65 -1
  449. data/test/test_page_revert.rb +14 -2
  450. data/test/test_pages_view.rb +37 -0
  451. data/test/test_unicode.rb +110 -0
  452. data/test/test_wiki.rb +51 -4
  453. metadata +658 -239
  454. data/lib/gollum/frontend/public/gollum/javascript/jquery.js +0 -7179
data/lib/gollum.rb CHANGED
@@ -15,13 +15,14 @@ require File.expand_path('../gollum/blob_entry', __FILE__)
15
15
  require File.expand_path('../gollum/wiki', __FILE__)
16
16
  require File.expand_path('../gollum/page', __FILE__)
17
17
  require File.expand_path('../gollum/file', __FILE__)
18
+ require File.expand_path('../gollum/file_view', __FILE__)
18
19
  require File.expand_path('../gollum/markup', __FILE__)
19
20
  require File.expand_path('../gollum/sanitization', __FILE__)
20
21
  require File.expand_path('../gollum/tex', __FILE__)
21
22
  require File.expand_path('../gollum/web_sequence_diagram', __FILE__)
22
23
 
23
24
  module Gollum
24
- VERSION = '2.0.0'
25
+ VERSION = '2.1.0'
25
26
 
26
27
  def self.assets_path
27
28
  ::File.expand_path('gollum/frontend/public', ::File.dirname(__FILE__))
@@ -48,6 +48,18 @@ module Gollum
48
48
  page
49
49
  end
50
50
 
51
+ # Gets a File instance for this blob.
52
+ #
53
+ # wiki - Gollum::Wiki instance for the Gollum::File
54
+ #
55
+ # Returns a Gollum::File instance.
56
+ def file(wiki, commit)
57
+ blob = self.blob(wiki.repo)
58
+ file = wiki.file_class.new(wiki).populate(blob, self.dir)
59
+ file.version = commit
60
+ file
61
+ end
62
+
51
63
  def inspect
52
64
  %(#<Gollum::BlobEntry #{@sha} #{@path}>)
53
65
  end
@@ -75,4 +87,4 @@ module Gollum
75
87
  dir
76
88
  end
77
89
  end
78
- end
90
+ end
@@ -91,7 +91,11 @@ module Gollum
91
91
  fullpath = ::File.join(*[@wiki.page_file_dir, dir, path].compact)
92
92
  fullpath = fullpath[1..-1] if fullpath =~ /^\//
93
93
 
94
- if index.current_tree && tree = index.current_tree / dir
94
+ if index.current_tree && tree = index.current_tree / (@wiki.page_file_dir || '/')
95
+ tree = tree / dir unless tree.nil?
96
+ end
97
+
98
+ if tree
95
99
  downpath = path.downcase.sub(/\.\w+$/, '')
96
100
 
97
101
  tree.blobs.each do |blob|
@@ -104,6 +108,8 @@ module Gollum
104
108
  end
105
109
  end
106
110
 
111
+ fullpath = fullpath.force_encoding('ascii-8bit') if fullpath.respond_to?(:force_encoding)
112
+
107
113
  index.add(fullpath, @wiki.normalize(data))
108
114
  end
109
115
 
@@ -129,6 +135,8 @@ module Gollum
129
135
  ::File.join(dir, @wiki.page_file_name(name, format))
130
136
  end
131
137
 
138
+ path = path.force_encoding('ascii-8bit') if path.respond_to?(:force_encoding)
139
+
132
140
  Dir.chdir(::File.join(@wiki.repo.path, '..')) do
133
141
  if file_path_scheduled_for_deletion?(index.tree, path)
134
142
  @wiki.repo.git.rm({'f' => true}, '--', path)
@@ -212,6 +220,7 @@ module Gollum
212
220
 
213
221
  # Proxies methods t
214
222
  def method_missing(name, *args)
223
+ args.map! { |item| item.respond_to?(:force_encoding) ? item.force_encoding('ascii-8bit') : item }
215
224
  index.send(name, *args)
216
225
  end
217
226
  end
data/lib/gollum/file.rb CHANGED
@@ -19,6 +19,7 @@ module Gollum
19
19
  def name
20
20
  @blob && @blob.name
21
21
  end
22
+ alias filename name
22
23
 
23
24
  # Public: The raw contents of the page.
24
25
  #
@@ -28,7 +29,7 @@ module Gollum
28
29
  end
29
30
 
30
31
  # Public: The Grit::Commit version of the file.
31
- attr_reader :version
32
+ attr_accessor :version
32
33
 
33
34
  # Public: The String path of the file.
34
35
  attr_reader :path
@@ -38,6 +39,18 @@ module Gollum
38
39
  @blob.mime_type
39
40
  end
40
41
 
42
+ # Populate the File with information from the Blob.
43
+ #
44
+ # blob - The Grit::Blob that contains the info.
45
+ # path - The String directory path of the file.
46
+ #
47
+ # Returns the populated Gollum::File.
48
+ def populate(blob, path=nil)
49
+ @blob = blob
50
+ @path = "#{path}/#{blob.name}"[1..-1]
51
+ self
52
+ end
53
+
41
54
  #########################################################################
42
55
  #
43
56
  # Internal Methods
@@ -61,4 +74,4 @@ module Gollum
61
74
  end
62
75
  end
63
76
  end
64
- end
77
+ end
@@ -0,0 +1,145 @@
1
+ module Gollum
2
+ =begin
3
+ FileView requires that:
4
+ - All files in root dir are processed first
5
+ - Then all the folders are sorted and processed
6
+ =end
7
+ class FileView
8
+ def initialize pages
9
+ @pages = pages
10
+ end
11
+
12
+ def enclose_tree string
13
+ %Q(<ol class="tree">\n) + string + %Q(</ol>)
14
+ end
15
+
16
+ def new_page page
17
+ name = page.name
18
+ url = url_for_page page
19
+ %Q( <li class="file"><a href="#{url}">#{name}</a></li>\n)
20
+ end
21
+
22
+ def new_folder folder_path
23
+ new_sub_folder folder_path
24
+ end
25
+
26
+ def new_sub_folder path
27
+ <<-HTML
28
+ <li>
29
+ <label>#{path}</label> <input type="checkbox" checked />
30
+ <ol>
31
+ HTML
32
+ end
33
+
34
+ def end_folder
35
+ <<-HTML
36
+ </ol>
37
+ </li>
38
+ HTML
39
+ end
40
+
41
+ def url_for_page page
42
+ url = ::File.join(::File.dirname(page.path), page.filename_stripped)
43
+ url = url[2..-1] if url[0,2] == './'
44
+ url
45
+ end
46
+
47
+ def render_files
48
+ html = ''
49
+ count = @pages.size
50
+ folder_start = -1
51
+
52
+ # Process all pages until folders start
53
+ count.times do | index |
54
+ page = @pages[ index ]
55
+ path = page.path
56
+
57
+ unless path.include? '/'
58
+ # Page processed (not contained in a folder)
59
+ html += new_page page
60
+ else
61
+ # Folders start at the next index
62
+ folder_start = index
63
+ break # Pages finished, move on to folders
64
+ end
65
+ end
66
+
67
+ # If there are no folders, then we're done.
68
+ return enclose_tree(html) if folder_start <= -1
69
+
70
+ # Handle special case of only one folder.
71
+ if (count - folder_start == 1)
72
+ page = @pages[ folder_start ]
73
+ name = page.name
74
+ url = url_for_page page
75
+ html += <<-HTML
76
+ <li>
77
+ <label>#{::File.dirname(page.path)}</label> <input type="checkbox" checked />
78
+ <ol>
79
+ <li class="file"><a href="#{url}">#{name}</a></li>
80
+ </ol>
81
+ </li>
82
+ HTML
83
+
84
+ return enclose_tree html
85
+ end
86
+
87
+ sorted_folders = []
88
+ (folder_start).upto count - 1 do | index |
89
+ sorted_folders += [[ @pages[ index ].path, index ]]
90
+ end
91
+
92
+ # http://stackoverflow.com/questions/3482814/sorting-list-of-string-paths-in-vb-net
93
+ sorted_folders.sort! do |first,second|
94
+ a = first[0]
95
+ b = second[0]
96
+
97
+ # use :: operator because gollum defines its own conflicting File class
98
+ dir_compare = ::File.dirname(a) <=> ::File.dirname(b)
99
+
100
+ # Sort based on directory name unless they're equal (0) in
101
+ # which case sort based on file name.
102
+ if dir_compare == 0
103
+ ::File.basename(a) <=> ::File.basename(b)
104
+ else
105
+ dir_compare
106
+ end
107
+ end
108
+
109
+ # keep track of folder depth, 0 = at root.
110
+ cwd_array = []
111
+ changed = false
112
+
113
+ # process rest of folders
114
+ (0...sorted_folders.size).each do | index |
115
+ page = @pages[ sorted_folders[ index ][ 1 ] ]
116
+ path = page.path
117
+ folder = ::File.dirname path
118
+
119
+ tmp_array = folder.split '/'
120
+
121
+ (0...tmp_array.size).each do | index |
122
+ if cwd_array[ index ].nil? || changed
123
+ html += new_sub_folder tmp_array[ index ]
124
+ next
125
+ end
126
+
127
+ if cwd_array[ index ] != tmp_array[ index ]
128
+ changed = true
129
+ (cwd_array.size - index).times do
130
+ html += end_folder
131
+ end
132
+ html += new_sub_folder tmp_array[ index ]
133
+ end
134
+ end
135
+
136
+ html += new_page page
137
+ cwd_array = tmp_array
138
+ changed = false
139
+ end
140
+
141
+ # return the completed html
142
+ enclose_tree html
143
+ end # end render_files
144
+ end # end FileView class
145
+ end # end Gollum module
@@ -2,16 +2,59 @@ require 'cgi'
2
2
  require 'sinatra'
3
3
  require 'gollum'
4
4
  require 'mustache/sinatra'
5
+ require 'useragent'
6
+ require 'stringex'
5
7
 
6
8
  require 'gollum/frontend/views/layout'
7
9
  require 'gollum/frontend/views/editable'
10
+ require 'gollum/frontend/views/has_page'
11
+
12
+ require File.expand_path '../uri_encode_component', __FILE__
13
+ require File.expand_path '../helpers', __FILE__
14
+
15
+ # Fix to_url
16
+ class String
17
+ alias :upstream_to_url :to_url
18
+ # _Header => header which causes errors
19
+ def to_url
20
+ return nil if self.nil?
21
+ return self if ['_Header', '_Footer', '_Sidebar'].include? self
22
+ upstream_to_url
23
+ end
24
+ end
8
25
 
26
+ # Run the frontend, based on Sinatra
27
+ #
28
+ # There are a number of wiki options that can be set for the frontend
29
+ #
30
+ # Example
31
+ # require 'gollum/frontend/app'
32
+ # Precious::App.set(:wiki_options, {
33
+ # :universal_toc => false,
34
+ # }
35
+ #
36
+ # See the wiki.rb file for more details on wiki options
9
37
  module Precious
10
38
  class App < Sinatra::Base
11
39
  register Mustache::Sinatra
40
+ include Precious::Helpers
12
41
 
13
42
  dir = File.dirname(File.expand_path(__FILE__))
14
43
 
44
+ # Detect unsupported browsers.
45
+ Browser = Struct.new(:browser, :version)
46
+
47
+ @@min_ua = [
48
+ Browser.new('Internet Explorer', '10.0'),
49
+ Browser.new('Chrome', '7.0'),
50
+ Browser.new('Firefox', '4.0'),
51
+ ]
52
+
53
+ def supported_useragent?(user_agent)
54
+ ua = UserAgent.parse(user_agent)
55
+ @@min_ua.detect {|min| ua >= min }
56
+ end
57
+
15
58
  # We want to serve public assets for now
16
59
  set :public_folder, "#{dir}/public/gollum"
17
60
  set :static, true
@@ -38,48 +81,119 @@ module Precious
38
81
  enable :logging, :raise_errors, :dump_errors
39
82
  end
40
83
 
84
+ before do
85
+ @base_url = settings.wiki_options.has_key?(:base_url) ? settings.wiki_options[:base_url] : url('/')
86
+ settings.wiki_options.merge!({ :base_path => @base_url }) unless settings.wiki_options.has_key? :base_path
87
+ end
88
+
41
89
  get '/' do
42
90
  show_page_or_file('Home')
43
91
  end
44
92
 
93
+ # name, path, version
94
+ def wiki_page( name, path = nil, version = nil)
95
+ path = name if path.nil?
96
+
97
+ name = extract_name(name)
98
+ path = extract_path(path)
99
+ wiki = wiki_new
100
+
101
+ OpenStruct.new(:wiki => wiki, :page => wiki.paged(name, path, version),
102
+ :name => name, :path => path)
103
+ end
104
+
105
+ def wiki_new
106
+ Gollum::Wiki.new(settings.gollum_path, settings.wiki_options)
107
+ end
108
+
109
+ get '/data/*' do
110
+ if page = wiki_page(params[:splat].first).page
111
+ page.raw_data
112
+ end
113
+ end
114
+
45
115
  get '/edit/*' do
46
- @name = params[:splat].first
47
- wiki = Gollum::Wiki.new(settings.gollum_path, settings.wiki_options)
48
- if page = wiki.page(@name)
49
- @page = page
50
- @page.version = wiki.repo.log(wiki.ref, @page.path).first
51
- @content = page.raw_data
52
- mustache :edit
116
+ wikip = wiki_page(params[:splat].first)
117
+ @name = wikip.name
118
+ @path = wikip.path
119
+ wiki = wikip.wiki
120
+ if page = wikip.page
121
+ if wiki.live_preview && page.format.to_s.include?('markdown') && supported_useragent?(request.user_agent)
122
+ live_preview_url = '/livepreview/index.html?page=' + encodeURIComponent(@name)
123
+ if @path
124
+ live_preview_url << '&path=' + encodeURIComponent(@path)
125
+ end
126
+ redirect to(live_preview_url)
127
+ else
128
+ @page = page
129
+ @page.version = wiki.repo.log(wiki.ref, @page.path).first
130
+ raw_data = page.raw_data
131
+ @content = raw_data.respond_to?(:force_encoding) ? raw_data.force_encoding('UTF-8') : raw_data
132
+ mustache :edit
133
+ end
53
134
  else
54
- mustache :create
135
+ redirect to("/create/#{CGI.escape(@name)}")
55
136
  end
56
137
  end
57
138
 
58
139
  post '/edit/*' do
59
- wiki = Gollum::Wiki.new(settings.gollum_path, settings.wiki_options)
60
- page = wiki.page(params[:splat].first)
61
- name = params[:rename] || page.name
62
- committer = Gollum::Committer.new(wiki, commit_message)
63
- commit = {:committer => committer}
64
-
65
- update_wiki_page(wiki, page, params[:content], commit, name,
66
- params[:format])
140
+ wikip = wiki_page(CGI.unescape(params[:page]), sanitize_empty_params(params[:path]))
141
+ path = wikip.path
142
+ wiki = wikip.wiki
143
+ page = wikip.page
144
+ rename = params[:rename].to_url if params[:rename]
145
+ name = rename || page.name
146
+ committer = Gollum::Committer.new(wiki, commit_message)
147
+ commit = {:committer => committer}
148
+
149
+ update_wiki_page(wiki, page, params[:content], commit, name, params[:format])
150
+ update_wiki_page(wiki, page.header, params[:header], commit) if params[:header]
67
151
  update_wiki_page(wiki, page.footer, params[:footer], commit) if params[:footer]
68
152
  update_wiki_page(wiki, page.sidebar, params[:sidebar], commit) if params[:sidebar]
69
153
  committer.commit
70
154
 
71
- redirect "/#{CGI.escape(Gollum::Page.cname(name))}"
155
+ page = wiki.page(rename) if rename
156
+
157
+ redirect to("/#{page.escaped_url_path}") unless page.nil?
158
+ end
159
+
160
+ get '/delete/*' do
161
+ wikip = wiki_page(params[:splat].first)
162
+ name = wikip.name
163
+ wiki = wikip.wiki
164
+ page = wikip.page
165
+ wiki.delete_page(page, { :message => "Destroyed #{name} (#{page.format})" })
166
+
167
+ redirect to('/')
168
+ end
169
+
170
+ get '/create/*' do
171
+ splat = params[:splat].first
172
+ wikip = wiki_page(extract_name(splat).to_url, splat)
173
+ @name = wikip.name
174
+ @path = wikip.path
175
+
176
+ page = wikip.page
177
+ if page
178
+ redirect to("/#{page.escaped_url_path}")
179
+ else
180
+ mustache :create
181
+ end
72
182
  end
73
183
 
74
184
  post '/create' do
75
- name = params[:page]
76
- wiki = Gollum::Wiki.new(settings.gollum_path, settings.wiki_options)
185
+ name = params[:page].to_url
186
+ path = sanitize_empty_params(params[:path])
187
+ format = params[:format].intern
77
188
 
78
- format = params[:format].intern
189
+ # write_page is not directory aware so use wiki_options to emulate dir support.
190
+ wiki_options = settings.wiki_options.merge({ :page_file_dir => path })
191
+ wiki = Gollum::Wiki.new(settings.gollum_path, wiki_options)
79
192
 
80
193
  begin
81
194
  wiki.write_page(name, format, params[:content], commit_message)
82
- redirect "/#{CGI.escape(Gollum::Page.cname(name))}"
195
+ page = wiki.page(name)
196
+ redirect to("/#{page.escaped_url_path}")
83
197
  rescue Gollum::DuplicatePageError => e
84
198
  @message = "Duplicate page: #{e.message}"
85
199
  mustache :error
@@ -87,62 +201,75 @@ module Precious
87
201
  end
88
202
 
89
203
  post '/revert/:page/*' do
90
- wiki = Gollum::Wiki.new(settings.gollum_path, settings.wiki_options)
91
- @name = params[:page]
92
- @page = wiki.page(@name)
93
- shas = params[:splat].first.split("/")
94
- sha1 = shas.shift
95
- sha2 = shas.shift
204
+ wikip = wiki_page(params[:page])
205
+ @path = wikip.path
206
+ @name = wikip.name
207
+ wiki = wikip.wiki
208
+ @page = wiki.paged(@name,@path)
209
+ shas = params[:splat].first.split("/")
210
+ sha1 = shas.shift
211
+ sha2 = shas.shift
96
212
 
97
213
  if wiki.revert_page(@page, sha1, sha2, commit_message)
98
- redirect "/#{CGI.escape(@name)}"
214
+ redirect to("/#{@page.escaped_url_path}")
99
215
  else
100
216
  sha2, sha1 = sha1, "#{sha1}^" if !sha2
101
- @versions = [sha1, sha2]
102
- diffs = wiki.repo.diff(@versions.first, @versions.last, @page.path)
103
- @diff = diffs.first
104
- @message = "The patch does not apply."
217
+ @versions = [sha1, sha2]
218
+ diffs = wiki.repo.diff(@versions.first, @versions.last, @page.path)
219
+ @diff = diffs.first
220
+ @message = "The patch does not apply."
105
221
  mustache :compare
106
222
  end
107
223
  end
108
224
 
109
225
  post '/preview' do
110
- wiki = Gollum::Wiki.new(settings.gollum_path, settings.wiki_options)
111
- @name = "Preview"
112
- @page = wiki.preview_page(@name, params[:content], params[:format])
113
- @content = @page.formatted_data
226
+ wiki = wiki_new
227
+ @name = params[:page] || "Preview"
228
+ @page = wiki.preview_page(@name, params[:content], params[:format])
229
+ @content = @page.formatted_data
230
+ @toc_content = wiki.universal_toc ? @page.toc_data : nil
231
+ @mathjax = wiki.mathjax
114
232
  @editable = false
115
233
  mustache :page
116
234
  end
117
235
 
118
- get '/history/:name' do
119
- @name = params[:name]
120
- wiki = Gollum::Wiki.new(settings.gollum_path, settings.wiki_options)
121
- @page = wiki.page(@name)
122
- @page_num = [params[:page].to_i, 1].max
123
- @versions = @page.versions :page => @page_num
236
+ get '/history/*' do
237
+ @page = wiki_page(params[:splat].first).page
238
+ @page_num = [params[:page].to_i, 1].max
239
+ @versions = @page.versions :page => @page_num
124
240
  mustache :history
125
241
  end
126
242
 
127
- post '/compare/:name' do
243
+ post '/compare/*' do
244
+ @file = params[:splat].first
128
245
  @versions = params[:versions] || []
129
246
  if @versions.size < 2
130
- redirect "/history/#{CGI.escape(params[:name])}"
247
+ redirect to("/history/#{@file}")
131
248
  else
132
- redirect "/compare/%s/%s...%s" % [
133
- CGI.escape(params[:name]),
249
+ redirect to("/compare/%s/%s...%s" % [
250
+ @file,
134
251
  @versions.last,
135
252
  @versions.first]
253
+ )
136
254
  end
137
255
  end
138
256
 
139
- get '/compare/:name/:version_list' do
140
- @name = params[:name]
141
- @versions = params[:version_list].split(/\.{2,3}/)
142
- wiki = Gollum::Wiki.new(settings.gollum_path, settings.wiki_options)
143
- @page = wiki.page(@name)
144
- diffs = wiki.repo.diff(@versions.first, @versions.last, @page.path)
145
- @diff = diffs.first
257
+ get %r{
258
+ /compare/ # match any URL beginning with /compare/
259
+ (.+) # extract the full path (including any directories)
260
+ / # match the final slash
261
+ ([^.]+) # match the first SHA1
262
+ \.{2,3} # match .. or ...
263
+ (.+) # match the second SHA1
264
+ }x do |path, start_version, end_version|
265
+ wikip = wiki_page(path)
266
+ @path = wikip.path
267
+ @name = wikip.name
268
+ @versions = [start_version, end_version]
269
+ wiki = wikip.wiki
270
+ @page = wikip.page
271
+ diffs = wiki.repo.diff(@versions.first, @versions.last, @page.path)
272
+ @diff = diffs.first
146
273
  mustache :compare
147
274
  end
148
275
 
@@ -157,9 +284,11 @@ module Precious
157
284
  end
158
285
 
159
286
  get %r{/(.+?)/([0-9a-f]{40})} do
160
- name = params[:captures][0]
161
- wiki = Gollum::Wiki.new(settings.gollum_path, settings.wiki_options)
162
- if page = wiki.page(name, params[:captures][1])
287
+ file_path = params[:captures][0]
288
+ name = extract_name(file_path)
289
+ path = extract_path(file_path)
290
+ version = params[:captures][1]
291
+ if page = wiki_page(name, path, version).page
163
292
  @page = page
164
293
  @name = name
165
294
  @content = page.formatted_data
@@ -172,47 +301,66 @@ module Precious
172
301
 
173
302
  get '/search' do
174
303
  @query = params[:q]
175
- wiki = Gollum::Wiki.new(settings.gollum_path, settings.wiki_options)
304
+ wiki = wiki_new
176
305
  @results = wiki.search @query
177
306
  @name = @query
178
307
  mustache :search
179
308
  end
180
309
 
181
- get '/pages' do
310
+ get %r{
311
+ /pages # match any URL beginning with /pages
312
+ (?: # begin an optional non-capturing group
313
+ /(.+) # capture any path after the "/pages" excluding the leading slash
314
+ )? # end the optional non-capturing group
315
+ }x do |path|
316
+ @path = extract_path(path) if path
317
+ wiki_options = settings.wiki_options.merge({ :page_file_dir => @path })
318
+ wiki = Gollum::Wiki.new(settings.gollum_path, wiki_options)
319
+ @results = wiki.pages
320
+ @ref = wiki.ref
321
+ mustache :pages
322
+ end
323
+
324
+ get '/fileview' do
182
325
  wiki = Gollum::Wiki.new(settings.gollum_path, settings.wiki_options)
183
- @results = wiki.pages
326
+ @results = Gollum::FileView.new(wiki.pages).render_files
184
327
  @ref = wiki.ref
185
- mustache :pages
328
+ mustache :file_view, { :layout => false }
186
329
  end
187
330
 
188
331
  get '/*' do
189
332
  show_page_or_file(params[:splat].first)
190
333
  end
191
334
 
192
- def show_page_or_file(name)
193
- wiki = Gollum::Wiki.new(settings.gollum_path, settings.wiki_options)
194
- if page = wiki.page(name)
335
+ def show_page_or_file(fullpath)
336
+ name = extract_name(fullpath)
337
+ path = extract_path(fullpath)
338
+ wiki = wiki_new
339
+
340
+ if page = wiki.paged(name, path)
195
341
  @page = page
196
342
  @name = name
197
- @content = page.formatted_data
198
343
  @editable = true
344
+ @content = page.formatted_data
345
+ @toc_content = wiki.universal_toc ? @page.toc_data : nil
346
+ @mathjax = wiki.mathjax
199
347
  mustache :page
200
- elsif file = wiki.file(name)
348
+ elsif file = wiki.file(fullpath)
201
349
  content_type file.mime_type
202
350
  file.raw_data
203
351
  else
204
- @name = name
205
- mustache :create
352
+ page_path = [path, name].compact.join('/')
353
+ redirect to("/create/#{CGI.escape(page_path).gsub('%2F','/')}")
206
354
  end
207
355
  end
208
356
 
209
- def update_wiki_page(wiki, page, content, commit_message, name = nil, format = nil)
357
+ def update_wiki_page(wiki, page, content, commit, name = nil, format = nil)
210
358
  return if !page ||
211
359
  ((!content || page.raw_data == content) && page.format == format)
212
360
  name ||= page.name
213
361
  format = (format || page.format).to_sym
214
362
  content ||= page.raw_data
215
- wiki.update_page(page, name, format, content.to_s, commit_message)
363
+ wiki.update_page(page, name, format, content.to_s, commit)
216
364
  end
217
365
 
218
366
  def commit_message