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,64 @@
|
|
1
|
+
<!doctype html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>CodeMirror: Scheme mode</title>
|
5
|
+
<link rel="stylesheet" href="../../lib/codemirror.css">
|
6
|
+
<script src="../../lib/codemirror.js"></script>
|
7
|
+
<script src="scheme.js"></script>
|
8
|
+
<style>.CodeMirror {background: #f8f8f8;}</style>
|
9
|
+
<link rel="stylesheet" href="../../doc/docs.css">
|
10
|
+
</head>
|
11
|
+
<body>
|
12
|
+
<h1>CodeMirror: Scheme mode</h1>
|
13
|
+
<form><textarea id="code" name="code">
|
14
|
+
; See if the input starts with a given symbol.
|
15
|
+
(define (match-symbol input pattern)
|
16
|
+
(cond ((null? (remain input)) #f)
|
17
|
+
((eqv? (car (remain input)) pattern) (r-cdr input))
|
18
|
+
(else #f)))
|
19
|
+
|
20
|
+
; Allow the input to start with one of a list of patterns.
|
21
|
+
(define (match-or input pattern)
|
22
|
+
(cond ((null? pattern) #f)
|
23
|
+
((match-pattern input (car pattern)))
|
24
|
+
(else (match-or input (cdr pattern)))))
|
25
|
+
|
26
|
+
; Allow a sequence of patterns.
|
27
|
+
(define (match-seq input pattern)
|
28
|
+
(if (null? pattern)
|
29
|
+
input
|
30
|
+
(let ((match (match-pattern input (car pattern))))
|
31
|
+
(if match (match-seq match (cdr pattern)) #f))))
|
32
|
+
|
33
|
+
; Match with the pattern but no problem if it does not match.
|
34
|
+
(define (match-opt input pattern)
|
35
|
+
(let ((match (match-pattern input (car pattern))))
|
36
|
+
(if match match input)))
|
37
|
+
|
38
|
+
; Match anything (other than '()), until pattern is found. The rather
|
39
|
+
; clumsy form of requiring an ending pattern is needed to decide where
|
40
|
+
; the end of the match is. If none is given, this will match the rest
|
41
|
+
; of the sentence.
|
42
|
+
(define (match-any input pattern)
|
43
|
+
(cond ((null? (remain input)) #f)
|
44
|
+
((null? pattern) (f-cons (remain input) (clear-remain input)))
|
45
|
+
(else
|
46
|
+
(let ((accum-any (collector)))
|
47
|
+
(define (match-pattern-any input pattern)
|
48
|
+
(cond ((null? (remain input)) #f)
|
49
|
+
(else (accum-any (car (remain input)))
|
50
|
+
(cond ((match-pattern (r-cdr input) pattern))
|
51
|
+
(else (match-pattern-any (r-cdr input) pattern))))))
|
52
|
+
(let ((retval (match-pattern-any input (car pattern))))
|
53
|
+
(if retval
|
54
|
+
(f-cons (accum-any) retval)
|
55
|
+
#f))))))
|
56
|
+
</textarea></form>
|
57
|
+
<script>
|
58
|
+
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {});
|
59
|
+
</script>
|
60
|
+
|
61
|
+
<p><strong>MIME types defined:</strong> <code>text/x-scheme</code>.</p>
|
62
|
+
|
63
|
+
</body>
|
64
|
+
</html>
|
@@ -0,0 +1,202 @@
|
|
1
|
+
/**
|
2
|
+
* Author: Koh Zi Han, based on implementation by Koh Zi Chun
|
3
|
+
*/
|
4
|
+
CodeMirror.defineMode("scheme", function (config, mode) {
|
5
|
+
var BUILTIN = "builtin", COMMENT = "comment", STRING = "string",
|
6
|
+
ATOM = "atom", NUMBER = "number", BRACKET = "bracket", KEYWORD="keyword";
|
7
|
+
var INDENT_WORD_SKIP = 2, KEYWORDS_SKIP = 1;
|
8
|
+
|
9
|
+
function makeKeywords(str) {
|
10
|
+
var obj = {}, words = str.split(" ");
|
11
|
+
for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
|
12
|
+
return obj;
|
13
|
+
}
|
14
|
+
|
15
|
+
var keywords = makeKeywords("λ case-lambda call/cc class define-class exit-handler field import inherit init-field interface let*-values let-values let/ec mixin opt-lambda override protect provide public rename require require-for-syntax syntax syntax-case syntax-error unit/sig unless when with-syntax and begin call-with-current-continuation call-with-input-file call-with-output-file case cond define define-syntax delay do dynamic-wind else for-each if lambda let let* let-syntax letrec letrec-syntax map or syntax-rules abs acos angle append apply asin assoc assq assv atan boolean? caar cadr call-with-input-file call-with-output-file call-with-values car cdddar cddddr cdr ceiling char->integer char-alphabetic? char-ci<=? char-ci<? char-ci=? char-ci>=? char-ci>? char-downcase char-lower-case? char-numeric? char-ready? char-upcase char-upper-case? char-whitespace? char<=? char<? char=? char>=? char>? char? close-input-port close-output-port complex? cons cos current-input-port current-output-port denominator display eof-object? eq? equal? eqv? eval even? exact->inexact exact? exp expt #f floor force gcd imag-part inexact->exact inexact? input-port? integer->char integer? interaction-environment lcm length list list->string list->vector list-ref list-tail list? load log magnitude make-polar make-rectangular make-string make-vector max member memq memv min modulo negative? newline not null-environment null? number->string number? numerator odd? open-input-file open-output-file output-port? pair? peek-char port? positive? procedure? quasiquote quote quotient rational? rationalize read read-char real-part real? remainder reverse round scheme-report-environment set! set-car! set-cdr! sin sqrt string string->list string->number string->symbol string-append string-ci<=? string-ci<? string-ci=? string-ci>=? string-ci>? string-copy string-fill! string-length string-ref string-set! string<=? string<? string=? string>=? string>? string? substring symbol->string symbol? #t tan transcript-off transcript-on truncate values vector vector->list vector-fill! vector-length vector-ref vector-set! with-input-from-file with-output-to-file write write-char zero?");
|
16
|
+
var indentKeys = makeKeywords("define let letrec let* lambda");
|
17
|
+
|
18
|
+
|
19
|
+
function stateStack(indent, type, prev) { // represents a state stack object
|
20
|
+
this.indent = indent;
|
21
|
+
this.type = type;
|
22
|
+
this.prev = prev;
|
23
|
+
}
|
24
|
+
|
25
|
+
function pushStack(state, indent, type) {
|
26
|
+
state.indentStack = new stateStack(indent, type, state.indentStack);
|
27
|
+
}
|
28
|
+
|
29
|
+
function popStack(state) {
|
30
|
+
state.indentStack = state.indentStack.prev;
|
31
|
+
}
|
32
|
+
|
33
|
+
/**
|
34
|
+
* Scheme numbers are complicated unfortunately.
|
35
|
+
* Checks if we're looking at a number, which might be possibly a fraction.
|
36
|
+
* Also checks that it is not part of a longer identifier. Returns true/false accordingly.
|
37
|
+
*/
|
38
|
+
function isNumber(ch, stream){
|
39
|
+
if(/[0-9]/.exec(ch) != null){
|
40
|
+
stream.eatWhile(/[0-9]/);
|
41
|
+
stream.eat(/\//);
|
42
|
+
stream.eatWhile(/[0-9]/);
|
43
|
+
if (stream.eol() || !(/[a-zA-Z\-\_\/]/.exec(stream.peek()))) return true;
|
44
|
+
stream.backUp(stream.current().length - 1); // undo all the eating
|
45
|
+
}
|
46
|
+
return false;
|
47
|
+
}
|
48
|
+
|
49
|
+
return {
|
50
|
+
startState: function () {
|
51
|
+
return {
|
52
|
+
indentStack: null,
|
53
|
+
indentation: 0,
|
54
|
+
mode: false,
|
55
|
+
sExprComment: false
|
56
|
+
};
|
57
|
+
},
|
58
|
+
|
59
|
+
token: function (stream, state) {
|
60
|
+
if (state.indentStack == null && stream.sol()) {
|
61
|
+
// update indentation, but only if indentStack is empty
|
62
|
+
state.indentation = stream.indentation();
|
63
|
+
}
|
64
|
+
|
65
|
+
// skip spaces
|
66
|
+
if (stream.eatSpace()) {
|
67
|
+
return null;
|
68
|
+
}
|
69
|
+
var returnType = null;
|
70
|
+
|
71
|
+
switch(state.mode){
|
72
|
+
case "string": // multi-line string parsing mode
|
73
|
+
var next, escaped = false;
|
74
|
+
while ((next = stream.next()) != null) {
|
75
|
+
if (next == "\"" && !escaped) {
|
76
|
+
|
77
|
+
state.mode = false;
|
78
|
+
break;
|
79
|
+
}
|
80
|
+
escaped = !escaped && next == "\\";
|
81
|
+
}
|
82
|
+
returnType = STRING; // continue on in scheme-string mode
|
83
|
+
break;
|
84
|
+
case "comment": // comment parsing mode
|
85
|
+
var next, maybeEnd = false;
|
86
|
+
while ((next = stream.next()) != null) {
|
87
|
+
if (next == "#" && maybeEnd) {
|
88
|
+
|
89
|
+
state.mode = false;
|
90
|
+
break;
|
91
|
+
}
|
92
|
+
maybeEnd = (next == "|");
|
93
|
+
}
|
94
|
+
returnType = COMMENT;
|
95
|
+
break;
|
96
|
+
case "s-expr-comment": // s-expr commenting mode
|
97
|
+
state.mode = false;
|
98
|
+
if(stream.peek() == "(" || stream.peek() == "["){
|
99
|
+
// actually start scheme s-expr commenting mode
|
100
|
+
state.sExprComment = 0;
|
101
|
+
}else{
|
102
|
+
// if not we just comment the entire of the next token
|
103
|
+
stream.eatWhile(/[^/s]/); // eat non spaces
|
104
|
+
returnType = COMMENT;
|
105
|
+
break;
|
106
|
+
}
|
107
|
+
default: // default parsing mode
|
108
|
+
var ch = stream.next();
|
109
|
+
|
110
|
+
if (ch == "\"") {
|
111
|
+
state.mode = "string";
|
112
|
+
returnType = STRING;
|
113
|
+
|
114
|
+
} else if (ch == "'") {
|
115
|
+
returnType = ATOM;
|
116
|
+
} else if (ch == '#') {
|
117
|
+
if (stream.eat("|")) { // Multi-line comment
|
118
|
+
state.mode = "comment"; // toggle to comment mode
|
119
|
+
returnType = COMMENT;
|
120
|
+
} else if (stream.eat(/[tf]/)) { // #t/#f (atom)
|
121
|
+
returnType = ATOM;
|
122
|
+
} else if (stream.eat(';')) { // S-Expr comment
|
123
|
+
state.mode = "s-expr-comment";
|
124
|
+
returnType = COMMENT;
|
125
|
+
}
|
126
|
+
|
127
|
+
} else if (ch == ";") { // comment
|
128
|
+
stream.skipToEnd(); // rest of the line is a comment
|
129
|
+
returnType = COMMENT;
|
130
|
+
} else if (ch == "-"){
|
131
|
+
|
132
|
+
if(!isNaN(parseInt(stream.peek()))){
|
133
|
+
stream.eatWhile(/[\/0-9]/);
|
134
|
+
returnType = NUMBER;
|
135
|
+
}else{
|
136
|
+
returnType = null;
|
137
|
+
}
|
138
|
+
} else if (isNumber(ch,stream)){
|
139
|
+
returnType = NUMBER;
|
140
|
+
} else if (ch == "(" || ch == "[") {
|
141
|
+
var keyWord = ''; var indentTemp = stream.column();
|
142
|
+
/**
|
143
|
+
Either
|
144
|
+
(indent-word ..
|
145
|
+
(non-indent-word ..
|
146
|
+
(;something else, bracket, etc.
|
147
|
+
*/
|
148
|
+
|
149
|
+
while ((letter = stream.eat(/[^\s\(\[\;\)\]]/)) != null) {
|
150
|
+
keyWord += letter;
|
151
|
+
}
|
152
|
+
|
153
|
+
if (keyWord.length > 0 && indentKeys.propertyIsEnumerable(keyWord)) { // indent-word
|
154
|
+
|
155
|
+
pushStack(state, indentTemp + INDENT_WORD_SKIP, ch);
|
156
|
+
} else { // non-indent word
|
157
|
+
// we continue eating the spaces
|
158
|
+
stream.eatSpace();
|
159
|
+
if (stream.eol() || stream.peek() == ";") {
|
160
|
+
// nothing significant after
|
161
|
+
// we restart indentation 1 space after
|
162
|
+
pushStack(state, indentTemp + 1, ch);
|
163
|
+
} else {
|
164
|
+
pushStack(state, indentTemp + stream.current().length, ch); // else we match
|
165
|
+
}
|
166
|
+
}
|
167
|
+
stream.backUp(stream.current().length - 1); // undo all the eating
|
168
|
+
|
169
|
+
if(typeof state.sExprComment == "number") state.sExprComment++;
|
170
|
+
|
171
|
+
returnType = BRACKET;
|
172
|
+
} else if (ch == ")" || ch == "]") {
|
173
|
+
returnType = BRACKET;
|
174
|
+
if (state.indentStack != null && state.indentStack.type == (ch == ")" ? "(" : "[")) {
|
175
|
+
popStack(state);
|
176
|
+
|
177
|
+
if(typeof state.sExprComment == "number"){
|
178
|
+
if(--state.sExprComment == 0){
|
179
|
+
returnType = COMMENT; // final closing bracket
|
180
|
+
state.sExprComment = false; // turn off s-expr commenting mode
|
181
|
+
}
|
182
|
+
}
|
183
|
+
}
|
184
|
+
} else {
|
185
|
+
stream.eatWhile(/[\w\$_\-]/);
|
186
|
+
|
187
|
+
if (keywords && keywords.propertyIsEnumerable(stream.current())) {
|
188
|
+
returnType = BUILTIN;
|
189
|
+
}else returnType = null;
|
190
|
+
}
|
191
|
+
}
|
192
|
+
return (typeof state.sExprComment == "number") ? COMMENT : returnType;
|
193
|
+
},
|
194
|
+
|
195
|
+
indent: function (state, textAfter) {
|
196
|
+
if (state.indentStack == null) return state.indentation;
|
197
|
+
return state.indentStack.indent;
|
198
|
+
}
|
199
|
+
};
|
200
|
+
});
|
201
|
+
|
202
|
+
CodeMirror.defineMIME("text/x-scheme", "scheme");
|
@@ -0,0 +1,55 @@
|
|
1
|
+
<!doctype html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>CodeMirror: Smalltalk mode</title>
|
5
|
+
<link rel="stylesheet" href="../../lib/codemirror.css">
|
6
|
+
<script src="../../lib/codemirror.js"></script>
|
7
|
+
<script src="smalltalk.js"></script>
|
8
|
+
<link rel="stylesheet" href="../../doc/docs.css">
|
9
|
+
<style>
|
10
|
+
.CodeMirror {border: 2px solid #dee; border-right-width: 10px;}
|
11
|
+
.CodeMirror-gutter {border: none; background: #dee;}
|
12
|
+
.CodeMirror-gutter pre {color: white; font-weight: bold;}
|
13
|
+
</style>
|
14
|
+
</head>
|
15
|
+
<body>
|
16
|
+
<h1>CodeMirror: Smalltalk mode</h1>
|
17
|
+
|
18
|
+
<form><textarea id="code" name="code">
|
19
|
+
"
|
20
|
+
This is a test of the Smalltalk code
|
21
|
+
"
|
22
|
+
Seaside.WAComponent subclass: #MyCounter [
|
23
|
+
| count |
|
24
|
+
MyCounter class >> canBeRoot [ ^true ]
|
25
|
+
|
26
|
+
initialize [
|
27
|
+
super initialize.
|
28
|
+
count := 0.
|
29
|
+
]
|
30
|
+
states [ ^{ self } ]
|
31
|
+
renderContentOn: html [
|
32
|
+
html heading: count.
|
33
|
+
html anchor callback: [ count := count + 1 ]; with: '++'.
|
34
|
+
html space.
|
35
|
+
html anchor callback: [ count := count - 1 ]; with: '--'.
|
36
|
+
]
|
37
|
+
]
|
38
|
+
|
39
|
+
MyCounter registerAsApplication: 'mycounter'
|
40
|
+
</textarea></form>
|
41
|
+
|
42
|
+
<script>
|
43
|
+
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
44
|
+
lineNumbers: true,
|
45
|
+
matchBrackets: true,
|
46
|
+
mode: "text/x-stsrc",
|
47
|
+
indentUnit: 4
|
48
|
+
});
|
49
|
+
</script>
|
50
|
+
|
51
|
+
<p>Simple Smalltalk mode.</p>
|
52
|
+
|
53
|
+
<p><strong>MIME types defined:</strong> <code>text/x-stsrc</code>.</p>
|
54
|
+
</body>
|
55
|
+
</html>
|
@@ -0,0 +1,139 @@
|
|
1
|
+
CodeMirror.defineMode('smalltalk', function(config, modeConfig) {
|
2
|
+
|
3
|
+
var specialChars = /[+\-/\\*~<>=@%|&?!.:;^]/;
|
4
|
+
var keywords = /true|false|nil|self|super|thisContext/;
|
5
|
+
|
6
|
+
var Context = function(tokenizer, parent) {
|
7
|
+
this.next = tokenizer;
|
8
|
+
this.parent = parent;
|
9
|
+
};
|
10
|
+
|
11
|
+
var Token = function(name, context, eos) {
|
12
|
+
this.name = name;
|
13
|
+
this.context = context;
|
14
|
+
this.eos = eos;
|
15
|
+
};
|
16
|
+
|
17
|
+
var State = function() {
|
18
|
+
this.context = new Context(next, null);
|
19
|
+
this.expectVariable = true;
|
20
|
+
this.indentation = 0;
|
21
|
+
this.userIndentationDelta = 0;
|
22
|
+
};
|
23
|
+
|
24
|
+
State.prototype.userIndent = function(indentation) {
|
25
|
+
this.userIndentationDelta = indentation > 0 ? (indentation / config.indentUnit - this.indentation) : 0;
|
26
|
+
};
|
27
|
+
|
28
|
+
var next = function(stream, context, state) {
|
29
|
+
var token = new Token(null, context, false);
|
30
|
+
var aChar = stream.next();
|
31
|
+
|
32
|
+
if (aChar === '"') {
|
33
|
+
token = nextComment(stream, new Context(nextComment, context));
|
34
|
+
|
35
|
+
} else if (aChar === '\'') {
|
36
|
+
token = nextString(stream, new Context(nextString, context));
|
37
|
+
|
38
|
+
} else if (aChar === '#') {
|
39
|
+
stream.eatWhile(/[^ .]/);
|
40
|
+
token.name = 'string-2';
|
41
|
+
|
42
|
+
} else if (aChar === '$') {
|
43
|
+
stream.eatWhile(/[^ ]/);
|
44
|
+
token.name = 'string-2';
|
45
|
+
|
46
|
+
} else if (aChar === '|' && state.expectVariable) {
|
47
|
+
token.context = new Context(nextTemporaries, context);
|
48
|
+
|
49
|
+
} else if (/[\[\]{}()]/.test(aChar)) {
|
50
|
+
token.name = 'bracket';
|
51
|
+
token.eos = /[\[{(]/.test(aChar);
|
52
|
+
|
53
|
+
if (aChar === '[') {
|
54
|
+
state.indentation++;
|
55
|
+
} else if (aChar === ']') {
|
56
|
+
state.indentation = Math.max(0, state.indentation - 1);
|
57
|
+
}
|
58
|
+
|
59
|
+
} else if (specialChars.test(aChar)) {
|
60
|
+
stream.eatWhile(specialChars);
|
61
|
+
token.name = 'operator';
|
62
|
+
token.eos = aChar !== ';'; // ; cascaded message expression
|
63
|
+
|
64
|
+
} else if (/\d/.test(aChar)) {
|
65
|
+
stream.eatWhile(/[\w\d]/);
|
66
|
+
token.name = 'number'
|
67
|
+
|
68
|
+
} else if (/[\w_]/.test(aChar)) {
|
69
|
+
stream.eatWhile(/[\w\d_]/);
|
70
|
+
token.name = state.expectVariable ? (keywords.test(stream.current()) ? 'keyword' : 'variable') : null;
|
71
|
+
|
72
|
+
} else {
|
73
|
+
token.eos = state.expectVariable;
|
74
|
+
}
|
75
|
+
|
76
|
+
return token;
|
77
|
+
};
|
78
|
+
|
79
|
+
var nextComment = function(stream, context) {
|
80
|
+
stream.eatWhile(/[^"]/);
|
81
|
+
return new Token('comment', stream.eat('"') ? context.parent : context, true);
|
82
|
+
};
|
83
|
+
|
84
|
+
var nextString = function(stream, context) {
|
85
|
+
stream.eatWhile(/[^']/);
|
86
|
+
return new Token('string', stream.eat('\'') ? context.parent : context, false);
|
87
|
+
};
|
88
|
+
|
89
|
+
var nextTemporaries = function(stream, context, state) {
|
90
|
+
var token = new Token(null, context, false);
|
91
|
+
var aChar = stream.next();
|
92
|
+
|
93
|
+
if (aChar === '|') {
|
94
|
+
token.context = context.parent;
|
95
|
+
token.eos = true;
|
96
|
+
|
97
|
+
} else {
|
98
|
+
stream.eatWhile(/[^|]/);
|
99
|
+
token.name = 'variable';
|
100
|
+
}
|
101
|
+
|
102
|
+
return token;
|
103
|
+
}
|
104
|
+
|
105
|
+
return {
|
106
|
+
startState: function() {
|
107
|
+
return new State;
|
108
|
+
},
|
109
|
+
|
110
|
+
token: function(stream, state) {
|
111
|
+
state.userIndent(stream.indentation());
|
112
|
+
|
113
|
+
if (stream.eatSpace()) {
|
114
|
+
return null;
|
115
|
+
}
|
116
|
+
|
117
|
+
var token = state.context.next(stream, state.context, state);
|
118
|
+
state.context = token.context;
|
119
|
+
state.expectVariable = token.eos;
|
120
|
+
|
121
|
+
state.lastToken = token;
|
122
|
+
return token.name;
|
123
|
+
},
|
124
|
+
|
125
|
+
blankLine: function(state) {
|
126
|
+
state.userIndent(0);
|
127
|
+
},
|
128
|
+
|
129
|
+
indent: function(state, textAfter) {
|
130
|
+
var i = state.context.next === next && textAfter && textAfter.charAt(0) === ']' ? -1 : state.userIndentationDelta;
|
131
|
+
return (state.indentation + i) * config.indentUnit;
|
132
|
+
},
|
133
|
+
|
134
|
+
electricChars: ']'
|
135
|
+
};
|
136
|
+
|
137
|
+
});
|
138
|
+
|
139
|
+
CodeMirror.defineMIME('text/x-stsrc', {name: 'smalltalk'});
|
@@ -0,0 +1,40 @@
|
|
1
|
+
<!doctype html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>CodeMirror: SPARQL mode</title>
|
5
|
+
<link rel="stylesheet" href="../../lib/codemirror.css">
|
6
|
+
<script src="../../lib/codemirror.js"></script>
|
7
|
+
<script src="sparql.js"></script>
|
8
|
+
<style>.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: SPARQL mode</h1>
|
13
|
+
<form><textarea id="code" name="code">
|
14
|
+
PREFIX a: <http://www.w3.org/2000/10/annotation-ns#>
|
15
|
+
PREFIX dc: <http://purl.org/dc/elements/1.1/>
|
16
|
+
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
|
17
|
+
|
18
|
+
# Comment!
|
19
|
+
|
20
|
+
SELECT ?given ?family
|
21
|
+
WHERE {
|
22
|
+
?annot a:annotates <http://www.w3.org/TR/rdf-sparql-query/> .
|
23
|
+
?annot dc:creator ?c .
|
24
|
+
OPTIONAL {?c foaf:given ?given ;
|
25
|
+
foaf:family ?family } .
|
26
|
+
FILTER isBlank(?c)
|
27
|
+
}
|
28
|
+
</textarea></form>
|
29
|
+
<script>
|
30
|
+
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
31
|
+
mode: "application/x-sparql-query",
|
32
|
+
tabMode: "indent",
|
33
|
+
matchBrackets: true
|
34
|
+
});
|
35
|
+
</script>
|
36
|
+
|
37
|
+
<p><strong>MIME types defined:</strong> <code>application/x-sparql-query</code>.</p>
|
38
|
+
|
39
|
+
</body>
|
40
|
+
</html>
|
@@ -0,0 +1,143 @@
|
|
1
|
+
CodeMirror.defineMode("sparql", function(config) {
|
2
|
+
var indentUnit = config.indentUnit;
|
3
|
+
var curPunc;
|
4
|
+
|
5
|
+
function wordRegexp(words) {
|
6
|
+
return new RegExp("^(?:" + words.join("|") + ")$", "i");
|
7
|
+
}
|
8
|
+
var ops = wordRegexp(["str", "lang", "langmatches", "datatype", "bound", "sameterm", "isiri", "isuri",
|
9
|
+
"isblank", "isliteral", "union", "a"]);
|
10
|
+
var keywords = wordRegexp(["base", "prefix", "select", "distinct", "reduced", "construct", "describe",
|
11
|
+
"ask", "from", "named", "where", "order", "limit", "offset", "filter", "optional",
|
12
|
+
"graph", "by", "asc", "desc"]);
|
13
|
+
var operatorChars = /[*+\-<>=&|]/;
|
14
|
+
|
15
|
+
function tokenBase(stream, state) {
|
16
|
+
var ch = stream.next();
|
17
|
+
curPunc = null;
|
18
|
+
if (ch == "$" || ch == "?") {
|
19
|
+
stream.match(/^[\w\d]*/);
|
20
|
+
return "variable-2";
|
21
|
+
}
|
22
|
+
else if (ch == "<" && !stream.match(/^[\s\u00a0=]/, false)) {
|
23
|
+
stream.match(/^[^\s\u00a0>]*>?/);
|
24
|
+
return "atom";
|
25
|
+
}
|
26
|
+
else if (ch == "\"" || ch == "'") {
|
27
|
+
state.tokenize = tokenLiteral(ch);
|
28
|
+
return state.tokenize(stream, state);
|
29
|
+
}
|
30
|
+
else if (/[{}\(\),\.;\[\]]/.test(ch)) {
|
31
|
+
curPunc = ch;
|
32
|
+
return null;
|
33
|
+
}
|
34
|
+
else if (ch == "#") {
|
35
|
+
stream.skipToEnd();
|
36
|
+
return "comment";
|
37
|
+
}
|
38
|
+
else if (operatorChars.test(ch)) {
|
39
|
+
stream.eatWhile(operatorChars);
|
40
|
+
return null;
|
41
|
+
}
|
42
|
+
else if (ch == ":") {
|
43
|
+
stream.eatWhile(/[\w\d\._\-]/);
|
44
|
+
return "atom";
|
45
|
+
}
|
46
|
+
else {
|
47
|
+
stream.eatWhile(/[_\w\d]/);
|
48
|
+
if (stream.eat(":")) {
|
49
|
+
stream.eatWhile(/[\w\d_\-]/);
|
50
|
+
return "atom";
|
51
|
+
}
|
52
|
+
var word = stream.current(), type;
|
53
|
+
if (ops.test(word))
|
54
|
+
return null;
|
55
|
+
else if (keywords.test(word))
|
56
|
+
return "keyword";
|
57
|
+
else
|
58
|
+
return "variable";
|
59
|
+
}
|
60
|
+
}
|
61
|
+
|
62
|
+
function tokenLiteral(quote) {
|
63
|
+
return function(stream, state) {
|
64
|
+
var escaped = false, ch;
|
65
|
+
while ((ch = stream.next()) != null) {
|
66
|
+
if (ch == quote && !escaped) {
|
67
|
+
state.tokenize = tokenBase;
|
68
|
+
break;
|
69
|
+
}
|
70
|
+
escaped = !escaped && ch == "\\";
|
71
|
+
}
|
72
|
+
return "string";
|
73
|
+
};
|
74
|
+
}
|
75
|
+
|
76
|
+
function pushContext(state, type, col) {
|
77
|
+
state.context = {prev: state.context, indent: state.indent, col: col, type: type};
|
78
|
+
}
|
79
|
+
function popContext(state) {
|
80
|
+
state.indent = state.context.indent;
|
81
|
+
state.context = state.context.prev;
|
82
|
+
}
|
83
|
+
|
84
|
+
return {
|
85
|
+
startState: function(base) {
|
86
|
+
return {tokenize: tokenBase,
|
87
|
+
context: null,
|
88
|
+
indent: 0,
|
89
|
+
col: 0};
|
90
|
+
},
|
91
|
+
|
92
|
+
token: function(stream, state) {
|
93
|
+
if (stream.sol()) {
|
94
|
+
if (state.context && state.context.align == null) state.context.align = false;
|
95
|
+
state.indent = stream.indentation();
|
96
|
+
}
|
97
|
+
if (stream.eatSpace()) return null;
|
98
|
+
var style = state.tokenize(stream, state);
|
99
|
+
|
100
|
+
if (style != "comment" && state.context && state.context.align == null && state.context.type != "pattern") {
|
101
|
+
state.context.align = true;
|
102
|
+
}
|
103
|
+
|
104
|
+
if (curPunc == "(") pushContext(state, ")", stream.column());
|
105
|
+
else if (curPunc == "[") pushContext(state, "]", stream.column());
|
106
|
+
else if (curPunc == "{") pushContext(state, "}", stream.column());
|
107
|
+
else if (/[\]\}\)]/.test(curPunc)) {
|
108
|
+
while (state.context && state.context.type == "pattern") popContext(state);
|
109
|
+
if (state.context && curPunc == state.context.type) popContext(state);
|
110
|
+
}
|
111
|
+
else if (curPunc == "." && state.context && state.context.type == "pattern") popContext(state);
|
112
|
+
else if (/atom|string|variable/.test(style) && state.context) {
|
113
|
+
if (/[\}\]]/.test(state.context.type))
|
114
|
+
pushContext(state, "pattern", stream.column());
|
115
|
+
else if (state.context.type == "pattern" && !state.context.align) {
|
116
|
+
state.context.align = true;
|
117
|
+
state.context.col = stream.column();
|
118
|
+
}
|
119
|
+
}
|
120
|
+
|
121
|
+
return style;
|
122
|
+
},
|
123
|
+
|
124
|
+
indent: function(state, textAfter) {
|
125
|
+
var firstChar = textAfter && textAfter.charAt(0);
|
126
|
+
var context = state.context;
|
127
|
+
if (/[\]\}]/.test(firstChar))
|
128
|
+
while (context && context.type == "pattern") context = context.prev;
|
129
|
+
|
130
|
+
var closing = context && firstChar == context.type;
|
131
|
+
if (!context)
|
132
|
+
return 0;
|
133
|
+
else if (context.type == "pattern")
|
134
|
+
return context.col;
|
135
|
+
else if (context.align)
|
136
|
+
return context.col + (closing ? 0 : 1);
|
137
|
+
else
|
138
|
+
return context.indent + (closing ? 0 : indentUnit);
|
139
|
+
}
|
140
|
+
};
|
141
|
+
});
|
142
|
+
|
143
|
+
CodeMirror.defineMIME("application/x-sparql-query", "sparql");
|