milksteak 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +1 -14
- data/.rspec +2 -0
- data/Gemfile +1 -1
- data/Guardfile +8 -0
- data/Rakefile +0 -1
- data/Readme.md +37 -0
- data/lib/helpers.rb +0 -0
- data/lib/milksteak/cms.rb +17 -0
- data/lib/milksteak/version.rb +1 -1
- data/lib/milksteak.rb +52 -1
- data/lib/models/page.rb +73 -0
- data/lib/models/user.rb +5 -0
- data/lib/public/milksteak/codemirror2/keymap/emacs.js +29 -0
- data/lib/public/milksteak/codemirror2/keymap/vim.js +347 -0
- data/lib/public/milksteak/codemirror2/lib/codemirror.css +110 -0
- data/lib/public/milksteak/codemirror2/lib/codemirror.js +2887 -0
- data/lib/public/milksteak/codemirror2/lib/util/dialog.css +23 -0
- data/lib/public/milksteak/codemirror2/lib/util/dialog.js +63 -0
- data/lib/public/milksteak/codemirror2/lib/util/foldcode.js +186 -0
- data/lib/public/milksteak/codemirror2/lib/util/formatting.js +294 -0
- data/lib/public/milksteak/codemirror2/lib/util/javascript-hint.js +132 -0
- data/lib/public/milksteak/codemirror2/lib/util/match-highlighter.js +44 -0
- data/lib/public/milksteak/codemirror2/lib/util/overlay.js +51 -0
- data/lib/public/milksteak/codemirror2/lib/util/runmode.js +49 -0
- data/lib/public/milksteak/codemirror2/lib/util/search.js +114 -0
- data/lib/public/milksteak/codemirror2/lib/util/searchcursor.js +117 -0
- data/lib/public/milksteak/codemirror2/lib/util/simple-hint.css +16 -0
- data/lib/public/milksteak/codemirror2/lib/util/simple-hint.js +66 -0
- data/lib/public/milksteak/codemirror2/mode/clike/clike.js +234 -0
- data/lib/public/milksteak/codemirror2/mode/clike/index.html +101 -0
- data/lib/public/milksteak/codemirror2/mode/clojure/clojure.js +207 -0
- data/lib/public/milksteak/codemirror2/mode/clojure/index.html +66 -0
- data/lib/public/milksteak/codemirror2/mode/coffeescript/LICENSE +22 -0
- data/lib/public/milksteak/codemirror2/mode/coffeescript/coffeescript.js +341 -0
- data/lib/public/milksteak/codemirror2/mode/coffeescript/index.html +721 -0
- data/lib/public/milksteak/codemirror2/mode/css/css.js +124 -0
- data/lib/public/milksteak/codemirror2/mode/css/index.html +55 -0
- data/lib/public/milksteak/codemirror2/mode/diff/diff.css +3 -0
- data/lib/public/milksteak/codemirror2/mode/diff/diff.js +13 -0
- data/lib/public/milksteak/codemirror2/mode/diff/index.html +99 -0
- data/lib/public/milksteak/codemirror2/mode/ecl/ecl.js +203 -0
- data/lib/public/milksteak/codemirror2/mode/ecl/index.html +42 -0
- data/lib/public/milksteak/codemirror2/mode/gfm/gfm.js +108 -0
- data/lib/public/milksteak/codemirror2/mode/gfm/index.html +47 -0
- data/lib/public/milksteak/codemirror2/mode/go/go.js +170 -0
- data/lib/public/milksteak/codemirror2/mode/go/index.html +72 -0
- data/lib/public/milksteak/codemirror2/mode/groovy/groovy.js +210 -0
- data/lib/public/milksteak/codemirror2/mode/groovy/index.html +71 -0
- data/lib/public/milksteak/codemirror2/mode/haskell/haskell.js +242 -0
- data/lib/public/milksteak/codemirror2/mode/haskell/index.html +60 -0
- data/lib/public/milksteak/codemirror2/mode/htmlembedded/htmlembedded.js +68 -0
- data/lib/public/milksteak/codemirror2/mode/htmlembedded/index.html +49 -0
- data/lib/public/milksteak/codemirror2/mode/htmlmixed/htmlmixed.js +83 -0
- data/lib/public/milksteak/codemirror2/mode/htmlmixed/index.html +51 -0
- data/lib/public/milksteak/codemirror2/mode/javascript/index.html +77 -0
- data/lib/public/milksteak/codemirror2/mode/javascript/javascript.js +360 -0
- data/lib/public/milksteak/codemirror2/mode/jinja2/index.html +37 -0
- data/lib/public/milksteak/codemirror2/mode/jinja2/jinja2.js +42 -0
- data/lib/public/milksteak/codemirror2/mode/less/index.html +577 -0
- data/lib/public/milksteak/codemirror2/mode/less/less.js +186 -0
- data/lib/public/milksteak/codemirror2/mode/lua/index.html +72 -0
- data/lib/public/milksteak/codemirror2/mode/lua/lua.js +140 -0
- data/lib/public/milksteak/codemirror2/mode/markdown/index.html +339 -0
- data/lib/public/milksteak/codemirror2/mode/markdown/markdown.js +276 -0
- data/lib/public/milksteak/codemirror2/mode/mysql/index.html +41 -0
- data/lib/public/milksteak/codemirror2/mode/mysql/mysql.js +188 -0
- data/lib/public/milksteak/codemirror2/mode/ntriples/index.html +32 -0
- data/lib/public/milksteak/codemirror2/mode/ntriples/ntriples.js +172 -0
- data/lib/public/milksteak/codemirror2/mode/pascal/LICENSE +7 -0
- data/lib/public/milksteak/codemirror2/mode/pascal/index.html +48 -0
- data/lib/public/milksteak/codemirror2/mode/pascal/pascal.js +94 -0
- data/lib/public/milksteak/codemirror2/mode/perl/LICENSE +19 -0
- data/lib/public/milksteak/codemirror2/mode/perl/index.html +62 -0
- data/lib/public/milksteak/codemirror2/mode/perl/perl.js +816 -0
- data/lib/public/milksteak/codemirror2/mode/php/index.html +48 -0
- data/lib/public/milksteak/codemirror2/mode/php/php.js +150 -0
- data/lib/public/milksteak/codemirror2/mode/plsql/index.html +62 -0
- data/lib/public/milksteak/codemirror2/mode/plsql/plsql.js +217 -0
- data/lib/public/milksteak/codemirror2/mode/properties/index.html +40 -0
- data/lib/public/milksteak/codemirror2/mode/properties/properties.css +3 -0
- data/lib/public/milksteak/codemirror2/mode/properties/properties.js +57 -0
- data/lib/public/milksteak/codemirror2/mode/python/LICENSE.txt +21 -0
- data/lib/public/milksteak/codemirror2/mode/python/index.html +122 -0
- data/lib/public/milksteak/codemirror2/mode/python/python.js +340 -0
- data/lib/public/milksteak/codemirror2/mode/r/LICENSE +24 -0
- data/lib/public/milksteak/codemirror2/mode/r/index.html +73 -0
- data/lib/public/milksteak/codemirror2/mode/r/r.js +141 -0
- data/lib/public/milksteak/codemirror2/mode/rpm/changes/changes.js +19 -0
- data/lib/public/milksteak/codemirror2/mode/rpm/changes/index.html +53 -0
- data/lib/public/milksteak/codemirror2/mode/rpm/spec/index.html +99 -0
- data/lib/public/milksteak/codemirror2/mode/rpm/spec/spec.css +5 -0
- data/lib/public/milksteak/codemirror2/mode/rpm/spec/spec.js +66 -0
- data/lib/public/milksteak/codemirror2/mode/rst/index.html +525 -0
- data/lib/public/milksteak/codemirror2/mode/rst/rst.js +326 -0
- data/lib/public/milksteak/codemirror2/mode/ruby/LICENSE +24 -0
- data/lib/public/milksteak/codemirror2/mode/ruby/index.html +171 -0
- data/lib/public/milksteak/codemirror2/mode/ruby/ruby.js +200 -0
- data/lib/public/milksteak/codemirror2/mode/rust/index.html +48 -0
- data/lib/public/milksteak/codemirror2/mode/rust/rust.js +432 -0
- data/lib/public/milksteak/codemirror2/mode/scheme/index.html +64 -0
- data/lib/public/milksteak/codemirror2/mode/scheme/scheme.js +202 -0
- data/lib/public/milksteak/codemirror2/mode/smalltalk/index.html +55 -0
- data/lib/public/milksteak/codemirror2/mode/smalltalk/smalltalk.js +139 -0
- data/lib/public/milksteak/codemirror2/mode/sparql/index.html +40 -0
- data/lib/public/milksteak/codemirror2/mode/sparql/sparql.js +143 -0
- data/lib/public/milksteak/codemirror2/mode/stex/index.html +95 -0
- data/lib/public/milksteak/codemirror2/mode/stex/stex.js +167 -0
- data/lib/public/milksteak/codemirror2/mode/tiddlywiki/index.html +183 -0
- data/lib/public/milksteak/codemirror2/mode/tiddlywiki/tiddlywiki.css +21 -0
- data/lib/public/milksteak/codemirror2/mode/tiddlywiki/tiddlywiki.js +374 -0
- data/lib/public/milksteak/codemirror2/mode/velocity/index.html +103 -0
- data/lib/public/milksteak/codemirror2/mode/velocity/velocity.js +146 -0
- data/lib/public/milksteak/codemirror2/mode/verilog/index.html +210 -0
- data/lib/public/milksteak/codemirror2/mode/verilog/verilog.js +194 -0
- data/lib/public/milksteak/codemirror2/mode/xml/index.html +45 -0
- data/lib/public/milksteak/codemirror2/mode/xml/xml.js +267 -0
- data/lib/public/milksteak/codemirror2/mode/xmlpure/index.html +59 -0
- data/lib/public/milksteak/codemirror2/mode/xmlpure/xmlpure.js +490 -0
- data/lib/public/milksteak/codemirror2/mode/yaml/index.html +67 -0
- data/lib/public/milksteak/codemirror2/mode/yaml/yaml.js +95 -0
- data/lib/public/milksteak/codemirror2/theme/cobalt.css +18 -0
- data/lib/public/milksteak/codemirror2/theme/eclipse.css +25 -0
- data/lib/public/milksteak/codemirror2/theme/elegant.css +10 -0
- data/lib/public/milksteak/codemirror2/theme/monokai.css +28 -0
- data/lib/public/milksteak/codemirror2/theme/neat.css +9 -0
- data/lib/public/milksteak/codemirror2/theme/night.css +21 -0
- data/lib/public/milksteak/codemirror2/theme/rubyblue.css +21 -0
- data/lib/public/milksteak/css/bootstrap-responsive.css +567 -0
- data/lib/public/milksteak/css/bootstrap-responsive.min.css +3 -0
- data/lib/public/milksteak/css/bootstrap.css +3365 -0
- data/lib/public/milksteak/css/bootstrap.min.css +610 -0
- data/lib/public/milksteak/css/calendrical.css +69 -0
- data/lib/public/milksteak/css/prettify.css +52 -0
- data/lib/public/milksteak/css/style.css +8 -0
- data/lib/public/milksteak/img/glyphicons-halflings-white.png +0 -0
- data/lib/public/milksteak/img/glyphicons-halflings.png +0 -0
- data/lib/public/milksteak/img/spinner.gif +0 -0
- data/lib/public/milksteak/jqueryFileTree/connectors/jqueryFileTree.asp +44 -0
- data/lib/public/milksteak/jqueryFileTree/connectors/jqueryFileTree.aspx +31 -0
- data/lib/public/milksteak/jqueryFileTree/connectors/jqueryFileTree.cf +19 -0
- data/lib/public/milksteak/jqueryFileTree/connectors/jqueryFileTree.jsp +49 -0
- data/lib/public/milksteak/jqueryFileTree/connectors/jqueryFileTree.php +43 -0
- data/lib/public/milksteak/jqueryFileTree/connectors/jqueryFileTree.pl +102 -0
- data/lib/public/milksteak/jqueryFileTree/connectors/jqueryFileTree.py +25 -0
- data/lib/public/milksteak/jqueryFileTree/connectors/jqueryFileTree.rb +61 -0
- data/lib/public/milksteak/jqueryFileTree/connectors/jqueryFileTree_huck.lasso +36 -0
- data/lib/public/milksteak/jqueryFileTree/connectors/jqueryFileTree_sabourdin.lasso +48 -0
- data/lib/public/milksteak/jqueryFileTree/images/application.png +0 -0
- data/lib/public/milksteak/jqueryFileTree/images/code.png +0 -0
- data/lib/public/milksteak/jqueryFileTree/images/css.png +0 -0
- data/lib/public/milksteak/jqueryFileTree/images/db.png +0 -0
- data/lib/public/milksteak/jqueryFileTree/images/directory.png +0 -0
- data/lib/public/milksteak/jqueryFileTree/images/doc.png +0 -0
- data/lib/public/milksteak/jqueryFileTree/images/file.png +0 -0
- data/lib/public/milksteak/jqueryFileTree/images/film.png +0 -0
- data/lib/public/milksteak/jqueryFileTree/images/flash.png +0 -0
- data/lib/public/milksteak/jqueryFileTree/images/folder_open.png +0 -0
- data/lib/public/milksteak/jqueryFileTree/images/html.png +0 -0
- data/lib/public/milksteak/jqueryFileTree/images/java.png +0 -0
- data/lib/public/milksteak/jqueryFileTree/images/linux.png +0 -0
- data/lib/public/milksteak/jqueryFileTree/images/music.png +0 -0
- data/lib/public/milksteak/jqueryFileTree/images/pdf.png +0 -0
- data/lib/public/milksteak/jqueryFileTree/images/php.png +0 -0
- data/lib/public/milksteak/jqueryFileTree/images/picture.png +0 -0
- data/lib/public/milksteak/jqueryFileTree/images/ppt.png +0 -0
- data/lib/public/milksteak/jqueryFileTree/images/psd.png +0 -0
- data/lib/public/milksteak/jqueryFileTree/images/ruby.png +0 -0
- data/lib/public/milksteak/jqueryFileTree/images/script.png +0 -0
- data/lib/public/milksteak/jqueryFileTree/images/spinner.gif +0 -0
- data/lib/public/milksteak/jqueryFileTree/images/txt.png +0 -0
- data/lib/public/milksteak/jqueryFileTree/images/xls.png +0 -0
- data/lib/public/milksteak/jqueryFileTree/images/zip.png +0 -0
- data/lib/public/milksteak/jqueryFileTree/jqueryFileTree.css +91 -0
- data/lib/public/milksteak/jqueryFileTree/jqueryFileTree.js +95 -0
- data/lib/public/milksteak/js/app.js +0 -0
- data/lib/public/milksteak/js/backbone.js +1290 -0
- data/lib/public/milksteak/js/bootstrap-alert.js +91 -0
- data/lib/public/milksteak/js/bootstrap-button.js +98 -0
- data/lib/public/milksteak/js/bootstrap-carousel.js +154 -0
- data/lib/public/milksteak/js/bootstrap-collapse.js +136 -0
- data/lib/public/milksteak/js/bootstrap-dropdown.js +92 -0
- data/lib/public/milksteak/js/bootstrap-modal.js +209 -0
- data/lib/public/milksteak/js/bootstrap-popover.js +95 -0
- data/lib/public/milksteak/js/bootstrap-scrollspy.js +125 -0
- data/lib/public/milksteak/js/bootstrap-tab.js +130 -0
- data/lib/public/milksteak/js/bootstrap-tooltip.js +270 -0
- data/lib/public/milksteak/js/bootstrap-transition.js +51 -0
- data/lib/public/milksteak/js/bootstrap-typeahead.js +271 -0
- data/lib/public/milksteak/js/bootstrap.js +1722 -0
- data/lib/public/milksteak/js/bootstrap.min.js +1 -0
- data/lib/public/milksteak/js/jquery-ui.min.js +15 -0
- data/lib/public/milksteak/js/jquery.calendrical.js +490 -0
- data/lib/public/milksteak/js/jquery.easing.js +146 -0
- data/lib/public/milksteak/js/jquery.js +9252 -0
- data/lib/public/milksteak/js/mustache.js +536 -0
- data/lib/public/milksteak/js/prettify.js +28 -0
- data/lib/public/milksteak/js/underscore.js +999 -0
- data/lib/public/milksteak/markitup/.DS_Store +0 -0
- data/lib/public/milksteak/markitup/jquery.markitup.js +593 -0
- data/lib/public/milksteak/markitup/sets/default/images/bold.png +0 -0
- data/lib/public/milksteak/markitup/sets/default/images/clean.png +0 -0
- data/lib/public/milksteak/markitup/sets/default/images/image.png +0 -0
- data/lib/public/milksteak/markitup/sets/default/images/italic.png +0 -0
- data/lib/public/milksteak/markitup/sets/default/images/link.png +0 -0
- data/lib/public/milksteak/markitup/sets/default/images/list-bullet.png +0 -0
- data/lib/public/milksteak/markitup/sets/default/images/list-numeric.png +0 -0
- data/lib/public/milksteak/markitup/sets/default/images/picture.png +0 -0
- data/lib/public/milksteak/markitup/sets/default/images/preview.png +0 -0
- data/lib/public/milksteak/markitup/sets/default/images/stroke.png +0 -0
- data/lib/public/milksteak/markitup/sets/default/set.js +30 -0
- data/lib/public/milksteak/markitup/sets/default/style.css +34 -0
- data/lib/public/milksteak/markitup/sets/textile/images/bold.png +0 -0
- data/lib/public/milksteak/markitup/sets/textile/images/code.png +0 -0
- data/lib/public/milksteak/markitup/sets/textile/images/h1.png +0 -0
- data/lib/public/milksteak/markitup/sets/textile/images/h2.png +0 -0
- data/lib/public/milksteak/markitup/sets/textile/images/h3.png +0 -0
- data/lib/public/milksteak/markitup/sets/textile/images/h4.png +0 -0
- data/lib/public/milksteak/markitup/sets/textile/images/h5.png +0 -0
- data/lib/public/milksteak/markitup/sets/textile/images/h6.png +0 -0
- data/lib/public/milksteak/markitup/sets/textile/images/italic.png +0 -0
- data/lib/public/milksteak/markitup/sets/textile/images/link.png +0 -0
- data/lib/public/milksteak/markitup/sets/textile/images/list-bullet.png +0 -0
- data/lib/public/milksteak/markitup/sets/textile/images/list-numeric.png +0 -0
- data/lib/public/milksteak/markitup/sets/textile/images/paragraph.png +0 -0
- data/lib/public/milksteak/markitup/sets/textile/images/picture.png +0 -0
- data/lib/public/milksteak/markitup/sets/textile/images/preview.png +0 -0
- data/lib/public/milksteak/markitup/sets/textile/images/quotes.png +0 -0
- data/lib/public/milksteak/markitup/sets/textile/images/stroke.png +0 -0
- data/lib/public/milksteak/markitup/sets/textile/set.js +33 -0
- data/lib/public/milksteak/markitup/sets/textile/style.css +60 -0
- data/lib/public/milksteak/markitup/skins/markitup/images/bg-container.png +0 -0
- data/lib/public/milksteak/markitup/skins/markitup/images/bg-editor-bbcode.png +0 -0
- data/lib/public/milksteak/markitup/skins/markitup/images/bg-editor-dotclear.png +0 -0
- data/lib/public/milksteak/markitup/skins/markitup/images/bg-editor-html.png +0 -0
- data/lib/public/milksteak/markitup/skins/markitup/images/bg-editor-json.png +0 -0
- data/lib/public/milksteak/markitup/skins/markitup/images/bg-editor-markdown.png +0 -0
- data/lib/public/milksteak/markitup/skins/markitup/images/bg-editor-textile.png +0 -0
- data/lib/public/milksteak/markitup/skins/markitup/images/bg-editor-wiki.png +0 -0
- data/lib/public/milksteak/markitup/skins/markitup/images/bg-editor-xml.png +0 -0
- data/lib/public/milksteak/markitup/skins/markitup/images/bg-editor.png +0 -0
- data/lib/public/milksteak/markitup/skins/markitup/images/handle.png +0 -0
- data/lib/public/milksteak/markitup/skins/markitup/images/menu.png +0 -0
- data/lib/public/milksteak/markitup/skins/markitup/images/submenu.png +0 -0
- data/lib/public/milksteak/markitup/skins/markitup/style.css +147 -0
- data/lib/public/milksteak/markitup/skins/simple/images/handle.png +0 -0
- data/lib/public/milksteak/markitup/skins/simple/images/menu.png +0 -0
- data/lib/public/milksteak/markitup/skins/simple/images/submenu.png +0 -0
- data/lib/public/milksteak/markitup/skins/simple/style.css +118 -0
- data/lib/public/milksteak/markitup/templates/preview.css +5 -0
- data/lib/public/milksteak/markitup/templates/preview.html +11 -0
- data/lib/public/milksteak/uploadify-v2.1.4/cancel.png +0 -0
- data/lib/public/milksteak/uploadify-v2.1.4/check.php +35 -0
- data/lib/public/milksteak/uploadify-v2.1.4/expressInstall.swf +0 -0
- data/lib/public/milksteak/uploadify-v2.1.4/jquery-1.4.2.min.js +154 -0
- data/lib/public/milksteak/uploadify-v2.1.4/jquery.uploadify.v2.1.4.js +296 -0
- data/lib/public/milksteak/uploadify-v2.1.4/jquery.uploadify.v2.1.4.min.js +26 -0
- data/lib/public/milksteak/uploadify-v2.1.4/swfobject.js +4 -0
- data/lib/public/milksteak/uploadify-v2.1.4/uploadify.allglyphs.swf +0 -0
- data/lib/public/milksteak/uploadify-v2.1.4/uploadify.css +53 -0
- data/lib/public/milksteak/uploadify-v2.1.4/uploadify.fla +0 -0
- data/lib/public/milksteak/uploadify-v2.1.4/uploadify.php +46 -0
- data/lib/public/milksteak/uploadify-v2.1.4/uploadify.swf +0 -0
- data/lib/public/milksteak/wmd/Markdown.Converter.js +1332 -0
- data/lib/public/milksteak/wmd/Markdown.Editor.js +2160 -0
- data/lib/public/milksteak/wmd/Markdown.Sanitizer.js +108 -0
- data/lib/public/milksteak/wmd/wmd-buttons.png +0 -0
- data/lib/public/milksteak/wmd/wmd.css +103 -0
- data/lib/public/milksteak/wymeditor/iframe/default/lbl-blockquote.png +0 -0
- data/lib/public/milksteak/wymeditor/iframe/default/lbl-h1.png +0 -0
- data/lib/public/milksteak/wymeditor/iframe/default/lbl-h2.png +0 -0
- data/lib/public/milksteak/wymeditor/iframe/default/lbl-h3.png +0 -0
- data/lib/public/milksteak/wymeditor/iframe/default/lbl-h4.png +0 -0
- data/lib/public/milksteak/wymeditor/iframe/default/lbl-h5.png +0 -0
- data/lib/public/milksteak/wymeditor/iframe/default/lbl-h6.png +0 -0
- data/lib/public/milksteak/wymeditor/iframe/default/lbl-p.png +0 -0
- data/lib/public/milksteak/wymeditor/iframe/default/lbl-pre.png +0 -0
- data/lib/public/milksteak/wymeditor/iframe/default/wymiframe.css +90 -0
- data/lib/public/milksteak/wymeditor/iframe/default/wymiframe.html +26 -0
- data/lib/public/milksteak/wymeditor/jquery.wymeditor.js +4688 -0
- data/lib/public/milksteak/wymeditor/jquery.wymeditor.min.js +1 -0
- data/lib/public/milksteak/wymeditor/jquery.wymeditor.pack.js +1 -0
- data/lib/public/milksteak/wymeditor/lang/bg.js +45 -0
- data/lib/public/milksteak/wymeditor/lang/ca.js +45 -0
- data/lib/public/milksteak/wymeditor/lang/cs.js +45 -0
- data/lib/public/milksteak/wymeditor/lang/cy.js +45 -0
- data/lib/public/milksteak/wymeditor/lang/de.js +45 -0
- data/lib/public/milksteak/wymeditor/lang/en.js +45 -0
- data/lib/public/milksteak/wymeditor/lang/es.js +45 -0
- data/lib/public/milksteak/wymeditor/lang/fa.js +46 -0
- data/lib/public/milksteak/wymeditor/lang/fi.js +44 -0
- data/lib/public/milksteak/wymeditor/lang/fr.js +45 -0
- data/lib/public/milksteak/wymeditor/lang/gl.js +45 -0
- data/lib/public/milksteak/wymeditor/lang/he.js +45 -0
- data/lib/public/milksteak/wymeditor/lang/hr.js +45 -0
- data/lib/public/milksteak/wymeditor/lang/hu.js +45 -0
- data/lib/public/milksteak/wymeditor/lang/it.js +45 -0
- data/lib/public/milksteak/wymeditor/lang/nb.js +45 -0
- data/lib/public/milksteak/wymeditor/lang/nl.js +45 -0
- data/lib/public/milksteak/wymeditor/lang/nn.js +45 -0
- data/lib/public/milksteak/wymeditor/lang/pl.js +45 -0
- data/lib/public/milksteak/wymeditor/lang/pt-br.js +45 -0
- data/lib/public/milksteak/wymeditor/lang/pt.js +45 -0
- data/lib/public/milksteak/wymeditor/lang/ru.js +45 -0
- data/lib/public/milksteak/wymeditor/lang/sv.js +45 -0
- data/lib/public/milksteak/wymeditor/lang/tr.js +45 -0
- data/lib/public/milksteak/wymeditor/lang/zh_cn.js +47 -0
- data/lib/public/milksteak/wymeditor/plugins/embed/jquery.wymeditor.embed.js +52 -0
- data/lib/public/milksteak/wymeditor/plugins/fullscreen/icon_fullscreen.gif +0 -0
- data/lib/public/milksteak/wymeditor/plugins/fullscreen/jquery.wymeditor.fullscreen.js +127 -0
- data/lib/public/milksteak/wymeditor/plugins/hovertools/jquery.wymeditor.hovertools.js +57 -0
- data/lib/public/milksteak/wymeditor/plugins/resizable/jquery.wymeditor.resizable.js +91 -0
- data/lib/public/milksteak/wymeditor/plugins/resizable/readme.txt +124 -0
- data/lib/public/milksteak/wymeditor/plugins/tidy/README +19 -0
- data/lib/public/milksteak/wymeditor/plugins/tidy/jquery.wymeditor.tidy.js +82 -0
- data/lib/public/milksteak/wymeditor/plugins/tidy/tidy.php +36 -0
- data/lib/public/milksteak/wymeditor/plugins/tidy/wand.png +0 -0
- data/lib/public/milksteak/wymeditor/skins/compact/icons.png +0 -0
- data/lib/public/milksteak/wymeditor/skins/compact/skin.css +134 -0
- data/lib/public/milksteak/wymeditor/skins/compact/skin.js +35 -0
- data/lib/public/milksteak/wymeditor/skins/default/icons.png +0 -0
- data/lib/public/milksteak/wymeditor/skins/default/skin.css +133 -0
- data/lib/public/milksteak/wymeditor/skins/default/skin.js +40 -0
- data/lib/public/milksteak/wymeditor/skins/minimal/images/bg.header.gif +0 -0
- data/lib/public/milksteak/wymeditor/skins/minimal/images/bg.selector.silver.gif +0 -0
- data/lib/public/milksteak/wymeditor/skins/minimal/images/bg.wymeditor.png +0 -0
- data/lib/public/milksteak/wymeditor/skins/minimal/images/icons.silver.gif +0 -0
- data/lib/public/milksteak/wymeditor/skins/minimal/skin.css +131 -0
- data/lib/public/milksteak/wymeditor/skins/minimal/skin.js +30 -0
- data/lib/public/milksteak/wymeditor/skins/silver/COPYING +674 -0
- data/lib/public/milksteak/wymeditor/skins/silver/README +27 -0
- data/lib/public/milksteak/wymeditor/skins/silver/images/bg.header.gif +0 -0
- data/lib/public/milksteak/wymeditor/skins/silver/images/bg.selector.silver.gif +0 -0
- data/lib/public/milksteak/wymeditor/skins/silver/images/bg.wymeditor.png +0 -0
- data/lib/public/milksteak/wymeditor/skins/silver/images/icons.silver.gif +0 -0
- data/lib/public/milksteak/wymeditor/skins/silver/skin.css +297 -0
- data/lib/public/milksteak/wymeditor/skins/silver/skin.js +61 -0
- data/lib/public/milksteak/wymeditor/skins/twopanels/icons.png +0 -0
- data/lib/public/milksteak/wymeditor/skins/twopanels/skin.css +134 -0
- data/lib/public/milksteak/wymeditor/skins/twopanels/skin.js +39 -0
- data/lib/public/milksteak/wymeditor/skins/wymeditor_icon.png +0 -0
- data/lib/views/layouts/admin.erb +8 -0
- data/lib/views/login.erb +1 -0
- data/milksteak.gemspec +30 -13
- data/spec/fixtures/pages/sample_page.yml +5 -0
- data/spec/lib/milksteak/cms_spec.rb +12 -0
- data/spec/models/page_spec.rb +58 -0
- data/spec/spec_helper.rb +19 -0
- metadata +429 -10
- data/LICENSE +0 -22
- data/README.md +0 -29
@@ -0,0 +1,47 @@
|
|
1
|
+
<!doctype html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>CodeMirror: GFM mode</title>
|
5
|
+
<link rel="stylesheet" href="../../lib/codemirror.css">
|
6
|
+
<script src="../../lib/codemirror.js"></script>
|
7
|
+
<script src="../xml/xml.js"></script>
|
8
|
+
<script src="../markdown/markdown.js"></script>
|
9
|
+
<script src="gfm.js"></script>
|
10
|
+
<script src="../javascript/javascript.js"></script>
|
11
|
+
<link rel="stylesheet" href="../markdown/markdown.css">
|
12
|
+
<style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
|
13
|
+
<link rel="stylesheet" href="../../doc/docs.css">
|
14
|
+
</head>
|
15
|
+
<body>
|
16
|
+
<h1>CodeMirror: GFM mode</h1>
|
17
|
+
|
18
|
+
<!-- source: http://daringfireball.net/projects/markdown/basics.text -->
|
19
|
+
<form><textarea id="code" name="code">
|
20
|
+
Github Flavored Markdown
|
21
|
+
========================
|
22
|
+
|
23
|
+
Everything from markdown plus GFM features:
|
24
|
+
|
25
|
+
## Fenced code blocks
|
26
|
+
|
27
|
+
```javascript
|
28
|
+
for (var i = 0; i < items.length; i++) {
|
29
|
+
console.log(items[i], i); // log them
|
30
|
+
}
|
31
|
+
```
|
32
|
+
|
33
|
+
See http://github.github.com/github-flavored-markdown/
|
34
|
+
|
35
|
+
</textarea></form>
|
36
|
+
|
37
|
+
<script>
|
38
|
+
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
39
|
+
mode: 'gfm',
|
40
|
+
lineNumbers: true,
|
41
|
+
matchBrackets: true,
|
42
|
+
theme: "default"
|
43
|
+
});
|
44
|
+
</script>
|
45
|
+
|
46
|
+
</body>
|
47
|
+
</html>
|
@@ -0,0 +1,170 @@
|
|
1
|
+
CodeMirror.defineMode("go", function(config, parserConfig) {
|
2
|
+
var indentUnit = config.indentUnit;
|
3
|
+
|
4
|
+
var keywords = {
|
5
|
+
"break":true, "case":true, "chan":true, "const":true, "continue":true,
|
6
|
+
"default":true, "defer":true, "else":true, "fallthrough":true, "for":true,
|
7
|
+
"func":true, "go":true, "goto":true, "if":true, "import":true,
|
8
|
+
"interface":true, "map":true, "package":true, "range":true, "return":true,
|
9
|
+
"select":true, "struct":true, "switch":true, "type":true, "var":true,
|
10
|
+
"bool":true, "byte":true, "complex64":true, "complex128":true,
|
11
|
+
"float32":true, "float64":true, "int8":true, "int16":true, "int32":true,
|
12
|
+
"int64":true, "string":true, "uint8":true, "uint16":true, "uint32":true,
|
13
|
+
"uint64":true, "int":true, "uint":true, "uintptr":true
|
14
|
+
};
|
15
|
+
|
16
|
+
var atoms = {
|
17
|
+
"true":true, "false":true, "iota":true, "nil":true, "append":true,
|
18
|
+
"cap":true, "close":true, "complex":true, "copy":true, "imag":true,
|
19
|
+
"len":true, "make":true, "new":true, "panic":true, "print":true,
|
20
|
+
"println":true, "real":true, "recover":true
|
21
|
+
};
|
22
|
+
|
23
|
+
var blockKeywords = {
|
24
|
+
"else":true, "for":true, "func":true, "if":true, "interface":true,
|
25
|
+
"select":true, "struct":true, "switch":true
|
26
|
+
};
|
27
|
+
|
28
|
+
var isOperatorChar = /[+\-*&^%:=<>!|\/]/;
|
29
|
+
|
30
|
+
var curPunc;
|
31
|
+
|
32
|
+
function tokenBase(stream, state) {
|
33
|
+
var ch = stream.next();
|
34
|
+
if (ch == '"' || ch == "'" || ch == "`") {
|
35
|
+
state.tokenize = tokenString(ch);
|
36
|
+
return state.tokenize(stream, state);
|
37
|
+
}
|
38
|
+
if (/[\d\.]/.test(ch)) {
|
39
|
+
if (ch == ".") {
|
40
|
+
stream.match(/^[0-9]+([eE][\-+]?[0-9]+)?/);
|
41
|
+
} else if (ch == "0") {
|
42
|
+
stream.match(/^[xX][0-9a-fA-F]+/) || stream.match(/^0[0-7]+/);
|
43
|
+
} else {
|
44
|
+
stream.match(/^[0-9]*\.?[0-9]*([eE][\-+]?[0-9]+)?/);
|
45
|
+
}
|
46
|
+
return "number";
|
47
|
+
}
|
48
|
+
if (/[\[\]{}\(\),;\:\.]/.test(ch)) {
|
49
|
+
curPunc = ch;
|
50
|
+
return null
|
51
|
+
}
|
52
|
+
if (ch == "/") {
|
53
|
+
if (stream.eat("*")) {
|
54
|
+
state.tokenize = tokenComment;
|
55
|
+
return tokenComment(stream, state);
|
56
|
+
}
|
57
|
+
if (stream.eat("/")) {
|
58
|
+
stream.skipToEnd();
|
59
|
+
return "comment";
|
60
|
+
}
|
61
|
+
}
|
62
|
+
if (isOperatorChar.test(ch)) {
|
63
|
+
stream.eatWhile(isOperatorChar);
|
64
|
+
return "operator";
|
65
|
+
}
|
66
|
+
stream.eatWhile(/[\w\$_]/);
|
67
|
+
var cur = stream.current();
|
68
|
+
if (keywords.propertyIsEnumerable(cur)) {
|
69
|
+
if (cur == "case" || cur == "default") curPunc = "case";
|
70
|
+
return "keyword";
|
71
|
+
}
|
72
|
+
if (atoms.propertyIsEnumerable(cur)) return "atom";
|
73
|
+
return "word";
|
74
|
+
}
|
75
|
+
|
76
|
+
function tokenString(quote) {
|
77
|
+
return function(stream, state) {
|
78
|
+
var escaped = false, next, end = false;
|
79
|
+
while ((next = stream.next()) != null) {
|
80
|
+
if (next == quote && !escaped) {end = true; break;}
|
81
|
+
escaped = !escaped && next == "\\";
|
82
|
+
}
|
83
|
+
if (end || !(escaped || quote == "`"))
|
84
|
+
state.tokenize = tokenBase;
|
85
|
+
return "string";
|
86
|
+
};
|
87
|
+
}
|
88
|
+
|
89
|
+
function tokenComment(stream, state) {
|
90
|
+
var maybeEnd = false, ch;
|
91
|
+
while (ch = stream.next()) {
|
92
|
+
if (ch == "/" && maybeEnd) {
|
93
|
+
state.tokenize = tokenBase;
|
94
|
+
break;
|
95
|
+
}
|
96
|
+
maybeEnd = (ch == "*");
|
97
|
+
}
|
98
|
+
return "comment";
|
99
|
+
}
|
100
|
+
|
101
|
+
function Context(indented, column, type, align, prev) {
|
102
|
+
this.indented = indented;
|
103
|
+
this.column = column;
|
104
|
+
this.type = type;
|
105
|
+
this.align = align;
|
106
|
+
this.prev = prev;
|
107
|
+
}
|
108
|
+
function pushContext(state, col, type) {
|
109
|
+
return state.context = new Context(state.indented, col, type, null, state.context);
|
110
|
+
}
|
111
|
+
function popContext(state) {
|
112
|
+
var t = state.context.type;
|
113
|
+
if (t == ")" || t == "]" || t == "}")
|
114
|
+
state.indented = state.context.indented;
|
115
|
+
return state.context = state.context.prev;
|
116
|
+
}
|
117
|
+
|
118
|
+
// Interface
|
119
|
+
|
120
|
+
return {
|
121
|
+
startState: function(basecolumn) {
|
122
|
+
return {
|
123
|
+
tokenize: null,
|
124
|
+
context: new Context((basecolumn || 0) - indentUnit, 0, "top", false),
|
125
|
+
indented: 0,
|
126
|
+
startOfLine: true
|
127
|
+
};
|
128
|
+
},
|
129
|
+
|
130
|
+
token: function(stream, state) {
|
131
|
+
var ctx = state.context;
|
132
|
+
if (stream.sol()) {
|
133
|
+
if (ctx.align == null) ctx.align = false;
|
134
|
+
state.indented = stream.indentation();
|
135
|
+
state.startOfLine = true;
|
136
|
+
if (ctx.type == "case") ctx.type = "}";
|
137
|
+
}
|
138
|
+
if (stream.eatSpace()) return null;
|
139
|
+
curPunc = null;
|
140
|
+
var style = (state.tokenize || tokenBase)(stream, state);
|
141
|
+
if (style == "comment") return style;
|
142
|
+
if (ctx.align == null) ctx.align = true;
|
143
|
+
|
144
|
+
if (curPunc == "{") pushContext(state, stream.column(), "}");
|
145
|
+
else if (curPunc == "[") pushContext(state, stream.column(), "]");
|
146
|
+
else if (curPunc == "(") pushContext(state, stream.column(), ")");
|
147
|
+
else if (curPunc == "case") ctx.type = "case"
|
148
|
+
else if (curPunc == "}" && ctx.type == "}") ctx = popContext(state);
|
149
|
+
else if (curPunc == ctx.type) popContext(state);
|
150
|
+
state.startOfLine = false;
|
151
|
+
return style;
|
152
|
+
},
|
153
|
+
|
154
|
+
indent: function(state, textAfter) {
|
155
|
+
if (state.tokenize != tokenBase && state.tokenize != null) return 0;
|
156
|
+
var ctx = state.context, firstChar = textAfter && textAfter.charAt(0);
|
157
|
+
if (ctx.type == "case" && /^(?:case|default)\b/.test(textAfter)) {
|
158
|
+
state.context.type = "}";
|
159
|
+
return ctx.indented;
|
160
|
+
}
|
161
|
+
var closing = firstChar == ctx.type;
|
162
|
+
if (ctx.align) return ctx.column + (closing ? 0 : 1);
|
163
|
+
else return ctx.indented + (closing ? 0 : indentUnit);
|
164
|
+
},
|
165
|
+
|
166
|
+
electricChars: "{}:"
|
167
|
+
};
|
168
|
+
});
|
169
|
+
|
170
|
+
CodeMirror.defineMIME("text/x-go", "go");
|
@@ -0,0 +1,72 @@
|
|
1
|
+
<!doctype html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>CodeMirror: Go mode</title>
|
5
|
+
<link rel="stylesheet" href="../../lib/codemirror.css">
|
6
|
+
<link rel="stylesheet" href="../../theme/elegant.css">
|
7
|
+
<script src="../../lib/codemirror.js"></script>
|
8
|
+
<script src="go.js"></script>
|
9
|
+
<link rel="stylesheet" href="../../doc/docs.css">
|
10
|
+
<style>.CodeMirror {border:1px solid #999; background:#ffc}</style>
|
11
|
+
</head>
|
12
|
+
<body>
|
13
|
+
<h1>CodeMirror: Go mode</h1>
|
14
|
+
|
15
|
+
<form><textarea id="code" name="code">
|
16
|
+
// Prime Sieve in Go.
|
17
|
+
// Taken from the Go specification.
|
18
|
+
// Copyright © The Go Authors.
|
19
|
+
|
20
|
+
package main
|
21
|
+
|
22
|
+
import "fmt"
|
23
|
+
|
24
|
+
// Send the sequence 2, 3, 4, ... to channel 'ch'.
|
25
|
+
func generate(ch chan<- int) {
|
26
|
+
for i := 2; ; i++ {
|
27
|
+
ch <- i // Send 'i' to channel 'ch'
|
28
|
+
}
|
29
|
+
}
|
30
|
+
|
31
|
+
// Copy the values from channel 'src' to channel 'dst',
|
32
|
+
// removing those divisible by 'prime'.
|
33
|
+
func filter(src <-chan int, dst chan<- int, prime int) {
|
34
|
+
for i := range src { // Loop over values received from 'src'.
|
35
|
+
if i%prime != 0 {
|
36
|
+
dst <- i // Send 'i' to channel 'dst'.
|
37
|
+
}
|
38
|
+
}
|
39
|
+
}
|
40
|
+
|
41
|
+
// The prime sieve: Daisy-chain filter processes together.
|
42
|
+
func sieve() {
|
43
|
+
ch := make(chan int) // Create a new channel.
|
44
|
+
go generate(ch) // Start generate() as a subprocess.
|
45
|
+
for {
|
46
|
+
prime := <-ch
|
47
|
+
fmt.Print(prime, "\n")
|
48
|
+
ch1 := make(chan int)
|
49
|
+
go filter(ch, ch1, prime)
|
50
|
+
ch = ch1
|
51
|
+
}
|
52
|
+
}
|
53
|
+
|
54
|
+
func main() {
|
55
|
+
sieve()
|
56
|
+
}
|
57
|
+
</textarea></form>
|
58
|
+
|
59
|
+
<script>
|
60
|
+
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
61
|
+
theme: "elegant",
|
62
|
+
matchBrackets: true,
|
63
|
+
indentUnit: 8,
|
64
|
+
tabSize: 8,
|
65
|
+
indentWithTabs: true,
|
66
|
+
mode: "text/x-go"
|
67
|
+
});
|
68
|
+
</script>
|
69
|
+
|
70
|
+
<p><strong>MIME type:</strong> <code>text/x-go</code></p>
|
71
|
+
</body>
|
72
|
+
</html>
|
@@ -0,0 +1,210 @@
|
|
1
|
+
CodeMirror.defineMode("groovy", function(config, parserConfig) {
|
2
|
+
function words(str) {
|
3
|
+
var obj = {}, words = str.split(" ");
|
4
|
+
for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
|
5
|
+
return obj;
|
6
|
+
}
|
7
|
+
var keywords = words(
|
8
|
+
"abstract as assert boolean break byte case catch char class const continue def default " +
|
9
|
+
"do double else enum extends final finally float for goto if implements import in " +
|
10
|
+
"instanceof int interface long native new package private protected public return " +
|
11
|
+
"short static strictfp super switch synchronized threadsafe throw throws transient " +
|
12
|
+
"try void volatile while");
|
13
|
+
var blockKeywords = words("catch class do else finally for if switch try while enum interface def");
|
14
|
+
var atoms = words("null true false this");
|
15
|
+
|
16
|
+
var curPunc;
|
17
|
+
function tokenBase(stream, state) {
|
18
|
+
var ch = stream.next();
|
19
|
+
if (ch == '"' || ch == "'") {
|
20
|
+
return startString(ch, stream, state);
|
21
|
+
}
|
22
|
+
if (/[\[\]{}\(\),;\:\.]/.test(ch)) {
|
23
|
+
curPunc = ch;
|
24
|
+
return null
|
25
|
+
}
|
26
|
+
if (/\d/.test(ch)) {
|
27
|
+
stream.eatWhile(/[\w\.]/);
|
28
|
+
if (stream.eat(/eE/)) { stream.eat(/\+\-/); stream.eatWhile(/\d/); }
|
29
|
+
return "number";
|
30
|
+
}
|
31
|
+
if (ch == "/") {
|
32
|
+
if (stream.eat("*")) {
|
33
|
+
state.tokenize.push(tokenComment);
|
34
|
+
return tokenComment(stream, state);
|
35
|
+
}
|
36
|
+
if (stream.eat("/")) {
|
37
|
+
stream.skipToEnd();
|
38
|
+
return "comment";
|
39
|
+
}
|
40
|
+
if (expectExpression(state.lastToken)) {
|
41
|
+
return startString(ch, stream, state);
|
42
|
+
}
|
43
|
+
}
|
44
|
+
if (ch == "-" && stream.eat(">")) {
|
45
|
+
curPunc = "->";
|
46
|
+
return null;
|
47
|
+
}
|
48
|
+
if (/[+\-*&%=<>!?|\/~]/.test(ch)) {
|
49
|
+
stream.eatWhile(/[+\-*&%=<>|~]/);
|
50
|
+
return "operator";
|
51
|
+
}
|
52
|
+
stream.eatWhile(/[\w\$_]/);
|
53
|
+
if (ch == "@") { stream.eatWhile(/[\w\$_\.]/); return "meta"; }
|
54
|
+
if (state.lastToken == ".") return "property";
|
55
|
+
if (stream.eat(":")) { curPunc = "proplabel"; return "property"; }
|
56
|
+
var cur = stream.current();
|
57
|
+
if (atoms.propertyIsEnumerable(cur)) { return "atom"; }
|
58
|
+
if (keywords.propertyIsEnumerable(cur)) {
|
59
|
+
if (blockKeywords.propertyIsEnumerable(cur)) curPunc = "newstatement";
|
60
|
+
return "keyword";
|
61
|
+
}
|
62
|
+
return "word";
|
63
|
+
}
|
64
|
+
tokenBase.isBase = true;
|
65
|
+
|
66
|
+
function startString(quote, stream, state) {
|
67
|
+
var tripleQuoted = false;
|
68
|
+
if (quote != "/" && stream.eat(quote)) {
|
69
|
+
if (stream.eat(quote)) tripleQuoted = true;
|
70
|
+
else return "string";
|
71
|
+
}
|
72
|
+
function t(stream, state) {
|
73
|
+
var escaped = false, next, end = !tripleQuoted;
|
74
|
+
while ((next = stream.next()) != null) {
|
75
|
+
if (next == quote && !escaped) {
|
76
|
+
if (!tripleQuoted) { break; }
|
77
|
+
if (stream.match(quote + quote)) { end = true; break; }
|
78
|
+
}
|
79
|
+
if (quote == '"' && next == "$" && !escaped && stream.eat("{")) {
|
80
|
+
state.tokenize.push(tokenBaseUntilBrace());
|
81
|
+
return "string";
|
82
|
+
}
|
83
|
+
escaped = !escaped && next == "\\";
|
84
|
+
}
|
85
|
+
if (end) state.tokenize.pop();
|
86
|
+
return "string";
|
87
|
+
}
|
88
|
+
state.tokenize.push(t);
|
89
|
+
return t(stream, state);
|
90
|
+
}
|
91
|
+
|
92
|
+
function tokenBaseUntilBrace() {
|
93
|
+
var depth = 1;
|
94
|
+
function t(stream, state) {
|
95
|
+
if (stream.peek() == "}") {
|
96
|
+
depth--;
|
97
|
+
if (depth == 0) {
|
98
|
+
state.tokenize.pop();
|
99
|
+
return state.tokenize[state.tokenize.length-1](stream, state);
|
100
|
+
}
|
101
|
+
} else if (stream.peek() == "{") {
|
102
|
+
depth++;
|
103
|
+
}
|
104
|
+
return tokenBase(stream, state);
|
105
|
+
}
|
106
|
+
t.isBase = true;
|
107
|
+
return t;
|
108
|
+
}
|
109
|
+
|
110
|
+
function tokenComment(stream, state) {
|
111
|
+
var maybeEnd = false, ch;
|
112
|
+
while (ch = stream.next()) {
|
113
|
+
if (ch == "/" && maybeEnd) {
|
114
|
+
state.tokenize.pop();
|
115
|
+
break;
|
116
|
+
}
|
117
|
+
maybeEnd = (ch == "*");
|
118
|
+
}
|
119
|
+
return "comment";
|
120
|
+
}
|
121
|
+
|
122
|
+
function expectExpression(last) {
|
123
|
+
return !last || last == "operator" || last == "->" || /[\.\[\{\(,;:]/.test(last) ||
|
124
|
+
last == "newstatement" || last == "keyword" || last == "proplabel";
|
125
|
+
}
|
126
|
+
|
127
|
+
function Context(indented, column, type, align, prev) {
|
128
|
+
this.indented = indented;
|
129
|
+
this.column = column;
|
130
|
+
this.type = type;
|
131
|
+
this.align = align;
|
132
|
+
this.prev = prev;
|
133
|
+
}
|
134
|
+
function pushContext(state, col, type) {
|
135
|
+
return state.context = new Context(state.indented, col, type, null, state.context);
|
136
|
+
}
|
137
|
+
function popContext(state) {
|
138
|
+
var t = state.context.type;
|
139
|
+
if (t == ")" || t == "]" || t == "}")
|
140
|
+
state.indented = state.context.indented;
|
141
|
+
return state.context = state.context.prev;
|
142
|
+
}
|
143
|
+
|
144
|
+
// Interface
|
145
|
+
|
146
|
+
return {
|
147
|
+
startState: function(basecolumn) {
|
148
|
+
return {
|
149
|
+
tokenize: [tokenBase],
|
150
|
+
context: new Context((basecolumn || 0) - config.indentUnit, 0, "top", false),
|
151
|
+
indented: 0,
|
152
|
+
startOfLine: true,
|
153
|
+
lastToken: null
|
154
|
+
};
|
155
|
+
},
|
156
|
+
|
157
|
+
token: function(stream, state) {
|
158
|
+
var ctx = state.context;
|
159
|
+
if (stream.sol()) {
|
160
|
+
if (ctx.align == null) ctx.align = false;
|
161
|
+
state.indented = stream.indentation();
|
162
|
+
state.startOfLine = true;
|
163
|
+
// Automatic semicolon insertion
|
164
|
+
if (ctx.type == "statement" && !expectExpression(state.lastToken)) {
|
165
|
+
popContext(state); ctx = state.context;
|
166
|
+
}
|
167
|
+
}
|
168
|
+
if (stream.eatSpace()) return null;
|
169
|
+
curPunc = null;
|
170
|
+
var style = state.tokenize[state.tokenize.length-1](stream, state);
|
171
|
+
if (style == "comment") return style;
|
172
|
+
if (ctx.align == null) ctx.align = true;
|
173
|
+
|
174
|
+
if ((curPunc == ";" || curPunc == ":") && ctx.type == "statement") popContext(state);
|
175
|
+
// Handle indentation for {x -> \n ... }
|
176
|
+
else if (curPunc == "->" && ctx.type == "statement" && ctx.prev.type == "}") {
|
177
|
+
popContext(state);
|
178
|
+
state.context.align = false;
|
179
|
+
}
|
180
|
+
else if (curPunc == "{") pushContext(state, stream.column(), "}");
|
181
|
+
else if (curPunc == "[") pushContext(state, stream.column(), "]");
|
182
|
+
else if (curPunc == "(") pushContext(state, stream.column(), ")");
|
183
|
+
else if (curPunc == "}") {
|
184
|
+
while (ctx.type == "statement") ctx = popContext(state);
|
185
|
+
if (ctx.type == "}") ctx = popContext(state);
|
186
|
+
while (ctx.type == "statement") ctx = popContext(state);
|
187
|
+
}
|
188
|
+
else if (curPunc == ctx.type) popContext(state);
|
189
|
+
else if (ctx.type == "}" || ctx.type == "top" || (ctx.type == "statement" && curPunc == "newstatement"))
|
190
|
+
pushContext(state, stream.column(), "statement");
|
191
|
+
state.startOfLine = false;
|
192
|
+
state.lastToken = curPunc || style;
|
193
|
+
return style;
|
194
|
+
},
|
195
|
+
|
196
|
+
indent: function(state, textAfter) {
|
197
|
+
if (!state.tokenize[state.tokenize.length-1].isBase) return 0;
|
198
|
+
var firstChar = textAfter && textAfter.charAt(0), ctx = state.context;
|
199
|
+
if (ctx.type == "statement" && !expectExpression(state.lastToken)) ctx = ctx.prev;
|
200
|
+
var closing = firstChar == ctx.type;
|
201
|
+
if (ctx.type == "statement") return ctx.indented + (firstChar == "{" ? 0 : config.indentUnit);
|
202
|
+
else if (ctx.align) return ctx.column + (closing ? 0 : 1);
|
203
|
+
else return ctx.indented + (closing ? 0 : config.indentUnit);
|
204
|
+
},
|
205
|
+
|
206
|
+
electricChars: "{}"
|
207
|
+
};
|
208
|
+
});
|
209
|
+
|
210
|
+
CodeMirror.defineMIME("text/x-groovy", "groovy");
|
@@ -0,0 +1,71 @@
|
|
1
|
+
<!doctype html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>CodeMirror: Groovy mode</title>
|
5
|
+
<link rel="stylesheet" href="../../lib/codemirror.css">
|
6
|
+
<script src="../../lib/codemirror.js"></script>
|
7
|
+
<script src="groovy.js"></script>
|
8
|
+
<link rel="stylesheet" href="../../doc/docs.css">
|
9
|
+
<style>.CodeMirror {border-top: 1px solid #500; border-bottom: 1px solid #500;}</style>
|
10
|
+
</head>
|
11
|
+
<body>
|
12
|
+
<h1>CodeMirror: Groovy mode</h1>
|
13
|
+
|
14
|
+
<form><textarea id="code" name="code">
|
15
|
+
//Pattern for groovy script
|
16
|
+
def p = ~/.*\.groovy/
|
17
|
+
new File( 'd:\\scripts' ).eachFileMatch(p) {f ->
|
18
|
+
// imports list
|
19
|
+
def imports = []
|
20
|
+
f.eachLine {
|
21
|
+
// condition to detect an import instruction
|
22
|
+
ln -> if ( ln =~ '^import .*' ) {
|
23
|
+
imports << "${ln - 'import '}"
|
24
|
+
}
|
25
|
+
}
|
26
|
+
// print thmen
|
27
|
+
if ( ! imports.empty ) {
|
28
|
+
println f
|
29
|
+
imports.each{ println " $it" }
|
30
|
+
}
|
31
|
+
}
|
32
|
+
|
33
|
+
/* Coin changer demo code from http://groovy.codehaus.org */
|
34
|
+
|
35
|
+
enum UsCoin {
|
36
|
+
quarter(25), dime(10), nickel(5), penny(1)
|
37
|
+
UsCoin(v) { value = v }
|
38
|
+
final value
|
39
|
+
}
|
40
|
+
|
41
|
+
enum OzzieCoin {
|
42
|
+
fifty(50), twenty(20), ten(10), five(5)
|
43
|
+
OzzieCoin(v) { value = v }
|
44
|
+
final value
|
45
|
+
}
|
46
|
+
|
47
|
+
def plural(word, count) {
|
48
|
+
if (count == 1) return word
|
49
|
+
word[-1] == 'y' ? word[0..-2] + "ies" : word + "s"
|
50
|
+
}
|
51
|
+
|
52
|
+
def change(currency, amount) {
|
53
|
+
currency.values().inject([]){ list, coin ->
|
54
|
+
int count = amount / coin.value
|
55
|
+
amount = amount % coin.value
|
56
|
+
list += "$count ${plural(coin.toString(), count)}"
|
57
|
+
}
|
58
|
+
}
|
59
|
+
</textarea></form>
|
60
|
+
|
61
|
+
<script>
|
62
|
+
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
63
|
+
lineNumbers: true,
|
64
|
+
matchBrackets: true,
|
65
|
+
mode: "text/x-groovy"
|
66
|
+
});
|
67
|
+
</script>
|
68
|
+
|
69
|
+
<p><strong>MIME types defined:</strong> <code>text/x-groovy</code></p>
|
70
|
+
</body>
|
71
|
+
</html>
|