utopia-wiki 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (415) hide show
  1. checksums.yaml +7 -0
  2. data/.github/workflows/development.yml +62 -0
  3. data/.gitignore +18 -0
  4. data/.rspec +2 -0
  5. data/.yarnrc +1 -0
  6. data/Gemfile +4 -0
  7. data/README.md +46 -0
  8. data/bake/utopia/wiki.rb +13 -0
  9. data/lib/components/.yarn-integrity +19 -0
  10. data/lib/components/jquery-litebox/README.md +66 -0
  11. data/lib/components/jquery-litebox/bower.json +27 -0
  12. data/lib/components/jquery-litebox/dist/jquery.litebox.css +23 -0
  13. data/lib/components/jquery-litebox/dist/jquery.litebox.gallery.css +48 -0
  14. data/lib/components/jquery-litebox/dist/jquery.litebox.js +30 -0
  15. data/lib/components/jquery-litebox/example/index.html +69 -0
  16. data/lib/components/jquery-litebox/example/jquery.min.js +4 -0
  17. data/lib/components/jquery-litebox/example/sample_images/large/IMG_3340.jpg +0 -0
  18. data/lib/components/jquery-litebox/example/sample_images/large/IMG_3341.jpg +0 -0
  19. data/lib/components/jquery-litebox/example/sample_images/large/IMG_3344.jpg +0 -0
  20. data/lib/components/jquery-litebox/example/sample_images/large/IMG_3351.jpg +0 -0
  21. data/lib/components/jquery-litebox/example/sample_images/medium/IMG_3340.jpg +0 -0
  22. data/lib/components/jquery-litebox/example/sample_images/medium/IMG_3341.jpg +0 -0
  23. data/lib/components/jquery-litebox/example/sample_images/medium/IMG_3344.jpg +0 -0
  24. data/lib/components/jquery-litebox/example/sample_images/medium/IMG_3351.jpg +0 -0
  25. data/lib/components/jquery-litebox/example/sample_images/small/IMG_3340.jpg +0 -0
  26. data/lib/components/jquery-litebox/example/sample_images/small/IMG_3341.jpg +0 -0
  27. data/lib/components/jquery-litebox/example/sample_images/small/IMG_3344.jpg +0 -0
  28. data/lib/components/jquery-litebox/example/sample_images/small/IMG_3351.jpg +0 -0
  29. data/lib/components/jquery-litebox/package.json +29 -0
  30. data/lib/components/jquery-syntax/Gemfile +5 -0
  31. data/lib/components/jquery-syntax/LICENSE.txt +19 -0
  32. data/lib/components/jquery-syntax/NOTES.txt +20 -0
  33. data/lib/components/jquery-syntax/README.md +95 -0
  34. data/lib/components/jquery-syntax/Rakefile +211 -0
  35. data/lib/components/jquery-syntax/bower.json +25 -0
  36. data/lib/components/jquery-syntax/config.ru +4 -0
  37. data/lib/components/jquery-syntax/dist/base/jquery.syntax.brush.apache.css +12 -0
  38. data/lib/components/jquery-syntax/dist/base/jquery.syntax.brush.applescript.css +5 -0
  39. data/lib/components/jquery-syntax/dist/base/jquery.syntax.brush.assembly.css +8 -0
  40. data/lib/components/jquery-syntax/dist/base/jquery.syntax.brush.bash-script.css +6 -0
  41. data/lib/components/jquery-syntax/dist/base/jquery.syntax.brush.bash.css +4 -0
  42. data/lib/components/jquery-syntax/dist/base/jquery.syntax.brush.clang.css +6 -0
  43. data/lib/components/jquery-syntax/dist/base/jquery.syntax.brush.css.css +14 -0
  44. data/lib/components/jquery-syntax/dist/base/jquery.syntax.brush.diff.css +16 -0
  45. data/lib/components/jquery-syntax/dist/base/jquery.syntax.brush.html.css +5 -0
  46. data/lib/components/jquery-syntax/dist/base/jquery.syntax.brush.ocaml.css +3 -0
  47. data/lib/components/jquery-syntax/dist/base/jquery.syntax.brush.protobuf.css +2 -0
  48. data/lib/components/jquery-syntax/dist/base/jquery.syntax.brush.python.css +6 -0
  49. data/lib/components/jquery-syntax/dist/base/jquery.syntax.brush.ruby.css +2 -0
  50. data/lib/components/jquery-syntax/dist/base/jquery.syntax.brush.xml.css +18 -0
  51. data/lib/components/jquery-syntax/dist/base/jquery.syntax.core.css +58 -0
  52. data/lib/components/jquery-syntax/dist/base/jquery.syntax.editor.css +6 -0
  53. data/lib/components/jquery-syntax/dist/base/theme.js +1 -0
  54. data/lib/components/jquery-syntax/dist/bright/jquery.syntax.core.css +27 -0
  55. data/lib/components/jquery-syntax/dist/bright/theme.js +1 -0
  56. data/lib/components/jquery-syntax/dist/jquery.syntax.brush.apache.js +3 -0
  57. data/lib/components/jquery-syntax/dist/jquery.syntax.brush.applescript.js +5 -0
  58. data/lib/components/jquery-syntax/dist/jquery.syntax.brush.assembly.js +3 -0
  59. data/lib/components/jquery-syntax/dist/jquery.syntax.brush.bash-script.js +4 -0
  60. data/lib/components/jquery-syntax/dist/jquery.syntax.brush.bash.js +2 -0
  61. data/lib/components/jquery-syntax/dist/jquery.syntax.brush.basic.js +5 -0
  62. data/lib/components/jquery-syntax/dist/jquery.syntax.brush.clang.js +5 -0
  63. data/lib/components/jquery-syntax/dist/jquery.syntax.brush.csharp.js +4 -0
  64. data/lib/components/jquery-syntax/dist/jquery.syntax.brush.css.js +5 -0
  65. data/lib/components/jquery-syntax/dist/jquery.syntax.brush.diff.js +2 -0
  66. data/lib/components/jquery-syntax/dist/jquery.syntax.brush.go.js +3 -0
  67. data/lib/components/jquery-syntax/dist/jquery.syntax.brush.haskell.js +3 -0
  68. data/lib/components/jquery-syntax/dist/jquery.syntax.brush.html.js +4 -0
  69. data/lib/components/jquery-syntax/dist/jquery.syntax.brush.io.js +3 -0
  70. data/lib/components/jquery-syntax/dist/jquery.syntax.brush.java.js +4 -0
  71. data/lib/components/jquery-syntax/dist/jquery.syntax.brush.javascript.js +3 -0
  72. data/lib/components/jquery-syntax/dist/jquery.syntax.brush.kai.js +2 -0
  73. data/lib/components/jquery-syntax/dist/jquery.syntax.brush.lisp.js +2 -0
  74. data/lib/components/jquery-syntax/dist/jquery.syntax.brush.lua.js +3 -0
  75. data/lib/components/jquery-syntax/dist/jquery.syntax.brush.nginx.js +2 -0
  76. data/lib/components/jquery-syntax/dist/jquery.syntax.brush.ocaml.js +4 -0
  77. data/lib/components/jquery-syntax/dist/jquery.syntax.brush.ooc.js +4 -0
  78. data/lib/components/jquery-syntax/dist/jquery.syntax.brush.pascal.js +4 -0
  79. data/lib/components/jquery-syntax/dist/jquery.syntax.brush.perl5.js +3 -0
  80. data/lib/components/jquery-syntax/dist/jquery.syntax.brush.php-script.js +4 -0
  81. data/lib/components/jquery-syntax/dist/jquery.syntax.brush.php.js +2 -0
  82. data/lib/components/jquery-syntax/dist/jquery.syntax.brush.plain.js +2 -0
  83. data/lib/components/jquery-syntax/dist/jquery.syntax.brush.protobuf.js +3 -0
  84. data/lib/components/jquery-syntax/dist/jquery.syntax.brush.python.js +5 -0
  85. data/lib/components/jquery-syntax/dist/jquery.syntax.brush.ruby.js +5 -0
  86. data/lib/components/jquery-syntax/dist/jquery.syntax.brush.scala.js +4 -0
  87. data/lib/components/jquery-syntax/dist/jquery.syntax.brush.smalltalk.js +2 -0
  88. data/lib/components/jquery-syntax/dist/jquery.syntax.brush.sql.js +4 -0
  89. data/lib/components/jquery-syntax/dist/jquery.syntax.brush.super-collider.js +3 -0
  90. data/lib/components/jquery-syntax/dist/jquery.syntax.brush.swift.js +3 -0
  91. data/lib/components/jquery-syntax/dist/jquery.syntax.brush.trenni.js +2 -0
  92. data/lib/components/jquery-syntax/dist/jquery.syntax.brush.xml.js +4 -0
  93. data/lib/components/jquery-syntax/dist/jquery.syntax.brush.yaml.js +2 -0
  94. data/lib/components/jquery-syntax/dist/jquery.syntax.cache.js +7 -0
  95. data/lib/components/jquery-syntax/dist/jquery.syntax.core.js +34 -0
  96. data/lib/components/jquery-syntax/dist/jquery.syntax.editor.js +11 -0
  97. data/lib/components/jquery-syntax/dist/jquery.syntax.js +8 -0
  98. data/lib/components/jquery-syntax/dist/jquery.syntax.min.js +13 -0
  99. data/lib/components/jquery-syntax/dist/paper/jquery.syntax.core.css +31 -0
  100. data/lib/components/jquery-syntax/dist/paper/theme.js +1 -0
  101. data/lib/components/jquery-syntax/examples/ex.applescript.html +120 -0
  102. data/lib/components/jquery-syntax/examples/ex.asm.html +43 -0
  103. data/lib/components/jquery-syntax/examples/ex.bash.html +139 -0
  104. data/lib/components/jquery-syntax/examples/ex.clang.html +337 -0
  105. data/lib/components/jquery-syntax/examples/ex.css.html +48 -0
  106. data/lib/components/jquery-syntax/examples/ex.diff.html +1226 -0
  107. data/lib/components/jquery-syntax/examples/ex.editor.html +28 -0
  108. data/lib/components/jquery-syntax/examples/ex.html.html +134 -0
  109. data/lib/components/jquery-syntax/examples/ex.javascript.html +330 -0
  110. data/lib/components/jquery-syntax/examples/ex.ooc.html +119 -0
  111. data/lib/components/jquery-syntax/examples/ex.php.html +54 -0
  112. data/lib/components/jquery-syntax/examples/ex.python.html +1510 -0
  113. data/lib/components/jquery-syntax/examples/ex.ruby.html +358 -0
  114. data/lib/components/jquery-syntax/examples/ex.swift.html +90 -0
  115. data/lib/components/jquery-syntax/examples/index.css +18 -0
  116. data/lib/components/jquery-syntax/examples/jquery-1.6.min.js +16 -0
  117. data/lib/components/jquery-syntax/examples/tests.html +71 -0
  118. data/lib/components/jquery-syntax/examples/wrapping-flex.html +71 -0
  119. data/lib/components/jquery-syntax/examples/wrapping.html +181 -0
  120. data/lib/components/jquery-syntax/ext/closure/COPYING +202 -0
  121. data/lib/components/jquery-syntax/ext/closure/README +292 -0
  122. data/lib/components/jquery-syntax/ext/closure/compiler.jar +0 -0
  123. data/lib/components/jquery-syntax/ext/theme.rb +85 -0
  124. data/lib/components/jquery-syntax/install.yaml +9 -0
  125. data/lib/components/jquery-syntax/jQuery.Syntax.artx/Preview/preview.png +0 -0
  126. data/lib/components/jquery-syntax/jQuery.Syntax.artx/doc.thread +0 -0
  127. data/lib/components/jquery-syntax/package.json +31 -0
  128. data/lib/components/jquery-syntax/source/jquery.syntax.brush.apache.js +41 -0
  129. data/lib/components/jquery-syntax/source/jquery.syntax.brush.applescript.js +57 -0
  130. data/lib/components/jquery-syntax/source/jquery.syntax.brush.assembly.js +37 -0
  131. data/lib/components/jquery-syntax/source/jquery.syntax.brush.bash-script.js +67 -0
  132. data/lib/components/jquery-syntax/source/jquery.syntax.brush.bash.js +33 -0
  133. data/lib/components/jquery-syntax/source/jquery.syntax.brush.basic.js +51 -0
  134. data/lib/components/jquery-syntax/source/jquery.syntax.brush.clang.js +89 -0
  135. data/lib/components/jquery-syntax/source/jquery.syntax.brush.csharp.js +47 -0
  136. data/lib/components/jquery-syntax/source/jquery.syntax.brush.css.js +80 -0
  137. data/lib/components/jquery-syntax/source/jquery.syntax.brush.diff.js +24 -0
  138. data/lib/components/jquery-syntax/source/jquery.syntax.brush.go.js +47 -0
  139. data/lib/components/jquery-syntax/source/jquery.syntax.brush.haskell.js +45 -0
  140. data/lib/components/jquery-syntax/source/jquery.syntax.brush.html.js +66 -0
  141. data/lib/components/jquery-syntax/source/jquery.syntax.brush.io.js +45 -0
  142. data/lib/components/jquery-syntax/source/jquery.syntax.brush.java.js +45 -0
  143. data/lib/components/jquery-syntax/source/jquery.syntax.brush.javascript.js +42 -0
  144. data/lib/components/jquery-syntax/source/jquery.syntax.brush.kai.js +29 -0
  145. data/lib/components/jquery-syntax/source/jquery.syntax.brush.lisp.js +34 -0
  146. data/lib/components/jquery-syntax/source/jquery.syntax.brush.lua.js +44 -0
  147. data/lib/components/jquery-syntax/source/jquery.syntax.brush.nginx.js +30 -0
  148. data/lib/components/jquery-syntax/source/jquery.syntax.brush.ocaml.js +73 -0
  149. data/lib/components/jquery-syntax/source/jquery.syntax.brush.ooc.js +46 -0
  150. data/lib/components/jquery-syntax/source/jquery.syntax.brush.pascal.js +51 -0
  151. data/lib/components/jquery-syntax/source/jquery.syntax.brush.perl5.js +52 -0
  152. data/lib/components/jquery-syntax/source/jquery.syntax.brush.php-script.js +48 -0
  153. data/lib/components/jquery-syntax/source/jquery.syntax.brush.php.js +15 -0
  154. data/lib/components/jquery-syntax/source/jquery.syntax.brush.plain.js +10 -0
  155. data/lib/components/jquery-syntax/source/jquery.syntax.brush.protobuf.js +43 -0
  156. data/lib/components/jquery-syntax/source/jquery.syntax.brush.python.js +44 -0
  157. data/lib/components/jquery-syntax/source/jquery.syntax.brush.ruby.js +77 -0
  158. data/lib/components/jquery-syntax/source/jquery.syntax.brush.scala.js +44 -0
  159. data/lib/components/jquery-syntax/source/jquery.syntax.brush.smalltalk.js +29 -0
  160. data/lib/components/jquery-syntax/source/jquery.syntax.brush.sql.js +31 -0
  161. data/lib/components/jquery-syntax/source/jquery.syntax.brush.super-collider.js +57 -0
  162. data/lib/components/jquery-syntax/source/jquery.syntax.brush.swift.js +55 -0
  163. data/lib/components/jquery-syntax/source/jquery.syntax.brush.trenni.js +35 -0
  164. data/lib/components/jquery-syntax/source/jquery.syntax.brush.xml.js +50 -0
  165. data/lib/components/jquery-syntax/source/jquery.syntax.brush.yaml.js +29 -0
  166. data/lib/components/jquery-syntax/source/jquery.syntax.core.js +1114 -0
  167. data/lib/components/jquery-syntax/source/jquery.syntax.editor.js +291 -0
  168. data/lib/components/jquery-syntax/source/jquery.syntax.js +258 -0
  169. data/lib/components/jquery-syntax/themes/base/jquery.syntax.brush.apache.sass +23 -0
  170. data/lib/components/jquery-syntax/themes/base/jquery.syntax.brush.applescript.sass +11 -0
  171. data/lib/components/jquery-syntax/themes/base/jquery.syntax.brush.assembly.sass +16 -0
  172. data/lib/components/jquery-syntax/themes/base/jquery.syntax.brush.bash-script.sass +14 -0
  173. data/lib/components/jquery-syntax/themes/base/jquery.syntax.brush.bash.sass +11 -0
  174. data/lib/components/jquery-syntax/themes/base/jquery.syntax.brush.clang.sass +12 -0
  175. data/lib/components/jquery-syntax/themes/base/jquery.syntax.brush.css.sass +25 -0
  176. data/lib/components/jquery-syntax/themes/base/jquery.syntax.brush.diff.sass +25 -0
  177. data/lib/components/jquery-syntax/themes/base/jquery.syntax.brush.html.sass +12 -0
  178. data/lib/components/jquery-syntax/themes/base/jquery.syntax.brush.ocaml.sass +8 -0
  179. data/lib/components/jquery-syntax/themes/base/jquery.syntax.brush.protobuf.sass +7 -0
  180. data/lib/components/jquery-syntax/themes/base/jquery.syntax.brush.python.sass +12 -0
  181. data/lib/components/jquery-syntax/themes/base/jquery.syntax.brush.ruby.sass +9 -0
  182. data/lib/components/jquery-syntax/themes/base/jquery.syntax.brush.xml.sass +30 -0
  183. data/lib/components/jquery-syntax/themes/base/jquery.syntax.core.sass +86 -0
  184. data/lib/components/jquery-syntax/themes/base/jquery.syntax.editor.sass +12 -0
  185. data/lib/components/jquery-syntax/themes/bright/_config.yaml +2 -0
  186. data/lib/components/jquery-syntax/themes/bright/jquery.syntax.core.sass +42 -0
  187. data/lib/components/jquery-syntax/themes/paper/_config.yaml +2 -0
  188. data/lib/components/jquery-syntax/themes/paper/jquery.syntax.core.sass +47 -0
  189. data/lib/components/jquery/AUTHORS.txt +327 -0
  190. data/lib/components/jquery/LICENSE.txt +20 -0
  191. data/lib/components/jquery/README.md +62 -0
  192. data/lib/components/jquery/bower.json +14 -0
  193. data/lib/components/jquery/dist/jquery.js +10872 -0
  194. data/lib/components/jquery/dist/jquery.min.js +2 -0
  195. data/lib/components/jquery/dist/jquery.min.map +1 -0
  196. data/lib/components/jquery/dist/jquery.slim.js +8777 -0
  197. data/lib/components/jquery/dist/jquery.slim.min.js +2 -0
  198. data/lib/components/jquery/dist/jquery.slim.min.map +1 -0
  199. data/lib/components/jquery/external/sizzle/LICENSE.txt +36 -0
  200. data/lib/components/jquery/external/sizzle/dist/sizzle.js +2478 -0
  201. data/lib/components/jquery/external/sizzle/dist/sizzle.min.js +3 -0
  202. data/lib/components/jquery/external/sizzle/dist/sizzle.min.map +1 -0
  203. data/lib/components/jquery/package.json +117 -0
  204. data/lib/components/jquery/src/ajax.js +873 -0
  205. data/lib/components/jquery/src/ajax/jsonp.js +103 -0
  206. data/lib/components/jquery/src/ajax/load.js +77 -0
  207. data/lib/components/jquery/src/ajax/script.js +74 -0
  208. data/lib/components/jquery/src/ajax/var/location.js +5 -0
  209. data/lib/components/jquery/src/ajax/var/nonce.js +5 -0
  210. data/lib/components/jquery/src/ajax/var/rquery.js +5 -0
  211. data/lib/components/jquery/src/ajax/xhr.js +170 -0
  212. data/lib/components/jquery/src/attributes.js +13 -0
  213. data/lib/components/jquery/src/attributes/attr.js +141 -0
  214. data/lib/components/jquery/src/attributes/classes.js +186 -0
  215. data/lib/components/jquery/src/attributes/prop.js +143 -0
  216. data/lib/components/jquery/src/attributes/support.js +33 -0
  217. data/lib/components/jquery/src/attributes/val.js +191 -0
  218. data/lib/components/jquery/src/callbacks.js +236 -0
  219. data/lib/components/jquery/src/core.js +400 -0
  220. data/lib/components/jquery/src/core/DOMEval.js +43 -0
  221. data/lib/components/jquery/src/core/access.js +72 -0
  222. data/lib/components/jquery/src/core/camelCase.js +23 -0
  223. data/lib/components/jquery/src/core/init.js +129 -0
  224. data/lib/components/jquery/src/core/isAttached.js +26 -0
  225. data/lib/components/jquery/src/core/nodeName.js +13 -0
  226. data/lib/components/jquery/src/core/parseHTML.js +65 -0
  227. data/lib/components/jquery/src/core/parseXML.js +30 -0
  228. data/lib/components/jquery/src/core/ready-no-deferred.js +97 -0
  229. data/lib/components/jquery/src/core/ready.js +86 -0
  230. data/lib/components/jquery/src/core/readyException.js +13 -0
  231. data/lib/components/jquery/src/core/stripAndCollapse.js +14 -0
  232. data/lib/components/jquery/src/core/support.js +20 -0
  233. data/lib/components/jquery/src/core/toType.js +20 -0
  234. data/lib/components/jquery/src/core/var/rsingleTag.js +7 -0
  235. data/lib/components/jquery/src/css.js +494 -0
  236. data/lib/components/jquery/src/css/addGetHookIf.js +26 -0
  237. data/lib/components/jquery/src/css/adjustCSS.js +74 -0
  238. data/lib/components/jquery/src/css/curCSS.js +65 -0
  239. data/lib/components/jquery/src/css/finalPropName.js +42 -0
  240. data/lib/components/jquery/src/css/hiddenVisibleSelectors.js +15 -0
  241. data/lib/components/jquery/src/css/showHide.js +105 -0
  242. data/lib/components/jquery/src/css/support.js +133 -0
  243. data/lib/components/jquery/src/css/var/cssExpand.js +5 -0
  244. data/lib/components/jquery/src/css/var/getStyles.js +17 -0
  245. data/lib/components/jquery/src/css/var/isHiddenWithinTree.js +34 -0
  246. data/lib/components/jquery/src/css/var/rboxStyle.js +7 -0
  247. data/lib/components/jquery/src/css/var/rnumnonpx.js +7 -0
  248. data/lib/components/jquery/src/css/var/swap.js +26 -0
  249. data/lib/components/jquery/src/data.js +180 -0
  250. data/lib/components/jquery/src/data/Data.js +162 -0
  251. data/lib/components/jquery/src/data/var/acceptData.js +19 -0
  252. data/lib/components/jquery/src/data/var/dataPriv.js +7 -0
  253. data/lib/components/jquery/src/data/var/dataUser.js +7 -0
  254. data/lib/components/jquery/src/deferred.js +399 -0
  255. data/lib/components/jquery/src/deferred/exceptionHook.js +21 -0
  256. data/lib/components/jquery/src/deprecated.js +87 -0
  257. data/lib/components/jquery/src/deprecated/ajax-event-alias.js +22 -0
  258. data/lib/components/jquery/src/deprecated/event.js +48 -0
  259. data/lib/components/jquery/src/dimensions.js +57 -0
  260. data/lib/components/jquery/src/effects.js +701 -0
  261. data/lib/components/jquery/src/effects/Tween.js +125 -0
  262. data/lib/components/jquery/src/effects/animatedSelector.js +15 -0
  263. data/lib/components/jquery/src/event.js +892 -0
  264. data/lib/components/jquery/src/event/focusin.js +58 -0
  265. data/lib/components/jquery/src/event/support.js +11 -0
  266. data/lib/components/jquery/src/event/trigger.js +201 -0
  267. data/lib/components/jquery/src/exports/amd.js +26 -0
  268. data/lib/components/jquery/src/exports/global.js +34 -0
  269. data/lib/components/jquery/src/jquery.js +41 -0
  270. data/lib/components/jquery/src/manipulation.js +480 -0
  271. data/lib/components/jquery/src/manipulation/_evalUrl.js +32 -0
  272. data/lib/components/jquery/src/manipulation/buildFragment.js +106 -0
  273. data/lib/components/jquery/src/manipulation/getAll.js +32 -0
  274. data/lib/components/jquery/src/manipulation/setGlobalEval.js +22 -0
  275. data/lib/components/jquery/src/manipulation/support.js +41 -0
  276. data/lib/components/jquery/src/manipulation/var/rscriptType.js +5 -0
  277. data/lib/components/jquery/src/manipulation/var/rtagName.js +8 -0
  278. data/lib/components/jquery/src/manipulation/wrapMap.js +30 -0
  279. data/lib/components/jquery/src/offset.js +238 -0
  280. data/lib/components/jquery/src/queue.js +145 -0
  281. data/lib/components/jquery/src/queue/delay.js +24 -0
  282. data/lib/components/jquery/src/selector-native.js +241 -0
  283. data/lib/components/jquery/src/selector-sizzle.js +19 -0
  284. data/lib/components/jquery/src/selector.js +3 -0
  285. data/lib/components/jquery/src/serialize.js +136 -0
  286. data/lib/components/jquery/src/traversing.js +198 -0
  287. data/lib/components/jquery/src/traversing/findFilter.js +97 -0
  288. data/lib/components/jquery/src/traversing/var/dir.js +22 -0
  289. data/lib/components/jquery/src/traversing/var/rneedsContext.js +8 -0
  290. data/lib/components/jquery/src/traversing/var/siblings.js +17 -0
  291. data/lib/components/jquery/src/var/ObjectFunctionString.js +7 -0
  292. data/lib/components/jquery/src/var/arr.js +5 -0
  293. data/lib/components/jquery/src/var/class2type.js +6 -0
  294. data/lib/components/jquery/src/var/document.js +5 -0
  295. data/lib/components/jquery/src/var/documentElement.js +7 -0
  296. data/lib/components/jquery/src/var/flat.js +16 -0
  297. data/lib/components/jquery/src/var/fnToString.js +7 -0
  298. data/lib/components/jquery/src/var/getProto.js +5 -0
  299. data/lib/components/jquery/src/var/hasOwn.js +7 -0
  300. data/lib/components/jquery/src/var/indexOf.js +7 -0
  301. data/lib/components/jquery/src/var/isFunction.js +13 -0
  302. data/lib/components/jquery/src/var/isWindow.js +8 -0
  303. data/lib/components/jquery/src/var/pnum.js +5 -0
  304. data/lib/components/jquery/src/var/push.js +7 -0
  305. data/lib/components/jquery/src/var/rcheckableType.js +5 -0
  306. data/lib/components/jquery/src/var/rcssNum.js +9 -0
  307. data/lib/components/jquery/src/var/rnothtmlwhite.js +8 -0
  308. data/lib/components/jquery/src/var/slice.js +7 -0
  309. data/lib/components/jquery/src/var/support.js +6 -0
  310. data/lib/components/jquery/src/var/toString.js +7 -0
  311. data/lib/components/jquery/src/wrap.js +78 -0
  312. data/lib/utopia/wiki.rb +80 -0
  313. data/lib/utopia/wiki/version.rb +27 -0
  314. data/package.json +6 -0
  315. data/pages/_editor.xnode +21 -0
  316. data/pages/_heading.xnode +2 -0
  317. data/pages/_listing.xnode +23 -0
  318. data/pages/_navigation.xnode +33 -0
  319. data/pages/_page.xnode +32 -0
  320. data/pages/_thumbnail.xnode +8 -0
  321. data/pages/controller.rb +77 -0
  322. data/pages/create.xnode +15 -0
  323. data/pages/edit.xnode +10 -0
  324. data/pages/errors/exception.xnode +5 -0
  325. data/pages/errors/file-not-found.xnode +5 -0
  326. data/pages/links.yaml +2 -0
  327. data/pages/show.xnode +15 -0
  328. data/public/.nojekyll +0 -0
  329. data/public/_components/jquery-litebox/jquery.litebox.css +23 -0
  330. data/public/_components/jquery-litebox/jquery.litebox.gallery.css +48 -0
  331. data/public/_components/jquery-litebox/jquery.litebox.js +30 -0
  332. data/public/_components/jquery-syntax/base/jquery.syntax.brush.apache.css +12 -0
  333. data/public/_components/jquery-syntax/base/jquery.syntax.brush.applescript.css +5 -0
  334. data/public/_components/jquery-syntax/base/jquery.syntax.brush.assembly.css +8 -0
  335. data/public/_components/jquery-syntax/base/jquery.syntax.brush.bash-script.css +6 -0
  336. data/public/_components/jquery-syntax/base/jquery.syntax.brush.bash.css +4 -0
  337. data/public/_components/jquery-syntax/base/jquery.syntax.brush.clang.css +6 -0
  338. data/public/_components/jquery-syntax/base/jquery.syntax.brush.css.css +14 -0
  339. data/public/_components/jquery-syntax/base/jquery.syntax.brush.diff.css +16 -0
  340. data/public/_components/jquery-syntax/base/jquery.syntax.brush.html.css +5 -0
  341. data/public/_components/jquery-syntax/base/jquery.syntax.brush.ocaml.css +3 -0
  342. data/public/_components/jquery-syntax/base/jquery.syntax.brush.protobuf.css +2 -0
  343. data/public/_components/jquery-syntax/base/jquery.syntax.brush.python.css +6 -0
  344. data/public/_components/jquery-syntax/base/jquery.syntax.brush.ruby.css +2 -0
  345. data/public/_components/jquery-syntax/base/jquery.syntax.brush.xml.css +18 -0
  346. data/public/_components/jquery-syntax/base/jquery.syntax.core.css +58 -0
  347. data/public/_components/jquery-syntax/base/jquery.syntax.editor.css +6 -0
  348. data/public/_components/jquery-syntax/base/theme.js +1 -0
  349. data/public/_components/jquery-syntax/bright/jquery.syntax.core.css +27 -0
  350. data/public/_components/jquery-syntax/bright/theme.js +1 -0
  351. data/public/_components/jquery-syntax/jquery.syntax.brush.apache.js +3 -0
  352. data/public/_components/jquery-syntax/jquery.syntax.brush.applescript.js +5 -0
  353. data/public/_components/jquery-syntax/jquery.syntax.brush.assembly.js +3 -0
  354. data/public/_components/jquery-syntax/jquery.syntax.brush.bash-script.js +4 -0
  355. data/public/_components/jquery-syntax/jquery.syntax.brush.bash.js +2 -0
  356. data/public/_components/jquery-syntax/jquery.syntax.brush.basic.js +5 -0
  357. data/public/_components/jquery-syntax/jquery.syntax.brush.clang.js +5 -0
  358. data/public/_components/jquery-syntax/jquery.syntax.brush.csharp.js +4 -0
  359. data/public/_components/jquery-syntax/jquery.syntax.brush.css.js +5 -0
  360. data/public/_components/jquery-syntax/jquery.syntax.brush.diff.js +2 -0
  361. data/public/_components/jquery-syntax/jquery.syntax.brush.go.js +3 -0
  362. data/public/_components/jquery-syntax/jquery.syntax.brush.haskell.js +3 -0
  363. data/public/_components/jquery-syntax/jquery.syntax.brush.html.js +4 -0
  364. data/public/_components/jquery-syntax/jquery.syntax.brush.io.js +3 -0
  365. data/public/_components/jquery-syntax/jquery.syntax.brush.java.js +4 -0
  366. data/public/_components/jquery-syntax/jquery.syntax.brush.javascript.js +3 -0
  367. data/public/_components/jquery-syntax/jquery.syntax.brush.kai.js +2 -0
  368. data/public/_components/jquery-syntax/jquery.syntax.brush.lisp.js +2 -0
  369. data/public/_components/jquery-syntax/jquery.syntax.brush.lua.js +3 -0
  370. data/public/_components/jquery-syntax/jquery.syntax.brush.nginx.js +2 -0
  371. data/public/_components/jquery-syntax/jquery.syntax.brush.ocaml.js +4 -0
  372. data/public/_components/jquery-syntax/jquery.syntax.brush.ooc.js +4 -0
  373. data/public/_components/jquery-syntax/jquery.syntax.brush.pascal.js +4 -0
  374. data/public/_components/jquery-syntax/jquery.syntax.brush.perl5.js +3 -0
  375. data/public/_components/jquery-syntax/jquery.syntax.brush.php-script.js +4 -0
  376. data/public/_components/jquery-syntax/jquery.syntax.brush.php.js +2 -0
  377. data/public/_components/jquery-syntax/jquery.syntax.brush.plain.js +2 -0
  378. data/public/_components/jquery-syntax/jquery.syntax.brush.protobuf.js +3 -0
  379. data/public/_components/jquery-syntax/jquery.syntax.brush.python.js +5 -0
  380. data/public/_components/jquery-syntax/jquery.syntax.brush.ruby.js +5 -0
  381. data/public/_components/jquery-syntax/jquery.syntax.brush.scala.js +4 -0
  382. data/public/_components/jquery-syntax/jquery.syntax.brush.smalltalk.js +2 -0
  383. data/public/_components/jquery-syntax/jquery.syntax.brush.sql.js +4 -0
  384. data/public/_components/jquery-syntax/jquery.syntax.brush.super-collider.js +3 -0
  385. data/public/_components/jquery-syntax/jquery.syntax.brush.swift.js +3 -0
  386. data/public/_components/jquery-syntax/jquery.syntax.brush.trenni.js +2 -0
  387. data/public/_components/jquery-syntax/jquery.syntax.brush.xml.js +4 -0
  388. data/public/_components/jquery-syntax/jquery.syntax.brush.yaml.js +2 -0
  389. data/public/_components/jquery-syntax/jquery.syntax.cache.js +7 -0
  390. data/public/_components/jquery-syntax/jquery.syntax.core.js +34 -0
  391. data/public/_components/jquery-syntax/jquery.syntax.editor.js +11 -0
  392. data/public/_components/jquery-syntax/jquery.syntax.js +8 -0
  393. data/public/_components/jquery-syntax/jquery.syntax.min.js +13 -0
  394. data/public/_components/jquery-syntax/paper/jquery.syntax.core.css +31 -0
  395. data/public/_components/jquery-syntax/paper/theme.js +1 -0
  396. data/public/_components/jquery/jquery.js +10872 -0
  397. data/public/_components/jquery/jquery.min.js +2 -0
  398. data/public/_components/jquery/jquery.min.map +1 -0
  399. data/public/_components/jquery/jquery.slim.js +8777 -0
  400. data/public/_components/jquery/jquery.slim.min.js +2 -0
  401. data/public/_components/jquery/jquery.slim.min.map +1 -0
  402. data/public/_static/icon.png +0 -0
  403. data/public/_static/site.css +191 -0
  404. data/utopia-wiki.gemspec +39 -0
  405. data/wiki/Gemfile +10 -0
  406. data/wiki/config.ru +7 -0
  407. data/wiki/pages/_logos/Async.png +0 -0
  408. data/wiki/pages/_logos/Falcon.png +0 -0
  409. data/wiki/pages/_logos/Utopia.png +0 -0
  410. data/wiki/pages/index.en.md +62 -0
  411. data/wiki/pages/index.md +57 -0
  412. data/wiki/pages/links.yaml +2 -0
  413. data/wiki/pages/usage/merging/index.md +3 -0
  414. data/yarn.lock +22 -0
  415. metadata +675 -0
