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
@@ -0,0 +1,278 @@
1
+ /* ***** BEGIN LICENSE BLOCK *****
2
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
3
+ *
4
+ * The contents of this file are subject to the Mozilla Public License Version
5
+ * 1.1 (the "License"); you may not use this file except in compliance with
6
+ * the License. You may obtain a copy of the License at
7
+ * http://www.mozilla.org/MPL/
8
+ *
9
+ * Software distributed under the License is distributed on an "AS IS" basis,
10
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11
+ * for the specific language governing rights and limitations under the
12
+ * License.
13
+ *
14
+ * The Original Code is Ajax.org Code Editor (ACE).
15
+ *
16
+ * The Initial Developer of the Original Code is
17
+ * Ajax.org B.V.
18
+ * Portions created by the Initial Developer are Copyright (C) 2010
19
+ * the Initial Developer. All Rights Reserved.
20
+ *
21
+ * Contributor(s):
22
+ * Zef Hemel <zef@c9.io>
23
+ *
24
+ * Alternatively, the contents of this file may be used under the terms of
25
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
26
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27
+ * in which case the provisions of the GPL or the LGPL are applicable instead
28
+ * of those above. If you wish to allow use of your version of this file only
29
+ * under the terms of either the GPL or the LGPL, and not to allow others to
30
+ * use your version of this file under the terms of the MPL, indicate your
31
+ * decision by deleting the provisions above and replace them with the notice
32
+ * and other provisions required by the GPL or the LGPL. If you do not delete
33
+ * the provisions above, a recipient may use your version of this file under
34
+ * the terms of any one of the MPL, the GPL or the LGPL.
35
+ *
36
+ * ***** END LICENSE BLOCK ***** */
37
+ define(function(require, exports, module) {
38
+ "use strict";
39
+
40
+ var Range = require('./range').Range;
41
+ var EventEmitter = require("./lib/event_emitter").EventEmitter;
42
+ var oop = require("./lib/oop");
43
+
44
+ /**
45
+ * class PlaceHolder
46
+ *
47
+ * TODO
48
+ *
49
+ **/
50
+
51
+ /**
52
+ * new PlaceHolder(session, length, pos, others, mainClass, othersClass)
53
+ * - session (Document): The document to associate with the anchor
54
+ * - length (Number): The starting row position
55
+ * - pos (Number): The starting column position
56
+ * - others (String):
57
+ * - mainClass (String):
58
+ * - othersClass (String):
59
+ *
60
+ * TODO
61
+ *
62
+ **/
63
+
64
+ var PlaceHolder = function(session, length, pos, others, mainClass, othersClass) {
65
+ var _self = this;
66
+ this.length = length;
67
+ this.session = session;
68
+ this.doc = session.getDocument();
69
+ this.mainClass = mainClass;
70
+ this.othersClass = othersClass;
71
+ this.$onUpdate = this.onUpdate.bind(this);
72
+ this.doc.on("change", this.$onUpdate);
73
+ this.$others = others;
74
+
75
+ this.$onCursorChange = function() {
76
+ setTimeout(function() {
77
+ _self.onCursorChange();
78
+ });
79
+ };
80
+
81
+ this.$pos = pos;
82
+ // Used for reset
83
+ var undoStack = session.getUndoManager().$undoStack || session.getUndoManager().$undostack || {length: -1};
84
+ this.$undoStackDepth = undoStack.length;
85
+ this.setup();
86
+
87
+ session.selection.on("changeCursor", this.$onCursorChange);
88
+ };
89
+
90
+ (function() {
91
+
92
+ oop.implement(this, EventEmitter);
93
+
94
+ /**
95
+ * PlaceHolder.setup()
96
+ *
97
+ * TODO
98
+ *
99
+ **/
100
+ this.setup = function() {
101
+ var _self = this;
102
+ var doc = this.doc;
103
+ var session = this.session;
104
+ var pos = this.$pos;
105
+
106
+ this.pos = doc.createAnchor(pos.row, pos.column);
107
+ this.markerId = session.addMarker(new Range(pos.row, pos.column, pos.row, pos.column + this.length), this.mainClass, null, false);
108
+ this.pos.on("change", function(event) {
109
+ session.removeMarker(_self.markerId);
110
+ _self.markerId = session.addMarker(new Range(event.value.row, event.value.column, event.value.row, event.value.column+_self.length), _self.mainClass, null, false);
111
+ });
112
+ this.others = [];
113
+ this.$others.forEach(function(other) {
114
+ var anchor = doc.createAnchor(other.row, other.column);
115
+ _self.others.push(anchor);
116
+ });
117
+ session.setUndoSelect(false);
118
+ };
119
+
120
+ /**
121
+ * PlaceHolder.showOtherMarkers()
122
+ *
123
+ * TODO
124
+ *
125
+ **/
126
+ this.showOtherMarkers = function() {
127
+ if(this.othersActive) return;
128
+ var session = this.session;
129
+ var _self = this;
130
+ this.othersActive = true;
131
+ this.others.forEach(function(anchor) {
132
+ anchor.markerId = session.addMarker(new Range(anchor.row, anchor.column, anchor.row, anchor.column+_self.length), _self.othersClass, null, false);
133
+ anchor.on("change", function(event) {
134
+ session.removeMarker(anchor.markerId);
135
+ anchor.markerId = session.addMarker(new Range(event.value.row, event.value.column, event.value.row, event.value.column+_self.length), _self.othersClass, null, false);
136
+ });
137
+ });
138
+ };
139
+
140
+ /**
141
+ * PlaceHolder.hideOtherMarkers()
142
+ *
143
+ * Hides all over markers in the [[EditSession `EditSession`]] that are not the currently selected one.
144
+ *
145
+ **/
146
+ this.hideOtherMarkers = function() {
147
+ if(!this.othersActive) return;
148
+ this.othersActive = false;
149
+ for (var i = 0; i < this.others.length; i++) {
150
+ this.session.removeMarker(this.others[i].markerId);
151
+ }
152
+ };
153
+
154
+ /**
155
+ * PlaceHolder@onUpdate(e)
156
+ *
157
+ * Emitted when the place holder updates.
158
+ *
159
+ **/
160
+ this.onUpdate = function(event) {
161
+ var delta = event.data;
162
+ var range = delta.range;
163
+ if(range.start.row !== range.end.row) return;
164
+ if(range.start.row !== this.pos.row) return;
165
+ if (this.$updating) return;
166
+ this.$updating = true;
167
+ var lengthDiff = delta.action === "insertText" ? range.end.column - range.start.column : range.start.column - range.end.column;
168
+
169
+ if(range.start.column >= this.pos.column && range.start.column <= this.pos.column + this.length + 1) {
170
+ var distanceFromStart = range.start.column - this.pos.column;
171
+ this.length += lengthDiff;
172
+ if(!this.session.$fromUndo) {
173
+ if(delta.action === "insertText") {
174
+ for (var i = this.others.length - 1; i >= 0; i--) {
175
+ var otherPos = this.others[i];
176
+ var newPos = {row: otherPos.row, column: otherPos.column + distanceFromStart};
177
+ if(otherPos.row === range.start.row && range.start.column < otherPos.column)
178
+ newPos.column += lengthDiff;
179
+ this.doc.insert(newPos, delta.text);
180
+ }
181
+ } else if(delta.action === "removeText") {
182
+ for (var i = this.others.length - 1; i >= 0; i--) {
183
+ var otherPos = this.others[i];
184
+ var newPos = {row: otherPos.row, column: otherPos.column + distanceFromStart};
185
+ if(otherPos.row === range.start.row && range.start.column < otherPos.column)
186
+ newPos.column += lengthDiff;
187
+ this.doc.remove(new Range(newPos.row, newPos.column, newPos.row, newPos.column - lengthDiff));
188
+ }
189
+ }
190
+ // Special case: insert in beginning
191
+ if(range.start.column === this.pos.column && delta.action === "insertText") {
192
+ setTimeout(function() {
193
+ this.pos.setPosition(this.pos.row, this.pos.column - lengthDiff);
194
+ for (var i = 0; i < this.others.length; i++) {
195
+ var other = this.others[i];
196
+ var newPos = {row: other.row, column: other.column - lengthDiff};
197
+ if(other.row === range.start.row && range.start.column < other.column)
198
+ newPos.column += lengthDiff;
199
+ other.setPosition(newPos.row, newPos.column);
200
+ }
201
+ }.bind(this), 0);
202
+ }
203
+ else if(range.start.column === this.pos.column && delta.action === "removeText") {
204
+ setTimeout(function() {
205
+ for (var i = 0; i < this.others.length; i++) {
206
+ var other = this.others[i];
207
+ if(other.row === range.start.row && range.start.column < other.column) {
208
+ other.setPosition(other.row, other.column - lengthDiff);
209
+ }
210
+ }
211
+ }.bind(this), 0);
212
+ }
213
+ }
214
+ this.pos._emit("change", {value: this.pos});
215
+ for (var i = 0; i < this.others.length; i++) {
216
+ this.others[i]._emit("change", {value: this.others[i]});
217
+ }
218
+ }
219
+ this.$updating = false;
220
+ };
221
+
222
+ /**
223
+ * PlaceHolder@onCursorChange(e)
224
+ *
225
+ * Emitted when the cursor changes.
226
+ *
227
+ **/
228
+
229
+ this.onCursorChange = function(event) {
230
+ if (this.$updating) return;
231
+ var pos = this.session.selection.getCursor();
232
+ if(pos.row === this.pos.row && pos.column >= this.pos.column && pos.column <= this.pos.column + this.length) {
233
+ this.showOtherMarkers();
234
+ this._emit("cursorEnter", event);
235
+ } else {
236
+ this.hideOtherMarkers();
237
+ this._emit("cursorLeave", event);
238
+ }
239
+ };
240
+
241
+ /**
242
+ * PlaceHolder.detach()
243
+ *
244
+ * TODO
245
+ *
246
+ **/
247
+ this.detach = function() {
248
+ this.session.removeMarker(this.markerId);
249
+ this.hideOtherMarkers();
250
+ this.doc.removeEventListener("change", this.$onUpdate);
251
+ this.session.selection.removeEventListener("changeCursor", this.$onCursorChange);
252
+ this.pos.detach();
253
+ for (var i = 0; i < this.others.length; i++) {
254
+ this.others[i].detach();
255
+ }
256
+ this.session.setUndoSelect(true);
257
+ };
258
+
259
+ /**
260
+ * PlaceHolder.cancel()
261
+ *
262
+ * TODO
263
+ *
264
+ **/
265
+ this.cancel = function() {
266
+ if(this.$undoStackDepth === -1)
267
+ throw Error("Canceling placeholders only supported with undo manager attached to session.");
268
+ var undoManager = this.session.getUndoManager();
269
+ var undosRequired = (undoManager.$undoStack || undoManager.$undostack).length - this.$undoStackDepth;
270
+ for (var i = 0; i < undosRequired; i++) {
271
+ undoManager.undo(true);
272
+ }
273
+ };
274
+ }).call(PlaceHolder.prototype);
275
+
276
+
277
+ exports.PlaceHolder = PlaceHolder;
278
+ });
@@ -0,0 +1,164 @@
1
+ /* ***** BEGIN LICENSE BLOCK *****
2
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
3
+ *
4
+ * The contents of this file are subject to the Mozilla Public License Version
5
+ * 1.1 (the "License"); you may not use this file except in compliance with
6
+ * the License. You may obtain a copy of the License at
7
+ * http://www.mozilla.org/MPL/
8
+ *
9
+ * Software distributed under the License is distributed on an "AS IS" basis,
10
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11
+ * for the specific language governing rights and limitations under the
12
+ * License.
13
+ *
14
+ * The Original Code is Ajax.org Code Editor (ACE).
15
+ *
16
+ * The Initial Developer of the Original Code is
17
+ * Ajax.org B.V.
18
+ * Portions created by the Initial Developer are Copyright (C) 2010
19
+ * the Initial Developer. All Rights Reserved.
20
+ *
21
+ * Contributor(s):
22
+ * Fabian Jakobs <fabian AT ajax DOT org>
23
+ * Julian Viereck <julian DOT viereck AT gmail DOT com>
24
+ *
25
+ * Alternatively, the contents of this file may be used under the terms of
26
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
27
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28
+ * in which case the provisions of the GPL or the LGPL are applicable instead
29
+ * of those above. If you wish to allow use of your version of this file only
30
+ * under the terms of either the GPL or the LGPL, and not to allow others to
31
+ * use your version of this file under the terms of the MPL, indicate your
32
+ * decision by deleting the provisions above and replace them with the notice
33
+ * and other provisions required by the GPL or the LGPL. If you do not delete
34
+ * the provisions above, a recipient may use your version of this file under
35
+ * the terms of any one of the MPL, the GPL or the LGPL.
36
+ *
37
+ * ***** END LICENSE BLOCK ***** */
38
+
39
+ if (typeof process !== "undefined") {
40
+ require("amd-loader");
41
+ require("./test/mockdom");
42
+ }
43
+
44
+ define(function(require, exports, module) {
45
+ "use strict";
46
+
47
+ var EditSession = require("./edit_session").EditSession;
48
+ var Editor = require("./editor").Editor;
49
+ var MockRenderer = require("./test/mockrenderer").MockRenderer;
50
+ var assert = require("./test/assertions");
51
+ var JavaScriptMode = require("./mode/javascript").Mode;
52
+ var PlaceHolder = require('./placeholder').PlaceHolder;
53
+ var UndoManager = require('./undomanager').UndoManager;
54
+
55
+ module.exports = {
56
+
57
+ "test: simple at the end appending of text" : function() {
58
+ var session = new EditSession("var a = 10;\nconsole.log(a, a);", new JavaScriptMode());
59
+ var editor = new Editor(new MockRenderer(), session);
60
+
61
+ new PlaceHolder(session, 1, {row: 0, column: 4}, [{row: 1, column: 12}, {row: 1, column: 15}]);
62
+
63
+ editor.moveCursorTo(0, 5);
64
+ editor.insert('b');
65
+ assert.equal(session.doc.getValue(), "var ab = 10;\nconsole.log(ab, ab);");
66
+ editor.insert('cd');
67
+ assert.equal(session.doc.getValue(), "var abcd = 10;\nconsole.log(abcd, abcd);");
68
+ editor.remove('left');
69
+ editor.remove('left');
70
+ editor.remove('left');
71
+ assert.equal(session.doc.getValue(), "var a = 10;\nconsole.log(a, a);");
72
+ },
73
+
74
+ "test: inserting text outside placeholder" : function() {
75
+ var session = new EditSession("var a = 10;\nconsole.log(a, a);\n", new JavaScriptMode());
76
+ var editor = new Editor(new MockRenderer(), session);
77
+
78
+ new PlaceHolder(session, 1, {row: 0, column: 4}, [{row: 1, column: 12}, {row: 1, column: 15}]);
79
+
80
+ editor.moveCursorTo(2, 0);
81
+ editor.insert('b');
82
+ assert.equal(session.doc.getValue(), "var a = 10;\nconsole.log(a, a);\nb");
83
+ },
84
+
85
+ "test: insertion at the beginning" : function(next) {
86
+ var session = new EditSession("var a = 10;\nconsole.log(a, a);", new JavaScriptMode());
87
+ var editor = new Editor(new MockRenderer(), session);
88
+
89
+ var p = new PlaceHolder(session, 1, {row: 0, column: 4}, [{row: 1, column: 12}, {row: 1, column: 15}]);
90
+
91
+ editor.moveCursorTo(0, 4);
92
+ editor.insert('$');
93
+ assert.equal(session.doc.getValue(), "var $a = 10;\nconsole.log($a, $a);");
94
+ editor.moveCursorTo(0, 4);
95
+ // Have to put this in a setTimeout because the anchor is only fixed later.
96
+ setTimeout(function() {
97
+ editor.insert('v');
98
+ assert.equal(session.doc.getValue(), "var v$a = 10;\nconsole.log(v$a, v$a);");
99
+ next();
100
+ }, 10);
101
+ },
102
+
103
+ "test: detaching placeholder" : function() {
104
+ var session = new EditSession("var a = 10;\nconsole.log(a, a);", new JavaScriptMode());
105
+ var editor = new Editor(new MockRenderer(), session);
106
+
107
+ var p = new PlaceHolder(session, 1, {row: 0, column: 4}, [{row: 1, column: 12}, {row: 1, column: 15}]);
108
+
109
+ editor.moveCursorTo(0, 5);
110
+ editor.insert('b');
111
+ assert.equal(session.doc.getValue(), "var ab = 10;\nconsole.log(ab, ab);");
112
+ p.detach();
113
+ editor.insert('cd');
114
+ assert.equal(session.doc.getValue(), "var abcd = 10;\nconsole.log(ab, ab);");
115
+ },
116
+
117
+ "test: events" : function() {
118
+ var session = new EditSession("var a = 10;\nconsole.log(a, a);", new JavaScriptMode());
119
+ var editor = new Editor(new MockRenderer(), session);
120
+
121
+ var p = new PlaceHolder(session, 1, {row: 0, column: 4}, [{row: 1, column: 12}, {row: 1, column: 15}]);
122
+ var entered = false;
123
+ var left = false;
124
+ p.on("cursorEnter", function() {
125
+ entered = true;
126
+ });
127
+ p.on("cursorLeave", function() {
128
+ left = true;
129
+ });
130
+
131
+ editor.moveCursorTo(0, 0);
132
+ editor.moveCursorTo(0, 4);
133
+ p.onCursorChange(); // Have to do this by hand because moveCursorTo doesn't trigger the event
134
+ assert.ok(entered);
135
+ editor.moveCursorTo(1, 0);
136
+ p.onCursorChange(); // Have to do this by hand because moveCursorTo doesn't trigger the event
137
+ assert.ok(left);
138
+ },
139
+
140
+ "test: cancel": function(next) {
141
+ var session = new EditSession("var a = 10;\nconsole.log(a, a);", new JavaScriptMode());
142
+ session.setUndoManager(new UndoManager());
143
+ var editor = new Editor(new MockRenderer(), session);
144
+ var p = new PlaceHolder(session, 1, {row: 0, column: 4}, [{row: 1, column: 12}, {row: 1, column: 15}]);
145
+
146
+ editor.moveCursorTo(0, 5);
147
+ editor.insert('b');
148
+ editor.insert('cd');
149
+ editor.remove('left');
150
+ assert.equal(session.doc.getValue(), "var abc = 10;\nconsole.log(abc, abc);");
151
+ // Wait a little for the changes to enter the undo stack
152
+ setTimeout(function() {
153
+ p.cancel();
154
+ assert.equal(session.doc.getValue(), "var a = 10;\nconsole.log(a, a);");
155
+ next();
156
+ }, 80);
157
+ }
158
+ };
159
+
160
+ });
161
+
162
+ if (typeof module !== "undefined" && module === require.main) {
163
+ require("asyncjs").test.testcase(module.exports).exec()
164
+ }
@@ -0,0 +1,581 @@
1
+ /* ***** BEGIN LICENSE BLOCK *****
2
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
3
+ *
4
+ * The contents of this file are subject to the Mozilla Public License Version
5
+ * 1.1 (the "License"); you may not use this file except in compliance with
6
+ * the License. You may obtain a copy of the License at
7
+ * http://www.mozilla.org/MPL/
8
+ *
9
+ * Software distributed under the License is distributed on an "AS IS" basis,
10
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11
+ * for the specific language governing rights and limitations under the
12
+ * License.
13
+ *
14
+ * The Original Code is Ajax.org Code Editor (ACE).
15
+ *
16
+ * The Initial Developer of the Original Code is
17
+ * Ajax.org B.V.
18
+ * Portions created by the Initial Developer are Copyright (C) 2010
19
+ * the Initial Developer. All Rights Reserved.
20
+ *
21
+ * Contributor(s):
22
+ * Fabian Jakobs <fabian AT ajax DOT org>
23
+ *
24
+ * Alternatively, the contents of this file may be used under the terms of
25
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
26
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27
+ * in which case the provisions of the GPL or the LGPL are applicable instead
28
+ * of those above. If you wish to allow use of your version of this file only
29
+ * under the terms of either the GPL or the LGPL, and not to allow others to
30
+ * use your version of this file under the terms of the MPL, indicate your
31
+ * decision by deleting the provisions above and replace them with the notice
32
+ * and other provisions required by the GPL or the LGPL. If you do not delete
33
+ * the provisions above, a recipient may use your version of this file under
34
+ * the terms of any one of the MPL, the GPL or the LGPL.
35
+ *
36
+ * ***** END LICENSE BLOCK ***** */
37
+
38
+ define(function(require, exports, module) {
39
+ "use strict";
40
+
41
+ /**
42
+ * class Range
43
+ *
44
+ * This object is used in various places to indicate a region within the editor. To better visualize how this works, imagine a rectangle. Each quadrant of the rectangle is analogus to a range, as ranges contain a starting row and starting column, and an ending row, and ending column.
45
+ *
46
+ **/
47
+
48
+ /**
49
+ * new Range(startRow, startColumn, endRow, endColumn)
50
+ * - startRow (Number): The starting row
51
+ * - startColumn (Number): The starting column
52
+ * - endRow (Number): The ending row
53
+ * - endColumn (Number): The ending column
54
+ *
55
+ * Creates a new `Range` object with the given starting and ending row and column points.
56
+ *
57
+ **/
58
+ var Range = function(startRow, startColumn, endRow, endColumn) {
59
+ this.start = {
60
+ row: startRow,
61
+ column: startColumn
62
+ };
63
+
64
+ this.end = {
65
+ row: endRow,
66
+ column: endColumn
67
+ };
68
+ };
69
+
70
+ (function() {
71
+ /**
72
+ * Range.isEqual(range) -> Boolean
73
+ * - range (Range): A range to check against
74
+ *
75
+ * Returns `true` if and only if the starting row and column, and ending tow and column, are equivalent to those given by `range`.
76
+ *
77
+ **/
78
+ this.isEqual = function(range) {
79
+ return this.start.row == range.start.row &&
80
+ this.end.row == range.end.row &&
81
+ this.start.column == range.start.column &&
82
+ this.end.column == range.end.column
83
+ };
84
+
85
+ /**
86
+ * Range.toString() -> String
87
+ *
88
+ * Returns a string containing the range's row and column information, given like this:
89
+ *
90
+ * [start.row/start.column] -> [end.row/end.column]
91
+ *
92
+ **/
93
+ this.toString = function() {
94
+ return ("Range: [" + this.start.row + "/" + this.start.column +
95
+ "] -> [" + this.end.row + "/" + this.end.column + "]");
96
+ };
97
+
98
+ /** related to: Range.compare
99
+ * Range.contains(row, column) -> Boolean
100
+ * - row (Number): A row to check for
101
+ * - column (Number): A column to check for
102
+ *
103
+ * Returns `true` if the `row` and `column` provided are within the given range. This can better be expressed as returning `true` if:
104
+ *
105
+ * this.start.row <= row <= this.end.row &&
106
+ * this.start.column <= column <= this.end.column
107
+ *
108
+ **/
109
+
110
+ this.contains = function(row, column) {
111
+ return this.compare(row, column) == 0;
112
+ };
113
+
114
+ /** related to: Range.compare
115
+ * Range.compareRange(range) -> Number
116
+ * - range (Range): A range to compare with
117
+ * + (Number): This method returns one of the following numbers:<br/>
118
+ * <br/>
119
+ * * `-2`: (B) is in front of (A), and doesn't intersect with (A)<br/>
120
+ * * `-1`: (B) begins before (A) but ends inside of (A)<br/>
121
+ * * `0`: (B) is completely inside of (A) OR (A) is completely inside of (B)<br/>
122
+ * * `+1`: (B) begins inside of (A) but ends outside of (A)<br/>
123
+ * * `+2`: (B) is after (A) and doesn't intersect with (A)<br/>
124
+ * * `42`: FTW state: (B) ends in (A) but starts outside of (A)
125
+ *
126
+ * Compares `this` range (A) with another range (B).
127
+ *
128
+ **/
129
+ this.compareRange = function(range) {
130
+ var cmp,
131
+ end = range.end,
132
+ start = range.start;
133
+
134
+ cmp = this.compare(end.row, end.column);
135
+ if (cmp == 1) {
136
+ cmp = this.compare(start.row, start.column);
137
+ if (cmp == 1) {
138
+ return 2;
139
+ } else if (cmp == 0) {
140
+ return 1;
141
+ } else {
142
+ return 0;
143
+ }
144
+ } else if (cmp == -1) {
145
+ return -2;
146
+ } else {
147
+ cmp = this.compare(start.row, start.column);
148
+ if (cmp == -1) {
149
+ return -1;
150
+ } else if (cmp == 1) {
151
+ return 42;
152
+ } else {
153
+ return 0;
154
+ }
155
+ }
156
+ }
157
+
158
+ /** related to: Range.compare
159
+ * Range.comparePoint(p) -> Number
160
+ * - p (Range): A point to compare with
161
+ * + (Number): This method returns one of the following numbers:<br/>
162
+ * * `0` if the two points are exactly equal<br/>
163
+ * * `-1` if `p.row` is less then the calling range<br/>
164
+ * * `1` if `p.row` is greater than the calling range<br/>
165
+ * <br/>
166
+ * If the starting row of the calling range is equal to `p.row`, and:<br/>
167
+ * * `p.column` is greater than or equal to the calling range's starting column, this returns `0`<br/>
168
+ * * Otherwise, it returns -1<br/>
169
+ *<br/>
170
+ * If the ending row of the calling range is equal to `p.row`, and:<br/>
171
+ * * `p.column` is less than or equal to the calling range's ending column, this returns `0`<br/>
172
+ * * Otherwise, it returns 1<br/>
173
+ *
174
+ * Checks the row and column points of `p` with the row and column points of the calling range.
175
+ *
176
+ *
177
+ *
178
+ **/
179
+ this.comparePoint = function(p) {
180
+ return this.compare(p.row, p.column);
181
+ }
182
+
183
+ /** related to: Range.comparePoint
184
+ * Range.containsRange(range) -> Boolean
185
+ * - range (Range): A range to compare with
186
+ *
187
+ * Checks the start and end points of `range` and compares them to the calling range. Returns `true` if the `range` is contained within the caller's range.
188
+ *
189
+ **/
190
+ this.containsRange = function(range) {
191
+ return this.comparePoint(range.start) == 0 && this.comparePoint(range.end) == 0;
192
+ }
193
+
194
+ /**
195
+ * Range.intersects(range) -> Boolean
196
+ * - range (Range): A range to compare with
197
+ *
198
+ * Returns `true` if passed in `range` intersects with the one calling this method.
199
+ *
200
+ **/
201
+ this.intersects = function(range) {
202
+ var cmp = this.compareRange(range);
203
+ return (cmp == -1 || cmp == 0 || cmp == 1);
204
+ }
205
+
206
+ /**
207
+ * Range.isEnd(row, column) -> Boolean
208
+ * - row (Number): A row point to compare with
209
+ * - column (Number): A column point to compare with
210
+ *
211
+ * Returns `true` if the caller's ending row point is the same as `row`, and if the caller's ending column is the same as `column`.
212
+ *
213
+ **/
214
+ this.isEnd = function(row, column) {
215
+ return this.end.row == row && this.end.column == column;
216
+ }
217
+
218
+ /**
219
+ * Range.isStart(row, column) -> Boolean
220
+ * - row (Number): A row point to compare with
221
+ * - column (Number): A column point to compare with
222
+ *
223
+ * Returns `true` if the caller's starting row point is the same as `row`, and if the caller's starting column is the same as `column`.
224
+ *
225
+ **/
226
+ this.isStart = function(row, column) {
227
+ return this.start.row == row && this.start.column == column;
228
+ }
229
+
230
+ /**
231
+ * Range.setStart(row, column)
232
+ * - row (Number): A row point to set
233
+ * - column (Number): A column point to set
234
+ *
235
+ * Sets the starting row and column for the range.
236
+ *
237
+ **/
238
+ this.setStart = function(row, column) {
239
+ if (typeof row == "object") {
240
+ this.start.column = row.column;
241
+ this.start.row = row.row;
242
+ } else {
243
+ this.start.row = row;
244
+ this.start.column = column;
245
+ }
246
+ }
247
+
248
+ /**
249
+ * Range.setEnd(row, column)
250
+ * - row (Number): A row point to set
251
+ * - column (Number): A column point to set
252
+ *
253
+ * Sets the starting row and column for the range.
254
+ *
255
+ **/
256
+ this.setEnd = function(row, column) {
257
+ if (typeof row == "object") {
258
+ this.end.column = row.column;
259
+ this.end.row = row.row;
260
+ } else {
261
+ this.end.row = row;
262
+ this.end.column = column;
263
+ }
264
+ }
265
+
266
+ /** related to: Range.compare
267
+ * Range.inside(row, column) -> Boolean
268
+ * - row (Number): A row point to compare with
269
+ * - column (Number): A column point to compare with
270
+ *
271
+ * Returns `true` if the `row` and `column` are within the given range.
272
+ *
273
+ **/
274
+ this.inside = function(row, column) {
275
+ if (this.compare(row, column) == 0) {
276
+ if (this.isEnd(row, column) || this.isStart(row, column)) {
277
+ return false;
278
+ } else {
279
+ return true;
280
+ }
281
+ }
282
+ return false;
283
+ }
284
+
285
+ /** related to: Range.compare
286
+ * Range.insideStart(row, column) -> Boolean
287
+ * - row (Number): A row point to compare with
288
+ * - column (Number): A column point to compare with
289
+ *
290
+ * Returns `true` if the `row` and `column` are within the given range's starting points.
291
+ *
292
+ **/
293
+ this.insideStart = function(row, column) {
294
+ if (this.compare(row, column) == 0) {
295
+ if (this.isEnd(row, column)) {
296
+ return false;
297
+ } else {
298
+ return true;
299
+ }
300
+ }
301
+ return false;
302
+ }
303
+
304
+ /** related to: Range.compare
305
+ * Range.insideEnd(row, column) -> Boolean
306
+ * - row (Number): A row point to compare with
307
+ * - column (Number): A column point to compare with
308
+ *
309
+ * Returns `true` if the `row` and `column` are within the given range's ending points.
310
+ *
311
+ **/
312
+ this.insideEnd = function(row, column) {
313
+ if (this.compare(row, column) == 0) {
314
+ if (this.isStart(row, column)) {
315
+ return false;
316
+ } else {
317
+ return true;
318
+ }
319
+ }
320
+ return false;
321
+ }
322
+
323
+ /**
324
+ * Range.compare(row, column) -> Number
325
+ * - row (Number): A row point to compare with
326
+ * - column (Number): A column point to compare with
327
+ * + (Number): This method returns one of the following numbers:<br/>
328
+ * * `0` if the two points are exactly equal <br/>
329
+ * * `-1` if `p.row` is less then the calling range <br/>
330
+ * * `1` if `p.row` is greater than the calling range <br/>
331
+ * <br/>
332
+ * If the starting row of the calling range is equal to `p.row`, and: <br/>
333
+ * * `p.column` is greater than or equal to the calling range's starting column, this returns `0`<br/>
334
+ * * Otherwise, it returns -1<br/>
335
+ * <br/>
336
+ * If the ending row of the calling range is equal to `p.row`, and: <br/>
337
+ * * `p.column` is less than or equal to the calling range's ending column, this returns `0` <br/>
338
+ * * Otherwise, it returns 1
339
+ *
340
+ * Checks the row and column points with the row and column points of the calling range.
341
+ *
342
+ *
343
+ **/
344
+ this.compare = function(row, column) {
345
+ if (!this.isMultiLine()) {
346
+ if (row === this.start.row) {
347
+ return column < this.start.column ? -1 : (column > this.end.column ? 1 : 0);
348
+ };
349
+ }
350
+
351
+ if (row < this.start.row)
352
+ return -1;
353
+
354
+ if (row > this.end.row)
355
+ return 1;
356
+
357
+ if (this.start.row === row)
358
+ return column >= this.start.column ? 0 : -1;
359
+
360
+ if (this.end.row === row)
361
+ return column <= this.end.column ? 0 : 1;
362
+
363
+ return 0;
364
+ };
365
+
366
+ /**
367
+ * Range.compareStart(row, column) -> Number
368
+ * - row (Number): A row point to compare with
369
+ * - column (Number): A column point to compare with
370
+ * + (Number): This method returns one of the following numbers:<br/>
371
+ * <br/>
372
+ * * `0` if the two points are exactly equal<br/>
373
+ * * `-1` if `p.row` is less then the calling range<br/>
374
+ * * `1` if `p.row` is greater than the calling range, or if `isStart` is `true`.<br/>
375
+ * <br/>
376
+ * If the starting row of the calling range is equal to `p.row`, and:<br/>
377
+ * * `p.column` is greater than or equal to the calling range's starting column, this returns `0`<br/>
378
+ * * Otherwise, it returns -1<br/>
379
+ * <br/>
380
+ * If the ending row of the calling range is equal to `p.row`, and:<br/>
381
+ * * `p.column` is less than or equal to the calling range's ending column, this returns `0`<br/>
382
+ * * Otherwise, it returns 1
383
+ *
384
+ * Checks the row and column points with the row and column points of the calling range.
385
+ *
386
+ *
387
+ *
388
+ **/
389
+ this.compareStart = function(row, column) {
390
+ if (this.start.row == row && this.start.column == column) {
391
+ return -1;
392
+ } else {
393
+ return this.compare(row, column);
394
+ }
395
+ }
396
+
397
+ /**
398
+ * Range.compareEnd(row, column) -> Number
399
+ * - row (Number): A row point to compare with
400
+ * - column (Number): A column point to compare with
401
+ * + (Number): This method returns one of the following numbers:<br/>
402
+ * * `0` if the two points are exactly equal<br/>
403
+ * * `-1` if `p.row` is less then the calling range<br/>
404
+ * * `1` if `p.row` is greater than the calling range, or if `isEnd` is `true.<br/>
405
+ * <br/>
406
+ * If the starting row of the calling range is equal to `p.row`, and:<br/>
407
+ * * `p.column` is greater than or equal to the calling range's starting column, this returns `0`<br/>
408
+ * * Otherwise, it returns -1<br/>
409
+ *<br/>
410
+ * If the ending row of the calling range is equal to `p.row`, and:<br/>
411
+ * * `p.column` is less than or equal to the calling range's ending column, this returns `0`<br/>
412
+ * * Otherwise, it returns 1
413
+ *
414
+ * Checks the row and column points with the row and column points of the calling range.
415
+ *
416
+ *
417
+ **/
418
+ this.compareEnd = function(row, column) {
419
+ if (this.end.row == row && this.end.column == column) {
420
+ return 1;
421
+ } else {
422
+ return this.compare(row, column);
423
+ }
424
+ }
425
+
426
+ /**
427
+ * Range.compareInside(row, column) -> Number
428
+ * - row (Number): A row point to compare with
429
+ * - column (Number): A column point to compare with
430
+ * + (Number): This method returns one of the following numbers:<br/>
431
+ * * `1` if the ending row of the calling range is equal to `row`, and the ending column of the calling range is equal to `column`<br/>
432
+ * * `-1` if the starting row of the calling range is equal to `row`, and the starting column of the calling range is equal to `column`<br/>
433
+ * <br/>
434
+ * Otherwise, it returns the value after calling [[Range.compare `compare()`]].
435
+ *
436
+ * Checks the row and column points with the row and column points of the calling range.
437
+ *
438
+ *
439
+ *
440
+ **/
441
+ this.compareInside = function(row, column) {
442
+ if (this.end.row == row && this.end.column == column) {
443
+ return 1;
444
+ } else if (this.start.row == row && this.start.column == column) {
445
+ return -1;
446
+ } else {
447
+ return this.compare(row, column);
448
+ }
449
+ }
450
+
451
+ /**
452
+ * Range.clipRows(firstRow, lastRow) -> Range
453
+ * - firstRow (Number): The starting row
454
+ * - lastRow (Number): The ending row
455
+ *
456
+ * Returns the part of the current `Range` that occurs within the boundaries of `firstRow` and `lastRow` as a new `Range` object.
457
+ *
458
+ **/
459
+ this.clipRows = function(firstRow, lastRow) {
460
+ if (this.end.row > lastRow) {
461
+ var end = {
462
+ row: lastRow+1,
463
+ column: 0
464
+ };
465
+ }
466
+
467
+ if (this.start.row > lastRow) {
468
+ var start = {
469
+ row: lastRow+1,
470
+ column: 0
471
+ };
472
+ }
473
+
474
+ if (this.start.row < firstRow) {
475
+ var start = {
476
+ row: firstRow,
477
+ column: 0
478
+ };
479
+ }
480
+
481
+ if (this.end.row < firstRow) {
482
+ var end = {
483
+ row: firstRow,
484
+ column: 0
485
+ };
486
+ }
487
+ return Range.fromPoints(start || this.start, end || this.end);
488
+ };
489
+
490
+ /**
491
+ * Range.extend(row, column) -> Range
492
+ * - row (Number): A new row to extend to
493
+ * - column (Number): A new column to extend to
494
+ *
495
+ * Changes the row and column points for the calling range for both the starting and ending points. This method returns that range with a new row.
496
+ *
497
+ **/
498
+ this.extend = function(row, column) {
499
+ var cmp = this.compare(row, column);
500
+
501
+ if (cmp == 0)
502
+ return this;
503
+ else if (cmp == -1)
504
+ var start = {row: row, column: column};
505
+ else
506
+ var end = {row: row, column: column};
507
+
508
+ return Range.fromPoints(start || this.start, end || this.end);
509
+ };
510
+
511
+ this.isEmpty = function() {
512
+ return (this.start.row == this.end.row && this.start.column == this.end.column);
513
+ };
514
+
515
+ /**
516
+ * Range.isMultiLine() -> Boolean
517
+ *
518
+ * Returns true if the range spans across multiple lines.
519
+ *
520
+ **/
521
+ this.isMultiLine = function() {
522
+ return (this.start.row !== this.end.row);
523
+ };
524
+
525
+ /**
526
+ * Range.clone() -> Range
527
+ *
528
+ * Returns a duplicate of the calling range.
529
+ *
530
+ **/
531
+ this.clone = function() {
532
+ return Range.fromPoints(this.start, this.end);
533
+ };
534
+
535
+ /**
536
+ * Range.collapseRows() -> Range
537
+ *
538
+ * Returns a range containing the starting and ending rows of the original range, but with a column value of `0`.
539
+ *
540
+ **/
541
+ this.collapseRows = function() {
542
+ if (this.end.column == 0)
543
+ return new Range(this.start.row, 0, Math.max(this.start.row, this.end.row-1), 0)
544
+ else
545
+ return new Range(this.start.row, 0, this.end.row, 0)
546
+ };
547
+
548
+ /**
549
+ * Range.toScreenRange(session) -> Range
550
+ * - session (EditSession): The `EditSession` to retrieve coordinates from
551
+ *
552
+ * Given the current `Range`, this function converts those starting and ending points into screen positions, and then returns a new `Range` object.
553
+ **/
554
+ this.toScreenRange = function(session) {
555
+ var screenPosStart =
556
+ session.documentToScreenPosition(this.start);
557
+ var screenPosEnd =
558
+ session.documentToScreenPosition(this.end);
559
+
560
+ return new Range(
561
+ screenPosStart.row, screenPosStart.column,
562
+ screenPosEnd.row, screenPosEnd.column
563
+ );
564
+ };
565
+
566
+ }).call(Range.prototype);
567
+
568
+ /**
569
+ * Range.fromPoints(start, end) -> Range
570
+ * - start (Range): A starting point to use
571
+ * - end (Range): An ending point to use
572
+ *
573
+ * Creates and returns a new `Range` based on the row and column of the given parameters.
574
+ *
575
+ **/
576
+ Range.fromPoints = function(start, end) {
577
+ return new Range(start.row, start.column, end.row, end.column);
578
+ };
579
+
580
+ exports.Range = Range;
581
+ });