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,759 @@
1
+ /* vim:ts=4:sts=4:sw=4:
2
+ * ***** BEGIN LICENSE BLOCK *****
3
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4
+ *
5
+ * The contents of this file are subject to the Mozilla Public License Version
6
+ * 1.1 (the "License"); you may not use this file except in compliance with
7
+ * the License. You may obtain a copy of the License at
8
+ * http://www.mozilla.org/MPL/
9
+ *
10
+ * Software distributed under the License is distributed on an "AS IS" basis,
11
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12
+ * for the specific language governing rights and limitations under the
13
+ * License.
14
+ *
15
+ * The Original Code is Ajax.org Code Editor (ACE).
16
+ *
17
+ * The Initial Developer of the Original Code is
18
+ * Ajax.org B.V.
19
+ * Portions created by the Initial Developer are Copyright (C) 2010
20
+ * the Initial Developer. All Rights Reserved.
21
+ *
22
+ * Contributor(s):
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
+ define(function(require, exports, module) {
40
+ "use strict";
41
+
42
+ var Range = require("../range").Range;
43
+ var FoldLine = require("./fold_line").FoldLine;
44
+ var Fold = require("./fold").Fold;
45
+ var TokenIterator = require("../token_iterator").TokenIterator;
46
+
47
+ function Folding() {
48
+ /*
49
+ * Looks up a fold at a given row/column. Possible values for side:
50
+ * -1: ignore a fold if fold.start = row/column
51
+ * +1: ignore a fold if fold.end = row/column
52
+ */
53
+ this.getFoldAt = function(row, column, side) {
54
+ var foldLine = this.getFoldLine(row);
55
+ if (!foldLine)
56
+ return null;
57
+
58
+ var folds = foldLine.folds;
59
+ for (var i = 0; i < folds.length; i++) {
60
+ var fold = folds[i];
61
+ if (fold.range.contains(row, column)) {
62
+ if (side == 1 && fold.range.isEnd(row, column)) {
63
+ continue;
64
+ } else if (side == -1 && fold.range.isStart(row, column)) {
65
+ continue;
66
+ }
67
+ return fold;
68
+ }
69
+ }
70
+ };
71
+
72
+ /*
73
+ * Returns all folds in the given range. Note, that this will return folds
74
+ *
75
+ */
76
+ this.getFoldsInRange = function(range) {
77
+ range = range.clone();
78
+ var start = range.start;
79
+ var end = range.end;
80
+ var foldLines = this.$foldData;
81
+ var foundFolds = [];
82
+
83
+ start.column += 1;
84
+ end.column -= 1;
85
+
86
+ for (var i = 0; i < foldLines.length; i++) {
87
+ var cmp = foldLines[i].range.compareRange(range);
88
+ if (cmp == 2) {
89
+ // Range is before foldLine. No intersection. This means,
90
+ // there might be other foldLines that intersect.
91
+ continue;
92
+ }
93
+ else if (cmp == -2) {
94
+ // Range is after foldLine. There can't be any other foldLines then,
95
+ // so let's give up.
96
+ break;
97
+ }
98
+
99
+ var folds = foldLines[i].folds;
100
+ for (var j = 0; j < folds.length; j++) {
101
+ var fold = folds[j];
102
+ cmp = fold.range.compareRange(range);
103
+ if (cmp == -2) {
104
+ break;
105
+ } else if (cmp == 2) {
106
+ continue;
107
+ } else
108
+ // WTF-state: Can happen due to -1/+1 to start/end column.
109
+ if (cmp == 42) {
110
+ break;
111
+ }
112
+ foundFolds.push(fold);
113
+ }
114
+ }
115
+ return foundFolds;
116
+ };
117
+
118
+ /*
119
+ * Returns all folds in the document
120
+ */
121
+ this.getAllFolds = function() {
122
+ var folds = [];
123
+ var foldLines = this.$foldData;
124
+
125
+ function addFold(fold) {
126
+ folds.push(fold);
127
+ if (!fold.subFolds)
128
+ return;
129
+
130
+ for (var i = 0; i < fold.subFolds.length; i++)
131
+ addFold(fold.subFolds[i]);
132
+ }
133
+
134
+ for (var i = 0; i < foldLines.length; i++)
135
+ for (var j = 0; j < foldLines[i].folds.length; j++)
136
+ addFold(foldLines[i].folds[j]);
137
+
138
+ return folds;
139
+ };
140
+
141
+ /*
142
+ * Returns the string between folds at the given position.
143
+ * E.g.
144
+ * foo<fold>b|ar<fold>wolrd -> "bar"
145
+ * foo<fold>bar<fold>wol|rd -> "world"
146
+ * foo<fold>bar<fo|ld>wolrd -> <null>
147
+ *
148
+ * where | means the position of row/column
149
+ *
150
+ * The trim option determs if the return string should be trimed according
151
+ * to the "side" passed with the trim value:
152
+ *
153
+ * E.g.
154
+ * foo<fold>b|ar<fold>wolrd -trim=-1> "b"
155
+ * foo<fold>bar<fold>wol|rd -trim=+1> "rld"
156
+ * fo|o<fold>bar<fold>wolrd -trim=00> "foo"
157
+ */
158
+ this.getFoldStringAt = function(row, column, trim, foldLine) {
159
+ foldLine = foldLine || this.getFoldLine(row);
160
+ if (!foldLine)
161
+ return null;
162
+
163
+ var lastFold = {
164
+ end: { column: 0 }
165
+ };
166
+ // TODO: Refactor to use getNextFoldTo function.
167
+ var str, fold;
168
+ for (var i = 0; i < foldLine.folds.length; i++) {
169
+ fold = foldLine.folds[i];
170
+ var cmp = fold.range.compareEnd(row, column);
171
+ if (cmp == -1) {
172
+ str = this
173
+ .getLine(fold.start.row)
174
+ .substring(lastFold.end.column, fold.start.column);
175
+ break;
176
+ }
177
+ else if (cmp === 0) {
178
+ return null;
179
+ }
180
+ lastFold = fold;
181
+ }
182
+ if (!str)
183
+ str = this.getLine(fold.start.row).substring(lastFold.end.column);
184
+
185
+ if (trim == -1)
186
+ return str.substring(0, column - lastFold.end.column);
187
+ else if (trim == 1)
188
+ return str.substring(column - lastFold.end.column);
189
+ else
190
+ return str;
191
+ };
192
+
193
+ this.getFoldLine = function(docRow, startFoldLine) {
194
+ var foldData = this.$foldData;
195
+ var i = 0;
196
+ if (startFoldLine)
197
+ i = foldData.indexOf(startFoldLine);
198
+ if (i == -1)
199
+ i = 0;
200
+ for (i; i < foldData.length; i++) {
201
+ var foldLine = foldData[i];
202
+ if (foldLine.start.row <= docRow && foldLine.end.row >= docRow) {
203
+ return foldLine;
204
+ } else if (foldLine.end.row > docRow) {
205
+ return null;
206
+ }
207
+ }
208
+ return null;
209
+ };
210
+
211
+ // returns the fold which starts after or contains docRow
212
+ this.getNextFoldLine = function(docRow, startFoldLine) {
213
+ var foldData = this.$foldData;
214
+ var i = 0;
215
+ if (startFoldLine)
216
+ i = foldData.indexOf(startFoldLine);
217
+ if (i == -1)
218
+ i = 0;
219
+ for (i; i < foldData.length; i++) {
220
+ var foldLine = foldData[i];
221
+ if (foldLine.end.row >= docRow) {
222
+ return foldLine;
223
+ }
224
+ }
225
+ return null;
226
+ };
227
+
228
+ this.getFoldedRowCount = function(first, last) {
229
+ var foldData = this.$foldData, rowCount = last-first+1;
230
+ for (var i = 0; i < foldData.length; i++) {
231
+ var foldLine = foldData[i],
232
+ end = foldLine.end.row,
233
+ start = foldLine.start.row;
234
+ if (end >= last) {
235
+ if(start < last) {
236
+ if(start >= first)
237
+ rowCount -= last-start;
238
+ else
239
+ rowCount = 0;//in one fold
240
+ }
241
+ break;
242
+ } else if(end >= first){
243
+ if (start >= first) //fold inside range
244
+ rowCount -= end-start;
245
+ else
246
+ rowCount -= end-first+1;
247
+ }
248
+ }
249
+ return rowCount;
250
+ };
251
+
252
+ this.$addFoldLine = function(foldLine) {
253
+ this.$foldData.push(foldLine);
254
+ this.$foldData.sort(function(a, b) {
255
+ return a.start.row - b.start.row;
256
+ });
257
+ return foldLine;
258
+ };
259
+
260
+ /*
261
+ * Adds a new fold.
262
+ *
263
+ * @returns
264
+ * The new created Fold object or an existing fold object in case the
265
+ * passed in range fits an existing fold exactly.
266
+ */
267
+ this.addFold = function(placeholder, range) {
268
+ var foldData = this.$foldData;
269
+ var added = false;
270
+ var fold;
271
+
272
+ if (placeholder instanceof Fold)
273
+ fold = placeholder;
274
+ else
275
+ fold = new Fold(range, placeholder);
276
+
277
+ this.$clipRangeToDocument(fold.range);
278
+
279
+ var startRow = fold.start.row;
280
+ var startColumn = fold.start.column;
281
+ var endRow = fold.end.row;
282
+ var endColumn = fold.end.column;
283
+
284
+ // --- Some checking ---
285
+ if (fold.placeholder.length < 2)
286
+ throw "Placeholder has to be at least 2 characters";
287
+
288
+ if (startRow == endRow && endColumn - startColumn < 2)
289
+ throw "The range has to be at least 2 characters width";
290
+
291
+ var startFold = this.getFoldAt(startRow, startColumn, 1);
292
+ var endFold = this.getFoldAt(endRow, endColumn, -1);
293
+ if (startFold && endFold == startFold)
294
+ return startFold.addSubFold(fold);
295
+
296
+ if (
297
+ (startFold && !startFold.range.isStart(startRow, startColumn))
298
+ || (endFold && !endFold.range.isEnd(endRow, endColumn))
299
+ ) {
300
+ throw "A fold can't intersect already existing fold" + fold.range + startFold.range;
301
+ }
302
+
303
+ // Check if there are folds in the range we create the new fold for.
304
+ var folds = this.getFoldsInRange(fold.range);
305
+ if (folds.length > 0) {
306
+ // Remove the folds from fold data.
307
+ this.removeFolds(folds);
308
+ // Add the removed folds as subfolds on the new fold.
309
+ fold.subFolds = folds;
310
+ }
311
+
312
+ for (var i = 0; i < foldData.length; i++) {
313
+ var foldLine = foldData[i];
314
+ if (endRow == foldLine.start.row) {
315
+ foldLine.addFold(fold);
316
+ added = true;
317
+ break;
318
+ }
319
+ else if (startRow == foldLine.end.row) {
320
+ foldLine.addFold(fold);
321
+ added = true;
322
+ if (!fold.sameRow) {
323
+ // Check if we might have to merge two FoldLines.
324
+ var foldLineNext = foldData[i + 1];
325
+ if (foldLineNext && foldLineNext.start.row == endRow) {
326
+ // We need to merge!
327
+ foldLine.merge(foldLineNext);
328
+ break;
329
+ }
330
+ }
331
+ break;
332
+ }
333
+ else if (endRow <= foldLine.start.row) {
334
+ break;
335
+ }
336
+ }
337
+
338
+ if (!added)
339
+ foldLine = this.$addFoldLine(new FoldLine(this.$foldData, fold));
340
+
341
+ if (this.$useWrapMode)
342
+ this.$updateWrapData(foldLine.start.row, foldLine.start.row);
343
+ else
344
+ this.$updateRowLengthCache(foldLine.start.row, foldLine.start.row);
345
+
346
+ // Notify that fold data has changed.
347
+ this.$modified = true;
348
+ this._emit("changeFold", { data: fold });
349
+
350
+ return fold;
351
+ };
352
+
353
+ this.addFolds = function(folds) {
354
+ folds.forEach(function(fold) {
355
+ this.addFold(fold);
356
+ }, this);
357
+ };
358
+
359
+ this.removeFold = function(fold) {
360
+ var foldLine = fold.foldLine;
361
+ var startRow = foldLine.start.row;
362
+ var endRow = foldLine.end.row;
363
+
364
+ var foldLines = this.$foldData;
365
+ var folds = foldLine.folds;
366
+ // Simple case where there is only one fold in the FoldLine such that
367
+ // the entire fold line can get removed directly.
368
+ if (folds.length == 1) {
369
+ foldLines.splice(foldLines.indexOf(foldLine), 1);
370
+ } else
371
+ // If the fold is the last fold of the foldLine, just remove it.
372
+ if (foldLine.range.isEnd(fold.end.row, fold.end.column)) {
373
+ folds.pop();
374
+ foldLine.end.row = folds[folds.length - 1].end.row;
375
+ foldLine.end.column = folds[folds.length - 1].end.column;
376
+ } else
377
+ // If the fold is the first fold of the foldLine, just remove it.
378
+ if (foldLine.range.isStart(fold.start.row, fold.start.column)) {
379
+ folds.shift();
380
+ foldLine.start.row = folds[0].start.row;
381
+ foldLine.start.column = folds[0].start.column;
382
+ } else
383
+ // We know there are more then 2 folds and the fold is not at the edge.
384
+ // This means, the fold is somewhere in between.
385
+ //
386
+ // If the fold is in one row, we just can remove it.
387
+ if (fold.sameRow) {
388
+ folds.splice(folds.indexOf(fold), 1);
389
+ } else
390
+ // The fold goes over more then one row. This means remvoing this fold
391
+ // will cause the fold line to get splitted up. newFoldLine is the second part
392
+ {
393
+ var newFoldLine = foldLine.split(fold.start.row, fold.start.column);
394
+ folds = newFoldLine.folds;
395
+ folds.shift();
396
+ newFoldLine.start.row = folds[0].start.row;
397
+ newFoldLine.start.column = folds[0].start.column;
398
+ }
399
+
400
+ if (this.$useWrapMode)
401
+ this.$updateWrapData(startRow, endRow);
402
+ else
403
+ this.$updateRowLengthCache(startRow, endRow);
404
+
405
+ // Notify that fold data has changed.
406
+ this.$modified = true;
407
+ this._emit("changeFold", { data: fold });
408
+ };
409
+
410
+ this.removeFolds = function(folds) {
411
+ // We need to clone the folds array passed in as it might be the folds
412
+ // array of a fold line and as we call this.removeFold(fold), folds
413
+ // are removed from folds and changes the current index.
414
+ var cloneFolds = [];
415
+ for (var i = 0; i < folds.length; i++) {
416
+ cloneFolds.push(folds[i]);
417
+ }
418
+
419
+ cloneFolds.forEach(function(fold) {
420
+ this.removeFold(fold);
421
+ }, this);
422
+ this.$modified = true;
423
+ };
424
+
425
+ this.expandFold = function(fold) {
426
+ this.removeFold(fold);
427
+ fold.subFolds.forEach(function(fold) {
428
+ this.addFold(fold);
429
+ }, this);
430
+ fold.subFolds = [];
431
+ };
432
+
433
+ this.expandFolds = function(folds) {
434
+ folds.forEach(function(fold) {
435
+ this.expandFold(fold);
436
+ }, this);
437
+ };
438
+
439
+ this.unfold = function(location, expandInner) {
440
+ var range, folds;
441
+ if (location == null)
442
+ range = new Range(0, 0, this.getLength(), 0);
443
+ else if (typeof location == "number")
444
+ range = new Range(location, 0, location, this.getLine(location).length);
445
+ else if ("row" in location)
446
+ range = Range.fromPoints(location, location);
447
+ else
448
+ range = location;
449
+
450
+ folds = this.getFoldsInRange(range);
451
+ if (expandInner) {
452
+ this.removeFolds(folds);
453
+ } else {
454
+ // TODO: might need to remove and add folds in one go instead of using
455
+ // expandFolds several times.
456
+ while (folds.length) {
457
+ this.expandFolds(folds);
458
+ folds = this.getFoldsInRange(range);
459
+ }
460
+ }
461
+ };
462
+
463
+ /*
464
+ * Checks if a given documentRow is folded. This is true if there are some
465
+ * folded parts such that some parts of the line is still visible.
466
+ **/
467
+ this.isRowFolded = function(docRow, startFoldRow) {
468
+ return !!this.getFoldLine(docRow, startFoldRow);
469
+ };
470
+
471
+ this.getRowFoldEnd = function(docRow, startFoldRow) {
472
+ var foldLine = this.getFoldLine(docRow, startFoldRow);
473
+ return (foldLine
474
+ ? foldLine.end.row
475
+ : docRow);
476
+ };
477
+
478
+ this.getFoldDisplayLine = function(foldLine, endRow, endColumn, startRow, startColumn) {
479
+ if (startRow == null) {
480
+ startRow = foldLine.start.row;
481
+ startColumn = 0;
482
+ }
483
+
484
+ if (endRow == null) {
485
+ endRow = foldLine.end.row;
486
+ endColumn = this.getLine(endRow).length;
487
+ }
488
+
489
+ // Build the textline using the FoldLine walker.
490
+ var doc = this.doc;
491
+ var textLine = "";
492
+
493
+ foldLine.walk(function(placeholder, row, column, lastColumn) {
494
+ if (row < startRow) {
495
+ return;
496
+ } else if (row == startRow) {
497
+ if (column < startColumn) {
498
+ return;
499
+ }
500
+ lastColumn = Math.max(startColumn, lastColumn);
501
+ }
502
+ if (placeholder) {
503
+ textLine += placeholder;
504
+ } else {
505
+ textLine += doc.getLine(row).substring(lastColumn, column);
506
+ }
507
+ }.bind(this), endRow, endColumn);
508
+ return textLine;
509
+ };
510
+
511
+ this.getDisplayLine = function(row, endColumn, startRow, startColumn) {
512
+ var foldLine = this.getFoldLine(row);
513
+
514
+ if (!foldLine) {
515
+ var line;
516
+ line = this.doc.getLine(row);
517
+ return line.substring(startColumn || 0, endColumn || line.length);
518
+ } else {
519
+ return this.getFoldDisplayLine(
520
+ foldLine, row, endColumn, startRow, startColumn);
521
+ }
522
+ };
523
+
524
+ this.$cloneFoldData = function() {
525
+ var fd = [];
526
+ fd = this.$foldData.map(function(foldLine) {
527
+ var folds = foldLine.folds.map(function(fold) {
528
+ return fold.clone();
529
+ });
530
+ return new FoldLine(fd, folds);
531
+ });
532
+
533
+ return fd;
534
+ };
535
+
536
+ this.toggleFold = function(tryToUnfold) {
537
+ var selection = this.selection;
538
+ var range = selection.getRange();
539
+ var fold;
540
+ var bracketPos;
541
+
542
+ if (range.isEmpty()) {
543
+ var cursor = range.start;
544
+ fold = this.getFoldAt(cursor.row, cursor.column);
545
+
546
+ if (fold) {
547
+ this.expandFold(fold);
548
+ return;
549
+ }
550
+ else if (bracketPos = this.findMatchingBracket(cursor)) {
551
+ if (range.comparePoint(bracketPos) == 1) {
552
+ range.end = bracketPos;
553
+ }
554
+ else {
555
+ range.start = bracketPos;
556
+ range.start.column++;
557
+ range.end.column--;
558
+ }
559
+ }
560
+ else if (bracketPos = this.findMatchingBracket({row: cursor.row, column: cursor.column + 1})) {
561
+ if (range.comparePoint(bracketPos) == 1)
562
+ range.end = bracketPos;
563
+ else
564
+ range.start = bracketPos;
565
+
566
+ range.start.column++;
567
+ }
568
+ else {
569
+ range = this.getCommentFoldRange(cursor.row, cursor.column) || range;
570
+ }
571
+ } else {
572
+ var folds = this.getFoldsInRange(range);
573
+ if (tryToUnfold && folds.length) {
574
+ this.expandFolds(folds);
575
+ return;
576
+ }
577
+ else if (folds.length == 1 ) {
578
+ fold = folds[0];
579
+ }
580
+ }
581
+
582
+ if (!fold)
583
+ fold = this.getFoldAt(range.start.row, range.start.column);
584
+
585
+ if (fold && fold.range.toString() == range.toString()) {
586
+ this.expandFold(fold);
587
+ return;
588
+ }
589
+
590
+ var placeholder = "...";
591
+ if (!range.isMultiLine()) {
592
+ placeholder = this.getTextRange(range);
593
+ if(placeholder.length < 4)
594
+ return;
595
+ placeholder = placeholder.trim().substring(0, 2) + "..";
596
+ }
597
+
598
+ this.addFold(placeholder, range);
599
+ };
600
+
601
+ this.getCommentFoldRange = function(row, column) {
602
+ var iterator = new TokenIterator(this, row, column);
603
+ var token = iterator.getCurrentToken();
604
+ if (token && /^comment|string/.test(token.type)) {
605
+ var range = new Range();
606
+ var re = new RegExp(token.type.replace(/\..*/, "\\."));
607
+ do {
608
+ token = iterator.stepBackward();
609
+ } while(token && re.test(token.type));
610
+
611
+ iterator.stepForward();
612
+ range.start.row = iterator.getCurrentTokenRow();
613
+ range.start.column = iterator.getCurrentTokenColumn() + 2;
614
+
615
+ iterator = new TokenIterator(this, row, column);
616
+
617
+ do {
618
+ token = iterator.stepForward();
619
+ } while(token && re.test(token.type));
620
+
621
+ token = iterator.stepBackward();
622
+
623
+ range.end.row = iterator.getCurrentTokenRow();
624
+ range.end.column = iterator.getCurrentTokenColumn() + token.value.length;
625
+ return range;
626
+ }
627
+ };
628
+
629
+ this.foldAll = function(startRow, endRow) {
630
+ var foldWidgets = this.foldWidgets;
631
+ endRow = endRow || this.getLength();
632
+ for (var row = startRow || 0; row < endRow; row++) {
633
+ if (foldWidgets[row] == null)
634
+ foldWidgets[row] = this.getFoldWidget(row);
635
+ if (foldWidgets[row] != "start")
636
+ continue;
637
+
638
+ var range = this.getFoldWidgetRange(row);
639
+ // sometimes range can be incompatible with existing fold
640
+ // wouldn't it be better for addFold to return null istead of throwing?
641
+ if (range && range.end.row < endRow) try {
642
+ this.addFold("...", range);
643
+ } catch(e) {}
644
+ }
645
+ };
646
+
647
+ this.$foldStyles = {
648
+ "manual": 1,
649
+ "markbegin": 1,
650
+ "markbeginend": 1
651
+ };
652
+ this.$foldStyle = "markbegin";
653
+ this.setFoldStyle = function(style) {
654
+ if (!this.$foldStyles[style])
655
+ throw new Error("invalid fold style: " + style + "[" + Object.keys(this.$foldStyles).join(", ") + "]");
656
+
657
+ if (this.$foldStyle == style)
658
+ return;
659
+
660
+ this.$foldStyle = style;
661
+
662
+ if (style == "manual")
663
+ this.unfold();
664
+
665
+ // reset folding
666
+ var mode = this.$foldMode;
667
+ this.$setFolding(null);
668
+ this.$setFolding(mode);
669
+ };
670
+
671
+ // structured folding
672
+ this.$setFolding = function(foldMode) {
673
+ if (this.$foldMode == foldMode)
674
+ return;
675
+
676
+ this.$foldMode = foldMode;
677
+
678
+ this.removeListener('change', this.$updateFoldWidgets);
679
+ this._emit("changeAnnotation");
680
+
681
+ if (!foldMode || this.$foldStyle == "manual") {
682
+ this.foldWidgets = null;
683
+ return;
684
+ }
685
+
686
+ this.foldWidgets = [];
687
+ this.getFoldWidget = foldMode.getFoldWidget.bind(foldMode, this, this.$foldStyle);
688
+ this.getFoldWidgetRange = foldMode.getFoldWidgetRange.bind(foldMode, this, this.$foldStyle);
689
+
690
+ this.$updateFoldWidgets = this.updateFoldWidgets.bind(this);
691
+ this.on('change', this.$updateFoldWidgets);
692
+
693
+ };
694
+
695
+ this.onFoldWidgetClick = function(row, e) {
696
+ var type = this.getFoldWidget(row);
697
+ var line = this.getLine(row);
698
+ var onlySubfolds = e.shiftKey;
699
+ var addSubfolds = onlySubfolds || e.ctrlKey || e.altKey || e.metaKey;
700
+ var fold;
701
+
702
+ if (type == "end")
703
+ fold = this.getFoldAt(row, 0, -1);
704
+ else
705
+ fold = this.getFoldAt(row, line.length, 1);
706
+
707
+ if (fold) {
708
+ if (addSubfolds)
709
+ this.removeFold(fold);
710
+ else
711
+ this.expandFold(fold);
712
+ return;
713
+ }
714
+
715
+ var range = this.getFoldWidgetRange(row);
716
+ if (range) {
717
+ // sometimes singleline folds can be missed by the code above
718
+ if (!range.isMultiLine()) {
719
+ fold = this.getFoldAt(range.start.row, range.start.column, 1);
720
+ if (fold && range.isEqual(fold.range)) {
721
+ this.removeFold(fold);
722
+ return;
723
+ }
724
+ }
725
+
726
+ if (!onlySubfolds)
727
+ this.addFold("...", range);
728
+
729
+ if (addSubfolds)
730
+ this.foldAll(range.start.row + 1, range.end.row);
731
+ } else {
732
+ if (addSubfolds)
733
+ this.foldAll(row + 1, this.getLength());
734
+ e.target.className += " invalid"
735
+ }
736
+ };
737
+
738
+ this.updateFoldWidgets = function(e) {
739
+ var delta = e.data;
740
+ var range = delta.range;
741
+ var firstRow = range.start.row;
742
+ var len = range.end.row - firstRow;
743
+
744
+ if (len === 0) {
745
+ this.foldWidgets[firstRow] = null;
746
+ } else if (delta.action == "removeText" || delta.action == "removeLines") {
747
+ this.foldWidgets.splice(firstRow, len + 1, null);
748
+ } else {
749
+ var args = Array(len + 1);
750
+ args.unshift(firstRow, 1);
751
+ this.foldWidgets.splice.apply(this.foldWidgets, args);
752
+ }
753
+ };
754
+
755
+ }
756
+
757
+ exports.Folding = Folding;
758
+
759
+ });