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,490 @@
|
|
1
|
+
/**
|
2
|
+
* xmlpure.js
|
3
|
+
*
|
4
|
+
* Building upon and improving the CodeMirror 2 XML parser
|
5
|
+
* @author: Dror BG (deebug.dev@gmail.com)
|
6
|
+
* @date: August, 2011
|
7
|
+
*/
|
8
|
+
|
9
|
+
CodeMirror.defineMode("xmlpure", function(config, parserConfig) {
|
10
|
+
// constants
|
11
|
+
var STYLE_ERROR = "error";
|
12
|
+
var STYLE_INSTRUCTION = "comment";
|
13
|
+
var STYLE_COMMENT = "comment";
|
14
|
+
var STYLE_ELEMENT_NAME = "tag";
|
15
|
+
var STYLE_ATTRIBUTE = "attribute";
|
16
|
+
var STYLE_WORD = "string";
|
17
|
+
var STYLE_TEXT = "atom";
|
18
|
+
var STYLE_ENTITIES = "string";
|
19
|
+
|
20
|
+
var TAG_INSTRUCTION = "!instruction";
|
21
|
+
var TAG_CDATA = "!cdata";
|
22
|
+
var TAG_COMMENT = "!comment";
|
23
|
+
var TAG_TEXT = "!text";
|
24
|
+
|
25
|
+
var doNotIndent = {
|
26
|
+
"!cdata": true,
|
27
|
+
"!comment": true,
|
28
|
+
"!text": true,
|
29
|
+
"!instruction": true
|
30
|
+
};
|
31
|
+
|
32
|
+
// options
|
33
|
+
var indentUnit = config.indentUnit;
|
34
|
+
|
35
|
+
///////////////////////////////////////////////////////////////////////////
|
36
|
+
// helper functions
|
37
|
+
|
38
|
+
// chain a parser to another parser
|
39
|
+
function chain(stream, state, parser) {
|
40
|
+
state.tokenize = parser;
|
41
|
+
return parser(stream, state);
|
42
|
+
}
|
43
|
+
|
44
|
+
// parse a block (comment, CDATA or text)
|
45
|
+
function inBlock(style, terminator, nextTokenize) {
|
46
|
+
return function(stream, state) {
|
47
|
+
while (!stream.eol()) {
|
48
|
+
if (stream.match(terminator)) {
|
49
|
+
popContext(state);
|
50
|
+
state.tokenize = nextTokenize;
|
51
|
+
break;
|
52
|
+
}
|
53
|
+
stream.next();
|
54
|
+
}
|
55
|
+
return style;
|
56
|
+
};
|
57
|
+
}
|
58
|
+
|
59
|
+
// go down a level in the document
|
60
|
+
// (hint: look at who calls this function to know what the contexts are)
|
61
|
+
function pushContext(state, tagName) {
|
62
|
+
var noIndent = doNotIndent.hasOwnProperty(tagName) || (state.context && state.context.doIndent);
|
63
|
+
var newContext = {
|
64
|
+
tagName: tagName,
|
65
|
+
prev: state.context,
|
66
|
+
indent: state.context ? state.context.indent + indentUnit : 0,
|
67
|
+
lineNumber: state.lineNumber,
|
68
|
+
indented: state.indented,
|
69
|
+
noIndent: noIndent
|
70
|
+
};
|
71
|
+
state.context = newContext;
|
72
|
+
}
|
73
|
+
|
74
|
+
// go up a level in the document
|
75
|
+
function popContext(state) {
|
76
|
+
if (state.context) {
|
77
|
+
var oldContext = state.context;
|
78
|
+
state.context = oldContext.prev;
|
79
|
+
return oldContext;
|
80
|
+
}
|
81
|
+
|
82
|
+
// we shouldn't be here - it means we didn't have a context to pop
|
83
|
+
return null;
|
84
|
+
}
|
85
|
+
|
86
|
+
// return true if the current token is seperated from the tokens before it
|
87
|
+
// which means either this is the start of the line, or there is at least
|
88
|
+
// one space or tab character behind the token
|
89
|
+
// otherwise returns false
|
90
|
+
function isTokenSeparated(stream) {
|
91
|
+
return stream.sol() ||
|
92
|
+
stream.string.charAt(stream.start - 1) == " " ||
|
93
|
+
stream.string.charAt(stream.start - 1) == "\t";
|
94
|
+
}
|
95
|
+
|
96
|
+
///////////////////////////////////////////////////////////////////////////
|
97
|
+
// context: document
|
98
|
+
//
|
99
|
+
// an XML document can contain:
|
100
|
+
// - a single declaration (if defined, it must be the very first line)
|
101
|
+
// - exactly one root element
|
102
|
+
// @todo try to actually limit the number of root elements to 1
|
103
|
+
// - zero or more comments
|
104
|
+
function parseDocument(stream, state) {
|
105
|
+
if(stream.eat("<")) {
|
106
|
+
if(stream.eat("?")) {
|
107
|
+
// processing instruction
|
108
|
+
pushContext(state, TAG_INSTRUCTION);
|
109
|
+
state.tokenize = parseProcessingInstructionStartTag;
|
110
|
+
return STYLE_INSTRUCTION;
|
111
|
+
} else if(stream.match("!--")) {
|
112
|
+
// new context: comment
|
113
|
+
pushContext(state, TAG_COMMENT);
|
114
|
+
return chain(stream, state, inBlock(STYLE_COMMENT, "-->", parseDocument));
|
115
|
+
} else if(stream.eatSpace() || stream.eol() ) {
|
116
|
+
stream.skipToEnd();
|
117
|
+
return STYLE_ERROR;
|
118
|
+
} else {
|
119
|
+
// element
|
120
|
+
state.tokenize = parseElementTagName;
|
121
|
+
return STYLE_ELEMENT_NAME;
|
122
|
+
}
|
123
|
+
}
|
124
|
+
|
125
|
+
// error on line
|
126
|
+
stream.skipToEnd();
|
127
|
+
return STYLE_ERROR;
|
128
|
+
}
|
129
|
+
|
130
|
+
///////////////////////////////////////////////////////////////////////////
|
131
|
+
// context: XML element start-tag or end-tag
|
132
|
+
//
|
133
|
+
// - element start-tag can contain attributes
|
134
|
+
// - element start-tag may self-close (or start an element block if it doesn't)
|
135
|
+
// - element end-tag can contain only the tag name
|
136
|
+
function parseElementTagName(stream, state) {
|
137
|
+
// get the name of the tag
|
138
|
+
var startPos = stream.pos;
|
139
|
+
if(stream.match(/^[a-zA-Z_:][-a-zA-Z0-9_:.]*/)) {
|
140
|
+
// element start-tag
|
141
|
+
var tagName = stream.string.substring(startPos, stream.pos);
|
142
|
+
pushContext(state, tagName);
|
143
|
+
state.tokenize = parseElement;
|
144
|
+
return STYLE_ELEMENT_NAME;
|
145
|
+
} else if(stream.match(/^\/[a-zA-Z_:][-a-zA-Z0-9_:.]*( )*>/)) {
|
146
|
+
// element end-tag
|
147
|
+
var endTagName = stream.string.substring(startPos + 1, stream.pos - 1).trim();
|
148
|
+
var oldContext = popContext(state);
|
149
|
+
state.tokenize = state.context == null ? parseDocument : parseElementBlock;
|
150
|
+
if(oldContext == null || endTagName != oldContext.tagName) {
|
151
|
+
// the start and end tag names should match - error
|
152
|
+
return STYLE_ERROR;
|
153
|
+
}
|
154
|
+
return STYLE_ELEMENT_NAME;
|
155
|
+
} else {
|
156
|
+
// no tag name - error
|
157
|
+
state.tokenize = state.context == null ? parseDocument : parseElementBlock;
|
158
|
+
stream.eatWhile(/[^>]/);
|
159
|
+
stream.eat(">");
|
160
|
+
return STYLE_ERROR;
|
161
|
+
}
|
162
|
+
|
163
|
+
stream.skipToEnd();
|
164
|
+
return null;
|
165
|
+
}
|
166
|
+
|
167
|
+
function parseElement(stream, state) {
|
168
|
+
if(stream.match(/^\/>/)) {
|
169
|
+
// self-closing tag
|
170
|
+
popContext(state);
|
171
|
+
state.tokenize = state.context == null ? parseDocument : parseElementBlock;
|
172
|
+
return STYLE_ELEMENT_NAME;
|
173
|
+
} else if(stream.eat(/^>/)) {
|
174
|
+
state.tokenize = parseElementBlock;
|
175
|
+
return STYLE_ELEMENT_NAME;
|
176
|
+
} else if(isTokenSeparated(stream) && stream.match(/^[a-zA-Z_:][-a-zA-Z0-9_:.]*( )*=/)) {
|
177
|
+
// attribute
|
178
|
+
state.tokenize = parseAttribute;
|
179
|
+
return STYLE_ATTRIBUTE;
|
180
|
+
}
|
181
|
+
|
182
|
+
// no other options - this is an error
|
183
|
+
state.tokenize = state.context == null ? parseDocument : parseDocument;
|
184
|
+
stream.eatWhile(/[^>]/);
|
185
|
+
stream.eat(">");
|
186
|
+
return STYLE_ERROR;
|
187
|
+
}
|
188
|
+
|
189
|
+
///////////////////////////////////////////////////////////////////////////
|
190
|
+
// context: attribute
|
191
|
+
//
|
192
|
+
// attribute values may contain everything, except:
|
193
|
+
// - the ending quote (with ' or ") - this marks the end of the value
|
194
|
+
// - the character "<" - should never appear
|
195
|
+
// - ampersand ("&") - unless it starts a reference: a string that ends with a semi-colon (";")
|
196
|
+
// ---> note: this parser is lax in what may be put into a reference string,
|
197
|
+
// ---> consult http://www.w3.org/TR/REC-xml/#NT-Reference if you want to make it tighter
|
198
|
+
function parseAttribute(stream, state) {
|
199
|
+
var quote = stream.next();
|
200
|
+
if(quote != "\"" && quote != "'") {
|
201
|
+
// attribute must be quoted
|
202
|
+
stream.skipToEnd();
|
203
|
+
state.tokenize = parseElement;
|
204
|
+
return STYLE_ERROR;
|
205
|
+
}
|
206
|
+
|
207
|
+
state.tokParams.quote = quote;
|
208
|
+
state.tokenize = parseAttributeValue;
|
209
|
+
return STYLE_WORD;
|
210
|
+
}
|
211
|
+
|
212
|
+
// @todo: find out whether this attribute value spans multiple lines,
|
213
|
+
// and if so, push a context for it in order not to indent it
|
214
|
+
// (or something of the sort..)
|
215
|
+
function parseAttributeValue(stream, state) {
|
216
|
+
var ch = "";
|
217
|
+
while(!stream.eol()) {
|
218
|
+
ch = stream.next();
|
219
|
+
if(ch == state.tokParams.quote) {
|
220
|
+
// end quote found
|
221
|
+
state.tokenize = parseElement;
|
222
|
+
return STYLE_WORD;
|
223
|
+
} else if(ch == "<") {
|
224
|
+
// can't have less-than signs in an attribute value, ever
|
225
|
+
stream.skipToEnd()
|
226
|
+
state.tokenize = parseElement;
|
227
|
+
return STYLE_ERROR;
|
228
|
+
} else if(ch == "&") {
|
229
|
+
// reference - look for a semi-colon, or return error if none found
|
230
|
+
ch = stream.next();
|
231
|
+
|
232
|
+
// make sure that semi-colon isn't right after the ampersand
|
233
|
+
if(ch == ';') {
|
234
|
+
stream.skipToEnd()
|
235
|
+
state.tokenize = parseElement;
|
236
|
+
return STYLE_ERROR;
|
237
|
+
}
|
238
|
+
|
239
|
+
// make sure no less-than characters slipped in
|
240
|
+
while(!stream.eol() && ch != ";") {
|
241
|
+
if(ch == "<") {
|
242
|
+
// can't have less-than signs in an attribute value, ever
|
243
|
+
stream.skipToEnd()
|
244
|
+
state.tokenize = parseElement;
|
245
|
+
return STYLE_ERROR;
|
246
|
+
}
|
247
|
+
ch = stream.next();
|
248
|
+
}
|
249
|
+
if(stream.eol() && ch != ";") {
|
250
|
+
// no ampersand found - error
|
251
|
+
stream.skipToEnd();
|
252
|
+
state.tokenize = parseElement;
|
253
|
+
return STYLE_ERROR;
|
254
|
+
}
|
255
|
+
}
|
256
|
+
}
|
257
|
+
|
258
|
+
// attribute value continues to next line
|
259
|
+
return STYLE_WORD;
|
260
|
+
}
|
261
|
+
|
262
|
+
///////////////////////////////////////////////////////////////////////////
|
263
|
+
// context: element block
|
264
|
+
//
|
265
|
+
// a block can contain:
|
266
|
+
// - elements
|
267
|
+
// - text
|
268
|
+
// - CDATA sections
|
269
|
+
// - comments
|
270
|
+
function parseElementBlock(stream, state) {
|
271
|
+
if(stream.eat("<")) {
|
272
|
+
if(stream.match("?")) {
|
273
|
+
pushContext(state, TAG_INSTRUCTION);
|
274
|
+
state.tokenize = parseProcessingInstructionStartTag;
|
275
|
+
return STYLE_INSTRUCTION;
|
276
|
+
} else if(stream.match("!--")) {
|
277
|
+
// new context: comment
|
278
|
+
pushContext(state, TAG_COMMENT);
|
279
|
+
return chain(stream, state, inBlock(STYLE_COMMENT, "-->",
|
280
|
+
state.context == null ? parseDocument : parseElementBlock));
|
281
|
+
} else if(stream.match("![CDATA[")) {
|
282
|
+
// new context: CDATA section
|
283
|
+
pushContext(state, TAG_CDATA);
|
284
|
+
return chain(stream, state, inBlock(STYLE_TEXT, "]]>",
|
285
|
+
state.context == null ? parseDocument : parseElementBlock));
|
286
|
+
} else if(stream.eatSpace() || stream.eol() ) {
|
287
|
+
stream.skipToEnd();
|
288
|
+
return STYLE_ERROR;
|
289
|
+
} else {
|
290
|
+
// element
|
291
|
+
state.tokenize = parseElementTagName;
|
292
|
+
return STYLE_ELEMENT_NAME;
|
293
|
+
}
|
294
|
+
} else if(stream.eat("&")) {
|
295
|
+
stream.eatWhile(/[^;]/);
|
296
|
+
stream.eat(";");
|
297
|
+
return STYLE_ENTITIES;
|
298
|
+
} else {
|
299
|
+
// new context: text
|
300
|
+
pushContext(state, TAG_TEXT);
|
301
|
+
state.tokenize = parseText;
|
302
|
+
return null;
|
303
|
+
}
|
304
|
+
|
305
|
+
state.tokenize = state.context == null ? parseDocument : parseElementBlock;
|
306
|
+
stream.skipToEnd();
|
307
|
+
return null;
|
308
|
+
}
|
309
|
+
|
310
|
+
function parseText(stream, state) {
|
311
|
+
stream.eatWhile(/[^<]/);
|
312
|
+
if(!stream.eol()) {
|
313
|
+
// we cannot possibly be in the document context,
|
314
|
+
// just inside an element block
|
315
|
+
popContext(state);
|
316
|
+
state.tokenize = parseElementBlock;
|
317
|
+
}
|
318
|
+
return STYLE_TEXT;
|
319
|
+
}
|
320
|
+
|
321
|
+
///////////////////////////////////////////////////////////////////////////
|
322
|
+
// context: XML processing instructions
|
323
|
+
//
|
324
|
+
// XML processing instructions (PIs) allow documents to contain instructions for applications.
|
325
|
+
// PI format: <?name data?>
|
326
|
+
// - 'name' can be anything other than 'xml' (case-insensitive)
|
327
|
+
// - 'data' can be anything which doesn't contain '?>'
|
328
|
+
// XML declaration is a special PI (see XML declaration context below)
|
329
|
+
function parseProcessingInstructionStartTag(stream, state) {
|
330
|
+
if(stream.match("xml", true, true)) {
|
331
|
+
// xml declaration
|
332
|
+
if(state.lineNumber > 1 || stream.pos > 5) {
|
333
|
+
state.tokenize = parseDocument;
|
334
|
+
stream.skipToEnd();
|
335
|
+
return STYLE_ERROR;
|
336
|
+
} else {
|
337
|
+
state.tokenize = parseDeclarationVersion;
|
338
|
+
return STYLE_INSTRUCTION;
|
339
|
+
}
|
340
|
+
}
|
341
|
+
|
342
|
+
// regular processing instruction
|
343
|
+
if(isTokenSeparated(stream) || stream.match("?>")) {
|
344
|
+
// we have a space after the start-tag, or nothing but the end-tag
|
345
|
+
// either way - error!
|
346
|
+
state.tokenize = parseDocument;
|
347
|
+
stream.skipToEnd();
|
348
|
+
return STYLE_ERROR;
|
349
|
+
}
|
350
|
+
|
351
|
+
state.tokenize = parseProcessingInstructionBody;
|
352
|
+
return STYLE_INSTRUCTION;
|
353
|
+
}
|
354
|
+
|
355
|
+
function parseProcessingInstructionBody(stream, state) {
|
356
|
+
stream.eatWhile(/[^?]/);
|
357
|
+
if(stream.eat("?")) {
|
358
|
+
if(stream.eat(">")) {
|
359
|
+
popContext(state);
|
360
|
+
state.tokenize = state.context == null ? parseDocument : parseElementBlock;
|
361
|
+
}
|
362
|
+
}
|
363
|
+
return STYLE_INSTRUCTION;
|
364
|
+
}
|
365
|
+
|
366
|
+
|
367
|
+
///////////////////////////////////////////////////////////////////////////
|
368
|
+
// context: XML declaration
|
369
|
+
//
|
370
|
+
// XML declaration is of the following format:
|
371
|
+
// <?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
372
|
+
// - must start at the first character of the first line
|
373
|
+
// - may span multiple lines
|
374
|
+
// - must include 'version'
|
375
|
+
// - may include 'encoding' and 'standalone' (in that order after 'version')
|
376
|
+
// - attribute names must be lowercase
|
377
|
+
// - cannot contain anything else on the line
|
378
|
+
function parseDeclarationVersion(stream, state) {
|
379
|
+
state.tokenize = parseDeclarationEncoding;
|
380
|
+
|
381
|
+
if(isTokenSeparated(stream) && stream.match(/^version( )*=( )*"([a-zA-Z0-9_.:]|\-)+"/)) {
|
382
|
+
return STYLE_INSTRUCTION;
|
383
|
+
}
|
384
|
+
stream.skipToEnd();
|
385
|
+
return STYLE_ERROR;
|
386
|
+
}
|
387
|
+
|
388
|
+
function parseDeclarationEncoding(stream, state) {
|
389
|
+
state.tokenize = parseDeclarationStandalone;
|
390
|
+
|
391
|
+
if(isTokenSeparated(stream) && stream.match(/^encoding( )*=( )*"[A-Za-z]([A-Za-z0-9._]|\-)*"/)) {
|
392
|
+
return STYLE_INSTRUCTION;
|
393
|
+
}
|
394
|
+
return null;
|
395
|
+
}
|
396
|
+
|
397
|
+
function parseDeclarationStandalone(stream, state) {
|
398
|
+
state.tokenize = parseDeclarationEndTag;
|
399
|
+
|
400
|
+
if(isTokenSeparated(stream) && stream.match(/^standalone( )*=( )*"(yes|no)"/)) {
|
401
|
+
return STYLE_INSTRUCTION;
|
402
|
+
}
|
403
|
+
return null;
|
404
|
+
}
|
405
|
+
|
406
|
+
function parseDeclarationEndTag(stream, state) {
|
407
|
+
state.tokenize = parseDocument;
|
408
|
+
|
409
|
+
if(stream.match("?>") && stream.eol()) {
|
410
|
+
popContext(state);
|
411
|
+
return STYLE_INSTRUCTION;
|
412
|
+
}
|
413
|
+
stream.skipToEnd();
|
414
|
+
return STYLE_ERROR;
|
415
|
+
}
|
416
|
+
|
417
|
+
///////////////////////////////////////////////////////////////////////////
|
418
|
+
// returned object
|
419
|
+
return {
|
420
|
+
electricChars: "/[",
|
421
|
+
|
422
|
+
startState: function() {
|
423
|
+
return {
|
424
|
+
tokenize: parseDocument,
|
425
|
+
tokParams: {},
|
426
|
+
lineNumber: 0,
|
427
|
+
lineError: false,
|
428
|
+
context: null,
|
429
|
+
indented: 0
|
430
|
+
};
|
431
|
+
},
|
432
|
+
|
433
|
+
token: function(stream, state) {
|
434
|
+
if(stream.sol()) {
|
435
|
+
// initialize a new line
|
436
|
+
state.lineNumber++;
|
437
|
+
state.lineError = false;
|
438
|
+
state.indented = stream.indentation();
|
439
|
+
}
|
440
|
+
|
441
|
+
// eat all (the spaces) you can
|
442
|
+
if(stream.eatSpace()) return null;
|
443
|
+
|
444
|
+
// run the current tokenize function, according to the state
|
445
|
+
var style = state.tokenize(stream, state);
|
446
|
+
|
447
|
+
// is there an error somewhere in the line?
|
448
|
+
state.lineError = (state.lineError || style == "error");
|
449
|
+
|
450
|
+
return style;
|
451
|
+
},
|
452
|
+
|
453
|
+
blankLine: function(state) {
|
454
|
+
// blank lines are lines too!
|
455
|
+
state.lineNumber++;
|
456
|
+
state.lineError = false;
|
457
|
+
},
|
458
|
+
|
459
|
+
indent: function(state, textAfter) {
|
460
|
+
if(state.context) {
|
461
|
+
if(state.context.noIndent == true) {
|
462
|
+
// do not indent - no return value at all
|
463
|
+
return;
|
464
|
+
}
|
465
|
+
if(textAfter.match(/^<\/.*/)) {
|
466
|
+
// end-tag - indent back to last context
|
467
|
+
return state.context.indent;
|
468
|
+
}
|
469
|
+
if(textAfter.match(/^<!\[CDATA\[/)) {
|
470
|
+
// a stand-alone CDATA start-tag - indent back to column 0
|
471
|
+
return 0;
|
472
|
+
}
|
473
|
+
// indent to last context + regular indent unit
|
474
|
+
return state.context.indent + indentUnit;
|
475
|
+
}
|
476
|
+
return 0;
|
477
|
+
},
|
478
|
+
|
479
|
+
compareStates: function(a, b) {
|
480
|
+
if (a.indented != b.indented) return false;
|
481
|
+
for (var ca = a.context, cb = b.context; ; ca = ca.prev, cb = cb.prev) {
|
482
|
+
if (!ca || !cb) return ca == cb;
|
483
|
+
if (ca.tagName != cb.tagName) return false;
|
484
|
+
}
|
485
|
+
}
|
486
|
+
};
|
487
|
+
});
|
488
|
+
|
489
|
+
CodeMirror.defineMIME("application/xml", "purexml");
|
490
|
+
CodeMirror.defineMIME("text/xml", "purexml");
|
@@ -0,0 +1,67 @@
|
|
1
|
+
<!doctype html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>CodeMirror: YAML mode</title>
|
5
|
+
<link rel="stylesheet" href="../../lib/codemirror.css">
|
6
|
+
<script src="../../lib/codemirror.js"></script>
|
7
|
+
<script src="yaml.js"></script>
|
8
|
+
<style>.CodeMirror { border-top: 1px solid #ddd; border-bottom: 1px solid #ddd; }</style>
|
9
|
+
<link rel="stylesheet" href="../../doc/docs.css">
|
10
|
+
</head>
|
11
|
+
<body>
|
12
|
+
<h1>CodeMirror: YAML mode</h1>
|
13
|
+
<form><textarea id="code" name="code">
|
14
|
+
--- # Favorite movies
|
15
|
+
- Casablanca
|
16
|
+
- North by Northwest
|
17
|
+
- The Man Who Wasn't There
|
18
|
+
--- # Shopping list
|
19
|
+
[milk, pumpkin pie, eggs, juice]
|
20
|
+
--- # Indented Blocks, common in YAML data files, use indentation and new lines to separate the key: value pairs
|
21
|
+
name: John Smith
|
22
|
+
age: 33
|
23
|
+
--- # Inline Blocks, common in YAML data streams, use commas to separate the key: value pairs between braces
|
24
|
+
{name: John Smith, age: 33}
|
25
|
+
---
|
26
|
+
receipt: Oz-Ware Purchase Invoice
|
27
|
+
date: 2007-08-06
|
28
|
+
customer:
|
29
|
+
given: Dorothy
|
30
|
+
family: Gale
|
31
|
+
|
32
|
+
items:
|
33
|
+
- part_no: A4786
|
34
|
+
descrip: Water Bucket (Filled)
|
35
|
+
price: 1.47
|
36
|
+
quantity: 4
|
37
|
+
|
38
|
+
- part_no: E1628
|
39
|
+
descrip: High Heeled "Ruby" Slippers
|
40
|
+
size: 8
|
41
|
+
price: 100.27
|
42
|
+
quantity: 1
|
43
|
+
|
44
|
+
bill-to: &id001
|
45
|
+
street: |
|
46
|
+
123 Tornado Alley
|
47
|
+
Suite 16
|
48
|
+
city: East Centerville
|
49
|
+
state: KS
|
50
|
+
|
51
|
+
ship-to: *id001
|
52
|
+
|
53
|
+
specialDelivery: >
|
54
|
+
Follow the Yellow Brick
|
55
|
+
Road to the Emerald City.
|
56
|
+
Pay no attention to the
|
57
|
+
man behind the curtain.
|
58
|
+
...
|
59
|
+
</textarea></form>
|
60
|
+
<script>
|
61
|
+
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {});
|
62
|
+
</script>
|
63
|
+
|
64
|
+
<p><strong>MIME types defined:</strong> <code>text/x-yaml</code>.</p>
|
65
|
+
|
66
|
+
</body>
|
67
|
+
</html>
|
@@ -0,0 +1,95 @@
|
|
1
|
+
CodeMirror.defineMode("yaml", function() {
|
2
|
+
|
3
|
+
var cons = ['true', 'false', 'on', 'off', 'yes', 'no'];
|
4
|
+
var keywordRegex = new RegExp("\\b(("+cons.join(")|(")+"))$", 'i');
|
5
|
+
|
6
|
+
return {
|
7
|
+
token: function(stream, state) {
|
8
|
+
var ch = stream.peek();
|
9
|
+
var esc = state.escaped;
|
10
|
+
state.escaped = false;
|
11
|
+
/* comments */
|
12
|
+
if (ch == "#") { stream.skipToEnd(); return "comment"; }
|
13
|
+
if (state.literal && stream.indentation() > state.keyCol) {
|
14
|
+
stream.skipToEnd(); return "string";
|
15
|
+
} else if (state.literal) { state.literal = false; }
|
16
|
+
if (stream.sol()) {
|
17
|
+
state.keyCol = 0;
|
18
|
+
state.pair = false;
|
19
|
+
state.pairStart = false;
|
20
|
+
/* document start */
|
21
|
+
if(stream.match(/---/)) { return "def"; }
|
22
|
+
/* document end */
|
23
|
+
if (stream.match(/\.\.\./)) { return "def"; }
|
24
|
+
/* array list item */
|
25
|
+
if (stream.match(/\s*-\s+/)) { return 'meta'; }
|
26
|
+
}
|
27
|
+
/* pairs (associative arrays) -> key */
|
28
|
+
if (!state.pair && stream.match(/^\s*([a-z0-9\._-])+(?=\s*:)/i)) {
|
29
|
+
state.pair = true;
|
30
|
+
state.keyCol = stream.indentation();
|
31
|
+
return "atom";
|
32
|
+
}
|
33
|
+
if (state.pair && stream.match(/^:\s*/)) { state.pairStart = true; return 'meta'; }
|
34
|
+
|
35
|
+
/* inline pairs/lists */
|
36
|
+
if (stream.match(/^(\{|\}|\[|\])/)) {
|
37
|
+
if (ch == '{')
|
38
|
+
state.inlinePairs++;
|
39
|
+
else if (ch == '}')
|
40
|
+
state.inlinePairs--;
|
41
|
+
else if (ch == '[')
|
42
|
+
state.inlineList++;
|
43
|
+
else
|
44
|
+
state.inlineList--;
|
45
|
+
return 'meta';
|
46
|
+
}
|
47
|
+
|
48
|
+
/* list seperator */
|
49
|
+
if (state.inlineList > 0 && !esc && ch == ',') {
|
50
|
+
stream.next();
|
51
|
+
return 'meta';
|
52
|
+
}
|
53
|
+
/* pairs seperator */
|
54
|
+
if (state.inlinePairs > 0 && !esc && ch == ',') {
|
55
|
+
state.keyCol = 0;
|
56
|
+
state.pair = false;
|
57
|
+
state.pairStart = false;
|
58
|
+
stream.next();
|
59
|
+
return 'meta';
|
60
|
+
}
|
61
|
+
|
62
|
+
/* start of value of a pair */
|
63
|
+
if (state.pairStart) {
|
64
|
+
/* block literals */
|
65
|
+
if (stream.match(/^\s*(\||\>)\s*/)) { state.literal = true; return 'meta'; };
|
66
|
+
/* references */
|
67
|
+
if (stream.match(/^\s*(\&|\*)[a-z0-9\._-]+\b/i)) { return 'variable-2'; }
|
68
|
+
/* numbers */
|
69
|
+
if (state.inlinePairs == 0 && stream.match(/^\s*-?[0-9\.\,]+\s?$/)) { return 'number'; }
|
70
|
+
if (state.inlinePairs > 0 && stream.match(/^\s*-?[0-9\.\,]+\s?(?=(,|}))/)) { return 'number'; }
|
71
|
+
/* keywords */
|
72
|
+
if (stream.match(keywordRegex)) { return 'keyword'; }
|
73
|
+
}
|
74
|
+
|
75
|
+
/* nothing found, continue */
|
76
|
+
state.pairStart = false;
|
77
|
+
state.escaped = (ch == '\\');
|
78
|
+
stream.next();
|
79
|
+
return null;
|
80
|
+
},
|
81
|
+
startState: function() {
|
82
|
+
return {
|
83
|
+
pair: false,
|
84
|
+
pairStart: false,
|
85
|
+
keyCol: 0,
|
86
|
+
inlinePairs: 0,
|
87
|
+
inlineList: 0,
|
88
|
+
literal: false,
|
89
|
+
escaped: false
|
90
|
+
};
|
91
|
+
}
|
92
|
+
};
|
93
|
+
});
|
94
|
+
|
95
|
+
CodeMirror.defineMIME("text/x-yaml", "yaml");
|
@@ -0,0 +1,18 @@
|
|
1
|
+
.cm-s-cobalt { background: #002240; color: white; }
|
2
|
+
.cm-s-cobalt div.CodeMirror-selected { background: #b36539 !important; }
|
3
|
+
.cm-s-cobalt .CodeMirror-gutter { background: #002240; border-right: 1px solid #aaa; }
|
4
|
+
.cm-s-cobalt .CodeMirror-gutter-text { color: #d0d0d0; }
|
5
|
+
.cm-s-cobalt .CodeMirror-cursor { border-left: 1px solid white !important; }
|
6
|
+
|
7
|
+
.cm-s-cobalt span.cm-comment { color: #08f; }
|
8
|
+
.cm-s-cobalt span.cm-atom { color: #845dc4; }
|
9
|
+
.cm-s-cobalt span.cm-number, .cm-s-cobalt span.cm-attribute { color: #ff80e1; }
|
10
|
+
.cm-s-cobalt span.cm-keyword { color: #ffee80; }
|
11
|
+
.cm-s-cobalt span.cm-string { color: #3ad900; }
|
12
|
+
.cm-s-cobalt span.cm-meta { color: #ff9d00; }
|
13
|
+
.cm-s-cobalt span.cm-variable-2, .cm-s-cobalt span.cm-tag { color: #9effff; }
|
14
|
+
.cm-s-cobalt span.cm-variable-3, .cm-s-cobalt span.cm-def { color: white; }
|
15
|
+
.cm-s-cobalt span.cm-error { color: #9d1e15; }
|
16
|
+
.cm-s-cobalt span.cm-bracket { color: #d8d8d8; }
|
17
|
+
.cm-s-cobalt span.cm-builtin, .cm-s-cobalt span.cm-special { color: #ff9e59; }
|
18
|
+
.cm-s-cobalt span.cm-link { color: #845dc4; }
|