@@ -0,0 +1,44 @@
1
+ // brush: "scala" aliases: []
2
+
3
+ // This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License.
4
+ // Copyright (c) 2011 Samuel G. D. Williams. <http://www.oriontransfer.co.nz>
5
+ // See <jquery.syntax.js> for licensing details.
6
+
7
+ Syntax.brushes.dependency('scala', 'xml');
8
+
9
+ Syntax.register('scala', function(brush) {
10
+ var keywords = ["abstract", "do", "finally", "import", "object", "return", "trait", "var", "case", "catch", "class", "else", "extends", "for", "forSome", "if", "lazy", "match", "new", "override", "package", "private", "sealed", "super", "try", "type", "while", "with", "yield", "def", "final", "implicit", "protected", "throw", "val"];
11
+ brush.push(keywords, {klass: 'keyword'});
12
+
13
+ var operators = ["_", ":", "=", "=>", "<-", "<:", "<%", ">:", "#", "@"];
14
+ brush.push(operators, {klass: 'operator'});
15
+
16
+ var constants = ["this", "null", "true", "false"];
17
+ brush.push(constants, {klass: 'constant'});
18
+
19
+ // Strings
20
+ brush.push({
21
+ pattern: /"""[\s\S]*?"""/g,
22
+ klass: 'string'
23
+ });
24
+
25
+ brush.push(Syntax.lib.doubleQuotedString);
26
+
27
+ // Functions
28
+ brush.push({
29
+ pattern: /(?:def\s+|\.)([a-z_][a-z0-9_]+)/gi,
30
+ matches: Syntax.extractMatches({klass: 'function'})
31
+ });
32
+
33
+ brush.push(Syntax.lib.camelCaseType);
34
+
35
+ // Types
36
+ brush.push(Syntax.lib.cStyleFunction);
37
+
38
+ // Comments
39
+ brush.push(Syntax.lib.cStyleComment);
40
+ brush.push(Syntax.lib.cppStyleComment);
41
+
42
+ brush.derives('xml');
43
+ });
44
+
@@ -0,0 +1,29 @@
1
+ // brush: "smalltalk" aliases: []
2
+
3
+ // This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License.
4
+ // Copyright (c) 2011 Samuel G. D. Williams. <http://www.oriontransfer.co.nz>
5
+ // See <jquery.syntax.js> for licensing details.
6
+
7
+ Syntax.register('smalltalk', function(brush) {
8
+ var operators = ["[", "]", "|", ":=", "."];
9
+
10
+ var values = ["self", "super", "true", "false", "nil"];
11
+
12
+ brush.push(values, {klass: 'constant'});
13
+ brush.push(operators, {klass: 'operator'});
14
+
15
+ // Objective-C style functions
16
+ brush.push({pattern: /\w+:/g, klass: 'function'});
17
+
18
+ // Camelcase Types
19
+ brush.push(Syntax.lib.camelCaseType);
20
+
21
+ // Strings
22
+ brush.push(Syntax.lib.singleQuotedString);
23
+ brush.push(Syntax.lib.doubleQuotedString);
24
+ brush.push(Syntax.lib.stringEscape);
25
+
26
+ // Numbers
27
+ brush.push(Syntax.lib.decimalNumber);
28
+ brush.push(Syntax.lib.hexNumber);
29
+ });
@@ -0,0 +1,31 @@
1
+ // brush: "sql" aliases: []
2
+
3
+ // This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License.
4
+ // Copyright (c) 2011 Samuel G. D. Williams. <http://www.oriontransfer.co.nz>
5
+ // See <jquery.syntax.js> for licensing details.
6
+
7
+ Syntax.lib.sqlStyleComment = {pattern: /-- .*$/gm, klass: 'comment', allow: ['href']};
8
+
9
+ Syntax.register('sql', function(brush) {
10
+ var keywords = ["A", "ABORT", "ABS", "ABSOLUTE", "ACCESS", "ACTION", "ADA", "ADD", "ADMIN", "AFTER", "AGGREGATE", "ALIAS", "ALL", "ALLOCATE", "ALSO", "ALTER", "ALWAYS", "ANALYSE", "ANALYZE", "AND", "ANY", "ARE", "ARRAY", "AS", "ASC", "ASENSITIVE", "ASSERTION", "ASSIGNMENT", "ASYMMETRIC", "AT", "ATOMIC", "ATTRIBUTE", "ATTRIBUTES", "AUDIT", "AUTHORIZATION", "AUTO_INCREMENT", "AVG", "AVG_ROW_LENGTH", "BACKUP", "BACKWARD", "BEFORE", "BEGIN", "BERNOULLI", "BETWEEN", "BIGINT", "BINARY", "BIT", "BIT_LENGTH", "BITVAR", "BLOB", "BOOL", "BOOLEAN", "BOTH", "BREADTH", "BREAK", "BROWSE", "BULK", "BY", "C", "CACHE", "CALL", "CALLED", "CARDINALITY", "CASCADE", "CASCADED", "CASE", "CAST", "CATALOG", "CATALOG_NAME", "CEIL", "CEILING", "CHAIN", "CHANGE", "CHAR", "CHAR_LENGTH", "CHARACTER", "CHARACTER_LENGTH", "CHARACTER_SET_CATALOG", "CHARACTER_SET_NAME", "CHARACTER_SET_SCHEMA", "CHARACTERISTICS", "CHARACTERS", "CHECK", "CHECKED", "CHECKPOINT", "CHECKSUM", "CLASS", "CLASS_ORIGIN", "CLOB", "CLOSE", "CLUSTER", "CLUSTERED", "COALESCE", "COBOL", "COLLATE", "COLLATION", "COLLATION_CATALOG", "COLLATION_NAME", "COLLATION_SCHEMA", "COLLECT", "COLUMN", "COLUMN_NAME", "COLUMNS", "COMMAND_FUNCTION", "COMMAND_FUNCTION_CODE", "COMMENT", "COMMIT", "COMMITTED", "COMPLETION", "COMPRESS", "COMPUTE", "CONDITION", "CONDITION_NUMBER", "CONNECT", "CONNECTION", "CONNECTION_NAME", "CONSTRAINT", "CONSTRAINT_CATALOG", "CONSTRAINT_NAME", "CONSTRAINT_SCHEMA", "CONSTRAINTS", "CONSTRUCTOR", "CONTAINS", "CONTAINSTABLE", "CONTINUE", "CONVERSION", "CONVERT", "COPY", "CORR", "CORRESPONDING", "COUNT", "COVAR_POP", "COVAR_SAMP", "CREATE", "CREATEDB", "CREATEROLE", "CREATEUSER", "CROSS", "CSV", "CUBE", "CUME_DIST", "CURRENT", "CURRENT_DATE", "CURRENT_DEFAULT_TRANSFORM_GROUP", "CURRENT_PATH", "CURRENT_ROLE", "CURRENT_TIME", "CURRENT_TIMESTAMP", "CURRENT_TRANSFORM_GROUP_FOR_TYPE", "CURRENT_USER", "CURSOR", "CURSOR_NAME", "CYCLE", "DATA", "DATABASE", "DATABASES", "DATE", "DATETIME", "DATETIME_INTERVAL_CODE", "DATETIME_INTERVAL_PRECISION", "DAY", "DAY_HOUR", "DAY_MICROSECOND", "DAY_MINUTE", "DAY_SECOND", "DAYOFMONTH", "DAYOFWEEK", "DAYOFYEAR", "DBCC", "DEALLOCATE", "DEC", "DECIMAL", "DECLARE", "DEFAULT", "DEFAULTS", "DEFERRABLE", "DEFERRED", "DEFINED", "DEFINER", "DEGREE", "DELAY_KEY_WRITE", "DELAYED", "DELETE", "DELIMITER", "DELIMITERS", "DENSE_RANK", "DENY", "DEPTH", "DEREF", "DERIVED", "DESC", "DESCRIBE", "DESCRIPTOR", "DESTROY", "DESTRUCTOR", "DETERMINISTIC", "DIAGNOSTICS", "DICTIONARY", "DISABLE", "DISCONNECT", "DISK", "DISPATCH", "DISTINCT", "DISTINCTROW", "DISTRIBUTED", "DIV", "DO", "DOMAIN", "DOUBLE", "DROP", "DUAL", "DUMMY", "DUMP", "DYNAMIC", "DYNAMIC_FUNCTION", "DYNAMIC_FUNCTION_CODE", "EACH", "ELEMENT", "ELSE", "ELSEIF", "ENABLE", "ENCLOSED", "ENCODING", "ENCRYPTED", "END", "END-EXEC", "ENUM", "EQUALS", "ERRLVL", "ESCAPE", "ESCAPED", "EVERY", "EXCEPT", "EXCEPTION", "EXCLUDE", "EXCLUDING", "EXCLUSIVE", "EXEC", "EXECUTE", "EXISTING", "EXISTS", "EXIT", "EXP", "EXPLAIN", "EXTERNAL", "EXTRACT", "FALSE", "FETCH", "FIELDS", "FILE", "FILLFACTOR", "FILTER", "FINAL", "FIRST", "FLOAT", "FLOAT4", "FLOAT8", "FLOOR", "FLUSH", "FOLLOWING", "FOR", "FORCE", "FOREIGN", "FORTRAN", "FORWARD", "FOUND", "FREE", "FREETEXT", "FREETEXTTABLE", "FREEZE", "FROM", "FULL", "FULLTEXT", "FUNCTION", "FUSION", "G", "GENERAL", "GENERATED", "GET", "GLOBAL", "GO", "GOTO", "GRANT", "GRANTED", "GRANTS", "GREATEST", "GROUP", "GROUPING", "HANDLER", "HAVING", "HEADER", "HEAP", "HIERARCHY", "HIGH_PRIORITY", "HOLD", "HOLDLOCK", "HOST", "HOSTS", "HOUR", "HOUR_MICROSECOND", "HOUR_MINUTE", "HOUR_SECOND", "IDENTIFIED", "IDENTITY", "IDENTITY_INSERT", "IDENTITYCOL", "IF", "IGNORE", "ILIKE", "IMMEDIATE", "IMMUTABLE", "IMPLEMENTATION", "IMPLICIT", "IN", "INCLUDE", "INCLUDING", "INCREMENT", "INDEX", "INDICATOR", "INFILE", "INFIX", "INHERIT", "INHERITS", "INITIAL", "INITIALIZE", "INITIALLY", "INNER", "INOUT", "INPUT", "INSENSITIVE", "INSERT", "INSERT_ID", "INSTANCE", "INSTANTIABLE", "INSTEAD", "INT", "INT1", "INT2", "INT3", "INT4", "INT8", "INTEGER", "INTERSECT", "INTERSECTION", "INTERVAL", "INTO", "INVOKER", "IS", "ISAM", "ISNULL", "ISOLATION", "ITERATE", "JOIN", "K", "KEY", "KEY_MEMBER", "KEY_TYPE", "KEYS", "KILL", "LANCOMPILER", "LANGUAGE", "LARGE", "LAST", "LAST_INSERT_ID", "LATERAL", "LEADING", "LEAST", "LEAVE", "LEFT", "LENGTH", "LESS", "LEVEL", "LIKE", "LIMIT", "LINENO", "LINES", "LISTEN", "LN", "LOAD", "LOCAL", "LOCALTIME", "LOCALTIMESTAMP", "LOCATION", "LOCATOR", "LOCK", "LOGIN", "LOGS", "LONG", "LONGBLOB", "LONGTEXT", "LOOP", "LOW_PRIORITY", "LOWER", "M", "MAP", "MATCH", "MATCHED", "MAX", "MAX_ROWS", "MAXEXTENTS", "MAXVALUE", "MEDIUMBLOB", "MEDIUMINT", "MEDIUMTEXT", "MEMBER", "MERGE", "MESSAGE_LENGTH", "MESSAGE_OCTET_LENGTH", "MESSAGE_TEXT", "METHOD", "MIDDLEINT", "MIN", "MIN_ROWS", "MINUS", "MINUTE", "MINUTE_MICROSECOND", "MINUTE_SECOND", "MINVALUE", "MLSLABEL", "MOD", "MODE", "MODIFIES", "MODIFY", "MODULE", "MONTH", "MONTHNAME", "MORE", "MOVE", "MULTISET", "MUMPS", "MYISAM", "NAMES", "NATIONAL", "NATURAL", "NCHAR", "NCLOB", "NESTING", "NEW", "NEXT", "NO", "NO_WRITE_TO_BINLOG", "NOAUDIT", "NOCHECK", "NOCOMPRESS", "NOCREATEDB", "NOCREATEROLE", "NOCREATEUSER", "NOINHERIT", "NOLOGIN", "NONCLUSTERED", "NONE", "NORMALIZE", "NORMALIZED", "NOSUPERUSER", "NOT", "NOTHING", "NOTIFY", "NOTNULL", "NOWAIT", "NULL", "NULLABLE", "NULLIF", "NULLS", "NUMBER", "NUMERIC", "OBJECT", "OCTET_LENGTH", "OCTETS", "OF", "OFF", "OFFLINE", "OFFSET", "OFFSETS", "OIDS", "OLD", "ON", "ONLINE", "ONLY", "OPEN", "OPENDATASOURCE", "OPENQUERY", "OPENROWSET", "OPENXML", "OPERATION", "OPERATOR", "OPTIMIZE", "OPTION", "OPTIONALLY", "OPTIONS", "OR", "ORDER", "ORDERING", "ORDINALITY", "OTHERS", "OUT", "OUTER", "OUTFILE", "OUTPUT", "OVER", "OVERLAPS", "OVERLAY", "OVERRIDING", "OWNER", "PACK_KEYS", "PAD", "PARAMETER", "PARAMETER_MODE", "PARAMETER_NAME", "PARAMETER_ORDINAL_POSITION", "PARAMETER_SPECIFIC_CATALOG", "PARAMETER_SPECIFIC_NAME", "PARAMETER_SPECIFIC_SCHEMA", "PARAMETERS", "PARTIAL", "PARTITION", "PASCAL", "PASSWORD", "PATH", "PCTFREE", "PERCENT", "PERCENT_RANK", "PERCENTILE_CONT", "PERCENTILE_DISC", "PLACING", "PLAN", "PLI", "POSITION", "POSTFIX", "POWER", "PRECEDING", "PRECISION", "PREFIX", "PREORDER", "PREPARE", "PREPARED", "PRESERVE", "PRIMARY", "PRINT", "PRIOR", "PRIVILEGES", "PROC", "PROCEDURAL", "PROCEDURE", "PROCESS", "PROCESSLIST", "PUBLIC", "PURGE", "QUOTE", "RAID0", "RAISERROR", "RANGE", "RANK", "RAW", "READ", "READS", "READTEXT", "REAL", "RECHECK", "RECONFIGURE", "RECURSIVE", "REF", "REFERENCES", "REFERENCING", "REGEXP", "REGR_AVGX", "REGR_AVGY", "REGR_COUNT", "REGR_INTERCEPT", "REGR_R2", "REGR_SLOPE", "REGR_SXX", "REGR_SXY", "REGR_SYY", "REINDEX", "RELATIVE", "RELEASE", "RELOAD", "RENAME", "REPEAT", "REPEATABLE", "REPLACE", "REPLICATION", "REQUIRE", "RESET", "RESIGNAL", "RESOURCE", "RESTART", "RESTORE", "RESTRICT", "RESULT", "RETURN", "RETURNED_CARDINALITY", "RETURNED_LENGTH", "RETURNED_OCTET_LENGTH", "RETURNED_SQLSTATE", "RETURNS", "REVOKE", "RIGHT", "RLIKE", "ROLE", "ROLLBACK", "ROLLUP", "ROUTINE", "ROUTINE_CATALOG", "ROUTINE_NAME", "ROUTINE_SCHEMA", "ROW", "ROW_COUNT", "ROW_NUMBER", "ROWCOUNT", "ROWGUIDCOL", "ROWID", "ROWNUM", "ROWS", "RULE", "SAVE", "SAVEPOINT", "SCALE", "SCHEMA", "SCHEMA_NAME", "SCHEMAS", "SCOPE", "SCOPE_CATALOG", "SCOPE_NAME", "SCOPE_SCHEMA", "SCROLL", "SEARCH", "SECOND", "SECOND_MICROSECOND", "SECTION", "SECURITY", "SELECT", "SELF", "SENSITIVE", "SEPARATOR", "SEQUENCE", "SERIALIZABLE", "SERVER_NAME", "SESSION", "SESSION_USER", "SET", "SETOF", "SETS", "SETUSER", "SHARE", "SHOW", "SHUTDOWN", "SIGNAL", "SIMILAR", "SIMPLE", "SIZE", "SMALLINT", "SOME", "SONAME", "SOURCE", "SPACE", "SPATIAL", "SPECIFIC", "SPECIFIC_NAME", "SPECIFICTYPE", "SQL", "SQL_BIG_RESULT", "SQL_BIG_SELECTS", "SQL_BIG_TABLES", "SQL_CALC_FOUND_ROWS", "SQL_LOG_OFF", "SQL_LOG_UPDATE", "SQL_LOW_PRIORITY_UPDATES", "SQL_SELECT_LIMIT", "SQL_SMALL_RESULT", "SQL_WARNINGS", "SQLCA", "SQLCODE", "SQLERROR", "SQLEXCEPTION", "SQLSTATE", "SQLWARNING", "SQRT", "SSL", "STABLE", "START", "STARTING", "STATE", "STATEMENT", "STATIC", "STATISTICS", "STATUS", "STDDEV_POP", "STDDEV_SAMP", "STDIN", "STDOUT", "STORAGE", "STRAIGHT_JOIN", "STRICT", "STRING", "STRUCTURE", "STYLE", "SUBCLASS_ORIGIN", "SUBLIST", "SUBMULTISET", "SUBSTRING", "SUCCESSFUL", "SUM", "SUPERUSER", "SYMMETRIC", "SYNONYM", "SYSDATE", "SYSID", "SYSTEM", "SYSTEM_USER", "TABLE", "TABLE_NAME", "TABLES", "TABLESAMPLE", "TABLESPACE", "TEMP", "TEMPLATE", "TEMPORARY", "TERMINATE", "TERMINATED", "TEXT", "TEXTSIZE", "THAN", "THEN", "TIES", "TIME", "TIMESTAMP", "TIMEZONE_HOUR", "TIMEZONE_MINUTE", "TINYBLOB", "TINYINT", "TINYTEXT", "TO", "TOAST", "TOP", "TOP_LEVEL_COUNT", "TRAILING", "TRAN", "TRANSACTION", "TRANSACTION_ACTIVE", "TRANSACTIONS_COMMITTED", "TRANSACTIONS_ROLLED_BACK", "TRANSFORM", "TRANSFORMS", "TRANSLATE", "TRANSLATION", "TREAT", "TRIGGER", "TRIGGER_CATALOG", "TRIGGER_NAME", "TRIGGER_SCHEMA", "TRIM", "TRUE", "TRUNCATE", "TRUSTED", "TSEQUAL", "TYPE", "UESCAPE", "UID", "UNBOUNDED", "UNCOMMITTED", "UNDER", "UNDO", "UNENCRYPTED", "UNION", "UNIQUE", "UNKNOWN", "UNLISTEN", "UNLOCK", "UNNAMED", "UNNEST", "UNSIGNED", "UNTIL", "UPDATE", "UPDATETEXT", "UPPER", "USAGE", "USE", "USER", "USER_DEFINED_TYPE_CATALOG", "USER_DEFINED_TYPE_CODE", "USER_DEFINED_TYPE_NAME", "USER_DEFINED_TYPE_SCHEMA", "USING", "UTC_DATE", "UTC_TIME", "UTC_TIMESTAMP", "VACUUM", "VALID", "VALIDATE", "VALIDATOR", "VALUE", "VALUES", "VAR_POP", "VAR_SAMP", "VARBINARY", "VARCHAR", "VARCHAR2", "VARCHARACTER", "VARIABLE", "VARIABLES", "VARYING", "VERBOSE", "VIEW", "VOLATILE", "WAITFOR", "WHEN", "WHENEVER", "WHERE", "WHILE", "WIDTH_BUCKET", "WINDOW", "WITH", "WITHIN", "WITHOUT", "WORK", "WRITE", "WRITETEXT", "X509", "XOR", "YEAR", "YEAR_MONTH", "ZEROFILL", "ZONE"];
11
+
12
+ var operators = ["=", "!=", "<", ">", "<=", ">=", "+", "-", "*", "/", "%"];
13
+
14
+ brush.push(operators, {klass: 'operator'});
15
+
16
+ brush.push(Syntax.lib.sqlStyleComment);
17
+
18
+ brush.push(keywords, {klass: 'keyword', options: 'gi'});
19
+
20
+ // Strings
21
+ brush.push(Syntax.lib.singleQuotedString);
22
+ brush.push(Syntax.lib.doubleQuotedString);
23
+ brush.push(Syntax.lib.stringEscape);
24
+
25
+ // Numbers
26
+ brush.push(Syntax.lib.decimalNumber);
27
+ brush.push(Syntax.lib.hexNumber);
28
+
29
+ brush.push(Syntax.lib.webLink);
30
+ });
31
+
@@ -0,0 +1,57 @@
1
+ // brush: "super-collider" aliases: ["sc"]
2
+
3
+ // This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License.
4
+ // Copyright (c) 2011 Samuel G. D. Williams. <http://www.oriontransfer.co.nz>
5
+ // See <jquery.syntax.js> for licensing details.
6
+
7
+ Syntax.register('super-collider', function(brush) {
8
+ var keywords = ["const", "arg", "classvar", "var"];
9
+ brush.push(keywords, {klass: 'keyword'});
10
+
11
+ var operators = ["`", "+", "@", ":", "*", "/", "-", "&", "|", "~", "!", "%", "<", "=", ">"];
12
+ brush.push(operators, {klass: 'operator'});
13
+
14
+ var values = ["thisFunctionDef", "thisFunction", "thisMethod", "thisProcess", "thisThread", "this", "super", "true", "false", "nil", "inf"];
15
+ brush.push(values, {klass: 'constant'});
16
+
17
+ brush.push(Syntax.lib.camelCaseType);
18
+
19
+ // Single Characters
20
+ brush.push({
21
+ pattern: /\$(\\)?./g,
22
+ klass: "constant"
23
+ });
24
+
25
+ // Symbols
26
+ brush.push({
27
+ pattern: /\\[a-z_][a-z0-9_]*/gi,
28
+ klass: "symbol"
29
+ });
30
+
31
+ brush.push({
32
+ pattern: /'[^']+'/g,
33
+ klass: "symbol"
34
+ });
35
+
36
+ // Comments
37
+ brush.push(Syntax.lib.cStyleComment);
38
+ brush.push(Syntax.lib.cppStyleComment);
39
+ brush.push(Syntax.lib.webLink);
40
+
41
+ // Strings
42
+ brush.push(Syntax.lib.singleQuotedString);
43
+ brush.push(Syntax.lib.doubleQuotedString);
44
+ brush.push(Syntax.lib.stringEscape);
45
+
46
+ // Numbers
47
+ brush.push(Syntax.lib.decimalNumber);
48
+ brush.push(Syntax.lib.hexNumber);
49
+
50
+ // Functions
51
+ brush.push({
52
+ pattern: /(?:\.)([a-z_][a-z0-9_]*)/gi,
53
+ matches: Syntax.extractMatches({klass: 'function'})
54
+ });
55
+
56
+ brush.push(Syntax.lib.cStyleFunction);
57
+ });
@@ -0,0 +1,55 @@
1
+ // brush: "swift" aliases: []
2
+
3
+ // This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License.
4
+ // Copyright (c) 2016 Samuel G. D. Williams. <http://www.oriontransfer.co.nz>
5
+ // See <jquery.syntax.js> for licensing details.
6
+
7
+ Syntax.register('swift', function(brush) {
8
+ var keywords = [
9
+ "associatedtype", "class", "deinit", "enum", "extension", "fileprivate", "func", "import", "init", "inout", "internal", "let", "operator", "private", "protocol", "static", "struct", "subscript", "typealias", "var", "break", "case", "continue", "default", "defer", "do", "else", "fallthrough", "for", "guard", "if", "in", "repeat", "return", "switch", "where", "while", "as", "catch", "is", "rethrows", "throw", "throws", "try", "_", "#available", "#colorLiteral", "#column", "#else", "#elseif", "#endif", "#file", "#fileLiteral", "#function", "#if", "#imageLiteral", "#line", "#selector", "#sourceLocation", "associativity", "convenience", "dynamic", "didSet", "final", "get", "infix", "indirect", "lazy", "left", "mutating", "none", "nonmutating", "optional", "override", "postfix", "precedence", "prefix", "Protocol", "required", "right", "set", "Type", "unowned", "weak", "willSet"];
10
+
11
+ var operators = ["+", "*", "/", "-", "&", "|", "~", "!", "%", "<", "=", ">",
12
+ "(", ")", "{", "}", "[", "]", ".", ",", ":", ";", "=", "@", "#", "->", "`", "?", "!"];
13
+
14
+ var values = ["self", "super", "true", "false", "nil"];
15
+
16
+ var access = ["fileprivate", "open", "private", "public"];
17
+
18
+ brush.push(access, {klass: 'access'});
19
+ brush.push(values, {klass: 'constant'});
20
+
21
+ brush.push({
22
+ pattern: /`[^`]+`/g,
23
+ klass: 'identifier'
24
+ });
25
+
26
+ brush.push({
27
+ pattern: /\\\(([^)]*)\)/g,
28
+ matches: Syntax.extractMatches({
29
+ brush: 'swift',
30
+ only: ['string']
31
+ })
32
+ });
33
+
34
+ brush.push(Syntax.lib.camelCaseType);
35
+ brush.push(keywords, {klass: 'keyword'});
36
+ brush.push(operators, {klass: 'operator'});
37
+
38
+ // Comments
39
+ brush.push(Syntax.lib.cStyleComment);
40
+ brush.push(Syntax.lib.cppStyleComment);
41
+ brush.push(Syntax.lib.webLink);
42
+
43
+ // Strings
44
+ brush.push(Syntax.lib.singleQuotedString);
45
+ brush.push(Syntax.lib.doubleQuotedString);
46
+ brush.push(Syntax.lib.stringEscape);
47
+
48
+ // Numbers
49
+ brush.push(Syntax.lib.decimalNumber);
50
+ brush.push(Syntax.lib.hexNumber);
51
+
52
+ // Functions
53
+ brush.push(Syntax.lib.cStyleFunction);
54
+ });
55
+
@@ -0,0 +1,35 @@
1
+ // brush: "html" aliases: []
2
+
3
+ // This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License.
4
+ // Copyright (c) 2011 Samuel G. D. Williams. <http://www.oriontransfer.co.nz>
5
+ // See <jquery.syntax.js> for licensing details.
6
+
7
+ Syntax.brushes.dependency('trenni', 'xml');
8
+ Syntax.brushes.dependency('trenni', 'ruby');
9
+
10
+ Syntax.register('trenni', function(brush) {
11
+ brush.push({
12
+ pattern: /((<\?r)([\s\S]*?)(\?>))/gm,
13
+ matches: Syntax.extractMatches(
14
+ {klass: 'ruby-tag', allow: ['keyword', 'ruby']},
15
+ {klass: 'keyword'},
16
+ {brush: 'ruby'},
17
+ {klass: 'keyword'}
18
+ )
19
+ });
20
+
21
+ brush.push({
22
+ pattern: /((#{)([\s\S]*?)(}))/gm,
23
+ matches: Syntax.extractMatches(
24
+ {klass: 'ruby-tag', allow: ['keyword', 'ruby']},
25
+ {klass: 'keyword'},
26
+ {brush: 'ruby'},
27
+ {klass: 'keyword'}
28
+ )
29
+ });
30
+
31
+ // The position of this statement is important - it determines at what point the rules of the parent are processed.
32
+ // In this case, the rules for xml are processed after the rules for html.
33
+ brush.derives('xml');
34
+ });
35
+
@@ -0,0 +1,50 @@
1
+ // brush: "xml" aliases: []
2
+
3
+ // This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License.
4
+ // Copyright (c) 2011 Samuel G. D. Williams. <http://www.oriontransfer.co.nz>
5
+ // See <jquery.syntax.js> for licensing details.
6
+
7
+ Syntax.lib.xmlEntity = {pattern: /&\w+;/g, klass: 'entity'};
8
+ Syntax.lib.xmlPercentEscape = {pattern: /(%[0-9a-f]{2})/gi, klass: 'percent-escape', only: ['string']};
9
+
10
+ Syntax.register('xml-tag', function(brush) {
11
+ brush.push({
12
+ pattern: /<\/?((?:[^:\s>]+:)?)([^\s>]+)(\s[^>]*)?\/?>/g,
13
+ matches: Syntax.extractMatches({klass: 'namespace'}, {klass: 'tag-name'})
14
+ });
15
+
16
+ brush.push({
17
+ pattern: /([^=\s]+)=(".*?"|'.*?'|[^\s>]+)/g,
18
+ matches: Syntax.extractMatches({klass: 'attribute', only: ['tag']}, {klass: 'string', only: ['tag']})
19
+ });
20
+
21
+ brush.push(Syntax.lib.xmlEntity);
22
+ brush.push(Syntax.lib.xmlPercentEscape);
23
+
24
+ brush.push(Syntax.lib.singleQuotedString);
25
+ brush.push(Syntax.lib.doubleQuotedString);
26
+ });
27
+
28
+ Syntax.register('xml', function(brush) {
29
+ brush.push({
30
+ pattern: /(<!(\[CDATA\[)([\s\S]*?)(\]\])>)/gm,
31
+ matches: Syntax.extractMatches(
32
+ {klass: 'cdata', allow: ['cdata-content', 'cdata-tag']},
33
+ {klass: 'cdata-tag'},
34
+ {klass: 'cdata-content'},
35
+ {klass: 'cdata-tag'}
36
+ )
37
+ });
38
+
39
+ brush.push(Syntax.lib.xmlComment);
40
+
41
+ brush.push({
42
+ pattern: /<[^>\-\s]([^>'"!\/;\?@\[\]^`\{\}\|]|"[^"]*"|'[^']')*[\/?]?>/g,
43
+ brush: 'xml-tag'
44
+ });
45
+
46
+ brush.push(Syntax.lib.xmlEntity);
47
+ brush.push(Syntax.lib.xmlPercentEscape);
48
+
49
+ brush.push(Syntax.lib.webLink);
50
+ });
@@ -0,0 +1,29 @@
1
+ // brush: "yaml" aliases: []
2
+
3
+ // This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License.
4
+ // Copyright (c) 2011 Samuel G. D. Williams. <http://www.oriontransfer.co.nz>
5
+ // See <jquery.syntax.js> for licensing details.
6
+
7
+ Syntax.register('yaml', function(brush) {
8
+ brush.push({
9
+ pattern: /^\s*#.*$/gm,
10
+ klass: 'comment',
11
+ allow: ['href']
12
+ });
13
+
14
+ brush.push(Syntax.lib.singleQuotedString);
15
+ brush.push(Syntax.lib.doubleQuotedString);
16
+
17
+ brush.push({
18
+ pattern: /(&|\*)[a-z0-9]+/gi,
19
+ klass: 'constant'
20
+ });
21
+
22
+ brush.push({
23
+ pattern: /(.*?):/gi,
24
+ matches: Syntax.extractMatches({klass: 'keyword'})
25
+ });
26
+
27
+ brush.push(Syntax.lib.webLink);
28
+ });
29
+
@@ -0,0 +1,1114 @@
1
+ // This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License.
2
+ // Copyright (c) 2011 Samuel G. D. Williams. <http://www.oriontransfer.co.nz>
3
+ // See <jquery.syntax.js> for licensing details.
4
+
5
+ if (!RegExp.prototype.indexOf) {
6
+ RegExp.indexOf = function (match, index) {
7
+ return match[0].indexOf(match[index]) + match.index;
8
+ };
9
+ }
10
+
11
+ if (!RegExp.prototype.escape) {
12
+ RegExp.escape = function (pattern) {
13
+ return pattern.replace(/[\-\[\]{}()*+?.\\\^$|,#\s]/g, "\\$&");
14
+ };
15
+ }
16
+
17
+ if (!String.prototype.repeat) {
18
+ String.prototype.repeat = function(l) {
19
+ return new Array(l+1).join(this);
20
+ };
21
+ }
22
+
23
+ // Return the inner text of an element - must preserve whitespace.
24
+ // Avoid returning \r characters.
25
+ Syntax.innerText = function(element) {
26
+ var text;
27
+
28
+ if (!element) {
29
+ return "";
30
+ }
31
+
32
+ if (element.nodeName == 'BR') {
33
+ return '\n';
34
+ } else if (element.textContent) {
35
+ // W3C: FF, Safari, Chrome, etc.
36
+ text = element.textContent;
37
+ } else if (document.body.innerText) {
38
+ // IE, other older browsers.
39
+ text = element.innerText;
40
+ }
41
+
42
+ return text.replace(/\r\n?/g, '\n');
43
+ }
44
+
45
+ Syntax.extractTextFromSelection = function(selection) {
46
+ var buffer = "";
47
+
48
+ for (var i = 0; i < selection.rangeCount; i += 1) {
49
+ var range = selection.getRangeAt(i),
50
+ text = range.toString();
51
+
52
+ buffer += text;
53
+ }
54
+
55
+ return buffer;
56
+ }
57
+
58
+ Syntax.copyCode = function(event) {
59
+ var
60
+ selection = window.getSelection(),
61
+ text = Syntax.extractTextFromSelection(selection);
62
+
63
+ event.clipboardData.setData('text/plain', text);
64
+
65
+ return false;
66
+ }
67
+
68
+ // Convert to stack based implementation
69
+ Syntax.extractElementMatches = function (elems, offset) {
70
+ var matches = [], current = [elems];
71
+ offset = offset || 0;
72
+
73
+ (function (elems) {
74
+ for (var i = 0; elems[i]; i++) {
75
+ var text = null, elem = elems[i];
76
+
77
+ if (elem.nodeType === 3 || elem.nodeType === 4) {
78
+ offset += elem.nodeValue.length;
79
+
80
+ } else if (elem.nodeType === 1) {
81
+ var text = Syntax.innerText(elem);
82
+
83
+ matches.push(new Syntax.Match(offset, text.length, {
84
+ klass: elem.className,
85
+ force: true,
86
+ element: elem,
87
+ allow: '*'
88
+ }, text));
89
+ }
90
+
91
+ // Traverse everything, except comment nodes
92
+ if (elem.nodeType !== 8 && elem.children) {
93
+ arguments.callee(elem.childNodes, offset);
94
+ }
95
+ }
96
+ })(elems);
97
+
98
+ // Remove the top level element, since this will be recreated based on the supplied configuration.
99
+ // Maybe there is a better way to achieve this?
100
+ matches.shift();
101
+
102
+ return matches;
103
+ }
104
+
105
+ // A helper function which automatically matches expressions with capture groups from the regular expression match.
106
+ // Each argument position corresponds to the same index regular expression group.
107
+ // Or, override by providing rule.index
108
+ Syntax.extractMatches = function() {
109
+ var rules = arguments;
110
+
111
+ return function(match, expr) {
112
+ var matches = [];
113
+
114
+ for (var i = 0; i < rules.length; i += 1) {
115
+ var rule = rules[i], index = i+1;
116
+
117
+ if (rule == null) {
118
+ continue;
119
+ }
120
+
121
+ if (typeof(rule.index) != 'undefined') {
122
+ index = rule.index;
123
+ }
124
+
125
+ if (rule.debug) {
126
+ console.log("extractMatches", rule, index, match[index], match);
127
+ }
128
+
129
+ if (match[index].length > 0) {
130
+ if (rule.brush) {
131
+ matches.push(Syntax.Brush.buildTree(rule, match[index], RegExp.indexOf(match, index)));
132
+ } else {
133
+ var expression = jQuery.extend({owner: expr.owner}, rule);
134
+
135
+ matches.push(new Syntax.Match(RegExp.indexOf(match, index), match[index].length, expression, match[index]));
136
+ }
137
+ }
138
+ }
139
+
140
+ return matches;
141
+ };
142
+ };
143
+
144
+ // Used to create processing functions that automatically link to remote documentation.
145
+ Syntax.lib.webLinkProcess = function (queryURI, lucky) {
146
+ if (lucky) {
147
+ queryURI = "http://www.google.com/search?btnI=I&q=" + encodeURIComponent(queryURI + " ");
148
+ }
149
+
150
+ return function (element, match, options) {
151
+ // Per-code block linkification control.
152
+ if (options.linkify === false)
153
+ return element;
154
+
155
+ var a = document.createElement('a');
156
+ a.href = queryURI + encodeURIComponent(Syntax.innerText(element));
157
+ a.className = element.className;
158
+
159
+ // Move children from <element> to <a>
160
+ while (element.childNodes.length > 0)
161
+ a.appendChild(element.childNodes[0]);
162
+
163
+ return a;
164
+ };
165
+ };
166
+
167
+ // Global brush registration function.
168
+ Syntax.register = function (name, callback) {
169
+ var brush = Syntax.brushes[name] = new Syntax.Brush();
170
+ brush.klass = name;
171
+
172
+ callback(brush);
173
+ };
174
+
175
+ // Library of helper patterns
176
+ Syntax.lib.cStyleComment = {pattern: /\/\*[\s\S]*?\*\//gm, klass: 'comment', allow: ['href']};
177
+ Syntax.lib.cppStyleComment = {pattern: /\/\/.*$/gm, klass: 'comment', allow: ['href']};
178
+ Syntax.lib.perlStyleComment = {pattern: /#.*$/gm, klass: 'comment', allow: ['href']};
179
+
180
+ // A hackity hack:
181
+ Syntax.lib.perlStyleRegularExpression = {pattern: /\B\/([^\\\/]|\\.)*\/[a-z]*(?=\s*($|[^\w\s'"\(]))/gm, klass: 'constant', incremental: true};
182
+ Syntax.lib.rubyStyleRegularExpression = {pattern: /\B\/([^\\\/]|\\.)*\/[a-z]*(?=\s*($|[^\w\s'"\(]|do))/gm, klass: 'constant', incremental: true};
183
+
184
+ Syntax.lib.cStyleFunction = {pattern: /([a-z_][a-z0-9_]*)\s*\(/gi, matches: Syntax.extractMatches({klass: 'function'})};
185
+ Syntax.lib.camelCaseType = {pattern: /\b_*[A-Z][\w]*\b/g, klass: 'type'};
186
+ Syntax.lib.cStyleType = {pattern: /\b[_a-z][_\w]*_t\b/gi, klass: 'type'};
187
+
188
+ Syntax.lib.xmlComment = {pattern: /(&lt;|<)!--[\s\S]*?--(&gt;|>)/gm, klass: 'comment'};
189
+ Syntax.lib.webLink = {pattern: /\w+:\/\/[\w\-.\/?%&=@:;#]*/g, klass: 'href'};
190
+
191
+ Syntax.lib.hexNumber = {pattern: /\b0x[0-9a-fA-F]+/g, klass: 'constant'};
192
+ Syntax.lib.decimalNumber = {pattern: /\b[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?/g, klass: 'constant'};
193
+
194
+ Syntax.lib.doubleQuotedString = {pattern: /"([^\\"\n]|\\.)*"/g, klass: 'string'};
195
+ Syntax.lib.singleQuotedString = {pattern: /'([^\\'\n]|\\.)*'/g, klass: 'string'};
196
+ Syntax.lib.multiLineDoubleQuotedString = {pattern: /"([^\\"]|\\.)*"/g, klass: 'string'};
197
+ Syntax.lib.multiLineSingleQuotedString = {pattern: /'([^\\']|\\.)*'/g, klass: 'string'};
198
+ Syntax.lib.stringEscape = {pattern: /\\./g, klass: 'escape', only: ['string']};
199
+
200
+ // Main match constructor. Make sure value is the correct size.
201
+ Syntax.Match = function (offset, length, expression, value) {
202
+ this.offset = offset;
203
+ this.endOffset = offset + length;
204
+ this.length = length;
205
+ this.expression = expression;
206
+ this.value = value;
207
+ this.children = [];
208
+ this.parent = null;
209
+
210
+ // When a node is bisected, this points to the next part.
211
+ this.next = null;
212
+ };
213
+
214
+ // Shifts an entire tree forward or backwards.
215
+ Syntax.Match.prototype.shift = function (offset, text) {
216
+ this.adjust(offset, null, text);
217
+
218
+ for (var i = 0; i < this.children.length; i++) {
219
+ this.children[i].shift(offset, text)
220
+ }
221
+ };
222
+
223
+ // C the current match to have different offset and length.
224
+ Syntax.Match.prototype.adjust = function (offset, length, text) {
225
+ this.offset += offset;
226
+ this.endOffset += offset;
227
+
228
+ if (length) {
229
+ this.length = length;
230
+ this.endOffset = this.offset + length;
231
+ }
232
+
233
+ if (text) {
234
+ this.value = text.substr(this.offset, this.length);
235
+ }
236
+ };
237
+
238
+ // Sort helper for sorting matches in forward order (e.g. same as the text that they were extracted from)
239
+ Syntax.Match.sort = function (a,b) {
240
+ return (a.offset - b.offset) || (b.length - a.length);
241
+ };
242
+
243
+ // Is the given match contained in the range of the parent match?
244
+ Syntax.Match.prototype.contains = function (match) {
245
+ return (match.offset >= this.offset) && (match.endOffset <= this.endOffset);
246
+ };
247
+
248
+ // Reduce a givent tree node into an html node.
249
+ Syntax.Match.defaultReduceCallback = function (node, container) {
250
+ // We avoid using jQuery in this function since it is incredibly performance sensitive.
251
+ // Using jQuery jQuery.fn.append() can reduce performance by as much as 1/3rd.
252
+ if (typeof(node) === 'string') {
253
+ node = document.createTextNode(node);
254
+ }
255
+
256
+ container.appendChild(node);
257
+ };
258
+
259
+ // Convert a tree of matches into some flat form (typically HTML nodes).
260
+ Syntax.Match.prototype.reduce = function (append, process) {
261
+ var start = this.offset;
262
+ var container = document.createElement('span');
263
+
264
+ append = append || Syntax.Match.defaultReduceCallback;
265
+
266
+ if (this.expression && this.expression.klass) {
267
+ if (container.className.length > 0)
268
+ container.className += ' ';
269
+
270
+ container.className += this.expression.klass;
271
+ }
272
+
273
+ if (this.className) {
274
+ container.className += ' ';
275
+ container.className += this.className;
276
+ }
277
+
278
+ for (var i = 0; i < this.children.length; i += 1) {
279
+ var child = this.children[i], end = child.offset;
280
+
281
+ if (child.offset < this.offset) {
282
+ console.log("Syntax Warning: Offset of child", child, "is before offset of parent", this);
283
+ }
284
+
285
+ var text = this.value.substr(start - this.offset, end - start);
286
+
287
+ append(text, container);
288
+ append(child.reduce(append, process), container);
289
+
290
+ start = child.endOffset;
291
+ }
292
+
293
+ if (start === this.offset) {
294
+ append(this.value, container);
295
+ } else if (start < this.endOffset) {
296
+ append(this.value.substr(start - this.offset, this.endOffset - start), container);
297
+ } else if (start > this.endOffset) {
298
+ console.log("Syntax Warning: Start position " + start + " exceeds end of value " + this.endOffset);
299
+ }
300
+
301
+ if (process) {
302
+ container = process(container, this);
303
+ }
304
+
305
+ return container;
306
+ };
307
+
308
+ // Main nesting check - can a match contain the given match?
309
+ Syntax.Match.prototype.canContain = function (match) {
310
+ // This is a special conditional for explicitly added ranges by the user.
311
+ // Since user added it, we honour it no matter what.
312
+ if (match.expression.force) {
313
+ return true;
314
+ }
315
+
316
+ // Can't add anything into complete trees.
317
+ if (this.complete) {
318
+ return false;
319
+ }
320
+
321
+ // match.expression.only will be checked on insertion using this.canHaveChild(match)
322
+ if (match.expression.only) {
323
+ return true;
324
+ }
325
+
326
+ // If allow is undefined, default behaviour is no children.
327
+ if (typeof(this.expression.allow) === 'undefined') {
328
+ return false;
329
+ }
330
+
331
+ // false if {disallow: [..., klass, ...]}
332
+ if (jQuery.isArray(this.expression.disallow) && jQuery.inArray(match.expression.klass, this.expression.disallow) !== -1) {
333
+ return false;
334
+ }
335
+
336
+ // true if {allow: '*'}
337
+ if (this.expression.allow === '*') {
338
+ return true;
339
+ }
340
+
341
+ // true if {allow: [..., klass, ...]}
342
+ if (jQuery.isArray(this.expression.allow) && jQuery.inArray(match.expression.klass, this.expression.allow) !== -1) {
343
+ return true;
344
+ }
345
+
346
+ return false;
347
+ };
348
+
349
+ // Return true if the given match can be spliced in as a child.
350
+ // Checked automatically when calling _splice.
351
+ Syntax.Match.prototype.canHaveChild = function(match) {
352
+ var only = match.expression.only;
353
+
354
+ // This condition is fairly slow
355
+ if (only) {
356
+ var cur = this;
357
+
358
+ while (cur !== null) {
359
+ if (jQuery.inArray(cur.expression.klass, only) !== -1) {
360
+ return true;
361
+ }
362
+
363
+ cur = cur.parent;
364
+
365
+ // We don't traverse into other trees.
366
+ if (cur && cur.complete) {
367
+ break;
368
+ }
369
+ }
370
+
371
+ return false;
372
+ }
373
+
374
+ return true;
375
+ };
376
+
377
+ // Add a child into the list of children for a given match, if it is acceptable to do so.
378
+ // Updates the owner of the match.
379
+ // Returns null if splice failed.
380
+ Syntax.Match.prototype._splice = function(i, match) {
381
+ if (this.canHaveChild(match)) {
382
+ this.children.splice(i, 0, match);
383
+ match.parent = this;
384
+
385
+ // For matches added using tags.
386
+ if (!match.expression.owner) {
387
+ match.expression.owner = this.expression.owner;
388
+ }
389
+
390
+ return this;
391
+ } else {
392
+ return null;
393
+ }
394
+ };
395
+
396
+ // This function implements a full insertion procedure, and will break up the match to fit.
397
+ // This operation is potentially very expensive, but is used to insert custom ranges into
398
+ // the tree, if they are specified by the user. A custom <span> may cover multiple leafs in
399
+ // the tree, thus some parts of the tree may need to be split. This behavior is controlled
400
+ // by whole - if true, the tree is split, if false, the match is split.
401
+ // You should avoid using this function except in very specific cases.
402
+ Syntax.Match.prototype.insert = function(match, whole) {
403
+ if (!this.contains(match))
404
+ return null;
405
+
406
+ if (whole) {
407
+ var top = this, i = 0;
408
+ while (i < top.children.length) {
409
+ if (top.children[i].contains(match)) {
410
+ top = top.children[i];
411
+ i = 0;
412
+ } else {
413
+ i += 1;
414
+ }
415
+ }
416
+
417
+ return top._insertWhole(match);
418
+ } else {
419
+ return this._insert(match);
420
+ }
421
+ }
422
+
423
+ Syntax.Match.prototype._insertWhole = function(match) {
424
+ var parts = this.bisectAtOffsets([match.offset, match.endOffset])
425
+ this.children = [];
426
+
427
+ if (parts[0]) {
428
+ this.children = this.children.concat(parts[0].children);
429
+ }
430
+
431
+ if (parts[1]) {
432
+ match.children = [];
433
+
434
+ // Update the match's expression based on the current position in the tree:
435
+ if (this.expression && this.expression.owner) {
436
+ match.expression = this.expression.owner.getRuleForKlass(match.expression.klass) || match.expression;
437
+ }
438
+
439
+ // This probably isn't ideal, it would be better to convert all children and children-of-children
440
+ // into a linear array and reinsert - it would be slightly more accurate in many cases.
441
+ for (var i = 0; i < parts[1].children.length; i += 1) {
442
+ var child = parts[1].children[i];
443
+
444
+ if (match.canContain(child)) {
445
+ match.children.push(child);
446
+ }
447
+ }
448
+
449
+ this.children.push(match);
450
+ }
451
+
452
+ if (parts[2]) {
453
+ this.children = this.children.concat(parts[2].children);
454
+ }
455
+
456
+ return this;
457
+ }
458
+
459
+ // This is not a general tree insertion function. It is optimised to run in almost constant
460
+ // time, but data must be inserted in sorted order, otherwise you will have problems.
461
+ // This function also ensures that matches won't be broken up unless absolutely necessary.
462
+ Syntax.Match.prototype.insertAtEnd = function(match) {
463
+ if (!this.contains(match)) {
464
+ console.log("Syntax Error: Child is not contained in parent node!");
465
+ return null;
466
+ }
467
+
468
+ if (!this.canContain(match)) {
469
+ return null;
470
+ }
471
+
472
+ if (this.children.length > 0) {
473
+ var i = this.children.length-1;
474
+ var child = this.children[i];
475
+
476
+ if (match.offset < child.offset) {
477
+ // Displacement: Before or LHS Overlap
478
+ // This means that the match has actually occurred before the last child.
479
+ // This is a bit of an unusual situation because the matches SHOULD be in
480
+ // sorted order.
481
+ // However, we are sure that the match is contained in this node. This situation
482
+ // sometimes occurs when sorting existing branches with matches that are supposed
483
+ // to be within that branch. When we insert the match into the branch, there are
484
+ // matches that technically should have been inserted afterwards.
485
+ // Normal usage should avoid this case, and this is best for performance.
486
+ if (match.force) {
487
+ return this._insert(match);
488
+ } else {
489
+ return null;
490
+ }
491
+ } else if (match.offset < child.endOffset) {
492
+ if (match.endOffset <= child.endOffset) {
493
+ // Displacement: Contains
494
+ //console.log("displacement => contains");
495
+ var result = child.insertAtEnd(match);
496
+ return result;
497
+ } else {
498
+ // Displacement: RHS Overlap
499
+ if (match.force) {
500
+ return this._insert(match);
501
+ } else {
502
+ return null;
503
+ }
504
+ }
505
+ } else {
506
+ // Displacement: After
507
+ return this._splice(i+1, match);
508
+ }
509
+ } else {
510
+ // Displacement: Contains [but currently no children]
511
+ return this._splice(0, match);
512
+ }
513
+ };
514
+
515
+ // This insertion function is relatively complex because it is required to split the match over
516
+ // several children. This function is used infrequently and is mostly for completeness. However,
517
+ // it might be possible to remove it to reduce code.
518
+ Syntax.Match.prototype._insert = function(match) {
519
+ if (this.children.length == 0)
520
+ return this._splice(0, match);
521
+
522
+ for (var i = 0; i < this.children.length; i += 1) {
523
+ var child = this.children[i];
524
+
525
+ // If the match ends before this child, it must be before it.
526
+ if (match.endOffset <= child.offset)
527
+ return this._splice(i, match);
528
+
529
+ // If the match starts after this child, we continue.
530
+ if (match.offset >= child.endOffset)
531
+ continue;
532
+
533
+ // There are four possibilities...
534
+ // ... with the possibility of overlapping children on the RHS.
535
+ // {------child------} {---possibly some other child---}
536
+ // |----------complete overlap---------|
537
+ // |--lhs overlap--|
538
+ // |--contains--|
539
+ // |--rhs overlap--|
540
+
541
+ // First, the easiest case:
542
+ if (child.contains(match)) {
543
+ return child._insert(match);
544
+ }
545
+
546
+ // console.log("Bisect at offsets", match, child.offset, child.endOffset);
547
+ var parts = match.bisectAtOffsets([child.offset, child.endOffset]);
548
+ // console.log("parts =", parts);
549
+ // We now have at most three parts
550
+ // {------child------} {---possibly some other child---}
551
+ // |--[0]--|-------[1]-------|--[2]--|
552
+
553
+ // console.log("parts", parts);
554
+
555
+ if (parts[0]) {
556
+ this._splice(i, parts[0])
557
+ }
558
+
559
+ if (parts[1]) {
560
+ child.insert(parts[1])
561
+ }
562
+
563
+ // Continue insertion at this level with remainder.
564
+ if (parts[2]) {
565
+ match = parts[2]
566
+ } else {
567
+ return this;
568
+ }
569
+ }
570
+
571
+ // If we got this far, the match wasn't [completely] inserted into the list of existing children, so it must be on the end.
572
+ this._splice(this.children.length, match);
573
+ }
574
+
575
+ // This algorithm recursively bisects the tree at a given offset, but it does this efficiently by folding multiple bisections
576
+ // at a time.
577
+ // Splits: / / /
578
+ // Tree: |-------------------------Top-------------------------|
579
+ // |------------A--------------------| |------C-------|
580
+ // |-------B----------|
581
+ // Step (1):
582
+ // Split Top into 4 parts:
583
+ // |------/----------------/-------------------/---------|
584
+ // For each part, check if there are any children that cover this part.
585
+ // If there is a child, recursively call bisect with all splits.
586
+ // Step (1-1):
587
+ // Split A into parts:
588
+ // |------/-----A----------/---------|
589
+ // For each part, check if there are any children that cover this part.
590
+ // If there is a child, recursively call bisect with all splits.
591
+ // Step (1-1-1):
592
+ // Split B into parts:
593
+ // |-------B---/------|
594
+ // No children covered by split. Return array of two parts, B1, B2.
595
+ // Step (1-2):
596
+ // Enumerate the results of splitting the child and merge piece-wise into own parts
597
+ // |------/-----A----------/---------|
598
+ // |------B1---|--B2--|
599
+ // Finished merging children, return array of three parts, A1, A2, A3
600
+ // Step (2):
601
+ // Enumerate the results of splitting the child and merge piece-wise into own parts.
602
+ // |------/----------------/-------------------/---------|
603
+ // |--A1--|-------A2-------|----A3---|
604
+ // |------B1---|--B2--|
605
+ // Continue by splitting next child, C.
606
+ // Once all children have been split and merged, return all parts, T1, T2, T3, T4.
607
+ // The new tree:
608
+ // |--T1--|-------T2-------|--------T3---------|---T4---|
609
+ // |--A1--|-------A2-------|----A3---| |--C1--|---C2--|
610
+ // |------B1---|--B2--|
611
+ //
612
+ // The new structure is as follows:
613
+ // T1 <- A1
614
+ // T2 <- A2 <- B1
615
+ // T3 <- A3 <- B2
616
+ // \- C1
617
+ // T4 <- C2
618
+ //
619
+ Syntax.Match.prototype.bisectAtOffsets = function(splits) {
620
+ var parts = [], start = this.offset, prev = null, children = jQuery.merge([], this.children);
621
+
622
+ // Copy the array so we can modify it.
623
+ splits = splits.slice(0);
624
+
625
+ // We need to split including the last part.
626
+ splits.push(this.endOffset);
627
+
628
+ splits.sort(function (a,b) {
629
+ return a-b;
630
+ });
631
+
632
+ // We build a set of top level matches by looking at each split point and
633
+ // creating a new match from the end of the previous match to the split point.
634
+ for (var i = 0; i < splits.length; i += 1) {
635
+ var offset = splits[i];
636
+
637
+ // The split offset is past the end of the match, so there are no more possible
638
+ // splits.
639
+ if (offset > this.endOffset) {
640
+ break;
641
+ }
642
+
643
+ // We keep track of null parts if the offset is less than the start
644
+ // so that things align up as expected with the requested splits.
645
+ if (
646
+ offset < this.offset // If the split point is less than the start of the match.
647
+ || (offset - start) == 0 // If the match would have effectively zero length.
648
+ ) {
649
+ parts.push(null); // Preserve alignment with splits.
650
+ start = offset;
651
+ continue;
652
+ }
653
+
654
+ // Even if the previous split was out to the left, we align up the start
655
+ // to be at the start of the match we are bisecting.
656
+ if (start < this.offset)
657
+ start = this.offset;
658
+
659
+ var match = new Syntax.Match(start, offset - start, this.expression);
660
+ match.value = this.value.substr(start - this.offset, match.length);
661
+
662
+ if (prev) {
663
+ prev.next = match;
664
+ }
665
+
666
+ prev = match;
667
+
668
+ start = match.endOffset;
669
+ parts.push(match);
670
+ }
671
+
672
+ // We only need to split to produce the number of parts we have.
673
+ splits.length = parts.length;
674
+
675
+ for (var i = 0; i < parts.length; i += 1) {
676
+ if (parts[i] == null)
677
+ continue;
678
+
679
+ var offset = splits[0];
680
+
681
+ while (children.length > 0) {
682
+ if (children[0].endOffset <= parts[i].endOffset) {
683
+ parts[i].children.push(children.shift());
684
+ } else {
685
+ break;
686
+ }
687
+ }
688
+
689
+ if (children.length) {
690
+ // We may have an intersection
691
+ if (children[0].offset < parts[i].endOffset) {
692
+ var children_parts = children.shift().bisectAtOffsets(splits), j = 0;
693
+
694
+ // children_parts are the bisected children which need to be merged with parts
695
+ // in a linear fashion
696
+ for (; j < children_parts.length; j += 1) {
697
+ if (children_parts[j] == null) continue; // Preserve alignment with splits.
698
+
699
+ parts[i+j].children.push(children_parts[j]);
700
+ }
701
+
702
+ // Skip any parts which have been populated already
703
+ // (i is incremented at the start of the loop, splits shifted at the end)
704
+ i += (children_parts.length-2);
705
+ splits.splice(0, children_parts.length-2);
706
+ }
707
+ }
708
+
709
+ splits.shift();
710
+ }
711
+
712
+ if (children.length) {
713
+ console.log("Syntax Error: Children nodes not consumed", children.length, " remaining!");
714
+ }
715
+
716
+ return parts;
717
+ };
718
+
719
+ // Split a match at points in the tree that match a specific regular expression pattern.
720
+ // Uses the fast tree bisection algorithm, performance should be bounded O(S log N) where N is
721
+ // the total number of matches and S is the number of splits (?).
722
+ Syntax.Match.prototype.split = function(pattern) {
723
+ var splits = [], match;
724
+
725
+ while ((match = pattern.exec(this.value)) !== null) {
726
+ splits.push(pattern.lastIndex);
727
+ }
728
+
729
+ var matches = this.bisectAtOffsets(splits);
730
+
731
+ // Remove any null placeholders.
732
+ return jQuery.grep(matches, function(n,i){
733
+ return n;
734
+ });
735
+ };
736
+
737
+ Syntax.Match.prototype.splitLines = function() {
738
+ var lines = this.split(/\n/g);
739
+
740
+ for (var i = 0; i < lines.length; i += 1) {
741
+ var line = lines[i];
742
+ var indentOffset = line.value.search(/\S/);
743
+
744
+ var top = new Syntax.Match(line.offset, line.length, line.expression, line.value);
745
+
746
+ if (indentOffset > 0) {
747
+ var parts = line.bisectAtOffsets([line.offset + indentOffset]);
748
+ top.children = parts;
749
+ parts[0].expression = {klass: 'indent'};
750
+ parts[1].expression = {klass: 'text'};
751
+ } else {
752
+ line.expression = {klass: 'text'};
753
+ top.children = [line];
754
+ }
755
+
756
+ lines[i] = top;
757
+ }
758
+
759
+ return lines;
760
+ }
761
+
762
+ Syntax.Brush = function () {
763
+ // The primary class of this brush. Must be unique.
764
+ this.klass = null;
765
+
766
+ // A sequential list of rules for extracting matches.
767
+ this.rules = [];
768
+
769
+ // A list of all parents that this brush derives from.
770
+ this.parents = [];
771
+
772
+ // A list of processes that may be run after extracting matches.
773
+ this.processes = {};
774
+ };
775
+
776
+ // Add a parent to the brush. This brush should be loaded as a dependency.
777
+ Syntax.Brush.prototype.derives = function (name) {
778
+ this.parents.push(name);
779
+ this.rules.push({
780
+ apply: function(text, expr) {
781
+ return Syntax.brushes[name].getMatches(text);
782
+ }
783
+ });
784
+ };
785
+
786
+ // Return an array of all classes that the brush consists of.
787
+ // A derivied brush is its own klass + the klass of any and all parents.
788
+ Syntax.Brush.prototype.allKlasses = function () {
789
+ var klasses = [this.klass];
790
+
791
+ for (var i = 0; i < this.parents.length; i += 1) {
792
+ klasses = klasses.concat(Syntax.brushes[this.parents[i]].allKlasses());
793
+ }
794
+
795
+ return klasses;
796
+ }
797
+
798
+ Syntax.Brush.convertStringToTokenPattern = function (pattern, escape) {
799
+ var prefix = "\\b", postfix = "\\b";
800
+
801
+ if (!pattern.match(/^\w/)) {
802
+ if (!pattern.match(/\w$/)) {
803
+ prefix = postfix = "";
804
+ } else {
805
+ prefix = "\\B";
806
+ }
807
+ } else {
808
+ if (!pattern.match(/\w$/)) {
809
+ postfix = "\\B";
810
+ }
811
+ }
812
+
813
+ if (escape)
814
+ pattern = RegExp.escape(pattern)
815
+
816
+ return prefix + pattern + postfix;
817
+ }
818
+
819
+ Syntax.Brush.MatchPattern = function (text, rule) {
820
+ if (!rule.pattern)
821
+ return [];
822
+
823
+ // Duplicate the pattern so that the function is reentrant.
824
+ var matches = [], pattern = new RegExp;
825
+ pattern.compile(rule.pattern);
826
+
827
+ while((match = pattern.exec(text)) !== null) {
828
+ if (rule.matches) {
829
+ matches = matches.concat(rule.matches(match, rule));
830
+ } else if (rule.brush) {
831
+ matches.push(Syntax.Brush.buildTree(rule, match[0], match.index));
832
+ } else {
833
+ matches.push(new Syntax.Match(match.index, match[0].length, rule, match[0]));
834
+ }
835
+
836
+ if (rule.incremental) {
837
+ // Don't start scanning from the end of the match..
838
+ pattern.lastIndex = match.index + 1;
839
+ }
840
+ }
841
+
842
+ return matches;
843
+ }
844
+
845
+ Syntax.Brush.prototype.push = function () {
846
+ if (jQuery.isArray(arguments[0])) {
847
+ var patterns = arguments[0], rule = arguments[1];
848
+
849
+ var all = "(";
850
+
851
+ for (var i = 0; i < patterns.length; i += 1) {
852
+ if (i > 0) all += "|";
853
+
854
+ var p = patterns[i];
855
+
856
+ if (p instanceof RegExp) {
857
+ all += p.source;
858
+ } else {
859
+ all += Syntax.Brush.convertStringToTokenPattern(p, true);
860
+ }
861
+ }
862
+
863
+ all += ")";
864
+
865
+ this.push(jQuery.extend({
866
+ pattern: new RegExp(all, rule.options || 'g')
867
+ }, rule));
868
+ } else {
869
+ var rule = arguments[0];
870
+
871
+ if (typeof(rule.pattern) === 'string') {
872
+ rule.string = rule.pattern;
873
+ rule.pattern = new RegExp(Syntax.Brush.convertStringToTokenPattern(rule.string, true), rule.options || 'g')
874
+ }
875
+
876
+ if (typeof(XRegExp) !== 'undefined') {
877
+ rule.pattern = new XRegExp(rule.pattern);
878
+ }
879
+
880
+ // Default pattern extraction algorithm
881
+ rule.apply = rule.apply || Syntax.Brush.MatchPattern;
882
+
883
+ if (rule.pattern && rule.pattern.global || typeof(rule.pattern) == 'undefined') {
884
+ this.rules.push(jQuery.extend({owner: this}, rule));
885
+ } else {
886
+ console.log("Syntax Error: Malformed rule: ", rule);
887
+ }
888
+ }
889
+ };
890
+
891
+ Syntax.Brush.prototype.getMatchesForRule = function (text, rule) {
892
+ var matches = [], match = null;
893
+
894
+ // Short circuit (user defined) function:
895
+ if (typeof(rule.apply) != 'undefined') {
896
+ matches = rule.apply(text, rule);
897
+ }
898
+
899
+ if (rule.debug) {
900
+ console.log("Syntax matches:", rule, text, matches);
901
+ }
902
+
903
+ return matches;
904
+ };
905
+
906
+ Syntax.Brush.prototype.getRuleForKlass = function (klass) {
907
+ for (var i = 0; i < this.rules.length; i += 1) {
908
+ if (this.rules[i].klass == klass) {
909
+ return this.rules[i];
910
+ }
911
+ }
912
+
913
+ return null;
914
+ }
915
+
916
+ // Get all matches from a given block of text.
917
+ Syntax.Brush.prototype.getMatches = function(text) {
918
+ var matches = [];
919
+
920
+ for (var i = 0; i < this.rules.length; i += 1) {
921
+ matches = matches.concat(this.getMatchesForRule(text, this.rules[i]));
922
+ }
923
+
924
+ return matches;
925
+ };
926
+
927
+ // A helper function for building a tree from a specific rule.
928
+ // Typically used where sub-trees are required, e.g. CSS brush in HTML brush.
929
+ Syntax.Brush.buildTree = function(rule, text, offset, additionalMatches) {
930
+ var match = Syntax.brushes[rule.brush].buildTree(text, offset, additionalMatches);
931
+
932
+ jQuery.extend(match.expression, rule);
933
+
934
+ return match;
935
+ }
936
+
937
+ // This function builds a tree from a given block of text.
938
+ // This is done by applying all rules to the text to get a complete list of matches,
939
+ // sorting them in order, and inserting them into a syntax tree data structure.
940
+ // Additional matches are forcefully inserted into the tree.
941
+ // Provide an offset if the text is offset in a larger block of text. Matches
942
+ // will be shifted along appropriately.
943
+ Syntax.Brush.prototype.buildTree = function(text, offset, additionalMatches) {
944
+ offset = offset || 0;
945
+
946
+ // Fixes code that uses \r\n for line endings. /$/ matches both \r\n, which is a problem..
947
+ text = text.replace(/\r/g, '');
948
+
949
+ var matches = this.getMatches(text);
950
+
951
+ // Shift matches if offset is provided.
952
+ if (offset && offset > 0) {
953
+ for (var i = 0; i < matches.length; i += 1) {
954
+ matches[i].shift(offset);
955
+ }
956
+ }
957
+
958
+ var top = new Syntax.Match(offset, text.length, {klass: this.allKlasses().join(" "), allow: '*', owner: this}, text);
959
+
960
+ // This sort is absolutely key to the functioning of the tree insertion algorithm.
961
+ matches.sort(Syntax.Match.sort);
962
+
963
+ for (var i = 0; i < matches.length; i += 1) {
964
+ top.insertAtEnd(matches[i]);
965
+ }
966
+
967
+ if (additionalMatches) {
968
+ for (var i = 0; i < additionalMatches.length; i += 1) {
969
+ top.insert(additionalMatches[i], true);
970
+ }
971
+ }
972
+
973
+ top.complete = true;
974
+
975
+ return top;
976
+ };
977
+
978
+ // This function builds a syntax tree from the given text and matches (optional).
979
+ // The syntax tree is then flattened into html using a variety of functions.
980
+ //
981
+ // By default, you can't control reduction process through this function, but
982
+ // it is possible to control the element conversion process by replace
983
+ // .reduce(null, ...) with .reduce(reduceCallback, ...)
984
+ // See Syntax.Match.defaultReduceCallback for more details about interface.
985
+ //
986
+ // Matches is optional, and provides a set of pre-existing matches to add
987
+ // to the tree.
988
+ // Options are passed to element level processing functions.
989
+ Syntax.Brush.prototype.process = function(text, matches, options) {
990
+ var top = this.buildTree(text, 0, matches);
991
+
992
+ var lines = top.splitLines();
993
+
994
+ var html = document.createElement('code');
995
+ html.className = 'syntax highlighted';
996
+
997
+ for (var i = 0; i < lines.length; i += 1) {
998
+ var line = lines[i].reduce(null, function (container, match) {
999
+ if (match.expression) {
1000
+ if (match.expression.process) {
1001
+ container = match.expression.process(container, match, options);
1002
+ }
1003
+
1004
+ if (match.expression.owner) {
1005
+ var process = match.expression.owner.processes[match.expression.klass];
1006
+ if (process) {
1007
+ container = process(container, match, options);
1008
+ }
1009
+ }
1010
+ }
1011
+ return container;
1012
+ });
1013
+
1014
+ html.appendChild(line);
1015
+ }
1016
+
1017
+ return html;
1018
+ };
1019
+
1020
+ // Highlights a given block of text with a given set of options.
1021
+ // options.brush should specify the brush to use, either by direct reference
1022
+ // or name.
1023
+ // Callback will be called with (highlighted_html, brush_used, original_text, options)
1024
+ Syntax.highlightText = function(text, brush, matches, options, callback) {
1025
+ brush = (brush || 'plain').toLowerCase();
1026
+ brush = Syntax.aliases[brush] || brush;
1027
+
1028
+ Syntax.brushes.get(brush, function(brush) {
1029
+ var html = brush.process(text, matches, options);
1030
+
1031
+ if (options.linkify) {
1032
+ jQuery('span.href', html).each(function(){
1033
+ jQuery(this).replaceWith(jQuery('<a>').attr('href', this.innerHTML).text(this.innerHTML));
1034
+ });
1035
+ }
1036
+
1037
+ callback(html, brush, text, options);
1038
+ });
1039
+ }
1040
+
1041
+ Syntax.extractBrushName = function (className) {
1042
+ // brush names are by default lower case - normalize so we can detect it.
1043
+ className = className.toLowerCase();
1044
+
1045
+ var match = className.match(/(brush|language)-([\S]+)/);
1046
+
1047
+ if (match) {
1048
+ return match[2];
1049
+ } else {
1050
+ var classes = className.split(/ /);
1051
+
1052
+ if (jQuery.inArray("syntax", classes) !== -1) {
1053
+ for (var i = 0; i < classes.length; i += 1) {
1054
+ var name = Syntax.aliases[classes[i]];
1055
+
1056
+ if (name) {
1057
+ return name;
1058
+ }
1059
+ }
1060
+ }
1061
+ }
1062
+
1063
+ return null;
1064
+ }
1065
+
1066
+ // Highlight a given set of elements with a set of options.
1067
+ // Callback will be called once per element with (options, highlighted_html, original_container)
1068
+ Syntax.highlight = function (elements, options, callback) {
1069
+ elements.each(function () {
1070
+ var container = jQuery(this);
1071
+ var brush = options.brush || Syntax.extractBrushName(this.className);
1072
+ var text = Syntax.innerText(this);
1073
+
1074
+ // We can augment the plain text to extract existing annotations (e.g. <span class="foo">...</span>).
1075
+ var matches = Syntax.extractElementMatches(container);
1076
+
1077
+ if (options.matches) {
1078
+ Array.prototype.push(matches, options.matches);
1079
+ }
1080
+
1081
+ Syntax.highlightText(text, brush, matches, options, function(html, brush/*, text, options*/) {
1082
+ html.oncopy = Syntax.copyCode;
1083
+
1084
+ html = jQuery(html);
1085
+
1086
+ // If there is a theme specified, ensure it is added to the top level class.
1087
+ if (options.theme) {
1088
+ // Load dependencies
1089
+ var themes = Syntax.themes[options.theme];
1090
+ for (var i = 0; i < themes.length; i += 1) {
1091
+ html.addClass("syntax-theme-" + themes[i]);
1092
+ }
1093
+
1094
+ // Add the base theme
1095
+ html.addClass("syntax-theme-" + options.theme);
1096
+ }
1097
+
1098
+ if (brush.postprocess) {
1099
+ html = brush.postprocess(options, html, container);
1100
+ }
1101
+
1102
+ if (callback) {
1103
+ html = callback(options, html, container);
1104
+ }
1105
+
1106
+ if (html && options.replace === true) {
1107
+ container.replaceWith(html);
1108
+ }
1109
+ });
1110
+ });
1111
+ };
1112
+
1113
+ // Register the file as being loaded
1114
+ Syntax.loader.core = true;