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,360 @@
|
|
1
|
+
CodeMirror.defineMode("javascript", function(config, parserConfig) {
|
2
|
+
var indentUnit = config.indentUnit;
|
3
|
+
var jsonMode = parserConfig.json;
|
4
|
+
|
5
|
+
// Tokenizer
|
6
|
+
|
7
|
+
var keywords = function(){
|
8
|
+
function kw(type) {return {type: type, style: "keyword"};}
|
9
|
+
var A = kw("keyword a"), B = kw("keyword b"), C = kw("keyword c");
|
10
|
+
var operator = kw("operator"), atom = {type: "atom", style: "atom"};
|
11
|
+
return {
|
12
|
+
"if": A, "while": A, "with": A, "else": B, "do": B, "try": B, "finally": B,
|
13
|
+
"return": C, "break": C, "continue": C, "new": C, "delete": C, "throw": C,
|
14
|
+
"var": kw("var"), "const": kw("var"), "let": kw("var"),
|
15
|
+
"function": kw("function"), "catch": kw("catch"),
|
16
|
+
"for": kw("for"), "switch": kw("switch"), "case": kw("case"), "default": kw("default"),
|
17
|
+
"in": operator, "typeof": operator, "instanceof": operator,
|
18
|
+
"true": atom, "false": atom, "null": atom, "undefined": atom, "NaN": atom, "Infinity": atom
|
19
|
+
};
|
20
|
+
}();
|
21
|
+
|
22
|
+
var isOperatorChar = /[+\-*&%=<>!?|]/;
|
23
|
+
|
24
|
+
function chain(stream, state, f) {
|
25
|
+
state.tokenize = f;
|
26
|
+
return f(stream, state);
|
27
|
+
}
|
28
|
+
|
29
|
+
function nextUntilUnescaped(stream, end) {
|
30
|
+
var escaped = false, next;
|
31
|
+
while ((next = stream.next()) != null) {
|
32
|
+
if (next == end && !escaped)
|
33
|
+
return false;
|
34
|
+
escaped = !escaped && next == "\\";
|
35
|
+
}
|
36
|
+
return escaped;
|
37
|
+
}
|
38
|
+
|
39
|
+
// Used as scratch variables to communicate multiple values without
|
40
|
+
// consing up tons of objects.
|
41
|
+
var type, content;
|
42
|
+
function ret(tp, style, cont) {
|
43
|
+
type = tp; content = cont;
|
44
|
+
return style;
|
45
|
+
}
|
46
|
+
|
47
|
+
function jsTokenBase(stream, state) {
|
48
|
+
var ch = stream.next();
|
49
|
+
if (ch == '"' || ch == "'")
|
50
|
+
return chain(stream, state, jsTokenString(ch));
|
51
|
+
else if (/[\[\]{}\(\),;\:\.]/.test(ch))
|
52
|
+
return ret(ch);
|
53
|
+
else if (ch == "0" && stream.eat(/x/i)) {
|
54
|
+
stream.eatWhile(/[\da-f]/i);
|
55
|
+
return ret("number", "number");
|
56
|
+
}
|
57
|
+
else if (/\d/.test(ch)) {
|
58
|
+
stream.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/);
|
59
|
+
return ret("number", "number");
|
60
|
+
}
|
61
|
+
else if (ch == "/") {
|
62
|
+
if (stream.eat("*")) {
|
63
|
+
return chain(stream, state, jsTokenComment);
|
64
|
+
}
|
65
|
+
else if (stream.eat("/")) {
|
66
|
+
stream.skipToEnd();
|
67
|
+
return ret("comment", "comment");
|
68
|
+
}
|
69
|
+
else if (state.reAllowed) {
|
70
|
+
nextUntilUnescaped(stream, "/");
|
71
|
+
stream.eatWhile(/[gimy]/); // 'y' is "sticky" option in Mozilla
|
72
|
+
return ret("regexp", "string-2");
|
73
|
+
}
|
74
|
+
else {
|
75
|
+
stream.eatWhile(isOperatorChar);
|
76
|
+
return ret("operator", null, stream.current());
|
77
|
+
}
|
78
|
+
}
|
79
|
+
else if (ch == "#") {
|
80
|
+
stream.skipToEnd();
|
81
|
+
return ret("error", "error");
|
82
|
+
}
|
83
|
+
else if (isOperatorChar.test(ch)) {
|
84
|
+
stream.eatWhile(isOperatorChar);
|
85
|
+
return ret("operator", null, stream.current());
|
86
|
+
}
|
87
|
+
else {
|
88
|
+
stream.eatWhile(/[\w\$_]/);
|
89
|
+
var word = stream.current(), known = keywords.propertyIsEnumerable(word) && keywords[word];
|
90
|
+
return (known && state.kwAllowed) ? ret(known.type, known.style, word) :
|
91
|
+
ret("variable", "variable", word);
|
92
|
+
}
|
93
|
+
}
|
94
|
+
|
95
|
+
function jsTokenString(quote) {
|
96
|
+
return function(stream, state) {
|
97
|
+
if (!nextUntilUnescaped(stream, quote))
|
98
|
+
state.tokenize = jsTokenBase;
|
99
|
+
return ret("string", "string");
|
100
|
+
};
|
101
|
+
}
|
102
|
+
|
103
|
+
function jsTokenComment(stream, state) {
|
104
|
+
var maybeEnd = false, ch;
|
105
|
+
while (ch = stream.next()) {
|
106
|
+
if (ch == "/" && maybeEnd) {
|
107
|
+
state.tokenize = jsTokenBase;
|
108
|
+
break;
|
109
|
+
}
|
110
|
+
maybeEnd = (ch == "*");
|
111
|
+
}
|
112
|
+
return ret("comment", "comment");
|
113
|
+
}
|
114
|
+
|
115
|
+
// Parser
|
116
|
+
|
117
|
+
var atomicTypes = {"atom": true, "number": true, "variable": true, "string": true, "regexp": true};
|
118
|
+
|
119
|
+
function JSLexical(indented, column, type, align, prev, info) {
|
120
|
+
this.indented = indented;
|
121
|
+
this.column = column;
|
122
|
+
this.type = type;
|
123
|
+
this.prev = prev;
|
124
|
+
this.info = info;
|
125
|
+
if (align != null) this.align = align;
|
126
|
+
}
|
127
|
+
|
128
|
+
function inScope(state, varname) {
|
129
|
+
for (var v = state.localVars; v; v = v.next)
|
130
|
+
if (v.name == varname) return true;
|
131
|
+
}
|
132
|
+
|
133
|
+
function parseJS(state, style, type, content, stream) {
|
134
|
+
var cc = state.cc;
|
135
|
+
// Communicate our context to the combinators.
|
136
|
+
// (Less wasteful than consing up a hundred closures on every call.)
|
137
|
+
cx.state = state; cx.stream = stream; cx.marked = null, cx.cc = cc;
|
138
|
+
|
139
|
+
if (!state.lexical.hasOwnProperty("align"))
|
140
|
+
state.lexical.align = true;
|
141
|
+
|
142
|
+
while(true) {
|
143
|
+
var combinator = cc.length ? cc.pop() : jsonMode ? expression : statement;
|
144
|
+
if (combinator(type, content)) {
|
145
|
+
while(cc.length && cc[cc.length - 1].lex)
|
146
|
+
cc.pop()();
|
147
|
+
if (cx.marked) return cx.marked;
|
148
|
+
if (type == "variable" && inScope(state, content)) return "variable-2";
|
149
|
+
return style;
|
150
|
+
}
|
151
|
+
}
|
152
|
+
}
|
153
|
+
|
154
|
+
// Combinator utils
|
155
|
+
|
156
|
+
var cx = {state: null, column: null, marked: null, cc: null};
|
157
|
+
function pass() {
|
158
|
+
for (var i = arguments.length - 1; i >= 0; i--) cx.cc.push(arguments[i]);
|
159
|
+
}
|
160
|
+
function cont() {
|
161
|
+
pass.apply(null, arguments);
|
162
|
+
return true;
|
163
|
+
}
|
164
|
+
function register(varname) {
|
165
|
+
var state = cx.state;
|
166
|
+
if (state.context) {
|
167
|
+
cx.marked = "def";
|
168
|
+
for (var v = state.localVars; v; v = v.next)
|
169
|
+
if (v.name == varname) return;
|
170
|
+
state.localVars = {name: varname, next: state.localVars};
|
171
|
+
}
|
172
|
+
}
|
173
|
+
|
174
|
+
// Combinators
|
175
|
+
|
176
|
+
var defaultVars = {name: "this", next: {name: "arguments"}};
|
177
|
+
function pushcontext() {
|
178
|
+
if (!cx.state.context) cx.state.localVars = defaultVars;
|
179
|
+
cx.state.context = {prev: cx.state.context, vars: cx.state.localVars};
|
180
|
+
}
|
181
|
+
function popcontext() {
|
182
|
+
cx.state.localVars = cx.state.context.vars;
|
183
|
+
cx.state.context = cx.state.context.prev;
|
184
|
+
}
|
185
|
+
function pushlex(type, info) {
|
186
|
+
var result = function() {
|
187
|
+
var state = cx.state;
|
188
|
+
state.lexical = new JSLexical(state.indented, cx.stream.column(), type, null, state.lexical, info)
|
189
|
+
};
|
190
|
+
result.lex = true;
|
191
|
+
return result;
|
192
|
+
}
|
193
|
+
function poplex() {
|
194
|
+
var state = cx.state;
|
195
|
+
if (state.lexical.prev) {
|
196
|
+
if (state.lexical.type == ")")
|
197
|
+
state.indented = state.lexical.indented;
|
198
|
+
state.lexical = state.lexical.prev;
|
199
|
+
}
|
200
|
+
}
|
201
|
+
poplex.lex = true;
|
202
|
+
|
203
|
+
function expect(wanted) {
|
204
|
+
return function expecting(type) {
|
205
|
+
if (type == wanted) return cont();
|
206
|
+
else if (wanted == ";") return pass();
|
207
|
+
else return cont(arguments.callee);
|
208
|
+
};
|
209
|
+
}
|
210
|
+
|
211
|
+
function statement(type) {
|
212
|
+
if (type == "var") return cont(pushlex("vardef"), vardef1, expect(";"), poplex);
|
213
|
+
if (type == "keyword a") return cont(pushlex("form"), expression, statement, poplex);
|
214
|
+
if (type == "keyword b") return cont(pushlex("form"), statement, poplex);
|
215
|
+
if (type == "{") return cont(pushlex("}"), block, poplex);
|
216
|
+
if (type == ";") return cont();
|
217
|
+
if (type == "function") return cont(functiondef);
|
218
|
+
if (type == "for") return cont(pushlex("form"), expect("("), pushlex(")"), forspec1, expect(")"),
|
219
|
+
poplex, statement, poplex);
|
220
|
+
if (type == "variable") return cont(pushlex("stat"), maybelabel);
|
221
|
+
if (type == "switch") return cont(pushlex("form"), expression, pushlex("}", "switch"), expect("{"),
|
222
|
+
block, poplex, poplex);
|
223
|
+
if (type == "case") return cont(expression, expect(":"));
|
224
|
+
if (type == "default") return cont(expect(":"));
|
225
|
+
if (type == "catch") return cont(pushlex("form"), pushcontext, expect("("), funarg, expect(")"),
|
226
|
+
statement, poplex, popcontext);
|
227
|
+
return pass(pushlex("stat"), expression, expect(";"), poplex);
|
228
|
+
}
|
229
|
+
function expression(type) {
|
230
|
+
if (atomicTypes.hasOwnProperty(type)) return cont(maybeoperator);
|
231
|
+
if (type == "function") return cont(functiondef);
|
232
|
+
if (type == "keyword c") return cont(maybeexpression);
|
233
|
+
if (type == "(") return cont(pushlex(")"), maybeexpression, expect(")"), poplex, maybeoperator);
|
234
|
+
if (type == "operator") return cont(expression);
|
235
|
+
if (type == "[") return cont(pushlex("]"), commasep(expression, "]"), poplex, maybeoperator);
|
236
|
+
if (type == "{") return cont(pushlex("}"), commasep(objprop, "}"), poplex, maybeoperator);
|
237
|
+
return cont();
|
238
|
+
}
|
239
|
+
function maybeexpression(type) {
|
240
|
+
if (type.match(/[;\}\)\],]/)) return pass();
|
241
|
+
return pass(expression);
|
242
|
+
}
|
243
|
+
|
244
|
+
function maybeoperator(type, value) {
|
245
|
+
if (type == "operator" && /\+\+|--/.test(value)) return cont(maybeoperator);
|
246
|
+
if (type == "operator") return cont(expression);
|
247
|
+
if (type == ";") return;
|
248
|
+
if (type == "(") return cont(pushlex(")"), commasep(expression, ")"), poplex, maybeoperator);
|
249
|
+
if (type == ".") return cont(property, maybeoperator);
|
250
|
+
if (type == "[") return cont(pushlex("]"), expression, expect("]"), poplex, maybeoperator);
|
251
|
+
}
|
252
|
+
function maybelabel(type) {
|
253
|
+
if (type == ":") return cont(poplex, statement);
|
254
|
+
return pass(maybeoperator, expect(";"), poplex);
|
255
|
+
}
|
256
|
+
function property(type) {
|
257
|
+
if (type == "variable") {cx.marked = "property"; return cont();}
|
258
|
+
}
|
259
|
+
function objprop(type) {
|
260
|
+
if (type == "variable") cx.marked = "property";
|
261
|
+
if (atomicTypes.hasOwnProperty(type)) return cont(expect(":"), expression);
|
262
|
+
}
|
263
|
+
function commasep(what, end) {
|
264
|
+
function proceed(type) {
|
265
|
+
if (type == ",") return cont(what, proceed);
|
266
|
+
if (type == end) return cont();
|
267
|
+
return cont(expect(end));
|
268
|
+
}
|
269
|
+
return function commaSeparated(type) {
|
270
|
+
if (type == end) return cont();
|
271
|
+
else return pass(what, proceed);
|
272
|
+
};
|
273
|
+
}
|
274
|
+
function block(type) {
|
275
|
+
if (type == "}") return cont();
|
276
|
+
return pass(statement, block);
|
277
|
+
}
|
278
|
+
function vardef1(type, value) {
|
279
|
+
if (type == "variable"){register(value); return cont(vardef2);}
|
280
|
+
return cont();
|
281
|
+
}
|
282
|
+
function vardef2(type, value) {
|
283
|
+
if (value == "=") return cont(expression, vardef2);
|
284
|
+
if (type == ",") return cont(vardef1);
|
285
|
+
}
|
286
|
+
function forspec1(type) {
|
287
|
+
if (type == "var") return cont(vardef1, forspec2);
|
288
|
+
if (type == ";") return pass(forspec2);
|
289
|
+
if (type == "variable") return cont(formaybein);
|
290
|
+
return pass(forspec2);
|
291
|
+
}
|
292
|
+
function formaybein(type, value) {
|
293
|
+
if (value == "in") return cont(expression);
|
294
|
+
return cont(maybeoperator, forspec2);
|
295
|
+
}
|
296
|
+
function forspec2(type, value) {
|
297
|
+
if (type == ";") return cont(forspec3);
|
298
|
+
if (value == "in") return cont(expression);
|
299
|
+
return cont(expression, expect(";"), forspec3);
|
300
|
+
}
|
301
|
+
function forspec3(type) {
|
302
|
+
if (type != ")") cont(expression);
|
303
|
+
}
|
304
|
+
function functiondef(type, value) {
|
305
|
+
if (type == "variable") {register(value); return cont(functiondef);}
|
306
|
+
if (type == "(") return cont(pushlex(")"), pushcontext, commasep(funarg, ")"), poplex, statement, popcontext);
|
307
|
+
}
|
308
|
+
function funarg(type, value) {
|
309
|
+
if (type == "variable") {register(value); return cont();}
|
310
|
+
}
|
311
|
+
|
312
|
+
// Interface
|
313
|
+
|
314
|
+
return {
|
315
|
+
startState: function(basecolumn) {
|
316
|
+
return {
|
317
|
+
tokenize: jsTokenBase,
|
318
|
+
reAllowed: true,
|
319
|
+
kwAllowed: true,
|
320
|
+
cc: [],
|
321
|
+
lexical: new JSLexical((basecolumn || 0) - indentUnit, 0, "block", false),
|
322
|
+
localVars: null,
|
323
|
+
context: null,
|
324
|
+
indented: 0
|
325
|
+
};
|
326
|
+
},
|
327
|
+
|
328
|
+
token: function(stream, state) {
|
329
|
+
if (stream.sol()) {
|
330
|
+
if (!state.lexical.hasOwnProperty("align"))
|
331
|
+
state.lexical.align = false;
|
332
|
+
state.indented = stream.indentation();
|
333
|
+
}
|
334
|
+
if (stream.eatSpace()) return null;
|
335
|
+
var style = state.tokenize(stream, state);
|
336
|
+
if (type == "comment") return style;
|
337
|
+
state.reAllowed = type == "operator" || type == "keyword c" || type.match(/^[\[{}\(,;:]$/);
|
338
|
+
state.kwAllowed = type != '.';
|
339
|
+
return parseJS(state, style, type, content, stream);
|
340
|
+
},
|
341
|
+
|
342
|
+
indent: function(state, textAfter) {
|
343
|
+
if (state.tokenize != jsTokenBase) return 0;
|
344
|
+
var firstChar = textAfter && textAfter.charAt(0), lexical = state.lexical,
|
345
|
+
type = lexical.type, closing = firstChar == type;
|
346
|
+
if (type == "vardef") return lexical.indented + 4;
|
347
|
+
else if (type == "form" && firstChar == "{") return lexical.indented;
|
348
|
+
else if (type == "stat" || type == "form") return lexical.indented + indentUnit;
|
349
|
+
else if (lexical.info == "switch" && !closing)
|
350
|
+
return lexical.indented + (/^(?:case|default)\b/.test(textAfter) ? indentUnit : 2 * indentUnit);
|
351
|
+
else if (lexical.align) return lexical.column + (closing ? 0 : 1);
|
352
|
+
else return lexical.indented + (closing ? 0 : indentUnit);
|
353
|
+
},
|
354
|
+
|
355
|
+
electricChars: ":{}"
|
356
|
+
};
|
357
|
+
});
|
358
|
+
|
359
|
+
CodeMirror.defineMIME("text/javascript", "javascript");
|
360
|
+
CodeMirror.defineMIME("application/json", {name: "javascript", json: true});
|
@@ -0,0 +1,37 @@
|
|
1
|
+
<!doctype html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>CodeMirror: Jinja2 mode</title>
|
5
|
+
<link rel="stylesheet" href="../../lib/codemirror.css">
|
6
|
+
<script src="../../lib/codemirror.js"></script>
|
7
|
+
<script src="jinja2.js"></script>
|
8
|
+
<style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
|
9
|
+
<link rel="stylesheet" href="../../doc/docs.css">
|
10
|
+
</head>
|
11
|
+
<body>
|
12
|
+
<h1>CodeMirror: Jinja2 mode</h1>
|
13
|
+
<form><textarea id="code" name="code">
|
14
|
+
<html style="color: green">
|
15
|
+
<!-- this is a comment -->
|
16
|
+
<head>
|
17
|
+
<title>Jinja2 Example</title>
|
18
|
+
</head>
|
19
|
+
<body>
|
20
|
+
<ul>
|
21
|
+
{# this is a comment #}
|
22
|
+
{%- for item in li -%}
|
23
|
+
<li>
|
24
|
+
{{ item.label }}
|
25
|
+
</li>
|
26
|
+
{% endfor -%}
|
27
|
+
</ul>
|
28
|
+
</body>
|
29
|
+
</html>
|
30
|
+
</textarea></form>
|
31
|
+
<script>
|
32
|
+
var editor =
|
33
|
+
CodeMirror.fromTextArea(document.getElementById("code"), {mode:
|
34
|
+
{name: "jinja2", htmlMode: true}});
|
35
|
+
</script>
|
36
|
+
</body>
|
37
|
+
</html>
|
@@ -0,0 +1,42 @@
|
|
1
|
+
CodeMirror.defineMode("jinja2", function(config, parserConf) {
|
2
|
+
var keywords = ["block", "endblock", "for", "endfor", "in", "true", "false",
|
3
|
+
"loop", "none", "self", "super", "if", "as", "not", "and",
|
4
|
+
"else", "import", "with", "without", "context"];
|
5
|
+
keywords = new RegExp("^((" + keywords.join(")|(") + "))\\b");
|
6
|
+
|
7
|
+
function tokenBase (stream, state) {
|
8
|
+
var ch = stream.next();
|
9
|
+
if (ch == "{") {
|
10
|
+
if (ch = stream.eat(/\{|%|#/)) {
|
11
|
+
stream.eat("-");
|
12
|
+
state.tokenize = inTag(ch);
|
13
|
+
return "tag";
|
14
|
+
}
|
15
|
+
}
|
16
|
+
}
|
17
|
+
function inTag (close) {
|
18
|
+
if (close == "{") {
|
19
|
+
close = "}";
|
20
|
+
}
|
21
|
+
return function (stream, state) {
|
22
|
+
var ch = stream.next();
|
23
|
+
if ((ch == close || (ch == "-" && stream.eat(close)))
|
24
|
+
&& stream.eat("}")) {
|
25
|
+
state.tokenize = tokenBase;
|
26
|
+
return "tag";
|
27
|
+
}
|
28
|
+
if (stream.match(keywords)) {
|
29
|
+
return "keyword";
|
30
|
+
}
|
31
|
+
return close == "#" ? "comment" : "string";
|
32
|
+
};
|
33
|
+
}
|
34
|
+
return {
|
35
|
+
startState: function () {
|
36
|
+
return {tokenize: tokenBase};
|
37
|
+
},
|
38
|
+
token: function (stream, state) {
|
39
|
+
return state.tokenize(stream, state);
|
40
|
+
}
|
41
|
+
};
|
42
|
+
});
|