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,122 @@
|
|
1
|
+
<!doctype html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>CodeMirror: Python mode</title>
|
5
|
+
<link rel="stylesheet" href="../../lib/codemirror.css">
|
6
|
+
<script src="../../lib/codemirror.js"></script>
|
7
|
+
<script src="python.js"></script>
|
8
|
+
<link rel="stylesheet" href="../../doc/docs.css">
|
9
|
+
<style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
|
10
|
+
</head>
|
11
|
+
<body>
|
12
|
+
<h1>CodeMirror: Python mode</h1>
|
13
|
+
|
14
|
+
<div><textarea id="code" name="code">
|
15
|
+
# Literals
|
16
|
+
1234
|
17
|
+
0.0e101
|
18
|
+
.123
|
19
|
+
0b01010011100
|
20
|
+
0o01234567
|
21
|
+
0x0987654321abcdef
|
22
|
+
7
|
23
|
+
2147483647
|
24
|
+
3L
|
25
|
+
79228162514264337593543950336L
|
26
|
+
0x100000000L
|
27
|
+
79228162514264337593543950336
|
28
|
+
0xdeadbeef
|
29
|
+
3.14j
|
30
|
+
10.j
|
31
|
+
10j
|
32
|
+
.001j
|
33
|
+
1e100j
|
34
|
+
3.14e-10j
|
35
|
+
|
36
|
+
|
37
|
+
# String Literals
|
38
|
+
'For\''
|
39
|
+
"God\""
|
40
|
+
"""so loved
|
41
|
+
the world"""
|
42
|
+
'''that he gave
|
43
|
+
his only begotten\' '''
|
44
|
+
'that whosoever believeth \
|
45
|
+
in him'
|
46
|
+
''
|
47
|
+
|
48
|
+
# Identifiers
|
49
|
+
__a__
|
50
|
+
a.b
|
51
|
+
a.b.c
|
52
|
+
|
53
|
+
# Operators
|
54
|
+
+ - * / % & | ^ ~ < >
|
55
|
+
== != <= >= <> << >> // **
|
56
|
+
and or not in is
|
57
|
+
|
58
|
+
# Delimiters
|
59
|
+
() [] {} , : ` = ; @ . # Note that @ and . require the proper context.
|
60
|
+
+= -= *= /= %= &= |= ^=
|
61
|
+
//= >>= <<= **=
|
62
|
+
|
63
|
+
# Keywords
|
64
|
+
as assert break class continue def del elif else except
|
65
|
+
finally for from global if import lambda pass raise
|
66
|
+
return try while with yield
|
67
|
+
|
68
|
+
# Python 2 Keywords (otherwise Identifiers)
|
69
|
+
exec print
|
70
|
+
|
71
|
+
# Python 3 Keywords (otherwise Identifiers)
|
72
|
+
nonlocal
|
73
|
+
|
74
|
+
# Types
|
75
|
+
bool classmethod complex dict enumerate float frozenset int list object
|
76
|
+
property reversed set slice staticmethod str super tuple type
|
77
|
+
|
78
|
+
# Python 2 Types (otherwise Identifiers)
|
79
|
+
basestring buffer file long unicode xrange
|
80
|
+
|
81
|
+
# Python 3 Types (otherwise Identifiers)
|
82
|
+
bytearray bytes filter map memoryview open range zip
|
83
|
+
|
84
|
+
# Some Example code
|
85
|
+
import os
|
86
|
+
from package import ParentClass
|
87
|
+
|
88
|
+
@nonsenseDecorator
|
89
|
+
def doesNothing():
|
90
|
+
pass
|
91
|
+
|
92
|
+
class ExampleClass(ParentClass):
|
93
|
+
@staticmethod
|
94
|
+
def example(inputStr):
|
95
|
+
a = list(inputStr)
|
96
|
+
a.reverse()
|
97
|
+
return ''.join(a)
|
98
|
+
|
99
|
+
def __init__(self, mixin = 'Hello'):
|
100
|
+
self.mixin = mixin
|
101
|
+
|
102
|
+
</textarea></div>
|
103
|
+
<script>
|
104
|
+
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
105
|
+
mode: {name: "python",
|
106
|
+
version: 2,
|
107
|
+
singleLineStringErrors: false},
|
108
|
+
lineNumbers: true,
|
109
|
+
indentUnit: 4,
|
110
|
+
tabMode: "shift",
|
111
|
+
matchBrackets: true
|
112
|
+
});
|
113
|
+
</script>
|
114
|
+
<h2>Configuration Options:</h2>
|
115
|
+
<ul>
|
116
|
+
<li>version - 2/3 - The version of Python to recognize. Default is 2.</li>
|
117
|
+
<li>singleLineStringErrors - true/false - If you have a single-line string that is not terminated at the end of the line, this will show subsequent lines as errors if true, otherwise it will consider the newline as the end of the string. Default is false.</li>
|
118
|
+
</ul>
|
119
|
+
|
120
|
+
<p><strong>MIME types defined:</strong> <code>text/x-python</code>.</p>
|
121
|
+
</body>
|
122
|
+
</html>
|
@@ -0,0 +1,340 @@
|
|
1
|
+
CodeMirror.defineMode("python", function(conf, parserConf) {
|
2
|
+
var ERRORCLASS = 'error';
|
3
|
+
|
4
|
+
function wordRegexp(words) {
|
5
|
+
return new RegExp("^((" + words.join(")|(") + "))\\b");
|
6
|
+
}
|
7
|
+
|
8
|
+
var singleOperators = new RegExp("^[\\+\\-\\*/%&|\\^~<>!]");
|
9
|
+
var singleDelimiters = new RegExp('^[\\(\\)\\[\\]\\{\\}@,:`=;\\.]');
|
10
|
+
var doubleOperators = new RegExp("^((==)|(!=)|(<=)|(>=)|(<>)|(<<)|(>>)|(//)|(\\*\\*))");
|
11
|
+
var doubleDelimiters = new RegExp("^((\\+=)|(\\-=)|(\\*=)|(%=)|(/=)|(&=)|(\\|=)|(\\^=))");
|
12
|
+
var tripleDelimiters = new RegExp("^((//=)|(>>=)|(<<=)|(\\*\\*=))");
|
13
|
+
var identifiers = new RegExp("^[_A-Za-z][_A-Za-z0-9]*");
|
14
|
+
|
15
|
+
var wordOperators = wordRegexp(['and', 'or', 'not', 'is', 'in']);
|
16
|
+
var commonkeywords = ['as', 'assert', 'break', 'class', 'continue',
|
17
|
+
'def', 'del', 'elif', 'else', 'except', 'finally',
|
18
|
+
'for', 'from', 'global', 'if', 'import',
|
19
|
+
'lambda', 'pass', 'raise', 'return',
|
20
|
+
'try', 'while', 'with', 'yield'];
|
21
|
+
var commonBuiltins = ['abs', 'all', 'any', 'bin', 'bool', 'bytearray', 'callable', 'chr',
|
22
|
+
'classmethod', 'compile', 'complex', 'delattr', 'dict', 'dir', 'divmod',
|
23
|
+
'enumerate', 'eval', 'filter', 'float', 'format', 'frozenset',
|
24
|
+
'getattr', 'globals', 'hasattr', 'hash', 'help', 'hex', 'id',
|
25
|
+
'input', 'int', 'isinstance', 'issubclass', 'iter', 'len',
|
26
|
+
'list', 'locals', 'map', 'max', 'memoryview', 'min', 'next',
|
27
|
+
'object', 'oct', 'open', 'ord', 'pow', 'property', 'range',
|
28
|
+
'repr', 'reversed', 'round', 'set', 'setattr', 'slice',
|
29
|
+
'sorted', 'staticmethod', 'str', 'sum', 'super', 'tuple',
|
30
|
+
'type', 'vars', 'zip', '__import__', 'NotImplemented',
|
31
|
+
'Ellipsis', '__debug__'];
|
32
|
+
var py2 = {'builtins': ['apply', 'basestring', 'buffer', 'cmp', 'coerce', 'execfile',
|
33
|
+
'file', 'intern', 'long', 'raw_input', 'reduce', 'reload',
|
34
|
+
'unichr', 'unicode', 'xrange', 'False', 'True', 'None'],
|
35
|
+
'keywords': ['exec', 'print']};
|
36
|
+
var py3 = {'builtins': ['ascii', 'bytes', 'exec', 'print'],
|
37
|
+
'keywords': ['nonlocal', 'False', 'True', 'None']};
|
38
|
+
|
39
|
+
if (!!parserConf.version && parseInt(parserConf.version, 10) === 3) {
|
40
|
+
commonkeywords = commonkeywords.concat(py3.keywords);
|
41
|
+
commonBuiltins = commonBuiltins.concat(py3.builtins);
|
42
|
+
var stringPrefixes = new RegExp("^(([rb]|(br))?('{3}|\"{3}|['\"]))", "i");
|
43
|
+
} else {
|
44
|
+
commonkeywords = commonkeywords.concat(py2.keywords);
|
45
|
+
commonBuiltins = commonBuiltins.concat(py2.builtins);
|
46
|
+
var stringPrefixes = new RegExp("^(([rub]|(ur)|(br))?('{3}|\"{3}|['\"]))", "i");
|
47
|
+
}
|
48
|
+
var keywords = wordRegexp(commonkeywords);
|
49
|
+
var builtins = wordRegexp(commonBuiltins);
|
50
|
+
|
51
|
+
var indentInfo = null;
|
52
|
+
|
53
|
+
// tokenizers
|
54
|
+
function tokenBase(stream, state) {
|
55
|
+
// Handle scope changes
|
56
|
+
if (stream.sol()) {
|
57
|
+
var scopeOffset = state.scopes[0].offset;
|
58
|
+
if (stream.eatSpace()) {
|
59
|
+
var lineOffset = stream.indentation();
|
60
|
+
if (lineOffset > scopeOffset) {
|
61
|
+
indentInfo = 'indent';
|
62
|
+
} else if (lineOffset < scopeOffset) {
|
63
|
+
indentInfo = 'dedent';
|
64
|
+
}
|
65
|
+
return null;
|
66
|
+
} else {
|
67
|
+
if (scopeOffset > 0) {
|
68
|
+
dedent(stream, state);
|
69
|
+
}
|
70
|
+
}
|
71
|
+
}
|
72
|
+
if (stream.eatSpace()) {
|
73
|
+
return null;
|
74
|
+
}
|
75
|
+
|
76
|
+
var ch = stream.peek();
|
77
|
+
|
78
|
+
// Handle Comments
|
79
|
+
if (ch === '#') {
|
80
|
+
stream.skipToEnd();
|
81
|
+
return 'comment';
|
82
|
+
}
|
83
|
+
|
84
|
+
// Handle Number Literals
|
85
|
+
if (stream.match(/^[0-9\.]/, false)) {
|
86
|
+
var floatLiteral = false;
|
87
|
+
// Floats
|
88
|
+
if (stream.match(/^\d*\.\d+(e[\+\-]?\d+)?/i)) { floatLiteral = true; }
|
89
|
+
if (stream.match(/^\d+\.\d*/)) { floatLiteral = true; }
|
90
|
+
if (stream.match(/^\.\d+/)) { floatLiteral = true; }
|
91
|
+
if (floatLiteral) {
|
92
|
+
// Float literals may be "imaginary"
|
93
|
+
stream.eat(/J/i);
|
94
|
+
return 'number';
|
95
|
+
}
|
96
|
+
// Integers
|
97
|
+
var intLiteral = false;
|
98
|
+
// Hex
|
99
|
+
if (stream.match(/^0x[0-9a-f]+/i)) { intLiteral = true; }
|
100
|
+
// Binary
|
101
|
+
if (stream.match(/^0b[01]+/i)) { intLiteral = true; }
|
102
|
+
// Octal
|
103
|
+
if (stream.match(/^0o[0-7]+/i)) { intLiteral = true; }
|
104
|
+
// Decimal
|
105
|
+
if (stream.match(/^[1-9]\d*(e[\+\-]?\d+)?/)) {
|
106
|
+
// Decimal literals may be "imaginary"
|
107
|
+
stream.eat(/J/i);
|
108
|
+
// TODO - Can you have imaginary longs?
|
109
|
+
intLiteral = true;
|
110
|
+
}
|
111
|
+
// Zero by itself with no other piece of number.
|
112
|
+
if (stream.match(/^0(?![\dx])/i)) { intLiteral = true; }
|
113
|
+
if (intLiteral) {
|
114
|
+
// Integer literals may be "long"
|
115
|
+
stream.eat(/L/i);
|
116
|
+
return 'number';
|
117
|
+
}
|
118
|
+
}
|
119
|
+
|
120
|
+
// Handle Strings
|
121
|
+
if (stream.match(stringPrefixes)) {
|
122
|
+
state.tokenize = tokenStringFactory(stream.current());
|
123
|
+
return state.tokenize(stream, state);
|
124
|
+
}
|
125
|
+
|
126
|
+
// Handle operators and Delimiters
|
127
|
+
if (stream.match(tripleDelimiters) || stream.match(doubleDelimiters)) {
|
128
|
+
return null;
|
129
|
+
}
|
130
|
+
if (stream.match(doubleOperators)
|
131
|
+
|| stream.match(singleOperators)
|
132
|
+
|| stream.match(wordOperators)) {
|
133
|
+
return 'operator';
|
134
|
+
}
|
135
|
+
if (stream.match(singleDelimiters)) {
|
136
|
+
return null;
|
137
|
+
}
|
138
|
+
|
139
|
+
if (stream.match(keywords)) {
|
140
|
+
return 'keyword';
|
141
|
+
}
|
142
|
+
|
143
|
+
if (stream.match(builtins)) {
|
144
|
+
return 'builtin';
|
145
|
+
}
|
146
|
+
|
147
|
+
if (stream.match(identifiers)) {
|
148
|
+
return 'variable';
|
149
|
+
}
|
150
|
+
|
151
|
+
// Handle non-detected items
|
152
|
+
stream.next();
|
153
|
+
return ERRORCLASS;
|
154
|
+
}
|
155
|
+
|
156
|
+
function tokenStringFactory(delimiter) {
|
157
|
+
while ('rub'.indexOf(delimiter.charAt(0).toLowerCase()) >= 0) {
|
158
|
+
delimiter = delimiter.substr(1);
|
159
|
+
}
|
160
|
+
var singleline = delimiter.length == 1;
|
161
|
+
var OUTCLASS = 'string';
|
162
|
+
|
163
|
+
return function tokenString(stream, state) {
|
164
|
+
while (!stream.eol()) {
|
165
|
+
stream.eatWhile(/[^'"\\]/);
|
166
|
+
if (stream.eat('\\')) {
|
167
|
+
stream.next();
|
168
|
+
if (singleline && stream.eol()) {
|
169
|
+
return OUTCLASS;
|
170
|
+
}
|
171
|
+
} else if (stream.match(delimiter)) {
|
172
|
+
state.tokenize = tokenBase;
|
173
|
+
return OUTCLASS;
|
174
|
+
} else {
|
175
|
+
stream.eat(/['"]/);
|
176
|
+
}
|
177
|
+
}
|
178
|
+
if (singleline) {
|
179
|
+
if (parserConf.singleLineStringErrors) {
|
180
|
+
return ERRORCLASS;
|
181
|
+
} else {
|
182
|
+
state.tokenize = tokenBase;
|
183
|
+
}
|
184
|
+
}
|
185
|
+
return OUTCLASS;
|
186
|
+
};
|
187
|
+
}
|
188
|
+
|
189
|
+
function indent(stream, state, type) {
|
190
|
+
type = type || 'py';
|
191
|
+
var indentUnit = 0;
|
192
|
+
if (type === 'py') {
|
193
|
+
if (state.scopes[0].type !== 'py') {
|
194
|
+
state.scopes[0].offset = stream.indentation();
|
195
|
+
return;
|
196
|
+
}
|
197
|
+
for (var i = 0; i < state.scopes.length; ++i) {
|
198
|
+
if (state.scopes[i].type === 'py') {
|
199
|
+
indentUnit = state.scopes[i].offset + conf.indentUnit;
|
200
|
+
break;
|
201
|
+
}
|
202
|
+
}
|
203
|
+
} else {
|
204
|
+
indentUnit = stream.column() + stream.current().length;
|
205
|
+
}
|
206
|
+
state.scopes.unshift({
|
207
|
+
offset: indentUnit,
|
208
|
+
type: type
|
209
|
+
});
|
210
|
+
}
|
211
|
+
|
212
|
+
function dedent(stream, state, type) {
|
213
|
+
type = type || 'py';
|
214
|
+
if (state.scopes.length == 1) return;
|
215
|
+
if (state.scopes[0].type === 'py') {
|
216
|
+
var _indent = stream.indentation();
|
217
|
+
var _indent_index = -1;
|
218
|
+
for (var i = 0; i < state.scopes.length; ++i) {
|
219
|
+
if (_indent === state.scopes[i].offset) {
|
220
|
+
_indent_index = i;
|
221
|
+
break;
|
222
|
+
}
|
223
|
+
}
|
224
|
+
if (_indent_index === -1) {
|
225
|
+
return true;
|
226
|
+
}
|
227
|
+
while (state.scopes[0].offset !== _indent) {
|
228
|
+
state.scopes.shift();
|
229
|
+
}
|
230
|
+
return false
|
231
|
+
} else {
|
232
|
+
if (type === 'py') {
|
233
|
+
state.scopes[0].offset = stream.indentation();
|
234
|
+
return false;
|
235
|
+
} else {
|
236
|
+
if (state.scopes[0].type != type) {
|
237
|
+
return true;
|
238
|
+
}
|
239
|
+
state.scopes.shift();
|
240
|
+
return false;
|
241
|
+
}
|
242
|
+
}
|
243
|
+
}
|
244
|
+
|
245
|
+
function tokenLexer(stream, state) {
|
246
|
+
indentInfo = null;
|
247
|
+
var style = state.tokenize(stream, state);
|
248
|
+
var current = stream.current();
|
249
|
+
|
250
|
+
// Handle '.' connected identifiers
|
251
|
+
if (current === '.') {
|
252
|
+
style = state.tokenize(stream, state);
|
253
|
+
current = stream.current();
|
254
|
+
if (style === 'variable' || style === 'builtin') {
|
255
|
+
return 'variable';
|
256
|
+
} else {
|
257
|
+
return ERRORCLASS;
|
258
|
+
}
|
259
|
+
}
|
260
|
+
|
261
|
+
// Handle decorators
|
262
|
+
if (current === '@') {
|
263
|
+
style = state.tokenize(stream, state);
|
264
|
+
current = stream.current();
|
265
|
+
if (style === 'variable'
|
266
|
+
|| current === '@staticmethod'
|
267
|
+
|| current === '@classmethod') {
|
268
|
+
return 'meta';
|
269
|
+
} else {
|
270
|
+
return ERRORCLASS;
|
271
|
+
}
|
272
|
+
}
|
273
|
+
|
274
|
+
// Handle scope changes.
|
275
|
+
if (current === 'pass' || current === 'return') {
|
276
|
+
state.dedent += 1;
|
277
|
+
}
|
278
|
+
if ((current === ':' && !state.lambda && state.scopes[0].type == 'py')
|
279
|
+
|| indentInfo === 'indent') {
|
280
|
+
indent(stream, state);
|
281
|
+
}
|
282
|
+
var delimiter_index = '[({'.indexOf(current);
|
283
|
+
if (delimiter_index !== -1) {
|
284
|
+
indent(stream, state, '])}'.slice(delimiter_index, delimiter_index+1));
|
285
|
+
}
|
286
|
+
if (indentInfo === 'dedent') {
|
287
|
+
if (dedent(stream, state)) {
|
288
|
+
return ERRORCLASS;
|
289
|
+
}
|
290
|
+
}
|
291
|
+
delimiter_index = '])}'.indexOf(current);
|
292
|
+
if (delimiter_index !== -1) {
|
293
|
+
if (dedent(stream, state, current)) {
|
294
|
+
return ERRORCLASS;
|
295
|
+
}
|
296
|
+
}
|
297
|
+
if (state.dedent > 0 && stream.eol() && state.scopes[0].type == 'py') {
|
298
|
+
if (state.scopes.length > 1) state.scopes.shift();
|
299
|
+
state.dedent -= 1;
|
300
|
+
}
|
301
|
+
|
302
|
+
return style;
|
303
|
+
}
|
304
|
+
|
305
|
+
var external = {
|
306
|
+
startState: function(basecolumn) {
|
307
|
+
return {
|
308
|
+
tokenize: tokenBase,
|
309
|
+
scopes: [{offset:basecolumn || 0, type:'py'}],
|
310
|
+
lastToken: null,
|
311
|
+
lambda: false,
|
312
|
+
dedent: 0
|
313
|
+
};
|
314
|
+
},
|
315
|
+
|
316
|
+
token: function(stream, state) {
|
317
|
+
var style = tokenLexer(stream, state);
|
318
|
+
|
319
|
+
state.lastToken = {style:style, content: stream.current()};
|
320
|
+
|
321
|
+
if (stream.eol() && stream.lambda) {
|
322
|
+
state.lambda = false;
|
323
|
+
}
|
324
|
+
|
325
|
+
return style;
|
326
|
+
},
|
327
|
+
|
328
|
+
indent: function(state, textAfter) {
|
329
|
+
if (state.tokenize != tokenBase) {
|
330
|
+
return 0;
|
331
|
+
}
|
332
|
+
|
333
|
+
return state.scopes[0].offset;
|
334
|
+
}
|
335
|
+
|
336
|
+
};
|
337
|
+
return external;
|
338
|
+
});
|
339
|
+
|
340
|
+
CodeMirror.defineMIME("text/x-python", "python");
|
@@ -0,0 +1,24 @@
|
|
1
|
+
Copyright (c) 2011, Ubalo, Inc.
|
2
|
+
All rights reserved.
|
3
|
+
|
4
|
+
Redistribution and use in source and binary forms, with or without
|
5
|
+
modification, are permitted provided that the following conditions are met:
|
6
|
+
* Redistributions of source code must retain the above copyright
|
7
|
+
notice, this list of conditions and the following disclaimer.
|
8
|
+
* Redistributions in binary form must reproduce the above copyright
|
9
|
+
notice, this list of conditions and the following disclaimer in the
|
10
|
+
documentation and/or other materials provided with the distribution.
|
11
|
+
* Neither the name of the Ubalo, Inc nor the names of its
|
12
|
+
contributors may be used to endorse or promote products derived
|
13
|
+
from this software without specific prior written permission.
|
14
|
+
|
15
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
16
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
17
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
18
|
+
DISCLAIMED. IN NO EVENT SHALL UBALO, INC BE LIABLE FOR ANY
|
19
|
+
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
20
|
+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
21
|
+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
22
|
+
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
23
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
24
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
@@ -0,0 +1,73 @@
|
|
1
|
+
<!doctype html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>CodeMirror: R mode</title>
|
5
|
+
<link rel="stylesheet" href="../../lib/codemirror.css">
|
6
|
+
<script src="../../lib/codemirror.js"></script>
|
7
|
+
<script src="r.js"></script>
|
8
|
+
<style>
|
9
|
+
.CodeMirror { border-top: 1px solid silver; border-bottom: 1px solid silver; }
|
10
|
+
.cm-s-default span.cm-semi { color: blue; font-weight: bold; }
|
11
|
+
.cm-s-default span.cm-dollar { color: orange; font-weight: bold; }
|
12
|
+
.cm-s-default span.cm-arrow { color: brown; }
|
13
|
+
.cm-s-default span.cm-arg-is { color: brown; }
|
14
|
+
</style>
|
15
|
+
<link rel="stylesheet" href="../../doc/docs.css">
|
16
|
+
</head>
|
17
|
+
<body>
|
18
|
+
<h1>CodeMirror: R mode</h1>
|
19
|
+
<form><textarea id="code" name="code">
|
20
|
+
# Code from http://www.mayin.org/ajayshah/KB/R/
|
21
|
+
|
22
|
+
# FIRST LEARN ABOUT LISTS --
|
23
|
+
X = list(height=5.4, weight=54)
|
24
|
+
print("Use default printing --")
|
25
|
+
print(X)
|
26
|
+
print("Accessing individual elements --")
|
27
|
+
cat("Your height is ", X$height, " and your weight is ", X$weight, "\n")
|
28
|
+
|
29
|
+
# FUNCTIONS --
|
30
|
+
square <- function(x) {
|
31
|
+
return(x*x)
|
32
|
+
}
|
33
|
+
cat("The square of 3 is ", square(3), "\n")
|
34
|
+
|
35
|
+
# default value of the arg is set to 5.
|
36
|
+
cube <- function(x=5) {
|
37
|
+
return(x*x*x);
|
38
|
+
}
|
39
|
+
cat("Calling cube with 2 : ", cube(2), "\n") # will give 2^3
|
40
|
+
cat("Calling cube : ", cube(), "\n") # will default to 5^3.
|
41
|
+
|
42
|
+
# LEARN ABOUT FUNCTIONS THAT RETURN MULTIPLE OBJECTS --
|
43
|
+
powers <- function(x) {
|
44
|
+
parcel = list(x2=x*x, x3=x*x*x, x4=x*x*x*x);
|
45
|
+
return(parcel);
|
46
|
+
}
|
47
|
+
|
48
|
+
X = powers(3);
|
49
|
+
print("Showing powers of 3 --"); print(X);
|
50
|
+
|
51
|
+
# WRITING THIS COMPACTLY (4 lines instead of 7)
|
52
|
+
|
53
|
+
powerful <- function(x) {
|
54
|
+
return(list(x2=x*x, x3=x*x*x, x4=x*x*x*x));
|
55
|
+
}
|
56
|
+
print("Showing powers of 3 --"); print(powerful(3));
|
57
|
+
|
58
|
+
# In R, the last expression in a function is, by default, what is
|
59
|
+
# returned. So you could equally just say:
|
60
|
+
powerful <- function(x) {list(x2=x*x, x3=x*x*x, x4=x*x*x*x)}
|
61
|
+
</textarea></form>
|
62
|
+
<script>
|
63
|
+
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {});
|
64
|
+
</script>
|
65
|
+
|
66
|
+
<p><strong>MIME types defined:</strong> <code>text/x-rsrc</code>.</p>
|
67
|
+
|
68
|
+
<p>Development of the CodeMirror R mode was kindly sponsored
|
69
|
+
by <a href="http://ubalo.com/">Ubalo</a>, who hold
|
70
|
+
the <a href="LICENSE">license</a>.</p>
|
71
|
+
|
72
|
+
</body>
|
73
|
+
</html>
|