utopia-wiki 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.github/workflows/development.yml +62 -0
- data/.gitignore +18 -0
- data/.rspec +2 -0
- data/.yarnrc +1 -0
- data/Gemfile +4 -0
- data/README.md +46 -0
- data/bake/utopia/wiki.rb +13 -0
- data/lib/components/.yarn-integrity +19 -0
- data/lib/components/jquery-litebox/README.md +66 -0
- data/lib/components/jquery-litebox/bower.json +27 -0
- data/lib/components/jquery-litebox/dist/jquery.litebox.css +23 -0
- data/lib/components/jquery-litebox/dist/jquery.litebox.gallery.css +48 -0
- data/lib/components/jquery-litebox/dist/jquery.litebox.js +30 -0
- data/lib/components/jquery-litebox/example/index.html +69 -0
- data/lib/components/jquery-litebox/example/jquery.min.js +4 -0
- data/lib/components/jquery-litebox/example/sample_images/large/IMG_3340.jpg +0 -0
- data/lib/components/jquery-litebox/example/sample_images/large/IMG_3341.jpg +0 -0
- data/lib/components/jquery-litebox/example/sample_images/large/IMG_3344.jpg +0 -0
- data/lib/components/jquery-litebox/example/sample_images/large/IMG_3351.jpg +0 -0
- data/lib/components/jquery-litebox/example/sample_images/medium/IMG_3340.jpg +0 -0
- data/lib/components/jquery-litebox/example/sample_images/medium/IMG_3341.jpg +0 -0
- data/lib/components/jquery-litebox/example/sample_images/medium/IMG_3344.jpg +0 -0
- data/lib/components/jquery-litebox/example/sample_images/medium/IMG_3351.jpg +0 -0
- data/lib/components/jquery-litebox/example/sample_images/small/IMG_3340.jpg +0 -0
- data/lib/components/jquery-litebox/example/sample_images/small/IMG_3341.jpg +0 -0
- data/lib/components/jquery-litebox/example/sample_images/small/IMG_3344.jpg +0 -0
- data/lib/components/jquery-litebox/example/sample_images/small/IMG_3351.jpg +0 -0
- data/lib/components/jquery-litebox/package.json +29 -0
- data/lib/components/jquery-syntax/Gemfile +5 -0
- data/lib/components/jquery-syntax/LICENSE.txt +19 -0
- data/lib/components/jquery-syntax/NOTES.txt +20 -0
- data/lib/components/jquery-syntax/README.md +95 -0
- data/lib/components/jquery-syntax/Rakefile +211 -0
- data/lib/components/jquery-syntax/bower.json +25 -0
- data/lib/components/jquery-syntax/config.ru +4 -0
- data/lib/components/jquery-syntax/dist/base/jquery.syntax.brush.apache.css +12 -0
- data/lib/components/jquery-syntax/dist/base/jquery.syntax.brush.applescript.css +5 -0
- data/lib/components/jquery-syntax/dist/base/jquery.syntax.brush.assembly.css +8 -0
- data/lib/components/jquery-syntax/dist/base/jquery.syntax.brush.bash-script.css +6 -0
- data/lib/components/jquery-syntax/dist/base/jquery.syntax.brush.bash.css +4 -0
- data/lib/components/jquery-syntax/dist/base/jquery.syntax.brush.clang.css +6 -0
- data/lib/components/jquery-syntax/dist/base/jquery.syntax.brush.css.css +14 -0
- data/lib/components/jquery-syntax/dist/base/jquery.syntax.brush.diff.css +16 -0
- data/lib/components/jquery-syntax/dist/base/jquery.syntax.brush.html.css +5 -0
- data/lib/components/jquery-syntax/dist/base/jquery.syntax.brush.ocaml.css +3 -0
- data/lib/components/jquery-syntax/dist/base/jquery.syntax.brush.protobuf.css +2 -0
- data/lib/components/jquery-syntax/dist/base/jquery.syntax.brush.python.css +6 -0
- data/lib/components/jquery-syntax/dist/base/jquery.syntax.brush.ruby.css +2 -0
- data/lib/components/jquery-syntax/dist/base/jquery.syntax.brush.xml.css +18 -0
- data/lib/components/jquery-syntax/dist/base/jquery.syntax.core.css +58 -0
- data/lib/components/jquery-syntax/dist/base/jquery.syntax.editor.css +6 -0
- data/lib/components/jquery-syntax/dist/base/theme.js +1 -0
- data/lib/components/jquery-syntax/dist/bright/jquery.syntax.core.css +27 -0
- data/lib/components/jquery-syntax/dist/bright/theme.js +1 -0
- data/lib/components/jquery-syntax/dist/jquery.syntax.brush.apache.js +3 -0
- data/lib/components/jquery-syntax/dist/jquery.syntax.brush.applescript.js +5 -0
- data/lib/components/jquery-syntax/dist/jquery.syntax.brush.assembly.js +3 -0
- data/lib/components/jquery-syntax/dist/jquery.syntax.brush.bash-script.js +4 -0
- data/lib/components/jquery-syntax/dist/jquery.syntax.brush.bash.js +2 -0
- data/lib/components/jquery-syntax/dist/jquery.syntax.brush.basic.js +5 -0
- data/lib/components/jquery-syntax/dist/jquery.syntax.brush.clang.js +5 -0
- data/lib/components/jquery-syntax/dist/jquery.syntax.brush.csharp.js +4 -0
- data/lib/components/jquery-syntax/dist/jquery.syntax.brush.css.js +5 -0
- data/lib/components/jquery-syntax/dist/jquery.syntax.brush.diff.js +2 -0
- data/lib/components/jquery-syntax/dist/jquery.syntax.brush.go.js +3 -0
- data/lib/components/jquery-syntax/dist/jquery.syntax.brush.haskell.js +3 -0
- data/lib/components/jquery-syntax/dist/jquery.syntax.brush.html.js +4 -0
- data/lib/components/jquery-syntax/dist/jquery.syntax.brush.io.js +3 -0
- data/lib/components/jquery-syntax/dist/jquery.syntax.brush.java.js +4 -0
- data/lib/components/jquery-syntax/dist/jquery.syntax.brush.javascript.js +3 -0
- data/lib/components/jquery-syntax/dist/jquery.syntax.brush.kai.js +2 -0
- data/lib/components/jquery-syntax/dist/jquery.syntax.brush.lisp.js +2 -0
- data/lib/components/jquery-syntax/dist/jquery.syntax.brush.lua.js +3 -0
- data/lib/components/jquery-syntax/dist/jquery.syntax.brush.nginx.js +2 -0
- data/lib/components/jquery-syntax/dist/jquery.syntax.brush.ocaml.js +4 -0
- data/lib/components/jquery-syntax/dist/jquery.syntax.brush.ooc.js +4 -0
- data/lib/components/jquery-syntax/dist/jquery.syntax.brush.pascal.js +4 -0
- data/lib/components/jquery-syntax/dist/jquery.syntax.brush.perl5.js +3 -0
- data/lib/components/jquery-syntax/dist/jquery.syntax.brush.php-script.js +4 -0
- data/lib/components/jquery-syntax/dist/jquery.syntax.brush.php.js +2 -0
- data/lib/components/jquery-syntax/dist/jquery.syntax.brush.plain.js +2 -0
- data/lib/components/jquery-syntax/dist/jquery.syntax.brush.protobuf.js +3 -0
- data/lib/components/jquery-syntax/dist/jquery.syntax.brush.python.js +5 -0
- data/lib/components/jquery-syntax/dist/jquery.syntax.brush.ruby.js +5 -0
- data/lib/components/jquery-syntax/dist/jquery.syntax.brush.scala.js +4 -0
- data/lib/components/jquery-syntax/dist/jquery.syntax.brush.smalltalk.js +2 -0
- data/lib/components/jquery-syntax/dist/jquery.syntax.brush.sql.js +4 -0
- data/lib/components/jquery-syntax/dist/jquery.syntax.brush.super-collider.js +3 -0
- data/lib/components/jquery-syntax/dist/jquery.syntax.brush.swift.js +3 -0
- data/lib/components/jquery-syntax/dist/jquery.syntax.brush.trenni.js +2 -0
- data/lib/components/jquery-syntax/dist/jquery.syntax.brush.xml.js +4 -0
- data/lib/components/jquery-syntax/dist/jquery.syntax.brush.yaml.js +2 -0
- data/lib/components/jquery-syntax/dist/jquery.syntax.cache.js +7 -0
- data/lib/components/jquery-syntax/dist/jquery.syntax.core.js +34 -0
- data/lib/components/jquery-syntax/dist/jquery.syntax.editor.js +11 -0
- data/lib/components/jquery-syntax/dist/jquery.syntax.js +8 -0
- data/lib/components/jquery-syntax/dist/jquery.syntax.min.js +13 -0
- data/lib/components/jquery-syntax/dist/paper/jquery.syntax.core.css +31 -0
- data/lib/components/jquery-syntax/dist/paper/theme.js +1 -0
- data/lib/components/jquery-syntax/examples/ex.applescript.html +120 -0
- data/lib/components/jquery-syntax/examples/ex.asm.html +43 -0
- data/lib/components/jquery-syntax/examples/ex.bash.html +139 -0
- data/lib/components/jquery-syntax/examples/ex.clang.html +337 -0
- data/lib/components/jquery-syntax/examples/ex.css.html +48 -0
- data/lib/components/jquery-syntax/examples/ex.diff.html +1226 -0
- data/lib/components/jquery-syntax/examples/ex.editor.html +28 -0
- data/lib/components/jquery-syntax/examples/ex.html.html +134 -0
- data/lib/components/jquery-syntax/examples/ex.javascript.html +330 -0
- data/lib/components/jquery-syntax/examples/ex.ooc.html +119 -0
- data/lib/components/jquery-syntax/examples/ex.php.html +54 -0
- data/lib/components/jquery-syntax/examples/ex.python.html +1510 -0
- data/lib/components/jquery-syntax/examples/ex.ruby.html +358 -0
- data/lib/components/jquery-syntax/examples/ex.swift.html +90 -0
- data/lib/components/jquery-syntax/examples/index.css +18 -0
- data/lib/components/jquery-syntax/examples/jquery-1.6.min.js +16 -0
- data/lib/components/jquery-syntax/examples/tests.html +71 -0
- data/lib/components/jquery-syntax/examples/wrapping-flex.html +71 -0
- data/lib/components/jquery-syntax/examples/wrapping.html +181 -0
- data/lib/components/jquery-syntax/ext/closure/COPYING +202 -0
- data/lib/components/jquery-syntax/ext/closure/README +292 -0
- data/lib/components/jquery-syntax/ext/closure/compiler.jar +0 -0
- data/lib/components/jquery-syntax/ext/theme.rb +85 -0
- data/lib/components/jquery-syntax/install.yaml +9 -0
- data/lib/components/jquery-syntax/jQuery.Syntax.artx/Preview/preview.png +0 -0
- data/lib/components/jquery-syntax/jQuery.Syntax.artx/doc.thread +0 -0
- data/lib/components/jquery-syntax/package.json +31 -0
- data/lib/components/jquery-syntax/source/jquery.syntax.brush.apache.js +41 -0
- data/lib/components/jquery-syntax/source/jquery.syntax.brush.applescript.js +57 -0
- data/lib/components/jquery-syntax/source/jquery.syntax.brush.assembly.js +37 -0
- data/lib/components/jquery-syntax/source/jquery.syntax.brush.bash-script.js +67 -0
- data/lib/components/jquery-syntax/source/jquery.syntax.brush.bash.js +33 -0
- data/lib/components/jquery-syntax/source/jquery.syntax.brush.basic.js +51 -0
- data/lib/components/jquery-syntax/source/jquery.syntax.brush.clang.js +89 -0
- data/lib/components/jquery-syntax/source/jquery.syntax.brush.csharp.js +47 -0
- data/lib/components/jquery-syntax/source/jquery.syntax.brush.css.js +80 -0
- data/lib/components/jquery-syntax/source/jquery.syntax.brush.diff.js +24 -0
- data/lib/components/jquery-syntax/source/jquery.syntax.brush.go.js +47 -0
- data/lib/components/jquery-syntax/source/jquery.syntax.brush.haskell.js +45 -0
- data/lib/components/jquery-syntax/source/jquery.syntax.brush.html.js +66 -0
- data/lib/components/jquery-syntax/source/jquery.syntax.brush.io.js +45 -0
- data/lib/components/jquery-syntax/source/jquery.syntax.brush.java.js +45 -0
- data/lib/components/jquery-syntax/source/jquery.syntax.brush.javascript.js +42 -0
- data/lib/components/jquery-syntax/source/jquery.syntax.brush.kai.js +29 -0
- data/lib/components/jquery-syntax/source/jquery.syntax.brush.lisp.js +34 -0
- data/lib/components/jquery-syntax/source/jquery.syntax.brush.lua.js +44 -0
- data/lib/components/jquery-syntax/source/jquery.syntax.brush.nginx.js +30 -0
- data/lib/components/jquery-syntax/source/jquery.syntax.brush.ocaml.js +73 -0
- data/lib/components/jquery-syntax/source/jquery.syntax.brush.ooc.js +46 -0
- data/lib/components/jquery-syntax/source/jquery.syntax.brush.pascal.js +51 -0
- data/lib/components/jquery-syntax/source/jquery.syntax.brush.perl5.js +52 -0
- data/lib/components/jquery-syntax/source/jquery.syntax.brush.php-script.js +48 -0
- data/lib/components/jquery-syntax/source/jquery.syntax.brush.php.js +15 -0
- data/lib/components/jquery-syntax/source/jquery.syntax.brush.plain.js +10 -0
- data/lib/components/jquery-syntax/source/jquery.syntax.brush.protobuf.js +43 -0
- data/lib/components/jquery-syntax/source/jquery.syntax.brush.python.js +44 -0
- data/lib/components/jquery-syntax/source/jquery.syntax.brush.ruby.js +77 -0
- data/lib/components/jquery-syntax/source/jquery.syntax.brush.scala.js +44 -0
- data/lib/components/jquery-syntax/source/jquery.syntax.brush.smalltalk.js +29 -0
- data/lib/components/jquery-syntax/source/jquery.syntax.brush.sql.js +31 -0
- data/lib/components/jquery-syntax/source/jquery.syntax.brush.super-collider.js +57 -0
- data/lib/components/jquery-syntax/source/jquery.syntax.brush.swift.js +55 -0
- data/lib/components/jquery-syntax/source/jquery.syntax.brush.trenni.js +35 -0
- data/lib/components/jquery-syntax/source/jquery.syntax.brush.xml.js +50 -0
- data/lib/components/jquery-syntax/source/jquery.syntax.brush.yaml.js +29 -0
- data/lib/components/jquery-syntax/source/jquery.syntax.core.js +1114 -0
- data/lib/components/jquery-syntax/source/jquery.syntax.editor.js +291 -0
- data/lib/components/jquery-syntax/source/jquery.syntax.js +258 -0
- data/lib/components/jquery-syntax/themes/base/jquery.syntax.brush.apache.sass +23 -0
- data/lib/components/jquery-syntax/themes/base/jquery.syntax.brush.applescript.sass +11 -0
- data/lib/components/jquery-syntax/themes/base/jquery.syntax.brush.assembly.sass +16 -0
- data/lib/components/jquery-syntax/themes/base/jquery.syntax.brush.bash-script.sass +14 -0
- data/lib/components/jquery-syntax/themes/base/jquery.syntax.brush.bash.sass +11 -0
- data/lib/components/jquery-syntax/themes/base/jquery.syntax.brush.clang.sass +12 -0
- data/lib/components/jquery-syntax/themes/base/jquery.syntax.brush.css.sass +25 -0
- data/lib/components/jquery-syntax/themes/base/jquery.syntax.brush.diff.sass +25 -0
- data/lib/components/jquery-syntax/themes/base/jquery.syntax.brush.html.sass +12 -0
- data/lib/components/jquery-syntax/themes/base/jquery.syntax.brush.ocaml.sass +8 -0
- data/lib/components/jquery-syntax/themes/base/jquery.syntax.brush.protobuf.sass +7 -0
- data/lib/components/jquery-syntax/themes/base/jquery.syntax.brush.python.sass +12 -0
- data/lib/components/jquery-syntax/themes/base/jquery.syntax.brush.ruby.sass +9 -0
- data/lib/components/jquery-syntax/themes/base/jquery.syntax.brush.xml.sass +30 -0
- data/lib/components/jquery-syntax/themes/base/jquery.syntax.core.sass +86 -0
- data/lib/components/jquery-syntax/themes/base/jquery.syntax.editor.sass +12 -0
- data/lib/components/jquery-syntax/themes/bright/_config.yaml +2 -0
- data/lib/components/jquery-syntax/themes/bright/jquery.syntax.core.sass +42 -0
- data/lib/components/jquery-syntax/themes/paper/_config.yaml +2 -0
- data/lib/components/jquery-syntax/themes/paper/jquery.syntax.core.sass +47 -0
- data/lib/components/jquery/AUTHORS.txt +327 -0
- data/lib/components/jquery/LICENSE.txt +20 -0
- data/lib/components/jquery/README.md +62 -0
- data/lib/components/jquery/bower.json +14 -0
- data/lib/components/jquery/dist/jquery.js +10872 -0
- data/lib/components/jquery/dist/jquery.min.js +2 -0
- data/lib/components/jquery/dist/jquery.min.map +1 -0
- data/lib/components/jquery/dist/jquery.slim.js +8777 -0
- data/lib/components/jquery/dist/jquery.slim.min.js +2 -0
- data/lib/components/jquery/dist/jquery.slim.min.map +1 -0
- data/lib/components/jquery/external/sizzle/LICENSE.txt +36 -0
- data/lib/components/jquery/external/sizzle/dist/sizzle.js +2478 -0
- data/lib/components/jquery/external/sizzle/dist/sizzle.min.js +3 -0
- data/lib/components/jquery/external/sizzle/dist/sizzle.min.map +1 -0
- data/lib/components/jquery/package.json +117 -0
- data/lib/components/jquery/src/ajax.js +873 -0
- data/lib/components/jquery/src/ajax/jsonp.js +103 -0
- data/lib/components/jquery/src/ajax/load.js +77 -0
- data/lib/components/jquery/src/ajax/script.js +74 -0
- data/lib/components/jquery/src/ajax/var/location.js +5 -0
- data/lib/components/jquery/src/ajax/var/nonce.js +5 -0
- data/lib/components/jquery/src/ajax/var/rquery.js +5 -0
- data/lib/components/jquery/src/ajax/xhr.js +170 -0
- data/lib/components/jquery/src/attributes.js +13 -0
- data/lib/components/jquery/src/attributes/attr.js +141 -0
- data/lib/components/jquery/src/attributes/classes.js +186 -0
- data/lib/components/jquery/src/attributes/prop.js +143 -0
- data/lib/components/jquery/src/attributes/support.js +33 -0
- data/lib/components/jquery/src/attributes/val.js +191 -0
- data/lib/components/jquery/src/callbacks.js +236 -0
- data/lib/components/jquery/src/core.js +400 -0
- data/lib/components/jquery/src/core/DOMEval.js +43 -0
- data/lib/components/jquery/src/core/access.js +72 -0
- data/lib/components/jquery/src/core/camelCase.js +23 -0
- data/lib/components/jquery/src/core/init.js +129 -0
- data/lib/components/jquery/src/core/isAttached.js +26 -0
- data/lib/components/jquery/src/core/nodeName.js +13 -0
- data/lib/components/jquery/src/core/parseHTML.js +65 -0
- data/lib/components/jquery/src/core/parseXML.js +30 -0
- data/lib/components/jquery/src/core/ready-no-deferred.js +97 -0
- data/lib/components/jquery/src/core/ready.js +86 -0
- data/lib/components/jquery/src/core/readyException.js +13 -0
- data/lib/components/jquery/src/core/stripAndCollapse.js +14 -0
- data/lib/components/jquery/src/core/support.js +20 -0
- data/lib/components/jquery/src/core/toType.js +20 -0
- data/lib/components/jquery/src/core/var/rsingleTag.js +7 -0
- data/lib/components/jquery/src/css.js +494 -0
- data/lib/components/jquery/src/css/addGetHookIf.js +26 -0
- data/lib/components/jquery/src/css/adjustCSS.js +74 -0
- data/lib/components/jquery/src/css/curCSS.js +65 -0
- data/lib/components/jquery/src/css/finalPropName.js +42 -0
- data/lib/components/jquery/src/css/hiddenVisibleSelectors.js +15 -0
- data/lib/components/jquery/src/css/showHide.js +105 -0
- data/lib/components/jquery/src/css/support.js +133 -0
- data/lib/components/jquery/src/css/var/cssExpand.js +5 -0
- data/lib/components/jquery/src/css/var/getStyles.js +17 -0
- data/lib/components/jquery/src/css/var/isHiddenWithinTree.js +34 -0
- data/lib/components/jquery/src/css/var/rboxStyle.js +7 -0
- data/lib/components/jquery/src/css/var/rnumnonpx.js +7 -0
- data/lib/components/jquery/src/css/var/swap.js +26 -0
- data/lib/components/jquery/src/data.js +180 -0
- data/lib/components/jquery/src/data/Data.js +162 -0
- data/lib/components/jquery/src/data/var/acceptData.js +19 -0
- data/lib/components/jquery/src/data/var/dataPriv.js +7 -0
- data/lib/components/jquery/src/data/var/dataUser.js +7 -0
- data/lib/components/jquery/src/deferred.js +399 -0
- data/lib/components/jquery/src/deferred/exceptionHook.js +21 -0
- data/lib/components/jquery/src/deprecated.js +87 -0
- data/lib/components/jquery/src/deprecated/ajax-event-alias.js +22 -0
- data/lib/components/jquery/src/deprecated/event.js +48 -0
- data/lib/components/jquery/src/dimensions.js +57 -0
- data/lib/components/jquery/src/effects.js +701 -0
- data/lib/components/jquery/src/effects/Tween.js +125 -0
- data/lib/components/jquery/src/effects/animatedSelector.js +15 -0
- data/lib/components/jquery/src/event.js +892 -0
- data/lib/components/jquery/src/event/focusin.js +58 -0
- data/lib/components/jquery/src/event/support.js +11 -0
- data/lib/components/jquery/src/event/trigger.js +201 -0
- data/lib/components/jquery/src/exports/amd.js +26 -0
- data/lib/components/jquery/src/exports/global.js +34 -0
- data/lib/components/jquery/src/jquery.js +41 -0
- data/lib/components/jquery/src/manipulation.js +480 -0
- data/lib/components/jquery/src/manipulation/_evalUrl.js +32 -0
- data/lib/components/jquery/src/manipulation/buildFragment.js +106 -0
- data/lib/components/jquery/src/manipulation/getAll.js +32 -0
- data/lib/components/jquery/src/manipulation/setGlobalEval.js +22 -0
- data/lib/components/jquery/src/manipulation/support.js +41 -0
- data/lib/components/jquery/src/manipulation/var/rscriptType.js +5 -0
- data/lib/components/jquery/src/manipulation/var/rtagName.js +8 -0
- data/lib/components/jquery/src/manipulation/wrapMap.js +30 -0
- data/lib/components/jquery/src/offset.js +238 -0
- data/lib/components/jquery/src/queue.js +145 -0
- data/lib/components/jquery/src/queue/delay.js +24 -0
- data/lib/components/jquery/src/selector-native.js +241 -0
- data/lib/components/jquery/src/selector-sizzle.js +19 -0
- data/lib/components/jquery/src/selector.js +3 -0
- data/lib/components/jquery/src/serialize.js +136 -0
- data/lib/components/jquery/src/traversing.js +198 -0
- data/lib/components/jquery/src/traversing/findFilter.js +97 -0
- data/lib/components/jquery/src/traversing/var/dir.js +22 -0
- data/lib/components/jquery/src/traversing/var/rneedsContext.js +8 -0
- data/lib/components/jquery/src/traversing/var/siblings.js +17 -0
- data/lib/components/jquery/src/var/ObjectFunctionString.js +7 -0
- data/lib/components/jquery/src/var/arr.js +5 -0
- data/lib/components/jquery/src/var/class2type.js +6 -0
- data/lib/components/jquery/src/var/document.js +5 -0
- data/lib/components/jquery/src/var/documentElement.js +7 -0
- data/lib/components/jquery/src/var/flat.js +16 -0
- data/lib/components/jquery/src/var/fnToString.js +7 -0
- data/lib/components/jquery/src/var/getProto.js +5 -0
- data/lib/components/jquery/src/var/hasOwn.js +7 -0
- data/lib/components/jquery/src/var/indexOf.js +7 -0
- data/lib/components/jquery/src/var/isFunction.js +13 -0
- data/lib/components/jquery/src/var/isWindow.js +8 -0
- data/lib/components/jquery/src/var/pnum.js +5 -0
- data/lib/components/jquery/src/var/push.js +7 -0
- data/lib/components/jquery/src/var/rcheckableType.js +5 -0
- data/lib/components/jquery/src/var/rcssNum.js +9 -0
- data/lib/components/jquery/src/var/rnothtmlwhite.js +8 -0
- data/lib/components/jquery/src/var/slice.js +7 -0
- data/lib/components/jquery/src/var/support.js +6 -0
- data/lib/components/jquery/src/var/toString.js +7 -0
- data/lib/components/jquery/src/wrap.js +78 -0
- data/lib/utopia/wiki.rb +80 -0
- data/lib/utopia/wiki/version.rb +27 -0
- data/package.json +6 -0
- data/pages/_editor.xnode +21 -0
- data/pages/_heading.xnode +2 -0
- data/pages/_listing.xnode +23 -0
- data/pages/_navigation.xnode +33 -0
- data/pages/_page.xnode +32 -0
- data/pages/_thumbnail.xnode +8 -0
- data/pages/controller.rb +77 -0
- data/pages/create.xnode +15 -0
- data/pages/edit.xnode +10 -0
- data/pages/errors/exception.xnode +5 -0
- data/pages/errors/file-not-found.xnode +5 -0
- data/pages/links.yaml +2 -0
- data/pages/show.xnode +15 -0
- data/public/.nojekyll +0 -0
- data/public/_components/jquery-litebox/jquery.litebox.css +23 -0
- data/public/_components/jquery-litebox/jquery.litebox.gallery.css +48 -0
- data/public/_components/jquery-litebox/jquery.litebox.js +30 -0
- data/public/_components/jquery-syntax/base/jquery.syntax.brush.apache.css +12 -0
- data/public/_components/jquery-syntax/base/jquery.syntax.brush.applescript.css +5 -0
- data/public/_components/jquery-syntax/base/jquery.syntax.brush.assembly.css +8 -0
- data/public/_components/jquery-syntax/base/jquery.syntax.brush.bash-script.css +6 -0
- data/public/_components/jquery-syntax/base/jquery.syntax.brush.bash.css +4 -0
- data/public/_components/jquery-syntax/base/jquery.syntax.brush.clang.css +6 -0
- data/public/_components/jquery-syntax/base/jquery.syntax.brush.css.css +14 -0
- data/public/_components/jquery-syntax/base/jquery.syntax.brush.diff.css +16 -0
- data/public/_components/jquery-syntax/base/jquery.syntax.brush.html.css +5 -0
- data/public/_components/jquery-syntax/base/jquery.syntax.brush.ocaml.css +3 -0
- data/public/_components/jquery-syntax/base/jquery.syntax.brush.protobuf.css +2 -0
- data/public/_components/jquery-syntax/base/jquery.syntax.brush.python.css +6 -0
- data/public/_components/jquery-syntax/base/jquery.syntax.brush.ruby.css +2 -0
- data/public/_components/jquery-syntax/base/jquery.syntax.brush.xml.css +18 -0
- data/public/_components/jquery-syntax/base/jquery.syntax.core.css +58 -0
- data/public/_components/jquery-syntax/base/jquery.syntax.editor.css +6 -0
- data/public/_components/jquery-syntax/base/theme.js +1 -0
- data/public/_components/jquery-syntax/bright/jquery.syntax.core.css +27 -0
- data/public/_components/jquery-syntax/bright/theme.js +1 -0
- data/public/_components/jquery-syntax/jquery.syntax.brush.apache.js +3 -0
- data/public/_components/jquery-syntax/jquery.syntax.brush.applescript.js +5 -0
- data/public/_components/jquery-syntax/jquery.syntax.brush.assembly.js +3 -0
- data/public/_components/jquery-syntax/jquery.syntax.brush.bash-script.js +4 -0
- data/public/_components/jquery-syntax/jquery.syntax.brush.bash.js +2 -0
- data/public/_components/jquery-syntax/jquery.syntax.brush.basic.js +5 -0
- data/public/_components/jquery-syntax/jquery.syntax.brush.clang.js +5 -0
- data/public/_components/jquery-syntax/jquery.syntax.brush.csharp.js +4 -0
- data/public/_components/jquery-syntax/jquery.syntax.brush.css.js +5 -0
- data/public/_components/jquery-syntax/jquery.syntax.brush.diff.js +2 -0
- data/public/_components/jquery-syntax/jquery.syntax.brush.go.js +3 -0
- data/public/_components/jquery-syntax/jquery.syntax.brush.haskell.js +3 -0
- data/public/_components/jquery-syntax/jquery.syntax.brush.html.js +4 -0
- data/public/_components/jquery-syntax/jquery.syntax.brush.io.js +3 -0
- data/public/_components/jquery-syntax/jquery.syntax.brush.java.js +4 -0
- data/public/_components/jquery-syntax/jquery.syntax.brush.javascript.js +3 -0
- data/public/_components/jquery-syntax/jquery.syntax.brush.kai.js +2 -0
- data/public/_components/jquery-syntax/jquery.syntax.brush.lisp.js +2 -0
- data/public/_components/jquery-syntax/jquery.syntax.brush.lua.js +3 -0
- data/public/_components/jquery-syntax/jquery.syntax.brush.nginx.js +2 -0
- data/public/_components/jquery-syntax/jquery.syntax.brush.ocaml.js +4 -0
- data/public/_components/jquery-syntax/jquery.syntax.brush.ooc.js +4 -0
- data/public/_components/jquery-syntax/jquery.syntax.brush.pascal.js +4 -0
- data/public/_components/jquery-syntax/jquery.syntax.brush.perl5.js +3 -0
- data/public/_components/jquery-syntax/jquery.syntax.brush.php-script.js +4 -0
- data/public/_components/jquery-syntax/jquery.syntax.brush.php.js +2 -0
- data/public/_components/jquery-syntax/jquery.syntax.brush.plain.js +2 -0
- data/public/_components/jquery-syntax/jquery.syntax.brush.protobuf.js +3 -0
- data/public/_components/jquery-syntax/jquery.syntax.brush.python.js +5 -0
- data/public/_components/jquery-syntax/jquery.syntax.brush.ruby.js +5 -0
- data/public/_components/jquery-syntax/jquery.syntax.brush.scala.js +4 -0
- data/public/_components/jquery-syntax/jquery.syntax.brush.smalltalk.js +2 -0
- data/public/_components/jquery-syntax/jquery.syntax.brush.sql.js +4 -0
- data/public/_components/jquery-syntax/jquery.syntax.brush.super-collider.js +3 -0
- data/public/_components/jquery-syntax/jquery.syntax.brush.swift.js +3 -0
- data/public/_components/jquery-syntax/jquery.syntax.brush.trenni.js +2 -0
- data/public/_components/jquery-syntax/jquery.syntax.brush.xml.js +4 -0
- data/public/_components/jquery-syntax/jquery.syntax.brush.yaml.js +2 -0
- data/public/_components/jquery-syntax/jquery.syntax.cache.js +7 -0
- data/public/_components/jquery-syntax/jquery.syntax.core.js +34 -0
- data/public/_components/jquery-syntax/jquery.syntax.editor.js +11 -0
- data/public/_components/jquery-syntax/jquery.syntax.js +8 -0
- data/public/_components/jquery-syntax/jquery.syntax.min.js +13 -0
- data/public/_components/jquery-syntax/paper/jquery.syntax.core.css +31 -0
- data/public/_components/jquery-syntax/paper/theme.js +1 -0
- data/public/_components/jquery/jquery.js +10872 -0
- data/public/_components/jquery/jquery.min.js +2 -0
- data/public/_components/jquery/jquery.min.map +1 -0
- data/public/_components/jquery/jquery.slim.js +8777 -0
- data/public/_components/jquery/jquery.slim.min.js +2 -0
- data/public/_components/jquery/jquery.slim.min.map +1 -0
- data/public/_static/icon.png +0 -0
- data/public/_static/site.css +191 -0
- data/utopia-wiki.gemspec +39 -0
- data/wiki/Gemfile +10 -0
- data/wiki/config.ru +7 -0
- data/wiki/pages/_logos/Async.png +0 -0
- data/wiki/pages/_logos/Falcon.png +0 -0
- data/wiki/pages/_logos/Utopia.png +0 -0
- data/wiki/pages/index.en.md +62 -0
- data/wiki/pages/index.md +57 -0
- data/wiki/pages/links.yaml +2 -0
- data/wiki/pages/usage/merging/index.md +3 -0
- data/yarn.lock +22 -0
- metadata +675 -0
@@ -0,0 +1,48 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<link rel="stylesheet" href="index.css" type="text/css" media="screen" />
|
5
|
+
|
6
|
+
<script src="jquery-1.6.min.js" type="text/javascript"></script>
|
7
|
+
<script src="../dist/jquery.syntax.js" type="text/javascript"></script>
|
8
|
+
<script src="../dist/jquery.syntax.cache.js" type="text/javascript"></script>
|
9
|
+
|
10
|
+
<script type="text/javascript">
|
11
|
+
jQuery(function($) {
|
12
|
+
$.syntax();
|
13
|
+
});
|
14
|
+
</script>
|
15
|
+
|
16
|
+
</head>
|
17
|
+
<body>
|
18
|
+
<h1>Syntax: CSS</h1>
|
19
|
+
|
20
|
+
<h2>Special Example</h2>
|
21
|
+
|
22
|
+
<p>This example extracts definitions and creates example elements on the right hand side.</p>
|
23
|
+
|
24
|
+
<pre><code class="syntax brush-css">
|
25
|
+
p {
|
26
|
+
background-color: #ccc;
|
27
|
+
border: 1px solid black;
|
28
|
+
}
|
29
|
+
|
30
|
+
/* The way this information is extracted isn't that great, but as long as the CSS is kept simple, it is fine for demonstration purposes */
|
31
|
+
|
32
|
+
h1 {
|
33
|
+
color: #cfcfcf;
|
34
|
+
background-color: red;
|
35
|
+
border: 1px solid green;
|
36
|
+
|
37
|
+
padding: 10px;
|
38
|
+
}
|
39
|
+
|
40
|
+
h2 {
|
41
|
+
color: PaleGoldenRod;
|
42
|
+
text-shadow: 0.1em 0.1em 5px #333;
|
43
|
+
|
44
|
+
border-color:#ff0000 #0000ff;
|
45
|
+
}
|
46
|
+
</code></pre>
|
47
|
+
</body>
|
48
|
+
</html>
|
@@ -0,0 +1,1226 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<link rel="stylesheet" href="index.css" type="text/css" media="screen" />
|
5
|
+
|
6
|
+
<script src="jquery-1.6.min.js" type="text/javascript"></script>
|
7
|
+
<script src="../dist/jquery.syntax.js" type="text/javascript"></script>
|
8
|
+
<script src="../dist/jquery.syntax.cache.js" type="text/javascript"></script>
|
9
|
+
|
10
|
+
<script type="text/javascript">
|
11
|
+
jQuery(function($) {
|
12
|
+
$.syntax();
|
13
|
+
});
|
14
|
+
</script>
|
15
|
+
|
16
|
+
</head>
|
17
|
+
<body>
|
18
|
+
<h1>Syntax: Diff</h1>
|
19
|
+
|
20
|
+
<h2>jQuery.Syntax Diff</h2>
|
21
|
+
|
22
|
+
<pre><code class="syntax brush-diff">
|
23
|
+
diff --git a/ex.ruby.html b/ex.ruby.html
|
24
|
+
index a02a04e..7d42db0 100644
|
25
|
+
--- a/ex.ruby.html
|
26
|
+
+++ b/ex.ruby.html
|
27
|
+
@@ -21,6 +21,8 @@
|
28
|
+
<body>
|
29
|
+
<h1>Syntax: Ruby</h1>
|
30
|
+
|
31
|
+
+ <h2>Ruby Script #1</h2>
|
32
|
+
+
|
33
|
+
<pre class="ruby">#!/usr/bin/env ruby
|
34
|
+
|
35
|
+
# Copyright (c) 2009 Samuel Williams. Released under the GNU GPLv3.
|
36
|
+
@@ -104,5 +106,257 @@ end
|
37
|
+
# RExec daemon runner
|
38
|
+
Server.daemonize</pre>
|
39
|
+
|
40
|
+
+ <h2>Ruby Script #2</h2>
|
41
|
+
+
|
42
|
+
+ <pre class="ruby">#!/usr/bin/env ruby
|
43
|
+
+# Simple Operator Expression Parser
|
44
|
+
+
|
45
|
+
+require &#x27;set&#x27;
|
46
|
+
+
|
47
|
+
+DEBUG = false
|
48
|
+
+
|
49
|
+
+class Array
|
50
|
+
+ def map_to(with)
|
51
|
+
+ r = {}
|
52
|
+
+
|
53
|
+
+ each_with_index { |v,i| r[v] = with[i] }
|
54
|
+
+
|
55
|
+
+ return r
|
56
|
+
+ end
|
57
|
+
+end
|
58
|
+
+
|
59
|
+
+module Expression
|
60
|
+
+ class Context
|
61
|
+
+ def initialize(operators, values)
|
62
|
+
+ @values = values
|
63
|
+
+ @operators = operators
|
64
|
+
+ end
|
65
|
+
+
|
66
|
+
+ def value_of (key)
|
67
|
+
+ @values[key]
|
68
|
+
+ end
|
69
|
+
+
|
70
|
+
+ def call (op, args)
|
71
|
+
+ @operators.call(op, args)
|
72
|
+
+ end
|
73
|
+
+ end
|
74
|
+
+
|
75
|
+
+ class Constant
|
76
|
+
+ def initialize(value)
|
77
|
+
+ @value = value
|
78
|
+
+ end
|
79
|
+
+
|
80
|
+
+ def evaluate (ctx)
|
81
|
+
+ return @value
|
82
|
+
+ end
|
83
|
+
+ end
|
84
|
+
+
|
85
|
+
+ class Identifier
|
86
|
+
+ def initialize(name)
|
87
|
+
+ @name = name
|
88
|
+
+ end
|
89
|
+
+
|
90
|
+
+ def evaluate (ctx)
|
91
|
+
+ ctx.value_of(@name)
|
92
|
+
+ end
|
93
|
+
+ end
|
94
|
+
+
|
95
|
+
+ class Operator
|
96
|
+
+ def initialize(name, args = [])
|
97
|
+
+ @name = name
|
98
|
+
+ @args = args
|
99
|
+
+ end
|
100
|
+
+
|
101
|
+
+ def name
|
102
|
+
+ @name
|
103
|
+
+ end
|
104
|
+
+
|
105
|
+
+ def evaluate (ctx)
|
106
|
+
+ ctx.call(@name, @args.collect { |a| a.evaluate(ctx) })
|
107
|
+
+ end
|
108
|
+
+
|
109
|
+
+ def args
|
110
|
+
+ @args
|
111
|
+
+ end
|
112
|
+
+ end
|
113
|
+
+
|
114
|
+
+ class Brackets
|
115
|
+
+ def initialize(node)
|
116
|
+
+ @node = node
|
117
|
+
+ end
|
118
|
+
+
|
119
|
+
+ def evaluate (ctx)
|
120
|
+
+ @node.evaluate(ctx)
|
121
|
+
+ end
|
122
|
+
+ end
|
123
|
+
+
|
124
|
+
+ class Parser
|
125
|
+
+ def initialize(ops, expr)
|
126
|
+
+ @identifiers = []
|
127
|
+
+ @operators = ops
|
128
|
+
+
|
129
|
+
+ # Tokens and expressions line up
|
130
|
+
+ @expressions = []
|
131
|
+
+ @tokens = []
|
132
|
+
+
|
133
|
+
+ @top = nil
|
134
|
+
+
|
135
|
+
+ parse(expr)
|
136
|
+
+ end
|
137
|
+
+
|
138
|
+
+ def evaluate (ctx)
|
139
|
+
+ @expressions.collect do |expr|
|
140
|
+
+ expr != nil ? expr.evaluate(ctx) : nil
|
141
|
+
+ end
|
142
|
+
+ end
|
143
|
+
+
|
144
|
+
+ def identifiers
|
145
|
+
+ @identifiers
|
146
|
+
+ end
|
147
|
+
+
|
148
|
+
+ def tokens
|
149
|
+
+ @tokens
|
150
|
+
+ end
|
151
|
+
+ private
|
152
|
+
+ def parse(expr)
|
153
|
+
+ symbols = @operators.keys + [&quot;(&quot;, &quot;)&quot;]
|
154
|
+
+ tokenizer = Regexp.union(Regexp.union(*symbols), /[A-Z]+/)
|
155
|
+
+
|
156
|
+
+ @tokens = expr.scan(tokenizer)
|
157
|
+
+ @expressions = [nil] * @tokens.size
|
158
|
+
+
|
159
|
+
+ @identifiers = Set.new(expr.scan(/[A-Z]+/))
|
160
|
+
+
|
161
|
+
+ @top, i = process_expression
|
162
|
+
+
|
163
|
+
+ if DEBUG
|
164
|
+
+ puts &quot;Processed #{i} tokens...&quot;
|
165
|
+
+ puts &quot;Tokens: &quot; + @tokens.join(&quot; &quot;)
|
166
|
+
+ puts @top.inspect
|
167
|
+
+ puts @expressions.inspect
|
168
|
+
+ end
|
169
|
+
+ end
|
170
|
+
+
|
171
|
+
+ def process_expression(i = 0)
|
172
|
+
+ ast = []
|
173
|
+
+ ops = {}
|
174
|
+
+ while i &lt; @tokens.size
|
175
|
+
+ t = @tokens[i]
|
176
|
+
+
|
177
|
+
+ if t == &quot;(&quot;
|
178
|
+
+ result, i = process_expression(i+1)
|
179
|
+
+ ast += result
|
180
|
+
+ elsif t == &quot;)&quot;
|
181
|
+
+ break
|
182
|
+
+ else
|
183
|
+
+ result = process_token(i)
|
184
|
+
+ ast &lt;&lt; result
|
185
|
+
+ end
|
186
|
+
+
|
187
|
+
+ if result.class == Operator
|
188
|
+
+ ops[result.name] ||= []
|
189
|
+
+ # Store the index
|
190
|
+
+ ops[result.name] &lt;&lt; (ast.size - 1)
|
191
|
+
+ end
|
192
|
+
+
|
193
|
+
+ i += 1
|
194
|
+
+ end
|
195
|
+
+
|
196
|
+
+ #puts ast.inspect
|
197
|
+
+
|
198
|
+
+ # We need to sort the list of operators now
|
199
|
+
+ # [c, infix, prefix, c]
|
200
|
+
+
|
201
|
+
+ @operators.order.each do |name|
|
202
|
+
+ op_kind = @operators.kind(name)
|
203
|
+
+ next unless ops[name]
|
204
|
+
+
|
205
|
+
+ ops[name].each do |loc|
|
206
|
+
+ op = ast[loc]
|
207
|
+
+
|
208
|
+
+ if op_kind == :prefix
|
209
|
+
+ rhs = find_subexpression(ast, loc, RHS_SEARCH)
|
210
|
+
+ op.args &lt;&lt; ast[rhs]
|
211
|
+
+ ast[rhs] = nil
|
212
|
+
+ elsif op_kind == :infix
|
213
|
+
+ lhs = find_subexpression(ast, loc, LHS_SEARCH)
|
214
|
+
+ rhs = find_subexpression(ast, loc, RHS_SEARCH)
|
215
|
+
+ op.args &lt;&lt; ast[lhs]
|
216
|
+
+ op.args &lt;&lt; ast[rhs]
|
217
|
+
+ ast[lhs] = ast[rhs] = nil
|
218
|
+
+ elsif op_kind == :postfix
|
219
|
+
+ lhs = find_subexpression(ast, loc, LHS_SEARCH)
|
220
|
+
+ op.args &lt;&lt; ast[lhs]
|
221
|
+
+ ast[rhs] = nil
|
222
|
+
+ end
|
223
|
+
+ end
|
224
|
+
+ end
|
225
|
+
+
|
226
|
+
+ return [ast.uniq, i]
|
227
|
+
+ end
|
228
|
+
+
|
229
|
+
+ RHS_SEARCH = 1
|
230
|
+
+ LHS_SEARCH = -1
|
231
|
+
+
|
232
|
+
+ def find_subexpression(ast, loc, dir)
|
233
|
+
+ while loc &gt;= 0 &amp;&amp; loc &lt; ast.size
|
234
|
+
+ loc += dir
|
235
|
+
+ return loc if ast[loc] != nil
|
236
|
+
+ end
|
237
|
+
+
|
238
|
+
+ return nil
|
239
|
+
+ end
|
240
|
+
+
|
241
|
+
+ def process_token(i)
|
242
|
+
+ t = @tokens[i]
|
243
|
+
+
|
244
|
+
+ if @operators.key? t
|
245
|
+
+ tok = Operator.new(t)
|
246
|
+
+ elsif t.match /[A-Z]+/
|
247
|
+
+ tok = Identifier.new(t)
|
248
|
+
+ else
|
249
|
+
+ tok = Constant.new(t)
|
250
|
+
+ end
|
251
|
+
+
|
252
|
+
+ @expressions[i] = tok
|
253
|
+
+ return tok
|
254
|
+
+ end
|
255
|
+
+ end
|
256
|
+
+
|
257
|
+
+ TYPE = 0
|
258
|
+
+ FUNC = 1
|
259
|
+
+ class Operators
|
260
|
+
+ def initialize
|
261
|
+
+ @operators = {}
|
262
|
+
+ @order = []
|
263
|
+
+ end
|
264
|
+
+
|
265
|
+
+ def add(sym, kind, &amp;block)
|
266
|
+
+ @operators[sym] = [kind, block]
|
267
|
+
+ @order &lt;&lt; sym
|
268
|
+
+ end
|
269
|
+
+
|
270
|
+
+ def order
|
271
|
+
+ @order
|
272
|
+
+ end
|
273
|
+
+
|
274
|
+
+ def keys
|
275
|
+
+ @operators.keys
|
276
|
+
+ end
|
277
|
+
+
|
278
|
+
+ def key? k
|
279
|
+
+ @operators.key? k
|
280
|
+
+ end
|
281
|
+
+
|
282
|
+
+ def kind k
|
283
|
+
+ @operators[k][0]
|
284
|
+
+ end
|
285
|
+
+
|
286
|
+
+ def call(k, args)
|
287
|
+
+ @operators[k][1].call(*args)
|
288
|
+
+ end
|
289
|
+
+ end
|
290
|
+
+end</pre>
|
291
|
+
+
|
292
|
+
</body>
|
293
|
+
</html>
|
294
|
+
|
295
|
+
diff --git a/example.css b/example.css
|
296
|
+
index e69de29..4ece63a 100644
|
297
|
+
--- a/example.css
|
298
|
+
+++ b/example.css
|
299
|
+
@@ -0,0 +1,3 @@
|
300
|
+
+body {
|
301
|
+
+ font-size: 70%;
|
302
|
+
+}
|
303
|
+
|
304
|
+
diff --git a/example.html b/example.html
|
305
|
+
deleted file mode 100644
|
306
|
+
index 7ac7cd5..0000000
|
307
|
+
--- a/example.html
|
308
|
+
+++ /dev/null
|
309
|
+
@@ -1,46 +0,0 @@
|
310
|
+
-<!DOCTYPE html>
|
311
|
+
-<html>
|
312
|
+
- <head>
|
313
|
+
-
|
314
|
+
- <link rel="stylesheet" href="jquery.syntax.css" type="text/css" media="screen" />
|
315
|
+
- <link rel="stylesheet" href="example.css" type="text/css" media="screen" />
|
316
|
+
-
|
317
|
+
- <script src="jquery-1.4.1.js" type="text/javascript" charset="utf-8"></script>
|
318
|
+
-
|
319
|
+
- <script src="jquery.syntax.js" type="text/javascript" charset="utf-8"></script>
|
320
|
+
- <script src="jquery.syntax.cache.js" type="text/javascript" charset='utf-8'></script>
|
321
|
+
-
|
322
|
+
- <script type="text/javascript" language="JavaScript">
|
323
|
+
- //<!--
|
324
|
+
- $(function() {
|
325
|
+
- $('#highlight').click(function() {
|
326
|
+
- $('pre.clang').syntax({brush: 'clang', layout: 'table', replace: true}, function(options, html, container) {
|
327
|
+
- //$('.function', html).replaceWith(function(){
|
328
|
+
- // return $('<a>').addClass('function').attr('href', '#' + $(this).text()).html($(this).html());
|
329
|
+
- //})
|
330
|
+
- });
|
331
|
+
- });
|
332
|
+
- });
|
333
|
+
- //-->
|
334
|
+
- </script>
|
335
|
+
-
|
336
|
+
- </head>
|
337
|
+
- <body>
|
338
|
+
- <h1>Syntax Highlighting Example</h1>
|
339
|
+
-
|
340
|
+
- <button id="highlight">Highlight</button>
|
341
|
+
-
|
342
|
+
- <pre class="clang">#include &lt;iostream&gt;
|
343
|
+
-/* Multi line c comment
|
344
|
+
-
|
345
|
+
- Hello World
|
346
|
+
-*/
|
347
|
+
-
|
348
|
+
- const char * s = "My name is computer!\n\n"
|
349
|
+
-int main (int argv, char ** argv) {
|
350
|
+
- return EXIT_SUCCESS;
|
351
|
+
-}
|
352
|
+
-</pre>
|
353
|
+
-
|
354
|
+
- </body>
|
355
|
+
-</html>
|
356
|
+
|
357
|
+
diff --git a/example2.html b/example2.html
|
358
|
+
deleted file mode 100644
|
359
|
+
index f5f1d8c..0000000
|
360
|
+
--- a/example2.html
|
361
|
+
+++ /dev/null
|
362
|
+
@@ -1,81 +0,0 @@
|
363
|
+
-<!DOCTYPE html>
|
364
|
+
-<html>
|
365
|
+
- <head>
|
366
|
+
-
|
367
|
+
- <link rel="stylesheet" href="jquery.syntax.css" type="text/css" media="screen" />
|
368
|
+
- <link rel="stylesheet" href="example.css" type="text/css" media="screen" />
|
369
|
+
-
|
370
|
+
- <script src="jquery-1.4.1.js" type="text/javascript"></script>
|
371
|
+
-
|
372
|
+
- <script src="jquery.syntax.js" type="text/javascript"></script>
|
373
|
+
- <script src="jquery.syntax.cache.js" type="text/javascript" charset='utf-8'></script>
|
374
|
+
-
|
375
|
+
- <script src="jquery.syntax.brush.clang.js" type="text/javascript"></script>
|
376
|
+
- <script src="jquery.syntax.layout.table.js" type="text/javascript"></script>
|
377
|
+
-
|
378
|
+
- <link rel="stylesheet" href="jquery.syntax.layout.table.css" type="text/css" media="screen">
|
379
|
+
-
|
380
|
+
- <script type="text/javascript" language="JavaScript">
|
381
|
+
- //<!--
|
382
|
+
- $(function() {
|
383
|
+
- $('#highlight').click(function() {
|
384
|
+
- window.console.profile("Syntax Highlighting");
|
385
|
+
- start = new Date();
|
386
|
+
-
|
387
|
+
- $('pre.clang').syntax({brush: 'clang', layout: 'table', replace: true}, function(options, html, container) {
|
388
|
+
- //$('.function', html).replaceWith(function(){
|
389
|
+
- // return $('<a>').addClass('function').attr('href', '#' + $(this).text()).html($(this).html());
|
390
|
+
- //})
|
391
|
+
-
|
392
|
+
- finish = new Date();
|
393
|
+
- window.console.profileEnd();
|
394
|
+
- window.console.log(finish - start);
|
395
|
+
- });
|
396
|
+
- });
|
397
|
+
- });
|
398
|
+
- //-->
|
399
|
+
- </script>
|
400
|
+
-
|
401
|
+
- </head>
|
402
|
+
- <body>
|
403
|
+
- <h1>Syntax Highlighting Example</h1>
|
404
|
+
-
|
405
|
+
- <button id="highlight">Highlight</button>
|
406
|
+
-
|
407
|
+
- <pre class="clang">#include &lt;iostream&gt;
|
408
|
+
-
|
409
|
+
-// If we increase row by 1, the offset will increase by sz (number of elements per row i.e. number of columns)
|
410
|
+
-// If we increase col by 1, the offset will increase by 1
|
411
|
+
-unsigned rowMajorOffset(unsigned row, unsigned col, unsigned sz)
|
412
|
+
-{
|
413
|
+
- return col + row * sz;
|
414
|
+
-}
|
415
|
+
-
|
416
|
+
-// If we increase col by 1, the offset will increase by sz (number of elements per column i.e. number of rows)
|
417
|
+
-// If we increase row by 1, the offset will increase by 1
|
418
|
+
-unsigned columnMajorOffset(unsigned row, unsigned col, unsigned sz)
|
419
|
+
-{
|
420
|
+
- return row + col * sz;
|
421
|
+
-}
|
422
|
+
-
|
423
|
+
-int main (int argc, char * const argv[]) {
|
424
|
+
- Matrix&lt;float, 4, 2, false&gt; rowMajorMatrix;
|
425
|
+
- Matrix&lt;float, 4, 2, true&gt; columnMajorMatrix;
|
426
|
+
-
|
427
|
+
- rowMajorMatrix.loadTestPattern();
|
428
|
+
- rowMajorMatrix.debug();
|
429
|
+
-
|
430
|
+
- columnMajorMatrix.loadTestPattern();
|
431
|
+
- columnMajorMatrix.debug();
|
432
|
+
-
|
433
|
+
- rowMajorMatrix = columnMajorMatrix.transposeStorage();
|
434
|
+
- rowMajorMatrix.debug();
|
435
|
+
-
|
436
|
+
- Matrix&lt;float, 2, 4, false&gt; transposedMatrix = columnMajorMatrix.transposeMatrix();
|
437
|
+
- transposedMatrix.debug();
|
438
|
+
-
|
439
|
+
- return 0;
|
440
|
+
-}</pre>
|
441
|
+
-
|
442
|
+
- </body>
|
443
|
+
-</html>
|
444
|
+
|
445
|
+
diff --git a/example3.html b/example3.html
|
446
|
+
deleted file mode 100644
|
447
|
+
index d559b68..0000000
|
448
|
+
--- a/example3.html
|
449
|
+
+++ /dev/null
|
450
|
+
@@ -1,171 +0,0 @@
|
451
|
+
-<!DOCTYPE html>
|
452
|
+
-<html>
|
453
|
+
- <head>
|
454
|
+
-
|
455
|
+
- <link rel="stylesheet" href="jquery.syntax.css" type="text/css" media="screen" />
|
456
|
+
- <link rel="stylesheet" href="example.css" type="text/css" media="screen" />
|
457
|
+
-
|
458
|
+
- <script src="jquery-1.4.1.js" type="text/javascript"></script>
|
459
|
+
-
|
460
|
+
- <script src="jquery.syntax.js" type="text/javascript"></script>
|
461
|
+
- <script src="jquery.syntax.cache.js" type="text/javascript" charset='utf-8'></script>
|
462
|
+
-
|
463
|
+
- <script src="jquery.syntax.brush.clang.js" type="text/javascript"></script>
|
464
|
+
- <script src="jquery.syntax.layout.table.js" type="text/javascript"></script>
|
465
|
+
-
|
466
|
+
- <link rel="stylesheet" href="jquery.syntax.layout.table.css" type="text/css" media="screen">
|
467
|
+
-
|
468
|
+
- <script type="text/javascript" language="JavaScript">
|
469
|
+
- //<!--
|
470
|
+
- $(function() {
|
471
|
+
- $('#highlight').click(function() {
|
472
|
+
- window.console.profile("Syntax Highlighting");
|
473
|
+
- start = new Date();
|
474
|
+
-
|
475
|
+
- $('pre.clang').syntax({brush: 'clang', layout: 'table', replace: true}, function(options, html, container) {
|
476
|
+
- //$('.function', html).replaceWith(function(){
|
477
|
+
- // return $('<a>').addClass('function').attr('href', '#' + $(this).text()).html($(this).html());
|
478
|
+
- //})
|
479
|
+
-
|
480
|
+
- finish = new Date();
|
481
|
+
- window.console.profileEnd();
|
482
|
+
- window.console.log(finish - start);
|
483
|
+
- });
|
484
|
+
- });
|
485
|
+
- });
|
486
|
+
- //-->
|
487
|
+
- </script>
|
488
|
+
-
|
489
|
+
- </head>
|
490
|
+
- <body>
|
491
|
+
- <h1>Syntax Highlighting Example</h1>
|
492
|
+
-
|
493
|
+
- <button id="highlight">Highlight</button>
|
494
|
+
-
|
495
|
+
- <pre class="clang">#include &lt;iostream&gt;
|
496
|
+
-
|
497
|
+
-// If we increase row by 1, the offset will increase by sz (number of elements per row i.e. number of columns)
|
498
|
+
-// If we increase col by 1, the offset will increase by 1
|
499
|
+
-unsigned rowMajorOffset(unsigned row, unsigned col, unsigned sz)
|
500
|
+
-{
|
501
|
+
- return col + row * sz;
|
502
|
+
-}
|
503
|
+
-
|
504
|
+
-// If we increase col by 1, the offset will increase by sz (number of elements per column i.e. number of rows)
|
505
|
+
-// If we increase row by 1, the offset will increase by 1
|
506
|
+
-unsigned columnMajorOffset(unsigned row, unsigned col, unsigned sz)
|
507
|
+
-{
|
508
|
+
- return row + col * sz;
|
509
|
+
-}
|
510
|
+
-
|
511
|
+
-template &lt;typename _ValueT, unsigned _R, unsigned _C, bool _ColumnMajor&gt;
|
512
|
+
-class Matrix {
|
513
|
+
-protected:
|
514
|
+
- enum { ColumnMajor = _ColumnMajor };
|
515
|
+
- enum { R = _R };
|
516
|
+
- enum { C = _C };
|
517
|
+
-
|
518
|
+
- typedef _ValueT ValueT;
|
519
|
+
-
|
520
|
+
- ValueT m_values[C*R];
|
521
|
+
-
|
522
|
+
-public:
|
523
|
+
- const ValueT &amp; at (unsigned r, unsigned c) const
|
524
|
+
- {
|
525
|
+
- if (ColumnMajor)
|
526
|
+
- return m_values[columnMajorOffset(r, c, R)];
|
527
|
+
- else
|
528
|
+
- return m_values[rowMajorOffset(r, c, C)];
|
529
|
+
- }
|
530
|
+
-
|
531
|
+
- ValueT &amp; at (unsigned r, unsigned c)
|
532
|
+
- {
|
533
|
+
- if (ColumnMajor)
|
534
|
+
- return m_values[columnMajorOffset(r, c, R)];
|
535
|
+
- else
|
536
|
+
- return m_values[rowMajorOffset(r, c, C)];
|
537
|
+
- }
|
538
|
+
-
|
539
|
+
- void loadTestPattern ()
|
540
|
+
- {
|
541
|
+
- for (unsigned r = 0; r &lt; R; r += 1)
|
542
|
+
- for (unsigned c = 0; c &lt; C; c += 1)
|
543
|
+
- at(r, c) = (r+1) * 1000 + (c+1);
|
544
|
+
- }
|
545
|
+
-
|
546
|
+
- void debug ()
|
547
|
+
- {
|
548
|
+
- using namespace std;
|
549
|
+
-
|
550
|
+
- if (ColumnMajor)
|
551
|
+
- cout &lt;&lt; &quot;Column-Major Matrix &quot; &lt;&lt; &quot;(&quot; &lt;&lt; R &lt;&lt; &quot;,&quot; &lt;&lt; C &lt;&lt; &quot;)&quot; &lt;&lt; &quot; @ &quot; &lt;&lt; this &lt;&lt; endl;
|
552
|
+
- else
|
553
|
+
- cout &lt;&lt; &quot;Row-Major Matrix &quot; &lt;&lt; &quot;(&quot; &lt;&lt; R &lt;&lt; &quot;,&quot; &lt;&lt; C &lt;&lt; &quot;)&quot; &lt;&lt; &quot; @ &quot; &lt;&lt; this &lt;&lt; endl;
|
554
|
+
-
|
555
|
+
- cout &lt;&lt; &quot;Memory Offset: &quot;;
|
556
|
+
- for (unsigned i = 0; i &lt; (R*C); i += 1)
|
557
|
+
- cout &lt;&lt; i &lt;&lt; &quot; &quot;;
|
558
|
+
- cout &lt;&lt; endl;
|
559
|
+
-
|
560
|
+
- cout &lt;&lt; &quot; Values: &quot;;
|
561
|
+
- for (unsigned i = 0; i &lt; (R*C); i += 1)
|
562
|
+
- cout &lt;&lt; m_values[i] &lt;&lt; &quot; &quot;;
|
563
|
+
- cout &lt;&lt; endl;
|
564
|
+
-
|
565
|
+
- cout &lt;&lt; &quot;Standard Mathematical Notation:&quot; &lt;&lt; endl;
|
566
|
+
- cout &lt;&lt; &quot; &quot;;
|
567
|
+
- for (unsigned c = 0; c &lt; C; c += 1)
|
568
|
+
- cout &lt;&lt; &quot;Col &quot; &lt;&lt; c &lt;&lt; &quot; &quot;;
|
569
|
+
- cout &lt;&lt; endl;
|
570
|
+
-
|
571
|
+
- for (unsigned r = 0; r &lt; R; r += 1) {
|
572
|
+
- cout &lt;&lt; &quot;Row &quot; &lt;&lt; r &lt;&lt; &quot; &quot;;
|
573
|
+
- for (unsigned c = 0; c &lt; C; c += 1)
|
574
|
+
- cout &lt;&lt; at(r, c) &lt;&lt; &quot; &quot;;
|
575
|
+
- cout &lt;&lt; endl;
|
576
|
+
- }
|
577
|
+
- cout &lt;&lt; endl;
|
578
|
+
- }
|
579
|
+
-
|
580
|
+
- Matrix&lt;ValueT, R, C, !ColumnMajor&gt; transposeStorage () const
|
581
|
+
- {
|
582
|
+
- Matrix&lt;ValueT, R, C, !ColumnMajor&gt; result;
|
583
|
+
-
|
584
|
+
- for (unsigned r = 0; r &lt; R; r += 1)
|
585
|
+
- for (unsigned c = 0; c &lt; C; c += 1)
|
586
|
+
- result.at(r, c) = at(r, c);
|
587
|
+
-
|
588
|
+
- return result;
|
589
|
+
- }
|
590
|
+
-
|
591
|
+
- Matrix&lt;ValueT, C, R, !ColumnMajor&gt; transposeMatrix () const
|
592
|
+
- {
|
593
|
+
- Matrix&lt;ValueT, C, R, !ColumnMajor&gt; result;
|
594
|
+
-
|
595
|
+
- memcpy(&amp;result.at(0,0), m_values, sizeof(m_values));
|
596
|
+
-
|
597
|
+
- return result;
|
598
|
+
- }
|
599
|
+
-};
|
600
|
+
-
|
601
|
+
-int main (int argc, char * const argv[]) {
|
602
|
+
- Matrix&lt;float, 4, 2, false&gt; rowMajorMatrix;
|
603
|
+
- Matrix&lt;float, 4, 2, true&gt; columnMajorMatrix;
|
604
|
+
-
|
605
|
+
- rowMajorMatrix.loadTestPattern();
|
606
|
+
- rowMajorMatrix.debug();
|
607
|
+
-
|
608
|
+
- columnMajorMatrix.loadTestPattern();
|
609
|
+
- columnMajorMatrix.debug();
|
610
|
+
-
|
611
|
+
- rowMajorMatrix = columnMajorMatrix.transposeStorage();
|
612
|
+
- rowMajorMatrix.debug();
|
613
|
+
-
|
614
|
+
- Matrix&lt;float, 2, 4, false&gt; transposedMatrix = columnMajorMatrix.transposeMatrix();
|
615
|
+
- transposedMatrix.debug();
|
616
|
+
-
|
617
|
+
- return 0;
|
618
|
+
-}</pre>
|
619
|
+
-
|
620
|
+
- </body>
|
621
|
+
-</html>
|
622
|
+
|
623
|
+
diff --git a/jquery.syntax.brush.clang.js b/jquery.syntax.brush.clang.js
|
624
|
+
index dcbebbc..3c10a29 100644
|
625
|
+
--- a/jquery.syntax.brush.clang.js
|
626
|
+
+++ b/jquery.syntax.brush.clang.js
|
627
|
+
@@ -1,16 +1,19 @@
|
628
|
+
// brush: "clang" aliases: ["cpp", "c", "objective-c"]
|
629
|
+
|
630
|
+
Syntax.register('clang', function(brush) {
|
631
|
+
- var keywords = ["@interface", "@implementation", "@protocol", "@end", "@private", "@protected", "@public", "@try", "@throw", "@catch", "@finally", "@class", "@selector", "@encode", "@synchronized", "struct", "break", "continue", "else", "for", "switch", "case", "default", "enum", "goto", "register", "sizeof", "typedef", "volatile", "do", "extern", "if", "return", "static", "union", "while", "asm", "dynamic_cast", "namespace", "reinterpret_cast", "try", "explicit", "static_cast", "typeid", "catch", "operator", "template", "class", "friend", "private", "using", "const_cast", "inline", "public", "throw", "virtual", "mutable", "protected", "wchar_t"];
|
632
|
+
+ var keywords = ["@interface", "@implementation", "@protocol", "@end", "@private", "@protected", "@public", "@try", "@throw", "@catch", "@finally", "@class", "@selector", "@encode", "@synchronized", "@property", "struct", "break", "continue", "else", "for", "switch", "case", "default", "enum", "goto", "register", "sizeof", "typedef", "volatile", "do", "extern", "if", "return", "static", "union", "while", "asm", "dynamic_cast", "namespace", "reinterpret_cast", "try", "explicit", "static_cast", "typeid", "catch", "operator", "template", "class", "friend", "private", "using", "const_cast", "inline", "public", "throw", "virtual", "mutable", "protected", "wchar_t"];
|
633
|
+
|
634
|
+
- var types = ["auto", "const", "double", "float", "int", "short", "char", "long", "signed", "unsigned", "bool", "void", "typename"];
|
635
|
+
- var operators = ["+", "*", "/", "-", "&", "|", "~", "!", "%", "<", "=", ">", "new", "delete"];
|
636
|
+
+ var types = ["auto", "const", "double", "float", "int", "short", "char", "long", "signed", "unsigned", "bool", "void", "typename", "id"];
|
637
|
+
+ var operators = ["+", "*", "/", "-", "&", "|", "~", "!", "%", "<", "=", ">", "[", "]", "new", "delete"];
|
638
|
+
var values = ["this", "true", "false", /[0-9]+(\.[0-9]+)?/g];
|
639
|
+
|
640
|
+
- brush.push(values, {klass: 'constant', children: null});
|
641
|
+
- brush.push(types, {klass: 'type', children: null})
|
642
|
+
- brush.push(keywords, {klass: 'keyword', children: null})
|
643
|
+
- brush.push(operators, {klass: 'operator', children: null})
|
644
|
+
+ brush.push(values, {klass: 'constant', children: []});
|
645
|
+
+ brush.push(types, {klass: 'type', children: []})
|
646
|
+
+ brush.push(keywords, {klass: 'keyword', children: []})
|
647
|
+
+ brush.push(operators, {klass: 'operator', children: []})
|
648
|
+
+
|
649
|
+
+ // Objective-C classes
|
650
|
+
+ brush.push({pattern: /\b[A-Z][\w]*\b/g, klass: 'type', children: []})
|
651
|
+
|
652
|
+
brush.push({
|
653
|
+
pattern: /#.*$/gmi,
|
654
|
+
@@ -21,6 +24,15 @@ Syntax.register('clang', function(brush) {
|
655
|
+
brush.push(Syntax.lib.cStyleComment);
|
656
|
+
brush.push(Syntax.lib.cppStyleComment);
|
657
|
+
|
658
|
+
+ // Objective-C style functions
|
659
|
+
+ brush.push({pattern: /\w+:/g, klass: 'function', children: []});
|
660
|
+
+ brush.push({
|
661
|
+
+ pattern: /[^:\[]\s+(\w+)(?=])/g,
|
662
|
+
+ klass: 'function',
|
663
|
+
+ matches: Syntax.singleMatchFunction(1, {klass: 'function', children: []})
|
664
|
+
+ })
|
665
|
+
+
|
666
|
+
+ // Strings
|
667
|
+
brush.push({pattern: /".+?"/g, klass: 'string', children: 'escape'});
|
668
|
+
brush.push({pattern: /\\./g, klass: 'escape'});
|
669
|
+
|
670
|
+
diff --git a/jquery.syntax.brush.ruby.js b/jquery.syntax.brush.ruby.js
|
671
|
+
index 71fdeaf..64a4626 100644
|
672
|
+
--- a/jquery.syntax.brush.ruby.js
|
673
|
+
+++ b/jquery.syntax.brush.ruby.js
|
674
|
+
@@ -1,34 +1,30 @@
|
675
|
+
// brush: "ruby" aliases: []
|
676
|
+
|
677
|
+
-/*
|
678
|
+
- # This ruby code will generate a list of classes.
|
679
|
+
- classes = []
|
680
|
+
-
|
681
|
+
- ObjectSpace.each_object(Class) do |c|
|
682
|
+
- classes << c
|
683
|
+
- end
|
684
|
+
-
|
685
|
+
- puts classes.collect{|cls| cls.name}.inspect
|
686
|
+
-*/
|
687
|
+
+Syntax.lib.rubyStyleFunction = {pattern: /(?:def\s+|\.)([a-z_][a-z0-9_]+)/gi, matches: Syntax.singleMatchFunction(1, {klass: 'function', children: null})}
|
688
|
+
+Syntax.lib.rubyStyleSymbol = {pattern: /:[\w]+/, klass: 'constant', children: null}
|
689
|
+
|
690
|
+
Syntax.register('ruby', function(brush) {
|
691
|
+
var keywords = ["alias", "and", "begin", "break", "case", "class", "def", "define_method", "defined", "do", "each", "else", "elsif", "end", "ensure", "false", "for", "if", "in", "module", "new", "next", "nil", "not", "or", "raise", "redo", "rescue", "retry", "return", "self", "super", "then", "throw", "true", "undef", "unless", "until", "when", "while", "yield"];
|
692
|
+
|
693
|
+
- var types = ["Socket", "UNIXServer", "UNIXSocket", "UDPSocket", "TCPServer", "TCPSocket", "IPSocket", "BasicSocket", "SocketError", "Pathname", "StopIteration", "Enumerable::Enumerator", "Binding", "UnboundMethod", "Method", "Proc", "SystemStackError", "LocalJumpError", "Struct::Tms", "Process::Status", "Time", "Dir", "File::Stat", "File", "IO", "EOFError", "IOError", "Range", "MatchData", "Regexp", "RegexpError", "Struct", "Hash", "Array", "Errno::EDQUOT", "Errno::ESTALE", "Errno::EINPROGRESS", "Errno::EALREADY", "Errno::EHOSTUNREACH", "Errno::EHOSTDOWN", "Errno::ECONNREFUSED", "Errno::ETIMEDOUT", "Errno::ETOOMANYREFS", "Errno::ESHUTDOWN", "Errno::ENOTCONN", "Errno::EISCONN", "Errno::ENOBUFS", "Errno::ECONNRESET", "Errno::ECONNABORTED", "Errno::ENETRESET", "Errno::ENETUNREACH", "Errno::ENETDOWN", "Errno::EADDRNOTAVAIL", "Errno::EADDRINUSE", "Errno::EAFNOSUPPORT", "Errno::EPFNOSUPPORT", "Errno::EOPNOTSUPP", "Errno::ESOCKTNOSUPPORT", "Errno::EPROTONOSUPPORT", "Errno::ENOPROTOOPT", "Errno::EPROTOTYPE", "Errno::EMSGSIZE", "Errno::EDESTADDRREQ", "Errno::ENOTSOCK", "Errno::EUSERS", "Errno::EILSEQ", "Errno::EOVERFLOW", "Errno::EBADMSG", "Errno::EMULTIHOP", "Errno::EPROTO", "Errno::ENOLINK", "Errno::EREMOTE", "Errno::ENOSR", "Errno::ETIME", "Errno::ENODATA", "Errno::ENOSTR", "Errno::EIDRM", "Errno::ENOMSG", "Errno::ELOOP", "Errno::ENOTEMPTY", "Errno::ENOSYS", "Errno::ENOLCK", "Errno::ENAMETOOLONG", "Errno::EDEADLK", "Errno::ERANGE", "Errno::EDOM", "Errno::EPIPE", "Errno::EMLINK", "Errno::EROFS", "Errno::ESPIPE", "Errno::ENOSPC", "Errno::EFBIG", "Errno::ETXTBSY", "Errno::ENOTTY", "Errno::EMFILE", "Errno::ENFILE", "Errno::EINVAL", "Errno::EISDIR", "Errno::ENOTDIR", "Errno::ENODEV", "Errno::EXDEV", "Errno::EEXIST", "Errno::EBUSY", "Errno::ENOTBLK", "Errno::EFAULT", "Errno::EACCES", "Errno::ENOMEM", "Errno::EAGAIN", "Errno::ECHILD", "Errno::EBADF", "Errno::ENOEXEC", "Errno::E2BIG", "Errno::ENXIO", "Errno::EIO", "Errno::EINTR", "Errno::ESRCH", "Errno::ENOENT", "Errno::EPERM", "Bignum", "Float", "Fixnum", "Integer", "Numeric", "FloatDomainError", "ZeroDivisionError", "ThreadGroup", "Continuation", "Thread", "ThreadError", "SystemCallError", "NoMemoryError", "SecurityError", "RuntimeError", "NotImplementedError", "LoadError", "SyntaxError", "ScriptError", "NoMethodError", "NameError::message", "NameError", "RangeError", "IndexError", "ArgumentError", "TypeError", "StandardError", "Interrupt", "SignalException", "fatal", "SystemExit", "Exception", "String", "FalseClass", "TrueClass", "Data", "Symbol", "NilClass", "Class", "Module", "Object"];
|
694
|
+
-
|
695
|
+
var operators = ["+", "*", "/", "-", "&", "|", "~", "!", "%", "<", "=", ">"];
|
696
|
+
var values = ["this", "true", "false", "nil", /[0-9]+(\.[0-9]+)?/g];
|
697
|
+
|
698
|
+
brush.push(values, {klass: 'constant', children: null});
|
699
|
+
- brush.push(types, {klass: 'type', children: null})
|
700
|
+
+
|
701
|
+
+ brush.push({pattern: /(@+|\$)[\w]+/g, klass: 'variable', children: null})
|
702
|
+
+
|
703
|
+
+ brush.push({pattern: /[A-Z_][\w:]+/g, klass: 'type', children: null})
|
704
|
+
brush.push(keywords, {klass: 'keyword', children: null})
|
705
|
+
brush.push(operators, {klass: 'operator', children: null})
|
706
|
+
|
707
|
+
brush.push(Syntax.lib.perlStyleComment)
|
708
|
+
+ brush.push(Syntax.lib.webLink)
|
709
|
+
|
710
|
+
brush.push({pattern: /".+?"/g, klass: 'string', children: ['escape']});
|
711
|
+
+ brush.push({pattern: /'.+?'/g, klass: 'string', children: ['escape']});
|
712
|
+
brush.push({pattern: /\\./g, klass: 'escape'});
|
713
|
+
|
714
|
+
brush.push(Syntax.lib.rubyStyleFunction);
|
715
|
+
+ brush.push(Syntax.lib.cStyleFunction);
|
716
|
+
});
|
717
|
+
|
718
|
+
diff --git a/jquery.syntax.css b/jquery.syntax.css
|
719
|
+
index 0c4d657..2423173 100644
|
720
|
+
--- a/jquery.syntax.css
|
721
|
+
+++ b/jquery.syntax.css
|
722
|
+
@@ -14,12 +14,12 @@
|
723
|
+
|
724
|
+
.syntax .keyword {
|
725
|
+
color: #3c3;
|
726
|
+
- font-weight: bold;
|
727
|
+
}
|
728
|
+
|
729
|
+
.syntax .type,
|
730
|
+
.syntax .template {
|
731
|
+
- color: #3c3;
|
732
|
+
+ color: #191;
|
733
|
+
+ font-weight: bold;
|
734
|
+
}
|
735
|
+
|
736
|
+
.syntax .typename {
|
737
|
+
@@ -44,7 +44,12 @@
|
738
|
+
color: #c00;
|
739
|
+
}
|
740
|
+
|
741
|
+
-.syntax .template {
|
742
|
+
+.syntax .href {
|
743
|
+
+ color: #00f;
|
744
|
+
+ text-decoration: underline;
|
745
|
+
+}
|
746
|
+
+
|
747
|
+
+.syntax .variable {
|
748
|
+
font-style: italic;
|
749
|
+
}
|
750
|
+
|
751
|
+
diff --git a/jquery.syntax.js b/jquery.syntax.js
|
752
|
+
index 7dfc642..07fc8a1 100644
|
753
|
+
--- a/jquery.syntax.js
|
754
|
+
+++ b/jquery.syntax.js
|
755
|
+
@@ -73,9 +73,8 @@ ResourceLoader.prototype._finish = function (name) {
|
756
|
+
if (!resource)
|
757
|
+
window.console.log("Could not load resource named ", name)
|
758
|
+
else {
|
759
|
+
- for (var i in loading) {
|
760
|
+
+ for (var i = 0; i < loading.length; i += 1)
|
761
|
+
loading[i](resource)
|
762
|
+
- }
|
763
|
+
}
|
764
|
+
}
|
765
|
+
|
766
|
+
@@ -100,11 +99,9 @@ Syntax = {
|
767
|
+
|
768
|
+
Syntax.getResource('jquery.syntax.brush', name, callback)
|
769
|
+
}),
|
770
|
+
-
|
771
|
+
layouts: new ResourceLoader(function(name, callback) {
|
772
|
+
Syntax.getResource('jquery.syntax.layout', name, callback)
|
773
|
+
- }),
|
774
|
+
-
|
775
|
+
+ }),
|
776
|
+
getStyles: function (path) {
|
777
|
+
var link = $('<link>')
|
778
|
+
$("head").append(link)
|
779
|
+
@@ -115,7 +112,6 @@ Syntax = {
|
780
|
+
href: path
|
781
|
+
})
|
782
|
+
},
|
783
|
+
-
|
784
|
+
getScript: function (path, callback) {
|
785
|
+
$.ajax({
|
786
|
+
async: 'true',
|
787
|
+
@@ -128,7 +124,6 @@ Syntax = {
|
788
|
+
cache: true
|
789
|
+
})
|
790
|
+
},
|
791
|
+
-
|
792
|
+
getResource: function (prefix, name, callback) {
|
793
|
+
var basename = prefix + "." + name
|
794
|
+
|
795
|
+
@@ -137,25 +132,22 @@ Syntax = {
|
796
|
+
|
797
|
+
Syntax.getScript(this.root + basename + '.js', callback)
|
798
|
+
},
|
799
|
+
-
|
800
|
+
register: function (name, callback) {
|
801
|
+
- brush = Syntax.brushes[name] = new Syntax.Brush()
|
802
|
+
+ var brush = Syntax.brushes[name] = new Syntax.Brush()
|
803
|
+
window.console.log("Registering brush", name, Syntax.brushes)
|
804
|
+
|
805
|
+
brush.klass = name
|
806
|
+
|
807
|
+
callback(brush)
|
808
|
+
},
|
809
|
+
-
|
810
|
+
alias: function (name, aliases) {
|
811
|
+
- for (var i in aliases)
|
812
|
+
+ for (var i = 0; i < aliases.length; i += 1)
|
813
|
+
Syntax.aliases[aliases[i]] = name
|
814
|
+
},
|
815
|
+
-
|
816
|
+
getMatches: function (text, expr) {
|
817
|
+
//window.console.log("getMatches: ", text, expr)
|
818
|
+
|
819
|
+
- var matches = []
|
820
|
+
+ var matches = [], match = null
|
821
|
+
|
822
|
+
while((match = expr.pattern.exec(text)) != null) {
|
823
|
+
if (expr.matches)
|
824
|
+
@@ -168,23 +160,23 @@ Syntax = {
|
825
|
+
}
|
826
|
+
}
|
827
|
+
|
828
|
+
-// Default layout
|
829
|
+
Syntax.layouts.plain = function (options, html, container) {
|
830
|
+
return html
|
831
|
+
}
|
832
|
+
|
833
|
+
Syntax.singleMatchFunction = function(index, rule) {
|
834
|
+
- return function(token) {
|
835
|
+
+ return function(match) {
|
836
|
+
return new Syntax.Match(RegExp.indexOf(match, index), match[index].length, rule, match[index])
|
837
|
+
}
|
838
|
+
}
|
839
|
+
|
840
|
+
-Syntax.lib.cStyleComment = {pattern: /\/\*[\s\S]*?\*\//gm, klass: 'comment', children: null}
|
841
|
+
-Syntax.lib.cppStyleComment = {pattern: /\/\/.*$/gm, klass: 'comment', children: null}
|
842
|
+
-Syntax.lib.perlStyleComment = {pattern: /#.*$/gm, klass: 'comment', children: null}
|
843
|
+
-Syntax.lib.cStyleFunction = {pattern: /([a-z_][a-z0-9_]+)\s*\(/gi, matches: Syntax.singleMatchFunction(1, {klass: 'function', children: null})}
|
844
|
+
-Syntax.lib.rubyStyleFunction = {pattern: /\.([a-z_][a-z0-9_]+)/gi, matches: Syntax.singleMatchFunction(1, {klass: 'function', children: null})}
|
845
|
+
-Syntax.lib.rubyStyleSymbol = {pattern: /:[\w]+/, klass: 'constant', children: null}
|
846
|
+
+Syntax.lib.cStyleComment = {pattern: /\/\*[\s\S]*?\*\//gm, klass: 'comment', children: ['href']}
|
847
|
+
+Syntax.lib.cppStyleComment = {pattern: /\/\/.*$/gm, klass: 'comment', children: ['href']}
|
848
|
+
+Syntax.lib.perlStyleComment = {pattern: /#.*$/gm, klass: 'comment', children: ['href']}
|
849
|
+
+
|
850
|
+
+Syntax.lib.cStyleFunction = {pattern: /([a-z_][a-z0-9_]+)\s*\(/gi, matches: Syntax.singleMatchFunction(1, {klass: 'function', children: []})}
|
851
|
+
+
|
852
|
+
+Syntax.lib.webLink = {pattern: /https?:\/\/([-\w~!$?&#\/+|.,=]|%[a-f\d]{2})+/g, klass: 'href'}
|
853
|
+
|
854
|
+
Syntax.Match = function (offset, length, expr, value) {
|
855
|
+
this.offset = offset
|
856
|
+
@@ -199,16 +191,11 @@ Syntax.Match = function (offset, length, expr, value) {
|
857
|
+
}
|
858
|
+
|
859
|
+
Syntax.Match.sort = function (a,b) {
|
860
|
+
- var diff = a.offset - b.offset
|
861
|
+
-
|
862
|
+
- if (diff != 0)
|
863
|
+
- return diff
|
864
|
+
- else
|
865
|
+
- return b.length - a.length
|
866
|
+
+ return (a.offset - b.offset) || (b.length - a.length)
|
867
|
+
}
|
868
|
+
|
869
|
+
Syntax.Match.prototype.contains = function (match) {
|
870
|
+
- return (this.offset <= match.offset) && (match.endOffset <= this.endOffset)
|
871
|
+
+ return (match.offset >= this.offset) && (match.endOffset <= this.endOffset)
|
872
|
+
}
|
873
|
+
|
874
|
+
Syntax.Match.defaultReduceCallback = function (node, container) {
|
875
|
+
@@ -237,9 +224,8 @@ Syntax.Match.prototype.reduce = function (append) {
|
876
|
+
if (this.expression && this.expression.klass)
|
877
|
+
container.addClass(this.expression.klass)
|
878
|
+
|
879
|
+
- for (var i in this.children) {
|
880
|
+
+ for (var i = 0; i < this.children.length; i += 1) {
|
881
|
+
//window.console.log(i, this.children[i], text)
|
882
|
+
-
|
883
|
+
var child = this.children[i]
|
884
|
+
var end = child.offset
|
885
|
+
|
886
|
+
@@ -256,56 +242,59 @@ Syntax.Match.prototype.reduce = function (append) {
|
887
|
+
else if (start < this.endOffset)
|
888
|
+
append(this.value.substr(start - this.offset, this.endOffset - start), container)
|
889
|
+
else if (start > this.endOffset)
|
890
|
+
- window.console.log("Start position", start, "exceeds length of value", this)
|
891
|
+
+ window.console.log("Start position", start, "exceeds length of value", this.offset, this.length)
|
892
|
+
|
893
|
+
return container
|
894
|
+
}
|
895
|
+
|
896
|
+
-// This function is by far the biggest overal cost in terms of run-time. This is not because
|
897
|
+
-// it is slow, but mostly because it is called many times. It already has as much of the logic
|
898
|
+
-// folded into it (few function calls). I considered making it non-recursive, but after testing,
|
899
|
+
-// I found that less than 64 out of 500 function calls recursed at all, so it wouldn't be worth
|
900
|
+
-// it - it might even get slower.
|
901
|
+
-Syntax.Match.prototype.insert = function (match) {
|
902
|
+
+// This is not a general tree insertion function. It is optimised to run in almost constant
|
903
|
+
+// time, but data must be inserted in sorted order, otherwise you will have problems.
|
904
|
+
+Syntax.Match.prototype.insertAtEnd = function (match) {
|
905
|
+
+ if (!this.contains(match)) {
|
906
|
+
+ window.console.log(this, "does not contain", match)
|
907
|
+
+ return null;
|
908
|
+
+ }
|
909
|
+
+
|
910
|
+
// We have explicitly said: no children
|
911
|
+
if (this.expression.children === null)
|
912
|
+
return null
|
913
|
+
-
|
914
|
+
- if (this.expression.children) {
|
915
|
+
- // window.console.log(this.expression.children, match.expression.klass, $.inArray(match.expression.klass, this.expression.children))
|
916
|
+
+ else if (this.expression.children) {
|
917
|
+
if ($.inArray(match.expression.klass, this.expression.children) == -1)
|
918
|
+
return null
|
919
|
+
}
|
920
|
+
|
921
|
+
- if (!this.contains(match))
|
922
|
+
- return null
|
923
|
+
-
|
924
|
+
if (this.children.length > 0) {
|
925
|
+
- for (var i in this.children) {
|
926
|
+
- var child = this.children[i]
|
927
|
+
-
|
928
|
+
- if (match.offset < child.offset) {
|
929
|
+
- if (match.endOffset <= child.offset) {
|
930
|
+
- this.children.splice(i, 0, match)
|
931
|
+
- return this
|
932
|
+
- } else {
|
933
|
+
- window.console.log("Match " + match.toString() + " " + displacement + " existing child: " + this.children[i].toString())
|
934
|
+
- return null
|
935
|
+
- }
|
936
|
+
- } else if (match.offset < child.endOffset) {
|
937
|
+
- if (match.endOffset <= child.endOffset) {
|
938
|
+
- // Recursive step
|
939
|
+
- return child.insert(match)
|
940
|
+
- } else {
|
941
|
+
- var parts = match.halfBisect(child.endOffset)
|
942
|
+
- child.insert(parts[0])
|
943
|
+
- match = parts[1]
|
944
|
+
- }
|
945
|
+
+ var i = this.children.length-1
|
946
|
+
+ var child = this.children[i]
|
947
|
+
+
|
948
|
+
+ if (match.offset < child.offset) {
|
949
|
+
+ if (match.endOffset <= child.offset) {
|
950
|
+
+ // displacement = 'before'
|
951
|
+
+ this.children.splice(i, 0, match)
|
952
|
+
+ return this
|
953
|
+
+ } else {
|
954
|
+
+ // displacement = 'left-overlap'
|
955
|
+
+ return null
|
956
|
+
+ }
|
957
|
+
+ } else if (match.offset < child.endOffset) {
|
958
|
+
+ if (match.endOffset <= child.endOffset) {
|
959
|
+
+ // displacement = 'contains'
|
960
|
+
+ var result = child.insertAtEnd(match)
|
961
|
+
+ return result
|
962
|
+
} else {
|
963
|
+
- if (i == this.children.length-1) {
|
964
|
+
- this.children.splice(i+1, 0, match)
|
965
|
+
- return this
|
966
|
+
- }
|
967
|
+
+ // displacement = 'right-overlap'
|
968
|
+
+ // This code should work, but right now I don't think its useful.
|
969
|
+
+ window.console.error("Cannot add match", match, "into", this, "it right-overlaps!")
|
970
|
+
+ //var parts = match.halfBisect(child.endOffset)
|
971
|
+
+ // child.insertAtEnd(parts[0])
|
972
|
+
+ // this.insertAtEnd(parts[1])
|
973
|
+
+ return null;
|
974
|
+
+ }
|
975
|
+
+ } else {
|
976
|
+
+ // displacement = 'after'
|
977
|
+
+ if (i == this.children.length-1) {
|
978
|
+
+ this.children.splice(i+1, 0, match)
|
979
|
+
+ return this
|
980
|
+
}
|
981
|
+
}
|
982
|
+
|
983
|
+
@@ -328,7 +317,14 @@ Syntax.Match.prototype.halfBisect = function(offset) {
|
984
|
+
Syntax.Match.prototype.bisectAtOffsets = function(splits) {
|
985
|
+
var parts = [], start = this.offset, prev = null, children = $.merge([], this.children)
|
986
|
+
|
987
|
+
- for (var i in splits) {
|
988
|
+
+ // Copy the array so we can modify it.
|
989
|
+
+ splits = splits.slice(0)
|
990
|
+
+
|
991
|
+
+ // We need to split including the last part.
|
992
|
+
+ splits.push(this.endOffset)
|
993
|
+
+ splits.sort(function(a,b){return a-b})
|
994
|
+
+
|
995
|
+
+ for (var i = 0; i < splits.length; i += 1) {
|
996
|
+
var offset = splits[i]
|
997
|
+
|
998
|
+
if (offset < this.offset || offset > this.endOffset) {
|
999
|
+
@@ -336,7 +332,7 @@ Syntax.Match.prototype.bisectAtOffsets = function(splits) {
|
1000
|
+
}
|
1001
|
+
|
1002
|
+
var match = new Syntax.Match(start, offset - start, this.expression)
|
1003
|
+
- match.value = this.value.substr(start, match.length)
|
1004
|
+
+ match.value = this.value.substr(start - this.offset, match.length)
|
1005
|
+
|
1006
|
+
if (prev)
|
1007
|
+
prev.next = match
|
1008
|
+
@@ -351,7 +347,7 @@ Syntax.Match.prototype.bisectAtOffsets = function(splits) {
|
1009
|
+
splits.length = parts.length
|
1010
|
+
|
1011
|
+
for (var i = 0; i < parts.length; i += 1) {
|
1012
|
+
- var offset = splits.shift()
|
1013
|
+
+ var offset = splits[0]
|
1014
|
+
|
1015
|
+
while (children.length > 0) {
|
1016
|
+
if (children[0].endOffset <= parts[i].endOffset)
|
1017
|
+
@@ -362,15 +358,18 @@ Syntax.Match.prototype.bisectAtOffsets = function(splits) {
|
1018
|
+
|
1019
|
+
if (children.length) {
|
1020
|
+
// We may have an intersection
|
1021
|
+
- if (children[0].offset < parts[i].offset) {
|
1022
|
+
- children_parts = children.shift().bisectAtOffsets(splits)
|
1023
|
+
+ if (children[0].offset < parts[i].endOffset) {
|
1024
|
+
+ var children_parts = children.shift().bisectAtOffsets(splits), j = 0
|
1025
|
+
|
1026
|
+
- for (var j in children_parts)
|
1027
|
+
+ for (; j < children_parts.length; j += 1)
|
1028
|
+
parts[i+j].children.push(children_parts[j])
|
1029
|
+
|
1030
|
+
- // i += (j-1)
|
1031
|
+
+ // Skip any parts which have been populated already
|
1032
|
+
+ // i += (children_parts.length-1)
|
1033
|
+
}
|
1034
|
+
}
|
1035
|
+
+
|
1036
|
+
+ splits.shift();
|
1037
|
+
}
|
1038
|
+
|
1039
|
+
if (children.length)
|
1040
|
+
@@ -380,14 +379,11 @@ Syntax.Match.prototype.bisectAtOffsets = function(splits) {
|
1041
|
+
}
|
1042
|
+
|
1043
|
+
Syntax.Match.prototype.split = function(pattern) {
|
1044
|
+
- var splits = []
|
1045
|
+
+ var splits = [], match
|
1046
|
+
|
1047
|
+
while ((match = pattern.exec(this.value)) != null)
|
1048
|
+
splits.push(pattern.lastIndex)
|
1049
|
+
|
1050
|
+
- // We need to have a fake split at the end.
|
1051
|
+
- splits.push(this.endOffset)
|
1052
|
+
-
|
1053
|
+
return this.bisectAtOffsets(splits)
|
1054
|
+
}
|
1055
|
+
|
1056
|
+
@@ -400,14 +396,24 @@ Syntax.Brush.prototype.push = function () {
|
1057
|
+
if ($.isArray(arguments[0])) {
|
1058
|
+
var patterns = arguments[0], rule = arguments[1]
|
1059
|
+
|
1060
|
+
- for (var i in patterns)
|
1061
|
+
+ for (var i = 0; i < patterns.length; i += 1)
|
1062
|
+
this.push($.extend({pattern: patterns[i]}, rule))
|
1063
|
+
} else {
|
1064
|
+
var rule = arguments[0]
|
1065
|
+
|
1066
|
+
if (typeof(rule.pattern) == 'string') {
|
1067
|
+
rule.string = rule.pattern
|
1068
|
+
- rule.pattern = new RegExp(RegExp.escape(rule.pattern), rule.options || 'g')
|
1069
|
+
+ var prefix = "\\b", postfix = "\\b"
|
1070
|
+
+
|
1071
|
+
+ if (!rule.pattern.match(/^\w/)) {
|
1072
|
+
+ if (!rule.pattern.match(/\w$/))
|
1073
|
+
+ prefix = postfix = ""
|
1074
|
+
+ else
|
1075
|
+
+ prefix = "\\B"
|
1076
|
+
+ }
|
1077
|
+
+
|
1078
|
+
+
|
1079
|
+
+ rule.pattern = rule.pattern = new RegExp(prefix + RegExp.escape(rule.pattern) + postfix, rule.options || 'g')
|
1080
|
+
}
|
1081
|
+
|
1082
|
+
if (rule.pattern.global)
|
1083
|
+
@@ -420,9 +426,8 @@ Syntax.Brush.prototype.push = function () {
|
1084
|
+
Syntax.Brush.prototype.getMatches = function(text) {
|
1085
|
+
var matches = []
|
1086
|
+
|
1087
|
+
- for (var i in this.rules) {
|
1088
|
+
+ for (var i = 0; i < this.rules.length; i += 1)
|
1089
|
+
matches = matches.concat(Syntax.getMatches(text, this.rules[i]))
|
1090
|
+
- }
|
1091
|
+
|
1092
|
+
return matches
|
1093
|
+
}
|
1094
|
+
@@ -434,15 +439,14 @@ Syntax.Brush.prototype.process = function(text) {
|
1095
|
+
// This sort is absolutely key to the functioning of the tree insertion algorithm.
|
1096
|
+
matches.sort(Syntax.Match.sort)
|
1097
|
+
|
1098
|
+
- for (var i in matches) {
|
1099
|
+
- top.insert(matches[i])
|
1100
|
+
- }
|
1101
|
+
+ for (var i = 0; i < matches.length; i += 1)
|
1102
|
+
+ top.insertAtEnd(matches[i])
|
1103
|
+
|
1104
|
+
var lines = top.split(/\n/g)
|
1105
|
+
|
1106
|
+
var html = $('<pre>').addClass('syntax')
|
1107
|
+
|
1108
|
+
- for (var i in lines) {
|
1109
|
+
+ for (var i = 0; i < lines.length; i += 1) {
|
1110
|
+
var line = lines[i].reduce()
|
1111
|
+
html.append(line)
|
1112
|
+
}
|
1113
|
+
diff --git a/jquery.syntax.layout.table.css b/jquery.syntax.layout.table.css
|
1114
|
+
index 6e12646..043f721 100644
|
1115
|
+
--- a/jquery.syntax.layout.table.css
|
1116
|
+
+++ b/jquery.syntax.layout.table.css
|
1117
|
+
@@ -11,6 +11,10 @@ table.syntax {
|
1118
|
+
-webkit-box-shadow: 5px 5px 5px #eee;
|
1119
|
+
}
|
1120
|
+
|
1121
|
+
+table.syntax tr.alt td.source {
|
1122
|
+
+ background-color: #f6f6f6;
|
1123
|
+
+}
|
1124
|
+
+
|
1125
|
+
table.syntax td {
|
1126
|
+
padding-left: 0.4em;
|
1127
|
+
padding-right: 0.4em;
|
1128
|
+
@@ -22,5 +26,5 @@ table.syntax td.number {
|
1129
|
+
|
1130
|
+
width: 2.5em;
|
1131
|
+
color: #555;
|
1132
|
+
- background-color: #dadada;
|
1133
|
+
+ background-color: #e0e0e0;
|
1134
|
+
}
|
1135
|
+
|
1136
|
+
diff --git a/jquery.syntax.layout.table.js b/jquery.syntax.layout.table.js
|
1137
|
+
index 9cd68c3..14967c4 100644
|
1138
|
+
--- a/jquery.syntax.layout.table.js
|
1139
|
+
+++ b/jquery.syntax.layout.table.js
|
1140
|
+
@@ -1,16 +1,14 @@
|
1141
|
+
-Syntax.layouts.table = function(options, code, container) {
|
1142
|
+
- var table = $('<table>'), tr = null, td = null;
|
1143
|
+
+Syntax.layouts.tableJQ = function(options, code, container) {
|
1144
|
+
+ var table = $('<table class="syntax">'), tr = null, td = null;
|
1145
|
+
var line = 1;
|
1146
|
+
|
1147
|
+
- table.addClass('syntax');
|
1148
|
+
-
|
1149
|
+
code.children().each(function() {
|
1150
|
+
- tr = $('<tr>').addClass('line', 'line-' + line);
|
1151
|
+
+ tr = $('<tr class="line ln' + line + '">')
|
1152
|
+
|
1153
|
+
- td = $('<td>').addClass('number').text(line);
|
1154
|
+
+ td = $('<td class="number">' + line + '</td>')
|
1155
|
+
tr.append(td);
|
1156
|
+
|
1157
|
+
- td = $('<td>').addClass('source');
|
1158
|
+
+ td = $('<td class="source">')
|
1159
|
+
td.append(this);
|
1160
|
+
tr.append(td);
|
1161
|
+
|
1162
|
+
@@ -19,4 +17,57 @@ Syntax.layouts.table = function(options, code, container) {
|
1163
|
+
});
|
1164
|
+
|
1165
|
+
return table;
|
1166
|
+
-}
|
1167
|
+
|
1168
|
+
+}
|
1169
|
+
+
|
1170
|
+
+Syntax.layouts.tableDOM = function(options, code, container) {
|
1171
|
+
+ var table = $('<table>'), tr = null, td = null;
|
1172
|
+
+ var line = 1;
|
1173
|
+
+
|
1174
|
+
+ table.addClass('syntax');
|
1175
|
+
+
|
1176
|
+
+ code.children().each(function() {
|
1177
|
+
+ tr = document.createElement('tr')
|
1178
|
+
+ tr.className = "line ln" + line
|
1179
|
+
+
|
1180
|
+
+ if (line % 2)
|
1181
|
+
+ tr.className += " alt"
|
1182
|
+
+
|
1183
|
+
+ td = document.createElement('td')
|
1184
|
+
+ td.className = "number"
|
1185
|
+
+ td.innerHTML = line
|
1186
|
+
+ tr.appendChild(td)
|
1187
|
+
+
|
1188
|
+
+ td = document.createElement('td')
|
1189
|
+
+ td.className = "source"
|
1190
|
+
+ td.innerHTML = this.innerHTML
|
1191
|
+
+ tr.appendChild(td)
|
1192
|
+
+
|
1193
|
+
+ table[0].appendChild(tr)
|
1194
|
+
+ line = line + 1;
|
1195
|
+
+ });
|
1196
|
+
+
|
1197
|
+
+ $('span.href', table).each(function(){
|
1198
|
+
+ $(this).replaceWith($('<a>').attr('href', this.innerHTML).text(this.innerHTML))
|
1199
|
+
+ })
|
1200
|
+
+
|
1201
|
+
+ return table;
|
1202
|
+
+}
|
1203
|
+
+
|
1204
|
+
+Syntax.layouts.tableSTR = function(options, code, container) {
|
1205
|
+
+ var table = "<table class='syntax'>", tr = null, td = null;
|
1206
|
+
+ var line = 1;
|
1207
|
+
+
|
1208
|
+
+ code.children().each(function() {
|
1209
|
+
+ table += "<tr class='line ln" + line + "'><td class='number'></td><td class='source'>" + this.innerHTML + "</td></tr>"
|
1210
|
+
+
|
1211
|
+
+ line = line + 1;
|
1212
|
+
+ });
|
1213
|
+
+
|
1214
|
+
+ table += "</table>"
|
1215
|
+
+
|
1216
|
+
+ window.console.log(table.length)
|
1217
|
+
+
|
1218
|
+
+ return $(table);
|
1219
|
+
+}
|
1220
|
+
+
|
1221
|
+
+Syntax.layouts.table = Syntax.layouts.tableDOM
|
1222
|
+
|
1223
|
+
</code></pre>
|
1224
|
+
|
1225
|
+
</body>
|
1226
|
+
</html>
|