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.
- data/README.md +44 -7
- data/Rakefile +1 -1
- data/bin/gollum +20 -1
- data/gollum.gemspec +400 -5
- data/lib/gollum.rb +2 -1
- data/lib/gollum/blob_entry.rb +13 -1
- data/lib/gollum/committer.rb +10 -1
- data/lib/gollum/file.rb +15 -2
- data/lib/gollum/file_view.rb +145 -0
- data/lib/gollum/frontend/app.rb +217 -69
- data/lib/gollum/frontend/helpers.rb +21 -0
- data/lib/gollum/frontend/public/gollum/css/_styles.css +121 -0
- data/lib/gollum/frontend/public/gollum/css/editor.css +17 -8
- data/lib/gollum/frontend/public/gollum/css/gollum.css +440 -402
- data/lib/gollum/frontend/public/gollum/css/template.css +540 -289
- data/lib/gollum/frontend/public/gollum/images/dirty-shade.png +0 -0
- data/lib/gollum/frontend/public/gollum/images/fileview/document.png +0 -0
- data/lib/gollum/frontend/public/gollum/images/fileview/folder-horizontal.png +0 -0
- data/lib/gollum/frontend/public/gollum/images/fileview/toggle-small-expand.png +0 -0
- data/lib/gollum/frontend/public/gollum/images/fileview/toggle-small.png +0 -0
- data/lib/gollum/frontend/public/gollum/images/para.png +0 -0
- data/lib/gollum/frontend/public/gollum/images/pin-16.png +0 -0
- data/lib/gollum/frontend/public/gollum/images/pin-20.png +0 -0
- data/lib/gollum/frontend/public/gollum/images/pin-24.png +0 -0
- data/lib/gollum/frontend/public/gollum/images/pin-32.png +0 -0
- data/lib/gollum/frontend/public/gollum/javascript/editor/gollum.editor.js +31 -7
- data/lib/gollum/frontend/public/gollum/javascript/editor/langs/asciidoc.js +2 -1
- data/lib/gollum/frontend/public/gollum/javascript/editor/langs/creole.js +2 -1
- data/lib/gollum/frontend/public/gollum/javascript/editor/langs/markdown.js +18 -6
- data/lib/gollum/frontend/public/gollum/javascript/editor/langs/org.js +2 -1
- data/lib/gollum/frontend/public/gollum/javascript/editor/langs/pod.js +2 -1
- data/lib/gollum/frontend/public/gollum/javascript/editor/langs/textile.js +2 -1
- data/lib/gollum/frontend/public/gollum/javascript/gollum.dialog.js +3 -0
- data/lib/gollum/frontend/public/gollum/javascript/gollum.js +78 -16
- data/lib/gollum/frontend/public/gollum/javascript/jquery-1.7.2.min.js +4 -0
- data/lib/gollum/frontend/public/gollum/javascript/mousetrap.min.js +8 -0
- data/lib/gollum/frontend/public/gollum/livepreview/css/custom.css +107 -0
- data/lib/gollum/frontend/public/gollum/livepreview/images/cancel_24.png +0 -0
- data/lib/gollum/frontend/public/gollum/livepreview/images/lr_24.png +0 -0
- data/lib/gollum/frontend/public/gollum/livepreview/images/save_24.png +0 -0
- data/lib/gollum/frontend/public/gollum/livepreview/images/savecomment_24.png +0 -0
- data/lib/gollum/frontend/public/gollum/livepreview/index.html +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/ace.js +103 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/anchor.js +254 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/anchor_test.js +184 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/background_tokenizer.js +261 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/background_tokenizer_test.js +92 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/commands/command_manager.js +121 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/commands/command_manager_test.js +193 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/commands/default_commands.js +460 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/commands/multi_select_commands.js +101 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/config.js +124 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/css/codefolding-fold-button-states.png +0 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/css/editor.css +327 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/css/expand-marker.png +0 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/document.js +617 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/document_test.js +314 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/edit_session.js +2419 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/edit_session/bracket_match.js +252 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/edit_session/fold.js +116 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/edit_session/fold_line.js +276 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/edit_session/folding.js +759 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/edit_session_test.js +981 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/editor.js +2163 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/editor_change_document_test.js +195 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/editor_highlight_selected_word_test.js +231 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/editor_navigation_test.js +171 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/editor_text_edit_test.js +562 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/ext/static.css +22 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/ext/static_highlight.js +98 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/ext/static_highlight_test.js +81 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/ext/textarea.js +536 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/keyboard/emacs.js +367 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/keyboard/hash_handler.js +170 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/keyboard/keybinding.js +143 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/keyboard/state_handler.js +257 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/keyboard/textinput.js +315 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/keyboard/vim.js +122 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/keyboard/vim/commands.js +556 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/keyboard/vim/maps/aliases.js +101 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/keyboard/vim/maps/motions.js +611 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/keyboard/vim/maps/operators.js +193 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/keyboard/vim/maps/util.js +134 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/keyboard/vim/registers.js +49 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/layer/cursor.js +202 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/layer/gutter.js +187 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/layer/marker.js +214 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/layer/text.js +595 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/layer/text_test.js +106 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/lib/browser_focus.js +105 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/lib/dom.js +292 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/lib/es5-shim.js +1059 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/lib/event.js +317 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/lib/event_emitter.js +121 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/lib/event_emitter_test.js +72 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/lib/fixoldbrowsers.js +19 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/lib/keys.js +129 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/lib/lang.js +164 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/lib/net.js +62 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/lib/oop.js +61 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/lib/regexp.js +113 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/lib/useragent.js +105 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/behaviour.js +98 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/behaviour/cstyle.js +225 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/behaviour/html.js +98 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/behaviour/xml.js +113 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/behaviour/xquery.js +68 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/c9search.js +74 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/c9search_highlight_rules.js +66 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/c_cpp.js +132 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/c_cpp_highlight_rules.js +180 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/clojure.js +121 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/clojure_highlight_rules.js +235 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coffee.js +121 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coffee/coffee-script.js +63 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coffee/helpers.js +100 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coffee/lexer.js +739 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coffee/nodes.js +2756 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coffee/parser.js +603 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coffee/parser_test.js +68 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coffee/rewriter.js +342 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coffee/scope.js +154 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coffee_highlight_rules.js +227 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coffee_highlight_rules_test.js +72 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coffee_worker.js +92 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coldfusion.js +71 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coldfusion_highlight_rules.js +135 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coldfusion_test.js +74 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/csharp.js +58 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/csharp_highlight_rules.js +104 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/css.js +110 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/css/csslint.js +9014 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/css_highlight_rules.js +242 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/css_highlight_rules_test.js +99 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/css_test.js +85 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/css_worker.js +66 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/css_worker_test.js +75 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/diff.js +58 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/diff_highlight_rules.js +108 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/doc_comment_highlight_rules.js +93 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/c9search.js +83 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/coffee.js +127 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/coffee_test.js +108 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/cstyle.js +95 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/cstyle_test.js +92 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/diff.js +76 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/fold_mode.js +115 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/html.js +86 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/html_test.js +169 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/mixed.js +88 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/pythonic.js +65 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/pythonic_test.js +105 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/xml.js +262 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/xml_test.js +117 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/golang.js +81 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/golang_highlight_rules.js +129 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/groovy.js +24 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/groovy_highlight_rules.js +183 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/haxe.js +58 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/haxe_highlight_rules.js +104 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/html.js +83 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/html_highlight_rules.js +159 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/html_highlight_rules_test.js +93 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/html_test.js +74 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/java.js +25 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/java_highlight_rules.js +144 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/javascript.js +164 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/javascript_highlight_rules.js +471 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/javascript_highlight_rules_test.js +225 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/javascript_test.js +165 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/javascript_worker.js +88 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/javascript_worker_test.js +99 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/json.js +100 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/json/json_parse.js +346 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/json_highlight_rules.js +111 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/json_worker.js +103 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/json_worker_test.js +108 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/jsx.js +53 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/jsx_highlight_rules.js +122 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/latex.js +57 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/latex_highlight_rules.js +38 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/less.js +87 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/less_highlight_rules.js +279 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/liquid.js +116 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/liquid_highlight_rules.js +220 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/liquid_highlight_rules_test.js +91 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/lua.js +87 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/lua_highlight_rules.js +436 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/luapage.js +22 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/luapage_highlight_rules.js +42 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/markdown.js +81 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/markdown_highlight_rules.js +195 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/matching_brace_outdent.js +81 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/matching_parens_outdent.js +81 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/ocaml.js +103 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/ocaml_highlight_rules.js +355 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/perl.js +117 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/perl_highlight_rules.js +168 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/pgsql.js +78 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/pgsql_highlight_rules.js +583 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/php.js +119 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/php_highlight_rules.js +1165 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/powershell.js +58 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/powershell_highlight_rules.js +138 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/python.js +147 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/python_highlight_rules.js +182 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/python_test.js +86 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/ruby.js +116 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/ruby_highlight_rules.js +194 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/ruby_highlight_rules_test.js +116 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/scad.js +132 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/scad_highlight_rules.js +168 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/scala.js +25 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/scala_highlight_rules.js +179 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/scss.js +86 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/scss_highlight_rules.js +304 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/sh.js +144 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/sh_highlight_rules.js +145 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/sql.js +70 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/sql_highlight_rules.js +89 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/svg.js +78 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/svg_highlight_rules.js +71 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/text.js +159 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/text_highlight_rules.js +109 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/text_test.js +71 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/textile.js +73 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/textile_highlight_rules.js +100 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xml.js +65 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xml_highlight_rules.js +109 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xml_highlight_rules_test.js +103 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xml_test.js +82 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xml_util.js +120 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery.js +202 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/Position.js +59 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/Readme.md +6 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/StringLexer.js +1686 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/XMLLexer.js +2993 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/XQDTLexer.js +69 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/XQDTParser.js +63 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/XQueryLexer.js +10363 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/XQueryParser.js +42525 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/XQuerySemanticHighlighter.js +165 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/antlr3-all.js +6177 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/xquery.js +55 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery_highlight_rules.js +158 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery_worker.js +86 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/yaml.js +64 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/yaml_highlight_rules.js +116 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/model/editor.js +70 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mouse/default_gutter_handler.js +73 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mouse/default_handlers.js +354 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mouse/dragdrop.js +105 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mouse/fold_handler.js +71 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mouse/mouse_event.js +140 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mouse/mouse_handler.js +158 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mouse/multi_select_handler.js +163 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/multi_select.js +762 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/multi_select_test.js +171 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/narcissus/definitions.js +696 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/narcissus/lexer.js +598 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/narcissus/options.js +61 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/narcissus/parser.js +2072 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/placeholder.js +278 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/placeholder_test.js +164 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/range.js +581 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/range_list.js +230 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/range_list_test.js +170 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/range_test.js +198 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/renderloop.js +93 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/requirejs/text.js +58 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/scrollbar.js +142 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/search.js +398 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/search_highlight.js +87 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/search_test.js +451 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/selection.js +886 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/selection_test.js +472 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/split.js +411 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/test/all.js +42 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/test/all_browser.js +136 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/test/assertions.js +63 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/test/asyncjs/assert.js +313 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/test/asyncjs/async.js +529 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/test/asyncjs/index.js +13 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/test/asyncjs/test.js +195 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/test/asyncjs/utils.js +65 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/test/benchmark.js +85 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/test/mockdom.js +10 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/test/mockrenderer.js +204 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/test/tests.html +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/chrome.css +159 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/chrome.js +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/clouds.css +118 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/clouds.js +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/clouds_midnight.css +119 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/clouds_midnight.js +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/cobalt.css +145 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/cobalt.js +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/crimson_editor.css +151 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/crimson_editor.js +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/dawn.css +149 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/dawn.js +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/dreamweaver.css +182 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/dreamweaver.js +45 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/eclipse.css +102 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/eclipse.js +48 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/github.css +133 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/github.js +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/idle_fingers.css +137 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/idle_fingers.js +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/kr_theme.css +140 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/kr_theme.js +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/merbivore.css +140 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/merbivore.js +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/merbivore_soft.css +146 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/merbivore_soft.js +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/mono_industrial.css +148 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/mono_industrial.js +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/monokai.css +145 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/monokai.js +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/pastel_on_dark.css +150 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/pastel_on_dark.js +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/solarized_dark.css +131 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/solarized_dark.js +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/solarized_light.css +130 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/solarized_light.js +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/textmate.css +165 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/textmate.js +47 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow.css +164 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow.js +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow_night.css +164 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow_night.js +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow_night_blue.css +164 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow_night_blue.js +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow_night_bright.css +164 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow_night_bright.js +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow_night_eighties.css +160 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow_night_eighties.js +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/twilight.css +162 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/twilight.js +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/vibrant_ink.css +141 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/vibrant_ink.js +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/token_iterator.js +162 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/token_iterator_test.js +219 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/tokenizer.js +195 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/undomanager.js +142 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/unicode.js +107 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/virtual_renderer.js +1402 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/virtual_renderer_test.js +93 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/worker/jshint.js +4469 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/worker/jslint.js +6396 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/worker/mirror.js +43 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/worker/worker.js +138 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/worker/worker_client.js +176 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/worker/worker_sourcemint.js +73 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/jquery.ba-throttle-debounce.min.js +2 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/livepreview.js +456 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/md_sundown.js +22 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/requirejs.min.js +35 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/sundown.js +1 -0
- data/lib/gollum/frontend/public/gollum/livepreview/licenses/ace/LICENSE.txt +476 -0
- data/lib/gollum/frontend/public/gollum/livepreview/licenses/bootstraponline_gollum/LICENSE.txt +9 -0
- data/lib/gollum/frontend/public/gollum/livepreview/licenses/debounce/LICENSE-MIT.txt +22 -0
- data/lib/gollum/frontend/public/gollum/livepreview/licenses/gollum/LICENSE.txt +21 -0
- data/lib/gollum/frontend/public/gollum/livepreview/licenses/jquery/MIT-LICENSE.txt +20 -0
- data/lib/gollum/frontend/public/gollum/livepreview/licenses/licenses.txt +59 -0
- data/lib/gollum/frontend/public/gollum/livepreview/licenses/notepages/LICENSE.txt +19 -0
- data/lib/gollum/frontend/public/gollum/livepreview/licenses/requirejs/LICENSE.txt +58 -0
- data/lib/gollum/frontend/public/gollum/livepreview/licenses/retina_display_icon_set/by_sa_3.0_unported_legalcode.txt +359 -0
- data/lib/gollum/frontend/public/gollum/livepreview/licenses/sizzle/LICENSE.txt +148 -0
- data/lib/gollum/frontend/public/gollum/livepreview/licenses/sundown/sundown.txt +4 -0
- data/lib/gollum/frontend/public/gollum/livepreview/readme.md +44 -0
- data/lib/gollum/frontend/templates/compare.mustache +9 -9
- data/lib/gollum/frontend/templates/create.mustache +4 -1
- data/lib/gollum/frontend/templates/edit.mustache +6 -3
- data/lib/gollum/frontend/templates/editor.mustache +30 -14
- data/lib/gollum/frontend/templates/file_view.mustache +32 -0
- data/lib/gollum/frontend/templates/history.mustache +8 -8
- data/lib/gollum/frontend/templates/layout.mustache +21 -14
- data/lib/gollum/frontend/templates/page.mustache +37 -14
- data/lib/gollum/frontend/templates/pages.mustache +14 -10
- data/lib/gollum/frontend/templates/search.mustache +2 -2
- data/lib/gollum/frontend/templates/searchbar.mustache +1 -1
- data/lib/gollum/frontend/uri_encode_component.rb +172 -0
- data/lib/gollum/frontend/views/compare.rb +2 -4
- data/lib/gollum/frontend/views/create.rb +5 -0
- data/lib/gollum/frontend/views/edit.rb +12 -0
- data/lib/gollum/frontend/views/file_view.rb +19 -0
- data/lib/gollum/frontend/views/has_page.rb +15 -0
- data/lib/gollum/frontend/views/history.rb +8 -4
- data/lib/gollum/frontend/views/layout.rb +9 -1
- data/lib/gollum/frontend/views/page.rb +37 -10
- data/lib/gollum/frontend/views/pages.rb +48 -0
- data/lib/gollum/git_access.rb +2 -2
- data/lib/gollum/markup.rb +115 -19
- data/lib/gollum/page.rb +79 -9
- data/lib/gollum/tex.rb +319 -42
- data/lib/gollum/wiki.rb +92 -12
- data/licenses/css_tree_menu_thecssninja/license.txt +50 -0
- data/licenses/licenses.txt +23 -0
- data/licenses/unity_asset_pool/COPYRIGHT +286 -0
- data/test/examples/lotr.git/config +1 -1
- data/test/examples/lotr.git/logs/HEAD +4 -0
- data/test/examples/lotr.git/logs/refs/heads/master +4 -0
- data/test/examples/lotr.git/objects/0d/c9016ca928c78d5421a99a53b379b53929221e +0 -0
- data/test/examples/lotr.git/objects/1c/79ddc69707f7b164bc2ea58beb5d8965ff6bd0 +0 -0
- data/test/examples/lotr.git/objects/27/680b0fce1abfbc528e7aa53d92645852d52eb6 +0 -0
- data/test/examples/lotr.git/objects/45/3b250f979c7bd6dfb62640c944c982ae6721ee +0 -0
- data/test/examples/lotr.git/objects/45/f319ee12f2b551b901b22e72602963c366fff1 +0 -0
- data/test/examples/lotr.git/objects/46/a697caf435815bb07bbce947fc2d58be15f087 +0 -0
- data/test/examples/lotr.git/objects/4c/45c2b4e297a726c3d3f66886f35373e48fe1c5 +2 -0
- data/test/examples/lotr.git/objects/4e/023f460ce466e154ca09d8774c79ad5a53fc15 +0 -0
- data/test/examples/lotr.git/objects/62/9aa678272b017a4d136d35e77ac94d80b08dc2 +1 -0
- data/test/examples/lotr.git/objects/6e/48abfc56565574859e081ee58eae655d48cf71 +0 -0
- data/test/examples/lotr.git/objects/7b/60c5a20a501a70f2317fa0ef763e1e2ce22d6b +0 -0
- data/test/examples/lotr.git/objects/7d/981cd984ad589e3cf00d8122170c6f7d685979 +0 -0
- data/test/examples/lotr.git/objects/94/9a9cc3119b9c98817f375e976d2bb5e2a42809 +0 -0
- data/test/examples/lotr.git/objects/9b/e95b960ac388d4e7db55f610f828e9c31344e6 +0 -0
- data/test/examples/lotr.git/objects/b0/de6e794dfdc7ef3400e894225bfe23308aae5c +0 -0
- data/test/examples/lotr.git/objects/b1/6b3d9fad9d78e5a669e7f33d94c96da374eccd +0 -0
- data/test/examples/lotr.git/objects/c9/6a7645db5d4c76389e77cd103ef3ed77d81e4c +0 -0
- data/test/examples/lotr.git/objects/ca/7355dc497e9729fbaf0c0e3f424b86afef5614 +0 -0
- data/test/examples/lotr.git/objects/cf/ea406f5f77afc7fb673a43e97721234385b1bd +2 -0
- data/test/examples/lotr.git/objects/d5/29304506d37f544675244c335d85cab5d29966 +0 -0
- data/test/examples/lotr.git/objects/fb/c5dd7d807707b4a0a97c1182fecfef1eced5df +1 -0
- data/test/examples/lotr.git/objects/fc/3eee516ff72dc9099ba00d4611eb02e5c9e634 +0 -0
- data/test/examples/lotr.git/objects/ff/6f7de62644369380ba73b4e4297c1a2d6f0b66 +0 -0
- data/test/examples/lotr.git/refs/heads/master +1 -1
- data/test/examples/revert.git/COMMIT_EDITMSG +1 -1
- data/test/examples/revert.git/index +0 -0
- data/test/examples/revert.git/logs/HEAD +1 -0
- data/test/examples/revert.git/logs/refs/heads/master +1 -0
- data/test/examples/revert.git/objects/10/2685c42018f802557f05db171f44443e8dacab +0 -0
- data/test/examples/revert.git/objects/8e/83f898e5e16ae400db59dda1017acad540f3aa +0 -0
- data/test/examples/revert.git/objects/ed/6c9f63b98acf73c25b5ffbb38da557d3682023 +3 -0
- data/test/examples/revert.git/refs/heads/master +1 -1
- data/test/file_view/1_file.txt +3 -0
- data/test/file_view/1_file_1_folder.txt +8 -0
- data/test/file_view/1_folder.txt +8 -0
- data/test/file_view/2_files_2_folders.txt +12 -0
- data/test/file_view/2_files_2_folders_1_root.txt +13 -0
- data/test/file_view/nested_folders.txt +28 -0
- data/test/test_app.rb +162 -12
- data/test/test_app_helpers.rb +13 -0
- data/test/test_committer.rb +1 -1
- data/test/test_file_view.rb +102 -0
- data/test/test_git_access.rb +3 -2
- data/test/test_markup.rb +45 -12
- data/test/test_page.rb +65 -1
- data/test/test_page_revert.rb +14 -2
- data/test/test_pages_view.rb +37 -0
- data/test/test_unicode.rb +110 -0
- data/test/test_wiki.rb +51 -4
- metadata +658 -239
- data/lib/gollum/frontend/public/gollum/javascript/jquery.js +0 -7179
Binary file
|
@@ -0,0 +1,617 @@
|
|
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
|
+
var oop = require("./lib/oop");
|
42
|
+
var EventEmitter = require("./lib/event_emitter").EventEmitter;
|
43
|
+
var Range = require("./range").Range;
|
44
|
+
var Anchor = require("./anchor").Anchor;
|
45
|
+
|
46
|
+
/**
|
47
|
+
* class Document
|
48
|
+
*
|
49
|
+
* Contains the text of the document. Documents are controlled by a single [[EditSession `EditSession`]]. At its core, `Document`s are just an array of strings, with each row in the document matching up to the array index.
|
50
|
+
*
|
51
|
+
*
|
52
|
+
**/
|
53
|
+
|
54
|
+
/**
|
55
|
+
* new Document([text])
|
56
|
+
* - text (String | Array): The starting text
|
57
|
+
*
|
58
|
+
* Creates a new `Document`. If `text` is included, the `Document` contains those strings; otherwise, it's empty.
|
59
|
+
*
|
60
|
+
**/
|
61
|
+
var Document = function(text) {
|
62
|
+
this.$lines = [];
|
63
|
+
|
64
|
+
// There has to be one line at least in the document. If you pass an empty
|
65
|
+
// string to the insert function, nothing will happen. Workaround.
|
66
|
+
if (text.length == 0) {
|
67
|
+
this.$lines = [""];
|
68
|
+
} else if (Array.isArray(text)) {
|
69
|
+
this.insertLines(0, text);
|
70
|
+
} else {
|
71
|
+
this.insert({row: 0, column:0}, text);
|
72
|
+
}
|
73
|
+
};
|
74
|
+
|
75
|
+
(function() {
|
76
|
+
|
77
|
+
oop.implement(this, EventEmitter);
|
78
|
+
|
79
|
+
/**
|
80
|
+
* Document.setValue(text) -> Void
|
81
|
+
* - text (String): The text to use
|
82
|
+
*
|
83
|
+
* Replaces all the lines in the current `Document` with the value of `text`.
|
84
|
+
**/
|
85
|
+
this.setValue = function(text) {
|
86
|
+
var len = this.getLength();
|
87
|
+
this.remove(new Range(0, 0, len, this.getLine(len-1).length));
|
88
|
+
this.insert({row: 0, column:0}, text);
|
89
|
+
};
|
90
|
+
|
91
|
+
/**
|
92
|
+
* Document.getValue() -> String
|
93
|
+
*
|
94
|
+
* Returns all the lines in the document as a single string, split by the new line character.
|
95
|
+
**/
|
96
|
+
this.getValue = function() {
|
97
|
+
return this.getAllLines().join(this.getNewLineCharacter());
|
98
|
+
};
|
99
|
+
|
100
|
+
/**
|
101
|
+
* Document.createAnchor(row, column) -> Anchor
|
102
|
+
* - row (Number): The row number to use
|
103
|
+
* - column (Number): The column number to use
|
104
|
+
*
|
105
|
+
* Creates a new `Anchor` to define a floating point in the document.
|
106
|
+
**/
|
107
|
+
this.createAnchor = function(row, column) {
|
108
|
+
return new Anchor(this, row, column);
|
109
|
+
};
|
110
|
+
|
111
|
+
/** internal, hide
|
112
|
+
* Document.$split(text) -> [String]
|
113
|
+
* - text (String): The text to work with
|
114
|
+
* + ([String]): A String array, with each index containing a piece of the original `text` string.
|
115
|
+
*
|
116
|
+
* Splits a string of text on any newline (`\n`) or carriage-return ('\r') characters.
|
117
|
+
*
|
118
|
+
*
|
119
|
+
**/
|
120
|
+
|
121
|
+
// check for IE split bug
|
122
|
+
if ("aaa".split(/a/).length == 0)
|
123
|
+
this.$split = function(text) {
|
124
|
+
return text.replace(/\r\n|\r/g, "\n").split("\n");
|
125
|
+
}
|
126
|
+
else
|
127
|
+
this.$split = function(text) {
|
128
|
+
return text.split(/\r\n|\r|\n/);
|
129
|
+
};
|
130
|
+
|
131
|
+
|
132
|
+
/** internal, hide
|
133
|
+
* Document.$detectNewLine(text) -> Void
|
134
|
+
*
|
135
|
+
*
|
136
|
+
**/
|
137
|
+
this.$detectNewLine = function(text) {
|
138
|
+
var match = text.match(/^.*?(\r\n|\r|\n)/m);
|
139
|
+
if (match) {
|
140
|
+
this.$autoNewLine = match[1];
|
141
|
+
} else {
|
142
|
+
this.$autoNewLine = "\n";
|
143
|
+
}
|
144
|
+
};
|
145
|
+
|
146
|
+
/**
|
147
|
+
* Document.getNewLineCharacter() -> String
|
148
|
+
* + (String): If `newLineMode == windows`, `\r\n` is returned.<br/>
|
149
|
+
* If `newLineMode == unix`, `\n` is returned.<br/>
|
150
|
+
* If `newLineMode == auto`, the value of `autoNewLine` is returned.
|
151
|
+
*
|
152
|
+
* Returns the newline character that's being used, depending on the value of `newLineMode`.
|
153
|
+
*
|
154
|
+
*
|
155
|
+
*
|
156
|
+
**/
|
157
|
+
this.getNewLineCharacter = function() {
|
158
|
+
switch (this.$newLineMode) {
|
159
|
+
case "windows":
|
160
|
+
return "\r\n";
|
161
|
+
|
162
|
+
case "unix":
|
163
|
+
return "\n";
|
164
|
+
|
165
|
+
case "auto":
|
166
|
+
return this.$autoNewLine;
|
167
|
+
}
|
168
|
+
};
|
169
|
+
|
170
|
+
this.$autoNewLine = "\n";
|
171
|
+
this.$newLineMode = "auto";
|
172
|
+
/**
|
173
|
+
* Document.setNewLineMode(newLineMode) -> Void
|
174
|
+
* - newLineMode(String): [The newline mode to use; can be either `windows`, `unix`, or `auto`]{: #Document.setNewLineMode.param}
|
175
|
+
*
|
176
|
+
* [Sets the new line mode.]{: #Document.setNewLineMode.desc}
|
177
|
+
**/
|
178
|
+
this.setNewLineMode = function(newLineMode) {
|
179
|
+
if (this.$newLineMode === newLineMode)
|
180
|
+
return;
|
181
|
+
|
182
|
+
this.$newLineMode = newLineMode;
|
183
|
+
};
|
184
|
+
|
185
|
+
/**
|
186
|
+
* Document.getNewLineMode() -> String
|
187
|
+
*
|
188
|
+
* [Returns the type of newlines being used; either `windows`, `unix`, or `auto`]{: #Document.getNewLineMode}
|
189
|
+
*
|
190
|
+
**/
|
191
|
+
this.getNewLineMode = function() {
|
192
|
+
return this.$newLineMode;
|
193
|
+
};
|
194
|
+
|
195
|
+
/**
|
196
|
+
* Document.isNewLine(text) -> Boolean
|
197
|
+
* - text (String): The text to check
|
198
|
+
*
|
199
|
+
* Returns `true` if `text` is a newline character (either `\r\n`, `\r`, or `\n`).
|
200
|
+
*
|
201
|
+
**/
|
202
|
+
this.isNewLine = function(text) {
|
203
|
+
return (text == "\r\n" || text == "\r" || text == "\n");
|
204
|
+
};
|
205
|
+
|
206
|
+
/**
|
207
|
+
* Document.getLine(row) -> String
|
208
|
+
* - row (Number): The row index to retrieve
|
209
|
+
*
|
210
|
+
* Returns a verbatim copy of the given line as it is in the document
|
211
|
+
*
|
212
|
+
**/
|
213
|
+
this.getLine = function(row) {
|
214
|
+
return this.$lines[row] || "";
|
215
|
+
};
|
216
|
+
|
217
|
+
/**
|
218
|
+
* Document.getLines(firstRow, lastRow) -> [String]
|
219
|
+
* - firstRow (Number): The first row index to retrieve
|
220
|
+
* - lastRow (Number): The final row index to retrieve
|
221
|
+
*
|
222
|
+
* Returns an array of strings of the rows between `firstRow` and `lastRow`. This function is inclusive of `lastRow`.
|
223
|
+
*
|
224
|
+
**/
|
225
|
+
this.getLines = function(firstRow, lastRow) {
|
226
|
+
return this.$lines.slice(firstRow, lastRow + 1);
|
227
|
+
};
|
228
|
+
|
229
|
+
/**
|
230
|
+
* Document.getAllLines() -> [String]
|
231
|
+
*
|
232
|
+
* Returns all lines in the document as string array. Warning: The caller should not modify this array!
|
233
|
+
**/
|
234
|
+
this.getAllLines = function() {
|
235
|
+
return this.getLines(0, this.getLength());
|
236
|
+
};
|
237
|
+
|
238
|
+
/**
|
239
|
+
* Document.getLength() -> Number
|
240
|
+
*
|
241
|
+
* Returns the number of rows in the document.
|
242
|
+
**/
|
243
|
+
this.getLength = function() {
|
244
|
+
return this.$lines.length;
|
245
|
+
};
|
246
|
+
|
247
|
+
/**
|
248
|
+
* Document.getTextRange(range) -> String
|
249
|
+
* - range (Range): The range to work with
|
250
|
+
*
|
251
|
+
* [Given a range within the document, this function returns all the text within that range as a single string.]{: #Document.getTextRange.desc}
|
252
|
+
**/
|
253
|
+
this.getTextRange = function(range) {
|
254
|
+
if (range.start.row == range.end.row) {
|
255
|
+
return this.$lines[range.start.row].substring(range.start.column,
|
256
|
+
range.end.column);
|
257
|
+
}
|
258
|
+
else {
|
259
|
+
var lines = this.getLines(range.start.row+1, range.end.row-1);
|
260
|
+
lines.unshift((this.$lines[range.start.row] || "").substring(range.start.column));
|
261
|
+
lines.push((this.$lines[range.end.row] || "").substring(0, range.end.column));
|
262
|
+
return lines.join(this.getNewLineCharacter());
|
263
|
+
}
|
264
|
+
};
|
265
|
+
|
266
|
+
/** internal, hide
|
267
|
+
* Document.$clipPosition(position) -> Number
|
268
|
+
*
|
269
|
+
*
|
270
|
+
**/
|
271
|
+
this.$clipPosition = function(position) {
|
272
|
+
var length = this.getLength();
|
273
|
+
if (position.row >= length) {
|
274
|
+
position.row = Math.max(0, length - 1);
|
275
|
+
position.column = this.getLine(length-1).length;
|
276
|
+
}
|
277
|
+
return position;
|
278
|
+
};
|
279
|
+
|
280
|
+
/**
|
281
|
+
* Document.insert(position, text) -> Number
|
282
|
+
* - position (Number): The position to start inserting at
|
283
|
+
* - text (String): A chunk of text to insert
|
284
|
+
* + (Number): The position of the last line of `text`. If the length of `text` is 0, this function simply returns `position`.
|
285
|
+
* Inserts a block of `text` and the indicated `position`.
|
286
|
+
*
|
287
|
+
*
|
288
|
+
**/
|
289
|
+
this.insert = function(position, text) {
|
290
|
+
if (!text || text.length === 0)
|
291
|
+
return position;
|
292
|
+
|
293
|
+
position = this.$clipPosition(position);
|
294
|
+
|
295
|
+
// only detect new lines if the document has no line break yet
|
296
|
+
if (this.getLength() <= 1)
|
297
|
+
this.$detectNewLine(text);
|
298
|
+
|
299
|
+
var lines = this.$split(text);
|
300
|
+
var firstLine = lines.splice(0, 1)[0];
|
301
|
+
var lastLine = lines.length == 0 ? null : lines.splice(lines.length - 1, 1)[0];
|
302
|
+
|
303
|
+
position = this.insertInLine(position, firstLine);
|
304
|
+
if (lastLine !== null) {
|
305
|
+
position = this.insertNewLine(position); // terminate first line
|
306
|
+
position = this.insertLines(position.row, lines);
|
307
|
+
position = this.insertInLine(position, lastLine || "");
|
308
|
+
}
|
309
|
+
return position;
|
310
|
+
};
|
311
|
+
|
312
|
+
/**
|
313
|
+
* Document.insertLines(row, lines) -> Object
|
314
|
+
* - row (Number): The index of the row to insert at
|
315
|
+
* - lines (Array): An array of strings
|
316
|
+
* + (Object): Returns an object containing the final row and column, like this:<br/>
|
317
|
+
* ```{row: endRow, column: 0}```<br/>
|
318
|
+
* If `lines` is empty, this function returns an object containing the current row, and column, like this:<br/>
|
319
|
+
* ```{row: row, column: 0}```
|
320
|
+
*
|
321
|
+
* Inserts the elements in `lines` into the document, starting at the row index given by `row`. This method also triggers the `'change'` event.
|
322
|
+
*
|
323
|
+
*
|
324
|
+
**/
|
325
|
+
this.insertLines = function(row, lines) {
|
326
|
+
if (lines.length == 0)
|
327
|
+
return {row: row, column: 0};
|
328
|
+
|
329
|
+
// apply doesn't work for big arrays (smallest threshold is on safari 0xFFFF)
|
330
|
+
// to circumvent that we have to break huge inserts into smaller chunks here
|
331
|
+
if (lines.length > 0xFFFF) {
|
332
|
+
var end = this.insertLines(row, lines.slice(0xFFFF));
|
333
|
+
lines = lines.slice(0, 0xFFFF);
|
334
|
+
}
|
335
|
+
|
336
|
+
var args = [row, 0];
|
337
|
+
args.push.apply(args, lines);
|
338
|
+
this.$lines.splice.apply(this.$lines, args);
|
339
|
+
|
340
|
+
var range = new Range(row, 0, row + lines.length, 0);
|
341
|
+
var delta = {
|
342
|
+
action: "insertLines",
|
343
|
+
range: range,
|
344
|
+
lines: lines
|
345
|
+
};
|
346
|
+
this._emit("change", { data: delta });
|
347
|
+
return end || range.end;
|
348
|
+
};
|
349
|
+
|
350
|
+
/**
|
351
|
+
* Document.insertNewLine(position) -> Object
|
352
|
+
* - position (String): The position to insert at
|
353
|
+
* + (Object): Returns an object containing the final row and column, like this:<br/>
|
354
|
+
* ```{row: endRow, column: 0}```
|
355
|
+
*
|
356
|
+
* Inserts a new line into the document at the current row's `position`. This method also triggers the `'change'` event.
|
357
|
+
*
|
358
|
+
*
|
359
|
+
*
|
360
|
+
**/
|
361
|
+
this.insertNewLine = function(position) {
|
362
|
+
position = this.$clipPosition(position);
|
363
|
+
var line = this.$lines[position.row] || "";
|
364
|
+
|
365
|
+
this.$lines[position.row] = line.substring(0, position.column);
|
366
|
+
this.$lines.splice(position.row + 1, 0, line.substring(position.column, line.length));
|
367
|
+
|
368
|
+
var end = {
|
369
|
+
row : position.row + 1,
|
370
|
+
column : 0
|
371
|
+
};
|
372
|
+
|
373
|
+
var delta = {
|
374
|
+
action: "insertText",
|
375
|
+
range: Range.fromPoints(position, end),
|
376
|
+
text: this.getNewLineCharacter()
|
377
|
+
};
|
378
|
+
this._emit("change", { data: delta });
|
379
|
+
|
380
|
+
return end;
|
381
|
+
};
|
382
|
+
|
383
|
+
/**
|
384
|
+
* Document.insertInLine(position, text) -> Object | Number
|
385
|
+
* - position (Number): The position to insert at
|
386
|
+
* - text (String): A chunk of text
|
387
|
+
* + (Object): Returns an object containing the final row and column, like this:<br/>
|
388
|
+
* ```{row: endRow, column: 0}```
|
389
|
+
* + (Number): If `text` is empty, this function returns the value of `position`
|
390
|
+
*
|
391
|
+
* Inserts `text` into the `position` at the current row. This method also triggers the `'change'` event.
|
392
|
+
*
|
393
|
+
*
|
394
|
+
*
|
395
|
+
**/
|
396
|
+
this.insertInLine = function(position, text) {
|
397
|
+
if (text.length == 0)
|
398
|
+
return position;
|
399
|
+
|
400
|
+
var line = this.$lines[position.row] || "";
|
401
|
+
|
402
|
+
this.$lines[position.row] = line.substring(0, position.column) + text
|
403
|
+
+ line.substring(position.column);
|
404
|
+
|
405
|
+
var end = {
|
406
|
+
row : position.row,
|
407
|
+
column : position.column + text.length
|
408
|
+
};
|
409
|
+
|
410
|
+
var delta = {
|
411
|
+
action: "insertText",
|
412
|
+
range: Range.fromPoints(position, end),
|
413
|
+
text: text
|
414
|
+
};
|
415
|
+
this._emit("change", { data: delta });
|
416
|
+
|
417
|
+
return end;
|
418
|
+
};
|
419
|
+
|
420
|
+
/**
|
421
|
+
* Document.remove(range) -> Object
|
422
|
+
* - range (Range): A specified Range to remove
|
423
|
+
* + (Object): Returns the new `start` property of the range, which contains `startRow` and `startColumn`. If `range` is empty, this function returns the unmodified value of `range.start`.
|
424
|
+
*
|
425
|
+
* Removes the `range` from the document.
|
426
|
+
*
|
427
|
+
*
|
428
|
+
**/
|
429
|
+
this.remove = function(range) {
|
430
|
+
// clip to document
|
431
|
+
range.start = this.$clipPosition(range.start);
|
432
|
+
range.end = this.$clipPosition(range.end);
|
433
|
+
|
434
|
+
if (range.isEmpty())
|
435
|
+
return range.start;
|
436
|
+
|
437
|
+
var firstRow = range.start.row;
|
438
|
+
var lastRow = range.end.row;
|
439
|
+
|
440
|
+
if (range.isMultiLine()) {
|
441
|
+
var firstFullRow = range.start.column == 0 ? firstRow : firstRow + 1;
|
442
|
+
var lastFullRow = lastRow - 1;
|
443
|
+
|
444
|
+
if (range.end.column > 0)
|
445
|
+
this.removeInLine(lastRow, 0, range.end.column);
|
446
|
+
|
447
|
+
if (lastFullRow >= firstFullRow)
|
448
|
+
this.removeLines(firstFullRow, lastFullRow);
|
449
|
+
|
450
|
+
if (firstFullRow != firstRow) {
|
451
|
+
this.removeInLine(firstRow, range.start.column, this.getLine(firstRow).length);
|
452
|
+
this.removeNewLine(range.start.row);
|
453
|
+
}
|
454
|
+
}
|
455
|
+
else {
|
456
|
+
this.removeInLine(firstRow, range.start.column, range.end.column);
|
457
|
+
}
|
458
|
+
return range.start;
|
459
|
+
};
|
460
|
+
|
461
|
+
/**
|
462
|
+
* Document.removeInLine(row, startColumn, endColumn) -> Object
|
463
|
+
* - row (Number): The row to remove from
|
464
|
+
* - startColumn (Number): The column to start removing at
|
465
|
+
* - endColumn (Number): The column to stop removing at
|
466
|
+
* + (Object): Returns an object containing `startRow` and `startColumn`, indicating the new row and column values.<br/>If `startColumn` is equal to `endColumn`, this function returns nothing.
|
467
|
+
*
|
468
|
+
* Removes the specified columns from the `row`. This method also triggers the `'change'` event.
|
469
|
+
*
|
470
|
+
*
|
471
|
+
**/
|
472
|
+
this.removeInLine = function(row, startColumn, endColumn) {
|
473
|
+
if (startColumn == endColumn)
|
474
|
+
return;
|
475
|
+
|
476
|
+
var range = new Range(row, startColumn, row, endColumn);
|
477
|
+
var line = this.getLine(row);
|
478
|
+
var removed = line.substring(startColumn, endColumn);
|
479
|
+
var newLine = line.substring(0, startColumn) + line.substring(endColumn, line.length);
|
480
|
+
this.$lines.splice(row, 1, newLine);
|
481
|
+
|
482
|
+
var delta = {
|
483
|
+
action: "removeText",
|
484
|
+
range: range,
|
485
|
+
text: removed
|
486
|
+
};
|
487
|
+
this._emit("change", { data: delta });
|
488
|
+
return range.start;
|
489
|
+
};
|
490
|
+
|
491
|
+
/**
|
492
|
+
* Document.removeLines(firstRow, lastRow) -> [String]
|
493
|
+
* - firstRow (Number): The first row to be removed
|
494
|
+
* - lastRow (Number): The last row to be removed
|
495
|
+
* + ([String]): Returns all the removed lines.
|
496
|
+
*
|
497
|
+
* Removes a range of full lines. This method also triggers the `'change'` event.
|
498
|
+
*
|
499
|
+
*
|
500
|
+
**/
|
501
|
+
this.removeLines = function(firstRow, lastRow) {
|
502
|
+
var range = new Range(firstRow, 0, lastRow + 1, 0);
|
503
|
+
var removed = this.$lines.splice(firstRow, lastRow - firstRow + 1);
|
504
|
+
|
505
|
+
var delta = {
|
506
|
+
action: "removeLines",
|
507
|
+
range: range,
|
508
|
+
nl: this.getNewLineCharacter(),
|
509
|
+
lines: removed
|
510
|
+
};
|
511
|
+
this._emit("change", { data: delta });
|
512
|
+
return removed;
|
513
|
+
};
|
514
|
+
|
515
|
+
/**
|
516
|
+
* Document.removeNewLine(row) -> Void
|
517
|
+
* - row (Number): The row to check
|
518
|
+
*
|
519
|
+
* Removes the new line between `row` and the row immediately following it. This method also triggers the `'change'` event.
|
520
|
+
*
|
521
|
+
**/
|
522
|
+
this.removeNewLine = function(row) {
|
523
|
+
var firstLine = this.getLine(row);
|
524
|
+
var secondLine = this.getLine(row+1);
|
525
|
+
|
526
|
+
var range = new Range(row, firstLine.length, row+1, 0);
|
527
|
+
var line = firstLine + secondLine;
|
528
|
+
|
529
|
+
this.$lines.splice(row, 2, line);
|
530
|
+
|
531
|
+
var delta = {
|
532
|
+
action: "removeText",
|
533
|
+
range: range,
|
534
|
+
text: this.getNewLineCharacter()
|
535
|
+
};
|
536
|
+
this._emit("change", { data: delta });
|
537
|
+
};
|
538
|
+
|
539
|
+
/**
|
540
|
+
* Document.replace(range, text) -> Object
|
541
|
+
* - range (Range): A specified Range to replace
|
542
|
+
* - text (String): The new text to use as a replacement
|
543
|
+
* + (Object): Returns an object containing the final row and column, like this:
|
544
|
+
* {row: endRow, column: 0}
|
545
|
+
* If the text and range are empty, this function returns an object containing the current `range.start` value.
|
546
|
+
* If the text is the exact same as what currently exists, this function returns an object containing the current `range.end` value.
|
547
|
+
*
|
548
|
+
* Replaces a range in the document with the new `text`.
|
549
|
+
*
|
550
|
+
**/
|
551
|
+
this.replace = function(range, text) {
|
552
|
+
if (text.length == 0 && range.isEmpty())
|
553
|
+
return range.start;
|
554
|
+
|
555
|
+
// Shortcut: If the text we want to insert is the same as it is already
|
556
|
+
// in the document, we don't have to replace anything.
|
557
|
+
if (text == this.getTextRange(range))
|
558
|
+
return range.end;
|
559
|
+
|
560
|
+
this.remove(range);
|
561
|
+
if (text) {
|
562
|
+
var end = this.insert(range.start, text);
|
563
|
+
}
|
564
|
+
else {
|
565
|
+
end = range.start;
|
566
|
+
}
|
567
|
+
|
568
|
+
return end;
|
569
|
+
};
|
570
|
+
|
571
|
+
/**
|
572
|
+
* Document.applyDeltas(deltas) -> Void
|
573
|
+
*
|
574
|
+
* Applies all the changes previously accumulated. These can be either `'includeText'`, `'insertLines'`, `'removeText'`, and `'removeLines'`.
|
575
|
+
**/
|
576
|
+
this.applyDeltas = function(deltas) {
|
577
|
+
for (var i=0; i<deltas.length; i++) {
|
578
|
+
var delta = deltas[i];
|
579
|
+
var range = Range.fromPoints(delta.range.start, delta.range.end);
|
580
|
+
|
581
|
+
if (delta.action == "insertLines")
|
582
|
+
this.insertLines(range.start.row, delta.lines);
|
583
|
+
else if (delta.action == "insertText")
|
584
|
+
this.insert(range.start, delta.text);
|
585
|
+
else if (delta.action == "removeLines")
|
586
|
+
this.removeLines(range.start.row, range.end.row - 1);
|
587
|
+
else if (delta.action == "removeText")
|
588
|
+
this.remove(range);
|
589
|
+
}
|
590
|
+
};
|
591
|
+
|
592
|
+
/**
|
593
|
+
* Document.revertDeltas(deltas) -> Void
|
594
|
+
*
|
595
|
+
* Reverts any changes previously applied. These can be either `'includeText'`, `'insertLines'`, `'removeText'`, and `'removeLines'`.
|
596
|
+
**/
|
597
|
+
this.revertDeltas = function(deltas) {
|
598
|
+
for (var i=deltas.length-1; i>=0; i--) {
|
599
|
+
var delta = deltas[i];
|
600
|
+
|
601
|
+
var range = Range.fromPoints(delta.range.start, delta.range.end);
|
602
|
+
|
603
|
+
if (delta.action == "insertLines")
|
604
|
+
this.removeLines(range.start.row, range.end.row - 1);
|
605
|
+
else if (delta.action == "insertText")
|
606
|
+
this.remove(range);
|
607
|
+
else if (delta.action == "removeLines")
|
608
|
+
this.insertLines(range.start.row, delta.lines);
|
609
|
+
else if (delta.action == "removeText")
|
610
|
+
this.insert(range.start, delta.text);
|
611
|
+
}
|
612
|
+
};
|
613
|
+
|
614
|
+
}).call(Document.prototype);
|
615
|
+
|
616
|
+
exports.Document = Document;
|
617
|
+
});
|