mdbe 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (688) hide show
  1. checksums.yaml +15 -0
  2. data/LICENSE.txt +21 -0
  3. data/README.md +53 -0
  4. data/app.rb +182 -0
  5. data/bin/mdbe +5 -0
  6. data/config.ru +2 -0
  7. data/environment.rb +8 -0
  8. data/lib/mdbe.rb +39 -0
  9. data/lib/mdbe/action_controller_debug_patch.rb +12 -0
  10. data/lib/mdbe/code_evaluation.rb +46 -0
  11. data/lib/mdbe/database_views.rb +24 -0
  12. data/lib/mdbe/database_views/abstract_dictionary.rb +69 -0
  13. data/lib/mdbe/database_views/abstract_exception.rb +25 -0
  14. data/lib/mdbe/database_views/array.rb +28 -0
  15. data/lib/mdbe/database_views/boolean.rb +12 -0
  16. data/lib/mdbe/database_views/class.rb +46 -0
  17. data/lib/mdbe/database_views/exception.rb +3 -0
  18. data/lib/mdbe/database_views/execblock.rb +5 -0
  19. data/lib/mdbe/database_views/fixnum.rb +5 -0
  20. data/lib/mdbe/database_views/float.rb +5 -0
  21. data/lib/mdbe/database_views/globals.rb +2 -0
  22. data/lib/mdbe/database_views/gsnmethod.rb +29 -0
  23. data/lib/mdbe/database_views/hash.rb +5 -0
  24. data/lib/mdbe/database_views/maglev_record.rb +42 -0
  25. data/lib/mdbe/database_views/module.rb +103 -0
  26. data/lib/mdbe/database_views/nilclass.rb +5 -0
  27. data/lib/mdbe/database_views/object.rb +80 -0
  28. data/lib/mdbe/database_views/proc.rb +3 -0
  29. data/lib/mdbe/database_views/repository.rb +3 -0
  30. data/lib/mdbe/database_views/ruby_workspace.rb +5 -0
  31. data/lib/mdbe/database_views/smalltalk_classes.rb +34 -0
  32. data/lib/mdbe/database_views/smalltalk_classes.st +60 -0
  33. data/lib/mdbe/database_views/string.rb +31 -0
  34. data/lib/mdbe/database_views/symbol.rb +32 -0
  35. data/lib/mdbe/database_views/system.rb +61 -0
  36. data/lib/mdbe/database_views/thread.rb +101 -0
  37. data/lib/mdbe/debug_server.rb +22 -0
  38. data/lib/mdbe/halt.rb +42 -0
  39. data/lib/mdbe/ruby_workspace.rb +29 -0
  40. data/lib/mdbe/version.rb +3 -0
  41. data/lib/tasks/maglev-database-explorer_tasks.rake +4 -0
  42. data/public/LICENSE +35 -0
  43. data/public/amber/CHANGELOG +65 -0
  44. data/public/amber/LICENSE +22 -0
  45. data/public/amber/Makefile +53 -0
  46. data/public/amber/README.md +30 -0
  47. data/public/amber/bin/amber +3 -0
  48. data/public/amber/bin/amberc +352 -0
  49. data/public/amber/bin/nodecompile.js +33 -0
  50. data/public/amber/bin/server +3 -0
  51. data/public/amber/bin/server.bat +3 -0
  52. data/public/amber/css/amber-normalize.css +468 -0
  53. data/public/amber/css/amber-normalize.less +501 -0
  54. data/public/amber/css/amber.css +539 -0
  55. data/public/amber/css/documentation.css +84 -0
  56. data/public/amber/css/profstef.css +75 -0
  57. data/public/amber/css/style.css +313 -0
  58. data/public/amber/documentation.html +37 -0
  59. data/public/amber/examples/Makefile +23 -0
  60. data/public/amber/examples/README +4 -0
  61. data/public/amber/examples/android/helloamber/AndroidManifest.xml +19 -0
  62. data/public/amber/examples/android/helloamber/HelloAmber.st +13 -0
  63. data/public/amber/examples/android/helloamber/Makefile +56 -0
  64. data/public/amber/examples/android/helloamber/README.md +80 -0
  65. data/public/amber/examples/android/helloamber/ant.properties +17 -0
  66. data/public/amber/examples/android/helloamber/assets/index.html +15 -0
  67. data/public/amber/examples/android/helloamber/assets/jquery-1.7.2.min.js +4 -0
  68. data/public/amber/examples/android/helloamber/build.xml +83 -0
  69. data/public/amber/examples/android/helloamber/local.properties +10 -0
  70. data/public/amber/examples/android/helloamber/proguard-project.txt +20 -0
  71. data/public/amber/examples/android/helloamber/project.properties +14 -0
  72. data/public/amber/examples/android/helloamber/res/layout/main.xml +6 -0
  73. data/public/amber/examples/android/helloamber/res/values/strings.xml +4 -0
  74. data/public/amber/examples/android/helloamber/src/org/amberlang/android/helloamber/HelloAmber.java +59 -0
  75. data/public/amber/examples/myproject/index.html +16 -0
  76. data/public/amber/examples/nodejs/README +9 -0
  77. data/public/amber/examples/nodejs/benchfib/Benchfib.st +124 -0
  78. data/public/amber/examples/nodejs/benchfib/Makefile +8 -0
  79. data/public/amber/examples/nodejs/benchfib/benchfib +1 -0
  80. data/public/amber/examples/nodejs/hello/Hello.st +9 -0
  81. data/public/amber/examples/nodejs/hello/Makefile +8 -0
  82. data/public/amber/examples/nodejs/hello/README +13 -0
  83. data/public/amber/examples/nodejs/hello/hello +1 -0
  84. data/public/amber/examples/nodejs/meta/Makefile +8 -0
  85. data/public/amber/examples/nodejs/meta/MyScript.st +27 -0
  86. data/public/amber/examples/nodejs/meta/meta +1 -0
  87. data/public/amber/examples/nodejs/pystone/Makefile +8 -0
  88. data/public/amber/examples/nodejs/pystone/Pystone.st +306 -0
  89. data/public/amber/examples/nodejs/pystone/pystone +1 -0
  90. data/public/amber/examples/nodejs/trivialserver/Makefile +8 -0
  91. data/public/amber/examples/nodejs/trivialserver/TrivialServer.st +51 -0
  92. data/public/amber/examples/nodejs/trivialserver/trivial +1 -0
  93. data/public/amber/examples/presentation/esug2011/images/asterix.png +0 -0
  94. data/public/amber/examples/presentation/esug2011/images/background_box.png +0 -0
  95. data/public/amber/examples/presentation/esug2011/images/background_header.png +0 -0
  96. data/public/amber/examples/presentation/esug2011/images/balloon.jpg +0 -0
  97. data/public/amber/examples/presentation/esug2011/images/balloon_header.png +0 -0
  98. data/public/amber/examples/presentation/esug2011/images/devices.jpg +0 -0
  99. data/public/amber/examples/presentation/esug2011/images/enyo.png +0 -0
  100. data/public/amber/examples/presentation/esug2011/images/ide_star_wars.png +0 -0
  101. data/public/amber/examples/presentation/esug2011/images/nodejs.png +0 -0
  102. data/public/amber/examples/presentation/esug2011/images/terminal.png +0 -0
  103. data/public/amber/examples/presentation/esug2011/images/webos.png +0 -0
  104. data/public/amber/examples/presentation/fosdem2012/images/amber.png +0 -0
  105. data/public/amber/examples/presentation/fosdem2012/images/ambrhino.jpg +0 -0
  106. data/public/amber/examples/presentation/fosdem2012/images/nodejs.png +0 -0
  107. data/public/amber/examples/presentation/fosdem2012/images/pharo.png +0 -0
  108. data/public/amber/examples/presentation/fosdem2012/images/php.gif +0 -0
  109. data/public/amber/examples/presentation/fosdem2012/images/rails.png +0 -0
  110. data/public/amber/examples/presentation/fosdem2012/lib/booklet/images/arrow-next.png +0 -0
  111. data/public/amber/examples/presentation/fosdem2012/lib/booklet/images/arrow-prev.png +0 -0
  112. data/public/amber/examples/presentation/fosdem2012/lib/booklet/images/closedhand.cur +0 -0
  113. data/public/amber/examples/presentation/fosdem2012/lib/booklet/images/openhand.cur +0 -0
  114. data/public/amber/examples/presentation/fosdem2012/lib/booklet/images/shadow-top-back.png +0 -0
  115. data/public/amber/examples/presentation/fosdem2012/lib/booklet/images/shadow-top-forward.png +0 -0
  116. data/public/amber/examples/presentation/fosdem2012/lib/booklet/images/shadow.png +0 -0
  117. data/public/amber/examples/presentation/fosdem2012/lib/booklet/jquery.booklet.1.2.0.css +100 -0
  118. data/public/amber/examples/presentation/fosdem2012/lib/booklet/jquery.booklet.1.2.0.js +1232 -0
  119. data/public/amber/examples/presentation/fosdem2012/lib/booklet/jquery.booklet.1.2.0.min.js +13 -0
  120. data/public/amber/examples/presentation/fosdem2012/lib/booklet/jquery.easing.1.3.js +38 -0
  121. data/public/amber/examples/presentation/index.html +17 -0
  122. data/public/amber/examples/presentation/js/Presentation.deploy.js +1922 -0
  123. data/public/amber/examples/presentation/js/Presentation.js +2712 -0
  124. data/public/amber/examples/presentation/st/Presentation.st +1996 -0
  125. data/public/amber/examples/trysmalltalk/index.html +18 -0
  126. data/public/amber/examples/trysmalltalk/js/TrySmalltalk.deploy.js +837 -0
  127. data/public/amber/examples/trysmalltalk/js/TrySmalltalk.js +1206 -0
  128. data/public/amber/examples/trysmalltalk/st/TrySmalltalk.st +964 -0
  129. data/public/amber/examples/twitterwall/css/twitterwall.css +19 -0
  130. data/public/amber/examples/twitterwall/index.html +35 -0
  131. data/public/amber/examples/twitterwall/js/TwitterWall.deploy.js +116 -0
  132. data/public/amber/examples/twitterwall/js/TwitterWall.js +146 -0
  133. data/public/amber/examples/twitterwall/st/TwitterWall.st +91 -0
  134. data/public/amber/examples/webos/README +11 -0
  135. data/public/amber/examples/webos/eris/DuckQwaq.wav +0 -0
  136. data/public/amber/examples/webos/eris/EnyoAmber.st +36 -0
  137. data/public/amber/examples/webos/eris/Eris.css +0 -0
  138. data/public/amber/examples/webos/eris/Eris.st +86 -0
  139. data/public/amber/examples/webos/eris/Makefile +37 -0
  140. data/public/amber/examples/webos/eris/README +3 -0
  141. data/public/amber/examples/webos/eris/appinfo.json +10 -0
  142. data/public/amber/examples/webos/eris/index.html +12 -0
  143. data/public/amber/examples/webos/helloamber/EnyoAmber.st +36 -0
  144. data/public/amber/examples/webos/helloamber/HelloAmber.st +86 -0
  145. data/public/amber/examples/webos/helloamber/Makefile +38 -0
  146. data/public/amber/examples/webos/helloamber/README +5 -0
  147. data/public/amber/examples/webos/helloamber/appinfo.json +10 -0
  148. data/public/amber/examples/webos/helloamber/index.html +12 -0
  149. data/public/amber/favicon.ico +0 -0
  150. data/public/amber/images/amber.png +0 -0
  151. data/public/amber/images/amber.svg +706 -0
  152. data/public/amber/images/amber_small.png +0 -0
  153. data/public/amber/images/off.amber.png +0 -0
  154. data/public/amber/images/off.png +0 -0
  155. data/public/amber/images/offHover.amber.png +0 -0
  156. data/public/amber/images/offHover.png +0 -0
  157. data/public/amber/images/presentation.png +0 -0
  158. data/public/amber/images/profstef.png +0 -0
  159. data/public/amber/images/sprite.amber.png +0 -0
  160. data/public/amber/images/sprite.png +0 -0
  161. data/public/amber/images/tinylogo.amber.png +0 -0
  162. data/public/amber/images/tinylogo.png +0 -0
  163. data/public/amber/images/twitterwall.png +0 -0
  164. data/public/amber/index.html +55 -0
  165. data/public/amber/js/Additional-Examples.deploy.js +15 -0
  166. data/public/amber/js/Additional-Examples.js +21 -0
  167. data/public/amber/js/Benchfib.deploy.js +132 -0
  168. data/public/amber/js/Benchfib.js +167 -0
  169. data/public/amber/js/Canvas.deploy.js +2446 -0
  170. data/public/amber/js/Canvas.js +3547 -0
  171. data/public/amber/js/Compiler-Tests.deploy.js +97 -0
  172. data/public/amber/js/Compiler-Tests.js +137 -0
  173. data/public/amber/js/Compiler.deploy.js +1877 -0
  174. data/public/amber/js/Compiler.js +2622 -0
  175. data/public/amber/js/Documentation.deploy.js +961 -0
  176. data/public/amber/js/Documentation.js +1376 -0
  177. data/public/amber/js/Examples.deploy.js +53 -0
  178. data/public/amber/js/Examples.js +73 -0
  179. data/public/amber/js/IDE.deploy.js +3557 -0
  180. data/public/amber/js/IDE.js +5002 -0
  181. data/public/amber/js/Kernel-Announcements.deploy.js +107 -0
  182. data/public/amber/js/Kernel-Announcements.js +152 -0
  183. data/public/amber/js/Kernel-Classes.deploy.js +774 -0
  184. data/public/amber/js/Kernel-Classes.js +1095 -0
  185. data/public/amber/js/Kernel-Collections.deploy.js +3121 -0
  186. data/public/amber/js/Kernel-Collections.js +4427 -0
  187. data/public/amber/js/Kernel-Exceptions.deploy.js +244 -0
  188. data/public/amber/js/Kernel-Exceptions.js +349 -0
  189. data/public/amber/js/Kernel-Methods.deploy.js +573 -0
  190. data/public/amber/js/Kernel-Methods.js +807 -0
  191. data/public/amber/js/Kernel-Objects.deploy.js +2877 -0
  192. data/public/amber/js/Kernel-Objects.js +4107 -0
  193. data/public/amber/js/Kernel-Tests.deploy.js +1513 -0
  194. data/public/amber/js/Kernel-Tests.js +2053 -0
  195. data/public/amber/js/Kernel-Transcript.deploy.js +142 -0
  196. data/public/amber/js/Kernel-Transcript.js +202 -0
  197. data/public/amber/js/Maglev-Core.deploy.js +2996 -0
  198. data/public/amber/js/Maglev-Core.js +4246 -0
  199. data/public/amber/js/Maglev-Database-Explorer.deploy.js +4476 -0
  200. data/public/amber/js/Maglev-Database-Explorer.js +6232 -0
  201. data/public/amber/js/Maglev-Vendor.deploy.js +350 -0
  202. data/public/amber/js/Maglev-Vendor.js +465 -0
  203. data/public/amber/js/README.md +5 -0
  204. data/public/amber/js/SUnit.deploy.js +351 -0
  205. data/public/amber/js/SUnit.js +501 -0
  206. data/public/amber/js/amber.js +273 -0
  207. data/public/amber/js/boot.js +602 -0
  208. data/public/amber/js/compat.js +22 -0
  209. data/public/amber/js/init.js +9 -0
  210. data/public/amber/js/lib/CodeMirror/LICENSE +19 -0
  211. data/public/amber/js/lib/CodeMirror/active-line.js +39 -0
  212. data/public/amber/js/lib/CodeMirror/amber.css +21 -0
  213. data/public/amber/js/lib/CodeMirror/codemirror.css +67 -0
  214. data/public/amber/js/lib/CodeMirror/codemirror.js +2144 -0
  215. data/public/amber/js/lib/CodeMirror/smalltalk.js +134 -0
  216. data/public/amber/js/lib/jQuery/jquery-1.4.4.min.js +167 -0
  217. data/public/amber/js/lib/jQuery/jquery-1.6.4.min.js +4 -0
  218. data/public/amber/js/lib/jQuery/jquery-ui-1.8.16.custom.min.js +791 -0
  219. data/public/amber/js/lib/jQuery/jquery.textarea.js +267 -0
  220. data/public/amber/js/lib/peg-0.6.2.min.js +2 -0
  221. data/public/amber/js/lib/showdown.js +419 -0
  222. data/public/amber/js/parser.js +4222 -0
  223. data/public/amber/js/parser.pegjs +223 -0
  224. data/public/amber/learn.html +40 -0
  225. data/public/amber/repl/Makefile +8 -0
  226. data/public/amber/repl/REPL.js +124 -0
  227. data/public/amber/repl/REPL.st +56 -0
  228. data/public/amber/repl/amber.js +18085 -0
  229. data/public/amber/server/FileServer.st +576 -0
  230. data/public/amber/server/Makefile +8 -0
  231. data/public/amber/server/server.js +13049 -0
  232. data/public/amber/st/Benchfib.js +297 -0
  233. data/public/amber/st/Benchfib.st +124 -0
  234. data/public/amber/st/Canvas.st +968 -0
  235. data/public/amber/st/Compiler-Tests.st +471 -0
  236. data/public/amber/st/Compiler.st +1445 -0
  237. data/public/amber/st/Documentation.st +758 -0
  238. data/public/amber/st/Examples.js +100 -0
  239. data/public/amber/st/Examples.st +38 -0
  240. data/public/amber/st/IDE.st +2404 -0
  241. data/public/amber/st/Kernel-Announcements.st +61 -0
  242. data/public/amber/st/Kernel-Classes.st +462 -0
  243. data/public/amber/st/Kernel-Collections.st +1611 -0
  244. data/public/amber/st/Kernel-Exceptions.st +124 -0
  245. data/public/amber/st/Kernel-Methods.st +291 -0
  246. data/public/amber/st/Kernel-Objects.st +1587 -0
  247. data/public/amber/st/Kernel-Tests.st +953 -0
  248. data/public/amber/st/Kernel-Transcript.st +70 -0
  249. data/public/amber/st/Maglev-Core.st +1694 -0
  250. data/public/amber/st/Maglev-Database-Explorer.st +3148 -0
  251. data/public/amber/st/Maglev-Vendor.st +151 -0
  252. data/public/amber/st/Makefile +104 -0
  253. data/public/amber/st/README.md +4 -0
  254. data/public/amber/st/SUnit.st +172 -0
  255. data/public/css/bootstrap-combined.no-icons.min.css +731 -0
  256. data/public/css/bootstrap.css +6811 -0
  257. data/public/css/images/animated-overlay.gif +0 -0
  258. data/public/css/images/ui-bg_diagonals-thick_18_b81900_40x40.png +0 -0
  259. data/public/css/images/ui-bg_diagonals-thick_20_666666_40x40.png +0 -0
  260. data/public/css/images/ui-bg_flat_10_000000_40x100.png +0 -0
  261. data/public/css/images/ui-bg_glass_100_f6f6f6_1x400.png +0 -0
  262. data/public/css/images/ui-bg_glass_100_fdf5ce_1x400.png +0 -0
  263. data/public/css/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  264. data/public/css/images/ui-bg_gloss-wave_35_f6a828_500x100.png +0 -0
  265. data/public/css/images/ui-bg_highlight-soft_100_eeeeee_1x100.png +0 -0
  266. data/public/css/images/ui-bg_highlight-soft_75_ffe45c_1x100.png +0 -0
  267. data/public/css/images/ui-icons_222222_256x240.png +0 -0
  268. data/public/css/images/ui-icons_228ef1_256x240.png +0 -0
  269. data/public/css/images/ui-icons_ef8c08_256x240.png +0 -0
  270. data/public/css/images/ui-icons_ffd27a_256x240.png +0 -0
  271. data/public/css/images/ui-icons_ffffff_256x240.png +0 -0
  272. data/public/css/jquery-ui.min.css +5 -0
  273. data/public/css/smalltalk_code.css +42 -0
  274. data/public/css/style.css +210 -0
  275. data/public/images/bg_tile.png +0 -0
  276. data/public/images/maglev-logo.gif +0 -0
  277. data/public/images/mchammer.gif +0 -0
  278. data/public/images/rails_tiny.png +0 -0
  279. data/public/images/ruby.png +0 -0
  280. data/public/images/ruby_smalltalk_bridge.png +0 -0
  281. data/public/images/smalltalk.png +0 -0
  282. data/public/img/glyphicons-halflings.png +0 -0
  283. data/public/index.html +118 -0
  284. data/public/libs/bootstrap.min.js +7 -0
  285. data/public/libs/codemirror/CONTRIBUTING.md +72 -0
  286. data/public/libs/codemirror/LICENSE +23 -0
  287. data/public/libs/codemirror/README.md +11 -0
  288. data/public/libs/codemirror/addon/dialog/dialog.css +32 -0
  289. data/public/libs/codemirror/addon/dialog/dialog.js +80 -0
  290. data/public/libs/codemirror/addon/display/placeholder.js +54 -0
  291. data/public/libs/codemirror/addon/edit/closebrackets.js +54 -0
  292. data/public/libs/codemirror/addon/edit/closetag.js +86 -0
  293. data/public/libs/codemirror/addon/edit/continuecomment.js +44 -0
  294. data/public/libs/codemirror/addon/edit/continuelist.js +25 -0
  295. data/public/libs/codemirror/addon/edit/matchbrackets.js +82 -0
  296. data/public/libs/codemirror/addon/fold/brace-fold.js +31 -0
  297. data/public/libs/codemirror/addon/fold/foldcode.js +32 -0
  298. data/public/libs/codemirror/addon/fold/indent-fold.js +11 -0
  299. data/public/libs/codemirror/addon/fold/xml-fold.js +64 -0
  300. data/public/libs/codemirror/addon/hint/html-hint.js +582 -0
  301. data/public/libs/codemirror/addon/hint/javascript-hint.js +142 -0
  302. data/public/libs/codemirror/addon/hint/pig-hint.js +117 -0
  303. data/public/libs/codemirror/addon/hint/python-hint.js +93 -0
  304. data/public/libs/codemirror/addon/hint/show-hint.css +38 -0
  305. data/public/libs/codemirror/addon/hint/show-hint.js +180 -0
  306. data/public/libs/codemirror/addon/hint/xml-hint.js +118 -0
  307. data/public/libs/codemirror/addon/lint/javascript-lint.js +127 -0
  308. data/public/libs/codemirror/addon/lint/json-lint.js +14 -0
  309. data/public/libs/codemirror/addon/lint/lint.css +96 -0
  310. data/public/libs/codemirror/addon/lint/lint.js +197 -0
  311. data/public/libs/codemirror/addon/mode/loadmode.js +51 -0
  312. data/public/libs/codemirror/addon/mode/multiplex.js +95 -0
  313. data/public/libs/codemirror/addon/mode/overlay.js +59 -0
  314. data/public/libs/codemirror/addon/runmode/colorize.js +29 -0
  315. data/public/libs/codemirror/addon/runmode/runmode-standalone.js +130 -0
  316. data/public/libs/codemirror/addon/runmode/runmode.js +52 -0
  317. data/public/libs/codemirror/addon/runmode/runmode.node.js +89 -0
  318. data/public/libs/codemirror/addon/search/match-highlighter.js +60 -0
  319. data/public/libs/codemirror/addon/search/search.js +131 -0
  320. data/public/libs/codemirror/addon/search/searchcursor.js +133 -0
  321. data/public/libs/codemirror/addon/selection/active-line.js +39 -0
  322. data/public/libs/codemirror/addon/selection/mark-selection.js +34 -0
  323. data/public/libs/codemirror/bin/compress +91 -0
  324. data/public/libs/codemirror/bin/lint +11 -0
  325. data/public/libs/codemirror/demo/activeline.html +70 -0
  326. data/public/libs/codemirror/demo/bidi.html +61 -0
  327. data/public/libs/codemirror/demo/btree.html +87 -0
  328. data/public/libs/codemirror/demo/buffers.html +98 -0
  329. data/public/libs/codemirror/demo/changemode.html +50 -0
  330. data/public/libs/codemirror/demo/closebrackets.html +63 -0
  331. data/public/libs/codemirror/demo/closetag.html +37 -0
  332. data/public/libs/codemirror/demo/complete.html +70 -0
  333. data/public/libs/codemirror/demo/emacs.html +60 -0
  334. data/public/libs/codemirror/demo/folding.html +69 -0
  335. data/public/libs/codemirror/demo/fullscreen.html +147 -0
  336. data/public/libs/codemirror/demo/html5complete.html +92 -0
  337. data/public/libs/codemirror/demo/indentwrap.html +49 -0
  338. data/public/libs/codemirror/demo/lint.html +90 -0
  339. data/public/libs/codemirror/demo/loadmode.html +40 -0
  340. data/public/libs/codemirror/demo/marker.html +59 -0
  341. data/public/libs/codemirror/demo/markselection.html +36 -0
  342. data/public/libs/codemirror/demo/matchhighlighter.html +38 -0
  343. data/public/libs/codemirror/demo/multiplex.html +60 -0
  344. data/public/libs/codemirror/demo/mustache.html +59 -0
  345. data/public/libs/codemirror/demo/placeholder.html +36 -0
  346. data/public/libs/codemirror/demo/preview.html +76 -0
  347. data/public/libs/codemirror/demo/resize.html +49 -0
  348. data/public/libs/codemirror/demo/runmode.html +50 -0
  349. data/public/libs/codemirror/demo/search.html +85 -0
  350. data/public/libs/codemirror/demo/spanaffectswrapping_shim.html +73 -0
  351. data/public/libs/codemirror/demo/theme.html +89 -0
  352. data/public/libs/codemirror/demo/variableheight.html +52 -0
  353. data/public/libs/codemirror/demo/vim.html +65 -0
  354. data/public/libs/codemirror/demo/visibletabs.html +53 -0
  355. data/public/libs/codemirror/demo/widget.html +74 -0
  356. data/public/libs/codemirror/demo/xmlcomplete.html +81 -0
  357. data/public/libs/codemirror/index.html +487 -0
  358. data/public/libs/codemirror/keymap/emacs.js +30 -0
  359. data/public/libs/codemirror/keymap/vim.js +3044 -0
  360. data/public/libs/codemirror/lib/codemirror.css +253 -0
  361. data/public/libs/codemirror/lib/codemirror.js +5585 -0
  362. data/public/libs/codemirror/mode/apl/apl.js +160 -0
  363. data/public/libs/codemirror/mode/apl/index.html +61 -0
  364. data/public/libs/codemirror/mode/asterisk/asterisk.js +183 -0
  365. data/public/libs/codemirror/mode/asterisk/index.html +142 -0
  366. data/public/libs/codemirror/mode/clike/clike.js +302 -0
  367. data/public/libs/codemirror/mode/clike/index.html +103 -0
  368. data/public/libs/codemirror/mode/clike/scala.html +767 -0
  369. data/public/libs/codemirror/mode/clojure/clojure.js +222 -0
  370. data/public/libs/codemirror/mode/clojure/index.html +76 -0
  371. data/public/libs/codemirror/mode/coffeescript/LICENSE +22 -0
  372. data/public/libs/codemirror/mode/coffeescript/coffeescript.js +346 -0
  373. data/public/libs/codemirror/mode/coffeescript/index.html +728 -0
  374. data/public/libs/codemirror/mode/commonlisp/commonlisp.js +101 -0
  375. data/public/libs/codemirror/mode/commonlisp/index.html +165 -0
  376. data/public/libs/codemirror/mode/css/css.js +567 -0
  377. data/public/libs/codemirror/mode/css/index.html +58 -0
  378. data/public/libs/codemirror/mode/css/scss.html +145 -0
  379. data/public/libs/codemirror/mode/css/scss_test.js +80 -0
  380. data/public/libs/codemirror/mode/css/test.js +113 -0
  381. data/public/libs/codemirror/mode/d/d.js +205 -0
  382. data/public/libs/codemirror/mode/d/index.html +262 -0
  383. data/public/libs/codemirror/mode/diff/diff.js +32 -0
  384. data/public/libs/codemirror/mode/diff/index.html +105 -0
  385. data/public/libs/codemirror/mode/ecl/ecl.js +192 -0
  386. data/public/libs/codemirror/mode/ecl/index.html +39 -0
  387. data/public/libs/codemirror/mode/erlang/erlang.js +463 -0
  388. data/public/libs/codemirror/mode/erlang/index.html +64 -0
  389. data/public/libs/codemirror/mode/gas/gas.js +326 -0
  390. data/public/libs/codemirror/mode/gas/index.html +57 -0
  391. data/public/libs/codemirror/mode/gfm/gfm.js +96 -0
  392. data/public/libs/codemirror/mode/gfm/index.html +74 -0
  393. data/public/libs/codemirror/mode/gfm/test.js +112 -0
  394. data/public/libs/codemirror/mode/go/go.js +165 -0
  395. data/public/libs/codemirror/mode/go/index.html +74 -0
  396. data/public/libs/codemirror/mode/groovy/groovy.js +210 -0
  397. data/public/libs/codemirror/mode/groovy/index.html +73 -0
  398. data/public/libs/codemirror/mode/haskell/haskell.js +242 -0
  399. data/public/libs/codemirror/mode/haskell/index.html +62 -0
  400. data/public/libs/codemirror/mode/haxe/haxe.js +429 -0
  401. data/public/libs/codemirror/mode/haxe/index.html +90 -0
  402. data/public/libs/codemirror/mode/htmlembedded/htmlembedded.js +73 -0
  403. data/public/libs/codemirror/mode/htmlembedded/index.html +49 -0
  404. data/public/libs/codemirror/mode/htmlmixed/htmlmixed.js +104 -0
  405. data/public/libs/codemirror/mode/htmlmixed/index.html +73 -0
  406. data/public/libs/codemirror/mode/http/http.js +98 -0
  407. data/public/libs/codemirror/mode/http/index.html +32 -0
  408. data/public/libs/codemirror/mode/javascript/index.html +92 -0
  409. data/public/libs/codemirror/mode/javascript/javascript.js +467 -0
  410. data/public/libs/codemirror/mode/javascript/typescript.html +48 -0
  411. data/public/libs/codemirror/mode/jinja2/index.html +38 -0
  412. data/public/libs/codemirror/mode/jinja2/jinja2.js +42 -0
  413. data/public/libs/codemirror/mode/less/index.html +741 -0
  414. data/public/libs/codemirror/mode/less/less.js +266 -0
  415. data/public/libs/codemirror/mode/livescript/LICENSE +23 -0
  416. data/public/libs/codemirror/mode/livescript/index.html +446 -0
  417. data/public/libs/codemirror/mode/livescript/livescript.js +267 -0
  418. data/public/libs/codemirror/mode/livescript/livescript.ls +266 -0
  419. data/public/libs/codemirror/mode/lua/index.html +74 -0
  420. data/public/libs/codemirror/mode/lua/lua.js +140 -0
  421. data/public/libs/codemirror/mode/markdown/index.html +344 -0
  422. data/public/libs/codemirror/mode/markdown/markdown.js +526 -0
  423. data/public/libs/codemirror/mode/markdown/test.js +636 -0
  424. data/public/libs/codemirror/mode/meta.js +75 -0
  425. data/public/libs/codemirror/mode/mirc/index.html +149 -0
  426. data/public/libs/codemirror/mode/mirc/mirc.js +177 -0
  427. data/public/libs/codemirror/mode/ntriples/index.html +33 -0
  428. data/public/libs/codemirror/mode/ntriples/ntriples.js +170 -0
  429. data/public/libs/codemirror/mode/ocaml/index.html +131 -0
  430. data/public/libs/codemirror/mode/ocaml/ocaml.js +113 -0
  431. data/public/libs/codemirror/mode/pascal/LICENSE +7 -0
  432. data/public/libs/codemirror/mode/pascal/index.html +48 -0
  433. data/public/libs/codemirror/mode/pascal/pascal.js +94 -0
  434. data/public/libs/codemirror/mode/perl/LICENSE +19 -0
  435. data/public/libs/codemirror/mode/perl/index.html +62 -0
  436. data/public/libs/codemirror/mode/perl/perl.js +816 -0
  437. data/public/libs/codemirror/mode/php/index.html +51 -0
  438. data/public/libs/codemirror/mode/php/php.js +129 -0
  439. data/public/libs/codemirror/mode/pig/index.html +42 -0
  440. data/public/libs/codemirror/mode/pig/pig.js +171 -0
  441. data/public/libs/codemirror/mode/properties/index.html +41 -0
  442. data/public/libs/codemirror/mode/properties/properties.js +63 -0
  443. data/public/libs/codemirror/mode/python/LICENSE.txt +21 -0
  444. data/public/libs/codemirror/mode/python/index.html +135 -0
  445. data/public/libs/codemirror/mode/python/python.js +340 -0
  446. data/public/libs/codemirror/mode/q/index.html +131 -0
  447. data/public/libs/codemirror/mode/q/q.js +124 -0
  448. data/public/libs/codemirror/mode/r/LICENSE +24 -0
  449. data/public/libs/codemirror/mode/r/index.html +74 -0
  450. data/public/libs/codemirror/mode/r/r.js +141 -0
  451. data/public/libs/codemirror/mode/rpm/changes/changes.js +19 -0
  452. data/public/libs/codemirror/mode/rpm/changes/index.html +53 -0
  453. data/public/libs/codemirror/mode/rpm/spec/index.html +99 -0
  454. data/public/libs/codemirror/mode/rpm/spec/spec.css +5 -0
  455. data/public/libs/codemirror/mode/rpm/spec/spec.js +66 -0
  456. data/public/libs/codemirror/mode/rst/LICENSE.txt +21 -0
  457. data/public/libs/codemirror/mode/rst/index.html +524 -0
  458. data/public/libs/codemirror/mode/rst/rst.js +550 -0
  459. data/public/libs/codemirror/mode/ruby/LICENSE +24 -0
  460. data/public/libs/codemirror/mode/ruby/index.html +173 -0
  461. data/public/libs/codemirror/mode/ruby/ruby.js +197 -0
  462. data/public/libs/codemirror/mode/rust/index.html +48 -0
  463. data/public/libs/codemirror/mode/rust/rust.js +432 -0
  464. data/public/libs/codemirror/mode/sass/index.html +54 -0
  465. data/public/libs/codemirror/mode/sass/sass.js +349 -0
  466. data/public/libs/codemirror/mode/scheme/index.html +65 -0
  467. data/public/libs/codemirror/mode/scheme/scheme.js +230 -0
  468. data/public/libs/codemirror/mode/shell/index.html +51 -0
  469. data/public/libs/codemirror/mode/shell/shell.js +118 -0
  470. data/public/libs/codemirror/mode/sieve/LICENSE +19 -0
  471. data/public/libs/codemirror/mode/sieve/index.html +81 -0
  472. data/public/libs/codemirror/mode/sieve/sieve.js +183 -0
  473. data/public/libs/codemirror/mode/smalltalk/index.html +57 -0
  474. data/public/libs/codemirror/mode/smalltalk/smalltalk.js +141 -0
  475. data/public/libs/codemirror/mode/smarty/index.html +83 -0
  476. data/public/libs/codemirror/mode/smarty/smarty.js +148 -0
  477. data/public/libs/codemirror/mode/sparql/index.html +42 -0
  478. data/public/libs/codemirror/mode/sparql/sparql.js +143 -0
  479. data/public/libs/codemirror/mode/sql/index.html +68 -0
  480. data/public/libs/codemirror/mode/sql/sql.js +268 -0
  481. data/public/libs/codemirror/mode/stex/index.html +98 -0
  482. data/public/libs/codemirror/mode/stex/stex.js +246 -0
  483. data/public/libs/codemirror/mode/stex/test.js +117 -0
  484. data/public/libs/codemirror/mode/tcl/index.html +129 -0
  485. data/public/libs/codemirror/mode/tcl/tcl.js +131 -0
  486. data/public/libs/codemirror/mode/tiddlywiki/index.html +142 -0
  487. data/public/libs/codemirror/mode/tiddlywiki/tiddlywiki.css +14 -0
  488. data/public/libs/codemirror/mode/tiddlywiki/tiddlywiki.js +353 -0
  489. data/public/libs/codemirror/mode/tiki/index.html +81 -0
  490. data/public/libs/codemirror/mode/tiki/tiki.css +26 -0
  491. data/public/libs/codemirror/mode/tiki/tiki.js +308 -0
  492. data/public/libs/codemirror/mode/turtle/index.html +39 -0
  493. data/public/libs/codemirror/mode/turtle/turtle.js +145 -0
  494. data/public/libs/codemirror/mode/vb/LICENSE.txt +21 -0
  495. data/public/libs/codemirror/mode/vb/index.html +88 -0
  496. data/public/libs/codemirror/mode/vb/vb.js +259 -0
  497. data/public/libs/codemirror/mode/vbscript/index.html +42 -0
  498. data/public/libs/codemirror/mode/vbscript/vbscript.js +26 -0
  499. data/public/libs/codemirror/mode/velocity/index.html +103 -0
  500. data/public/libs/codemirror/mode/velocity/velocity.js +144 -0
  501. data/public/libs/codemirror/mode/verilog/index.html +121 -0
  502. data/public/libs/codemirror/mode/verilog/verilog.js +182 -0
  503. data/public/libs/codemirror/mode/xml/index.html +45 -0
  504. data/public/libs/codemirror/mode/xml/xml.js +328 -0
  505. data/public/libs/codemirror/mode/xquery/LICENSE +20 -0
  506. data/public/libs/codemirror/mode/xquery/index.html +221 -0
  507. data/public/libs/codemirror/mode/xquery/test.js +64 -0
  508. data/public/libs/codemirror/mode/xquery/xquery.js +450 -0
  509. data/public/libs/codemirror/mode/yaml/index.html +68 -0
  510. data/public/libs/codemirror/mode/yaml/yaml.js +95 -0
  511. data/public/libs/codemirror/mode/z80/index.html +39 -0
  512. data/public/libs/codemirror/mode/z80/z80.js +85 -0
  513. data/public/libs/codemirror/package.json +21 -0
  514. data/public/libs/codemirror/test/doc_test.js +329 -0
  515. data/public/libs/codemirror/test/driver.js +138 -0
  516. data/public/libs/codemirror/test/index.html +182 -0
  517. data/public/libs/codemirror/test/lint/acorn.js +1593 -0
  518. data/public/libs/codemirror/test/lint/lint.js +112 -0
  519. data/public/libs/codemirror/test/lint/parse-js.js +1372 -0
  520. data/public/libs/codemirror/test/lint/walk.js +216 -0
  521. data/public/libs/codemirror/test/mode_test.css +10 -0
  522. data/public/libs/codemirror/test/mode_test.js +192 -0
  523. data/public/libs/codemirror/test/phantom_driver.js +31 -0
  524. data/public/libs/codemirror/test/run.js +33 -0
  525. data/public/libs/codemirror/test/test.js +1400 -0
  526. data/public/libs/codemirror/test/vim_test.js +1688 -0
  527. data/public/libs/codemirror/theme/ambiance-mobile.css +5 -0
  528. data/public/libs/codemirror/theme/ambiance.css +75 -0
  529. data/public/libs/codemirror/theme/blackboard.css +25 -0
  530. data/public/libs/codemirror/theme/cobalt.css +18 -0
  531. data/public/libs/codemirror/theme/eclipse.css +25 -0
  532. data/public/libs/codemirror/theme/elegant.css +10 -0
  533. data/public/libs/codemirror/theme/erlang-dark.css +21 -0
  534. data/public/libs/codemirror/theme/lesser-dark.css +44 -0
  535. data/public/libs/codemirror/theme/midnight.css +52 -0
  536. data/public/libs/codemirror/theme/monokai.css +28 -0
  537. data/public/libs/codemirror/theme/neat.css +9 -0
  538. data/public/libs/codemirror/theme/night.css +21 -0
  539. data/public/libs/codemirror/theme/rubyblue.css +21 -0
  540. data/public/libs/codemirror/theme/solarized.css +207 -0
  541. data/public/libs/codemirror/theme/twilight.css +26 -0
  542. data/public/libs/codemirror/theme/vibrant-ink.css +27 -0
  543. data/public/libs/codemirror/theme/xq-dark.css +46 -0
  544. data/public/libs/codemirror/theme/xq-light.css +43 -0
  545. data/public/libs/font-awesome/css/font-awesome-ie7.css +983 -0
  546. data/public/libs/font-awesome/css/font-awesome-ie7.min.css +24 -0
  547. data/public/libs/font-awesome/css/font-awesome.css +1268 -0
  548. data/public/libs/font-awesome/css/font-awesome.min.css +24 -0
  549. data/public/libs/font-awesome/font/FontAwesome.otf +0 -0
  550. data/public/libs/font-awesome/font/fontawesome-webfont.eot +0 -0
  551. data/public/libs/font-awesome/font/fontawesome-webfont.svg +339 -0
  552. data/public/libs/font-awesome/font/fontawesome-webfont.ttf +0 -0
  553. data/public/libs/font-awesome/font/fontawesome-webfont.woff +0 -0
  554. data/public/libs/font-awesome/less/bootstrap.less +78 -0
  555. data/public/libs/font-awesome/less/core.less +132 -0
  556. data/public/libs/font-awesome/less/extras.less +79 -0
  557. data/public/libs/font-awesome/less/font-awesome-ie7.less +413 -0
  558. data/public/libs/font-awesome/less/font-awesome.less +32 -0
  559. data/public/libs/font-awesome/less/icons.less +330 -0
  560. data/public/libs/font-awesome/less/mixins.less +34 -0
  561. data/public/libs/font-awesome/less/path.less +15 -0
  562. data/public/libs/font-awesome/less/variables.less +9 -0
  563. data/public/libs/jquery-1.10.0.min.js +6 -0
  564. data/public/libs/jquery-ui.min.js +12 -0
  565. data/public/libs/jquery.jsPlumb-1.4.0-all.js +9571 -0
  566. data/public/libs/jquery.livequery.js +226 -0
  567. data/public/libs/jsPlumbInitializer.js +72 -0
  568. data/public/libs/jstree/README.txt +10 -0
  569. data/public/libs/jstree/_demo/_dump.sql +20 -0
  570. data/public/libs/jstree/_demo/_inc/__mysql_errors.log +0 -0
  571. data/public/libs/jstree/_demo/_inc/class._database.php +146 -0
  572. data/public/libs/jstree/_demo/_inc/class._database_i.php +152 -0
  573. data/public/libs/jstree/_demo/_inc/class.tree.php +602 -0
  574. data/public/libs/jstree/_demo/_install.txt +6 -0
  575. data/public/libs/jstree/_demo/config.php +14 -0
  576. data/public/libs/jstree/_demo/file.png +0 -0
  577. data/public/libs/jstree/_demo/folder.png +0 -0
  578. data/public/libs/jstree/_demo/index.html +461 -0
  579. data/public/libs/jstree/_demo/root.png +0 -0
  580. data/public/libs/jstree/_demo/server.php +69 -0
  581. data/public/libs/jstree/_docs/!style.css +48 -0
  582. data/public/libs/jstree/_docs/_drive.png +0 -0
  583. data/public/libs/jstree/_docs/_html_data.html +2 -0
  584. data/public/libs/jstree/_docs/_json_data.json +4 -0
  585. data/public/libs/jstree/_docs/_search_data.json +6 -0
  586. data/public/libs/jstree/_docs/_search_result.json +1 -0
  587. data/public/libs/jstree/_docs/_xml_flat.xml +12 -0
  588. data/public/libs/jstree/_docs/_xml_nest.xml +18 -0
  589. data/public/libs/jstree/_docs/checkbox.html +171 -0
  590. data/public/libs/jstree/_docs/contextmenu.html +121 -0
  591. data/public/libs/jstree/_docs/cookies.html +97 -0
  592. data/public/libs/jstree/_docs/core.html +689 -0
  593. data/public/libs/jstree/_docs/crrm.html +316 -0
  594. data/public/libs/jstree/_docs/dnd.html +199 -0
  595. data/public/libs/jstree/_docs/hotkeys.html +82 -0
  596. data/public/libs/jstree/_docs/html_data.html +175 -0
  597. data/public/libs/jstree/_docs/index.html +86 -0
  598. data/public/libs/jstree/_docs/json_data.html +249 -0
  599. data/public/libs/jstree/_docs/languages.html +152 -0
  600. data/public/libs/jstree/_docs/logo.png +0 -0
  601. data/public/libs/jstree/_docs/search.html +153 -0
  602. data/public/libs/jstree/_docs/sort.html +85 -0
  603. data/public/libs/jstree/_docs/syntax/!script.js +2232 -0
  604. data/public/libs/jstree/_docs/syntax/!style.css +511 -0
  605. data/public/libs/jstree/_docs/syntax/clipboard.swf +0 -0
  606. data/public/libs/jstree/_docs/syntax/help.png +0 -0
  607. data/public/libs/jstree/_docs/syntax/magnifier.png +0 -0
  608. data/public/libs/jstree/_docs/syntax/page_white_code.png +0 -0
  609. data/public/libs/jstree/_docs/syntax/page_white_copy.png +0 -0
  610. data/public/libs/jstree/_docs/syntax/printer.png +0 -0
  611. data/public/libs/jstree/_docs/syntax/wrapping.png +0 -0
  612. data/public/libs/jstree/_docs/themeroller.html +107 -0
  613. data/public/libs/jstree/_docs/themes.html +127 -0
  614. data/public/libs/jstree/_docs/types.html +178 -0
  615. data/public/libs/jstree/_docs/ui.html +197 -0
  616. data/public/libs/jstree/_docs/unique.html +85 -0
  617. data/public/libs/jstree/_docs/xml_data.html +218 -0
  618. data/public/libs/jstree/_lib/jquery.cookie.js +96 -0
  619. data/public/libs/jstree/_lib/jquery.hotkeys.js +99 -0
  620. data/public/libs/jstree/_lib/jquery.js +5 -0
  621. data/public/libs/jstree/jquery.jstree.js +4564 -0
  622. data/public/libs/jstree/themes/apple/bg.jpg +0 -0
  623. data/public/libs/jstree/themes/apple/d.png +0 -0
  624. data/public/libs/jstree/themes/apple/dot_for_ie.gif +0 -0
  625. data/public/libs/jstree/themes/apple/style.css +61 -0
  626. data/public/libs/jstree/themes/apple/throbber.gif +0 -0
  627. data/public/libs/jstree/themes/classic/d.gif +0 -0
  628. data/public/libs/jstree/themes/classic/d.png +0 -0
  629. data/public/libs/jstree/themes/classic/dot_for_ie.gif +0 -0
  630. data/public/libs/jstree/themes/classic/style.css +77 -0
  631. data/public/libs/jstree/themes/classic/throbber.gif +0 -0
  632. data/public/libs/jstree/themes/default-rtl/d.gif +0 -0
  633. data/public/libs/jstree/themes/default-rtl/d.png +0 -0
  634. data/public/libs/jstree/themes/default-rtl/dots.gif +0 -0
  635. data/public/libs/jstree/themes/default-rtl/style.css +84 -0
  636. data/public/libs/jstree/themes/default-rtl/throbber.gif +0 -0
  637. data/public/libs/jstree/themes/default/d.gif +0 -0
  638. data/public/libs/jstree/themes/default/d.png +0 -0
  639. data/public/libs/jstree/themes/default/style.css +74 -0
  640. data/public/libs/jstree/themes/default/throbber.gif +0 -0
  641. data/public/themes/geo-bootstrap/README.md +25 -0
  642. data/public/themes/geo-bootstrap/img/flames.gif +0 -0
  643. data/public/themes/geo-bootstrap/img/glyphicons-halflings-white.png +0 -0
  644. data/public/themes/geo-bootstrap/img/glyphicons-halflings.png +0 -0
  645. data/public/themes/geo-bootstrap/img/microfab.gif +0 -0
  646. data/public/themes/geo-bootstrap/img/progress.gif +0 -0
  647. data/public/themes/geo-bootstrap/img/rainbow.gif +0 -0
  648. data/public/themes/geo-bootstrap/img/stars.gif +0 -0
  649. data/public/themes/geo-bootstrap/img/test/7upspot.gif +0 -0
  650. data/public/themes/geo-bootstrap/img/test/americanflag.gif +0 -0
  651. data/public/themes/geo-bootstrap/img/test/community.gif +0 -0
  652. data/public/themes/geo-bootstrap/img/test/computer-01.gif +0 -0
  653. data/public/themes/geo-bootstrap/img/test/computer.gif +0 -0
  654. data/public/themes/geo-bootstrap/img/test/construction.gif +0 -0
  655. data/public/themes/geo-bootstrap/img/test/counter.gif +0 -0
  656. data/public/themes/geo-bootstrap/img/test/counter2.gif +0 -0
  657. data/public/themes/geo-bootstrap/img/test/divider.gif +0 -0
  658. data/public/themes/geo-bootstrap/img/test/divider1.gif +0 -0
  659. data/public/themes/geo-bootstrap/img/test/divider2.gif +0 -0
  660. data/public/themes/geo-bootstrap/img/test/divider3.gif +0 -0
  661. data/public/themes/geo-bootstrap/img/test/divider4.gif +0 -0
  662. data/public/themes/geo-bootstrap/img/test/drudgesiren.gif +0 -0
  663. data/public/themes/geo-bootstrap/img/test/emailme.gif +0 -0
  664. data/public/themes/geo-bootstrap/img/test/funky.gif +0 -0
  665. data/public/themes/geo-bootstrap/img/test/geocities.jpg +0 -0
  666. data/public/themes/geo-bootstrap/img/test/hacker.gif +0 -0
  667. data/public/themes/geo-bootstrap/img/test/heart.gif +0 -0
  668. data/public/themes/geo-bootstrap/img/test/hot.gif +0 -0
  669. data/public/themes/geo-bootstrap/img/test/ie_logo.gif +0 -0
  670. data/public/themes/geo-bootstrap/img/test/mailkitten.gif +0 -0
  671. data/public/themes/geo-bootstrap/img/test/mchammer.gif +0 -0
  672. data/public/themes/geo-bootstrap/img/test/new.gif +0 -0
  673. data/public/themes/geo-bootstrap/img/test/new2.gif +0 -0
  674. data/public/themes/geo-bootstrap/img/test/noframes.gif +0 -0
  675. data/public/themes/geo-bootstrap/img/test/notepad.gif +0 -0
  676. data/public/themes/geo-bootstrap/img/test/ns_logo.gif +0 -0
  677. data/public/themes/geo-bootstrap/img/test/sign-in.gif +0 -0
  678. data/public/themes/geo-bootstrap/img/test/spinningearth.gif +0 -0
  679. data/public/themes/geo-bootstrap/img/test/underconstruction.gif +0 -0
  680. data/public/themes/geo-bootstrap/img/test/wabwalk.gif +0 -0
  681. data/public/themes/geo-bootstrap/img/test/webtrips.gif +0 -0
  682. data/public/themes/geo-bootstrap/img/test/yahooweek.gif +0 -0
  683. data/public/themes/geo-bootstrap/package.json +21 -0
  684. data/public/themes/geo-bootstrap/swatch/bootstrap-responsive.css +1109 -0
  685. data/public/themes/geo-bootstrap/swatch/bootstrap-responsive.min.css +9 -0
  686. data/public/themes/geo-bootstrap/swatch/bootstrap.css +6462 -0
  687. data/public/themes/geo-bootstrap/swatch/bootstrap.min.css +9 -0
  688. metadata +791 -0
@@ -0,0 +1,152 @@
1
+ <!DOCTYPE html
2
+ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
3
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4
+ <html xmlns="http://www.w3.org/1999/xhtml">
5
+ <head>
6
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
7
+ <title>jsTree v.1.0 - languages documentation</title>
8
+ <script type="text/javascript" src="../_lib/jquery.js"></script>
9
+ <script type="text/javascript" src="../_lib/jquery.cookie.js"></script>
10
+ <script type="text/javascript" src="../_lib/jquery.hotkeys.js"></script>
11
+ <script type="text/javascript" src="../jquery.jstree.js"></script>
12
+
13
+ <link type="text/css" rel="stylesheet" href="syntax/!style.css"/>
14
+ <link type="text/css" rel="stylesheet" href="!style.css"/>
15
+ <script type="text/javascript" src="syntax/!script.js"></script>
16
+ </head>
17
+ <body>
18
+ <div id="container">
19
+
20
+ <h1 id="dhead">jsTree v.1.0</h1>
21
+ <h1>languages plugin</h1>
22
+ <h2>Description</h2>
23
+ <div id="description">
24
+ <p>The <code>languages</code> plugin enables multilanguage trees. This means that each node has a specified number of titles - each in a different "language". Only one language set is visible at any given time. This is useful for maintaining the same structure in many languages (hence the name of the plugin)</p>
25
+ </div>
26
+
27
+ <h2 id="configuration">Configuration</h2>
28
+ <div class="panel configuration">
29
+ <p>Expects an array of language codes. Each of the items is used as a CSS class name, so make sure you specify only valid CSS class name strings. The first langauge will be visible onload. For example:</p>
30
+ <p><code>[ "en", "de", "bg" ]</code></p>
31
+ </div>
32
+
33
+ <h2 id="demos">Demos</h2>
34
+ <div class="panel">
35
+ <p>Check your data plugin documentation (<a href="html_data.html">html_data</a>, <a href="xml_data.html">xml_data</a>, <a href="json_data.html">json_data</a>) or take a close look at these examples for information on how to specify multilanguage nodes.</p>
36
+
37
+ <h3>Using the languages plugin with HTML data</h3>
38
+ <input type="button" class="button" value="en" id="en_1" style="float:left;" />
39
+ <input type="button" class="button" value="bg" id="bg_1" style="float:left;" />
40
+ <input type="button" class="button" value="rename_1" id="rename_1" style="float:left;" />
41
+ <input type="button" class="button" value="rename_2" id="rename_2" style="" />
42
+ <div id="demo1" class="demo">
43
+ <ul>
44
+ <li id="phtml_1">
45
+ <a href="#" class="en">Root node 1</a>
46
+ <a href="#" class="bg">Корен 1</a>
47
+ <ul>
48
+ <li id="phtml_2">
49
+ <a href="#" class="en">Child node 1</a>
50
+ <a href="#" class="bg">Дете 1</a>
51
+ </li>
52
+ <li id="phtml_3">
53
+ <a href="#" class="en">Child node 2</a>
54
+ <a href="#" class="bg">Дете 2</a>
55
+ </li>
56
+ </ul>
57
+ </li>
58
+ <li id="phtml_4">
59
+ <a href="#" class="en">Root node 2</a>
60
+ <a href="#" class="bg">Корен 2</a>
61
+ </li>
62
+ </ul>
63
+ </div>
64
+ <script type="text/javascript" class="source">
65
+ $(function () {
66
+ $("#en_1, #bg_1").click(function () {
67
+ $("#demo1").jstree("set_lang", this.value);
68
+ });
69
+ $("#rename_1").click(function () {
70
+ $("#demo1").jstree("rename_node", "#phtml_1", "Rename visible lang");
71
+ });
72
+ $("#rename_2").click(function () {
73
+ $("#demo1").jstree("rename_node", "#phtml_1", "Rename `bg`", "bg");
74
+ });
75
+ $("#demo1").jstree({
76
+ "languages" : [ "en", "bg" ],
77
+ "plugins" : [ "themes", "html_data", "languages","checkbox"]
78
+ });
79
+ });
80
+ </script>
81
+
82
+ </div>
83
+
84
+ <h2 id="api">API</h2>
85
+ <div class="panel api">
86
+
87
+ <h3 id="set_lang">.set_lang ( lang )</h3>
88
+ <p>Set the tree's visible language. Triggers an event.</p>
89
+ <ul class="arguments">
90
+ <li>
91
+ <code class="tp">string <br />number</code> <strong>lang</strong>
92
+ <p>Either the language code string (as specified in the config) or an index from the config array.</p>
93
+ </li>
94
+ </ul>
95
+ <h3 id="get_lang">.get_lang ( )</h3>
96
+ <p>Returns the name of the currently visible language.</p>
97
+
98
+ <h3 id="_get_string">._get_string ( node , lang )</h3>
99
+ <p>Returns the needed string from the core config object. Overwrites the <a href="core.html#_get_string">get_string function</a> from the core. If the key does not exist in that language, but exists in the root of the object - that is returned, if even that does not exist - the key itself is returned.</p>
100
+ <ul class="arguments">
101
+ <li>
102
+ <code class="tp">string</code> <strong>key</strong>
103
+ <p>The name of the string you are looking for. If you want to use the localize option just set the strings core config option to an object like this one: <code>strings : { "lang-code-here" : { "string-key" : "string-value" ... }, "other-lang" : { ... } }</code>, otherwise _get_strings won't be affected.</p>
104
+ </li>
105
+ <li>
106
+ <code class="tp">string</code> <strong>lang</strong>
107
+ <p>The language code string (as specified in the config) to get the key in. If not specified the currently visible language is used.</p>
108
+ </li>
109
+ </ul>
110
+
111
+ <h3 id="get_text">.get_text ( node , lang )</h3>
112
+ <p>Returns the title of a node. Overwrites the <a href="core.html#get_text">get_text function</a> from the core.</p>
113
+ <ul class="arguments">
114
+ <li>
115
+ <code class="tp">mixed</code> <strong>node</strong>
116
+ <p>This can be a DOM node, jQuery node or selector pointing to the element whose title you need.</p>
117
+ </li>
118
+ <li>
119
+ <code class="tp">string</code> <strong>lang</strong>
120
+ <p>The language code string (as specified in the config) to get the title in. If you omit this - the currently visible language is used.</p>
121
+ </li>
122
+ </ul>
123
+
124
+ <h3 id="set_text">.set_text ( node , text , lang )</h3>
125
+ <p>Sets the title of a node. Overwrites the <a href="core.html#set_text">set_text function</a> from the core. This is used internally - you should use <a href="core.html#rename_node">rename_node</a>. Since <code>rename_node</code> uses <code>set_text</code> internally you can pass a language string as a third parameter to rename_node.</p>
126
+ <ul class="arguments">
127
+ <li>
128
+ <code class="tp">mixed</code> <strong>node</strong>
129
+ <p>This can be a DOM node, jQuery node or selector pointing to the element whose title you want to change.</p>
130
+ </li>
131
+ <li>
132
+ <code class="tp">string</code> <strong>text</strong>
133
+ <p>The new title.</p>
134
+ </li>
135
+ <li>
136
+ <code class="tp">string</code> <strong>lang</strong>
137
+ <p>The language code string (as specified in the config) to get the title in. If you omit this - the currently visible language is used.</p>
138
+ </li>
139
+ </ul>
140
+
141
+ <h3 id="_load_css">._load_css ( )</h3>
142
+ <p>used only internally to include the CSS necessary for the plugin onload.</p>
143
+
144
+ <h3 id="create_node">.create_node ( obj , position , js , callback )</h3>
145
+ <p>Overwrites the <a href="core.html#create_node">create_node</a> function from the core. To create a node with a few titles use an array for the <code>data</code> property of the <code>js</code> parameter:</p>
146
+ <p><code>{ "data" : [ { "title" : "EN title", language : "en" }, { "title" : "BG заглавие", language : "bg" } ] }</code></p>
147
+
148
+ </div>
149
+
150
+ </div>
151
+ </body>
152
+ </html>
@@ -0,0 +1,153 @@
1
+ <!DOCTYPE html
2
+ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
3
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4
+ <html xmlns="http://www.w3.org/1999/xhtml">
5
+ <head>
6
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
7
+ <title>jsTree v.1.0 - Search documentation</title>
8
+ <script type="text/javascript" src="../_lib/jquery.js"></script>
9
+ <script type="text/javascript" src="../_lib/jquery.cookie.js"></script>
10
+ <script type="text/javascript" src="../_lib/jquery.hotkeys.js"></script>
11
+ <script type="text/javascript" src="../jquery.jstree.js"></script>
12
+
13
+ <link type="text/css" rel="stylesheet" href="syntax/!style.css"/>
14
+ <link type="text/css" rel="stylesheet" href="!style.css"/>
15
+ <script type="text/javascript" src="syntax/!script.js"></script>
16
+ </head>
17
+ <body>
18
+ <div id="container">
19
+
20
+ <h1 id="dhead">jsTree v.1.0</h1>
21
+ <h1>search plugin</h1>
22
+ <h2>Description</h2>
23
+ <div id="description">
24
+ <p>The <code>search</code> plugin enables searching for nodes whose title contains a given string, works on async trees too. All found nodes get the <code>jstree-search</code> class applied to their contained <code>a</code> nodes - you can use that class to style search results.</p>
25
+ </div>
26
+
27
+ <h2 id="configuration">Configuration</h2>
28
+ <div class="panel configuration">
29
+
30
+ <h3>search_method</h3>
31
+ <p class="meta">A string. Default is <code>"contains"</code>.</p>
32
+ <p>The method to use for searching. The other options bundled with jstree are <code>"jstree_contains"</code> (case insensitive search) and <code>"jstree_title_contains"</code> (case insensitive based on the title tag of the A node). For multiple word search take a look this: <a href="https://github.com/vakata/jstree/issues/10">https://github.com/vakata/jstree/issues/10</a> - you can easily write your own method too.</p>
33
+
34
+ <h3>show_only_matches</h3>
35
+ <p class="meta">A boolean. Default is <code>false</code>.</p>
36
+ <p>If set to <code>true</code> all non-matching nodes are hidden and only the matching nodes (and their parents) are left visible, until the search is cleared. Keep in mind <code>show_only_matches</code> is heavy on the browser/DOM and is still experimental.</p>
37
+
38
+ <h3>ajax</h3>
39
+ <p class="meta">An object (or <code>false</code> if not used). Default is <code>false</code>.</p>
40
+ <p>This object can be used to make a request to the server on each search - useful if you are using async trees. That way you can return an array of IDs that need to be loaded before the actual DOM search is performed (so that all the nodes that will match the search are loaded). For example if the user searches for "string", you get that on the server side, check the database and find out that there is a node containing that string. But the node is the child of some other node, etc - so in your response you must return the path to the node (without the node itself) as ids: <code>["#root_node","#child_node_3"]</code>. This means that jstree will load those two nodes before doing the client side search, ensuring that your node will be visible.</p>
41
+ <p>The ajax config object is pretty much the same as the <a href="http://api.jquery.com/jQuery.ajax/">jQuery ajax settings object</a>.</p>
42
+ <p>You can set the <code>data</code> option to a function, that will be executed in the current tree's scope (<code>this</code> will be the tree instance) and gets the search string as a paramater. Whatever you return in the function will be sent to the server as data.</p>
43
+ <p>You can set the <code>url</code> option to a function, that will be executed in the current tree's scope (<code>this</code> will be the tree instance) and gets the search string as a paramater. Whatever you return in the function will be used as the URL of the ajax request.</p>
44
+ <p>The <code>error</code> and <code>success</code> functions (if present) also fire in the context of the tree, and if you return a value in the <code>success</code> function it will be used as the array of IDs.</p>
45
+
46
+ </div>
47
+
48
+ <h2 id="demos">Demos</h2>
49
+ <div class="panel">
50
+
51
+ <h3>Searching nodes</h3>
52
+ <p>Do not open the node - instead - just press the button.</p>
53
+ <input type="button" class="button" value="Search" id="search" style="" />
54
+ <div id="demo1" class="demo"></div>
55
+ <script type="text/javascript" class="source">
56
+ $(function () {
57
+ $("#search").click(function () {
58
+ $("#demo1").jstree("search","TARGEt");
59
+ });
60
+ $("#demo1")
61
+ .jstree({
62
+ "json_data" : {
63
+ "data" : [
64
+ {
65
+ "attr" : { "id" : "root_node" },
66
+ "data" : "A closed node",
67
+ "state" : "closed"
68
+ }
69
+ ],
70
+ "ajax" : {
71
+ "url" : "_search_data.json",
72
+ "data" : function (n) {
73
+ return { id : n.attr ? n.attr("id") : 0 };
74
+ }
75
+ }
76
+ },
77
+ "search" : {
78
+ "case_insensitive" : true,
79
+ "ajax" : {
80
+ "url" : "_search_result.json"
81
+ }
82
+ },
83
+ "plugins" : [ "themes", "json_data", "search" ]
84
+ })
85
+ .bind("search.jstree", function (e, data) {
86
+ alert("Found " + data.rslt.nodes.length + " nodes matching '" + data.rslt.str + "'.");
87
+ });
88
+ });
89
+ </script>
90
+
91
+ <h3>Using adv_search</h3>
92
+ <p>Try pressing the buttons. It will also work with AJAX searching.</p>
93
+ <input type="button" class="button" value="search for ADV_SEARCH" id="search1" rel="ADV_SEARCH" style="float:left;" />
94
+ <input type="button" class="button" value="search for Root" id="search2" rel="Root" style="float:left;" />
95
+ <input type="button" class="button" value="search for Child" id="search3" rel="Child" style="float:left;" />
96
+ <input type="button" class="button" value="Clear search" id="clear" style="" />
97
+ <div id="demo2" class="demo">
98
+ <ul>
99
+ <li class="jstree-open"><a href="#">Root node 1</a>
100
+ <ul>
101
+ <li><a href="#">Child node 1</a></li>
102
+ <li><a href="#">Child node 2</a></li>
103
+ <li><a href="#">ADV_SEARCH</a></li>
104
+ <li><a href="#">Child node 4</a></li>
105
+ </ul>
106
+ </li>
107
+ <li><a href="#">Root node 2</a>
108
+ </ul>
109
+ </div>
110
+ <script type="text/javascript" class="source">
111
+ $(function () {
112
+ $("#search1, #search2, #search3").click(function () {
113
+ $("#demo2").jstree("search", $(this).attr("rel"));
114
+ });
115
+ $("#clear").click(function () {
116
+ $("#demo2").jstree("clear_search");
117
+ });
118
+ $("#demo2")
119
+ .jstree({
120
+ "plugins" : [ "themes", "html_data", "search", "adv_search" ]
121
+ });
122
+ });
123
+ </script>
124
+
125
+ </div>
126
+
127
+ <h2 id="api">API</h2>
128
+ <div class="panel api">
129
+
130
+ <h3 id="search">.search ( str , skip_async )</h3>
131
+ <p>Searches for nodes matching the supplied string. Triggers an event.</p>
132
+ <ul class="arguments">
133
+ <li>
134
+ <code class="tp">string</code> <strong>str</strong>
135
+ <p>The string to search for.</p>
136
+ </li>
137
+ <li>
138
+ <code class="tp">boolean</code> <strong>skip_async</strong>
139
+ <p>If set to <code>true</code> - skip the async search (if setup in the config). This is used mostly internally.</p>
140
+ </li>
141
+ </ul>
142
+
143
+ <h3 id="clear_search">.clear_search ( )</h3>
144
+ <p>Clears the current search. This function is automatically called when doing a new search. Triggers an event.</p>
145
+
146
+ <h3 id="_search_open">._search_open ( is_callback )</h3>
147
+ <p>Used internally if async is setup in the config. This functions loads the nodes returned by the server one by one.</p>
148
+
149
+ </div>
150
+
151
+ </div>
152
+ </body>
153
+ </html>
@@ -0,0 +1,85 @@
1
+ <!DOCTYPE html
2
+ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
3
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4
+ <html xmlns="http://www.w3.org/1999/xhtml">
5
+ <head>
6
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
7
+ <title>jsTree v.1.0 - sort documentation</title>
8
+ <script type="text/javascript" src="../_lib/jquery.js"></script>
9
+ <script type="text/javascript" src="../_lib/jquery.cookie.js"></script>
10
+ <script type="text/javascript" src="../_lib/jquery.hotkeys.js"></script>
11
+ <script type="text/javascript" src="../jquery.jstree.js"></script>
12
+
13
+ <link type="text/css" rel="stylesheet" href="syntax/!style.css"/>
14
+ <link type="text/css" rel="stylesheet" href="!style.css"/>
15
+ <script type="text/javascript" src="syntax/!script.js"></script>
16
+ </head>
17
+ <body>
18
+ <div id="container">
19
+
20
+ <h1 id="dhead">jsTree v.1.0</h1>
21
+ <h1>sort plugin</h1>
22
+ <h2>Description</h2>
23
+ <div id="description">
24
+ <p>The <code>sort</code> enables jstree to automatically sort all nodes using a specified function. This means that when the user creates, renames or moves nodes around - they will automatically sort.</p>
25
+ </div>
26
+
27
+ <h2 id="configuration">Configuration</h2>
28
+ <div class="panel configuration">
29
+
30
+ <p>Expects a function. The functions receives two arguments - two nodes to be compared. Return <code>-1</code> or <code>1</code> (or any other different from -1). Default is: </p>
31
+ <p><code>function (a, b) { return this.get_text(a) > this.get_text(b) ? 1 : -1; }</code></p>
32
+
33
+ </div>
34
+
35
+ <h2 id="demos">Demos</h2>
36
+ <div class="panel">
37
+ <h3>Using the sort plugin</h3>
38
+ <input type="button" class="button" value="rename" id="rename" style="" />
39
+ <div id="demo1" class="demo">
40
+ <ul>
41
+ <li id="phtml_1">
42
+ <a href="#">Root node 1</a>
43
+ <ul>
44
+ <li id="phtml_2">
45
+ <a href="#">Child node 1</a>
46
+ </li>
47
+ <li id="phtml_3">
48
+ <a href="#">Child node 2</a>
49
+ </li>
50
+ </ul>
51
+ </li>
52
+ <li id="phtml_4">
53
+ <a href="#">Root node 2</a>
54
+ </li>
55
+ </ul>
56
+ </div>
57
+ <script type="text/javascript" class="source">
58
+ $(function () {
59
+ $("#rename").click(function () {
60
+ $("#demo1").jstree("rename");
61
+ });
62
+ $("#demo1").jstree({
63
+ "plugins" : [ "themes", "html_data", "ui", "crrm", "sort" ]
64
+ });
65
+ });
66
+ </script>
67
+
68
+ </div>
69
+
70
+ <h2 id="api">API</h2>
71
+ <div class="panel api">
72
+
73
+ <h3 id="sort">.sort ( node )</h3>
74
+ <p>Sorts the children of the specified node - this function is called automatically.</p>
75
+ <ul class="arguments">
76
+ <li>
77
+ <code class="tp">mixed</code> <strong>node</strong>
78
+ <p>This can be a DOM node, jQuery node or selector pointing to the element.</p>
79
+ </li>
80
+ </ul>
81
+ </div>
82
+
83
+ </div>
84
+ </body>
85
+ </html>
@@ -0,0 +1,2232 @@
1
+ /**
2
+ * SyntaxHighlighter
3
+ * http://alexgorbatchev.com/
4
+ *
5
+ * SyntaxHighlighter is donationware. If you are using it, please donate.
6
+ * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate
7
+ *
8
+ * @version
9
+ * 2.1.364 (October 15 2009)
10
+ *
11
+ * @copyright
12
+ * Copyright (C) 2004-2009 Alex Gorbatchev.
13
+ *
14
+ * @license
15
+ * This file is part of SyntaxHighlighter.
16
+ *
17
+ * SyntaxHighlighter is free software: you can redistribute it and/or modify
18
+ * it under the terms of the GNU Lesser General Public License as published by
19
+ * the Free Software Foundation, either version 3 of the License, or
20
+ * (at your option) any later version.
21
+ *
22
+ * SyntaxHighlighter is distributed in the hope that it will be useful,
23
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
24
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25
+ * GNU General Public License for more details.
26
+ *
27
+ * You should have received a copy of the GNU General Public License
28
+ * along with SyntaxHighlighter. If not, see <http://www.gnu.org/copyleft/lesser.html>.
29
+ */
30
+ //
31
+ // Begin anonymous function. This is used to contain local scope variables without polutting global scope.
32
+ //
33
+ if (!window.SyntaxHighlighter) var SyntaxHighlighter = function() {
34
+
35
+ // Shortcut object which will be assigned to the SyntaxHighlighter variable.
36
+ // This is a shorthand for local reference in order to avoid long namespace
37
+ // references to SyntaxHighlighter.whatever...
38
+ var sh = {
39
+ defaults : {
40
+ /** Additional CSS class names to be added to highlighter elements. */
41
+ 'class-name' : '',
42
+
43
+ /** First line number. */
44
+ 'first-line' : 1,
45
+
46
+ /**
47
+ * Pads line numbers. Possible values are:
48
+ *
49
+ * false - don't pad line numbers.
50
+ * true - automaticaly pad numbers with minimum required number of leading zeroes.
51
+ * [int] - length up to which pad line numbers.
52
+ */
53
+ 'pad-line-numbers' : true,
54
+
55
+ /** Lines to highlight. */
56
+ 'highlight' : null,
57
+
58
+ /** Enables or disables smart tabs. */
59
+ 'smart-tabs' : true,
60
+
61
+ /** Gets or sets tab size. */
62
+ 'tab-size' : 4,
63
+
64
+ /** Enables or disables gutter. */
65
+ 'gutter' : true,
66
+
67
+ /** Enables or disables toolbar. */
68
+ 'toolbar' : true,
69
+
70
+ /** Forces code view to be collapsed. */
71
+ 'collapse' : false,
72
+
73
+ /** Enables or disables automatic links. */
74
+ 'auto-links' : true,
75
+
76
+ /** Gets or sets light mode. Equavalent to turning off gutter and toolbar. */
77
+ 'light' : false,
78
+
79
+ /** Enables or disables automatic line wrapping. */
80
+ 'wrap-lines' : true,
81
+
82
+ 'html-script' : false
83
+ },
84
+
85
+ config : {
86
+ /** Enables use of <SCRIPT type="syntaxhighlighter" /> tags. */
87
+ useScriptTags : true,
88
+
89
+ /** Path to the copy to clipboard SWF file. */
90
+ clipboardSwf : null,
91
+
92
+ /** Width of an item in the toolbar. */
93
+ toolbarItemWidth : 16,
94
+
95
+ /** Height of an item in the toolbar. */
96
+ toolbarItemHeight : 16,
97
+
98
+ /** Blogger mode flag. */
99
+ bloggerMode : false,
100
+
101
+ stripBrs : false,
102
+
103
+ /** Name of the tag that SyntaxHighlighter will automatically look for. */
104
+ tagName : 'pre',
105
+
106
+ strings : {
107
+ expandSource : 'show source',
108
+ viewSource : 'view source',
109
+ copyToClipboard : 'copy to clipboard',
110
+ copyToClipboardConfirmation : 'The code is in your clipboard now',
111
+ print : 'print',
112
+ help : '?',
113
+ alert: 'SyntaxHighlighter\n\n',
114
+ noBrush : 'Can\'t find brush for: ',
115
+ brushNotHtmlScript : 'Brush wasn\'t configured for html-script option: ',
116
+
117
+ // this is populated by the build script
118
+ aboutDialog : '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>About SyntaxHighlighter</title></head><body style="font-family:Geneva,Arial,Helvetica,sans-serif;background-color:#fff;color:#000;font-size:1em;text-align:center;"><div style="text-align:center;margin-top:3em;"><div style="font-size:xx-large;">SyntaxHighlighter</div><div style="font-size:.75em;margin-bottom:4em;"><div>version 2.1.364 (October 15 2009)</div><div><a href="http://alexgorbatchev.com" target="_blank" style="color:#0099FF;text-decoration:none;">http://alexgorbatchev.com</a></div><div>If you like this script, please <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=2930402" style="color:#0099FF;text-decoration:none;">donate</a> to keep development active!</div></div><div>JavaScript code syntax highlighter.</div><div>Copyright 2004-2009 Alex Gorbatchev.</div></div></body></html>'
119
+ },
120
+
121
+ /** If true, output will show HTML produces instead. */
122
+ debug : false
123
+ },
124
+
125
+ /** Internal 'global' variables. */
126
+ vars : {
127
+ discoveredBrushes : null,
128
+ spaceWidth : null,
129
+ printFrame : null,
130
+ highlighters : {}
131
+ },
132
+
133
+ /** This object is populated by user included external brush files. */
134
+ brushes : {},
135
+
136
+ /** Common regular expressions. */
137
+ regexLib : {
138
+ multiLineCComments : /\/\*[\s\S]*?\*\//gm,
139
+ singleLineCComments : /\/\/.*$/gm,
140
+ singleLinePerlComments : /#.*$/gm,
141
+ doubleQuotedString : /"([^\\"\n]|\\.)*"/g,
142
+ singleQuotedString : /'([^\\'\n]|\\.)*'/g,
143
+ multiLineDoubleQuotedString : /"([^\\"]|\\.)*"/g,
144
+ multiLineSingleQuotedString : /'([^\\']|\\.)*'/g,
145
+ xmlComments : /(&lt;|<)!--[\s\S]*?--(&gt;|>)/gm,
146
+ url : /&lt;\w+:\/\/[\w-.\/?%&=@:;]*&gt;|\w+:\/\/[\w-.\/?%&=@:;]*/g,
147
+
148
+ /** <?= ?> tags. */
149
+ phpScriptTags : { left: /(&lt;|<)\?=?/g, right: /\?(&gt;|>)/g },
150
+
151
+ /** <%= %> tags. */
152
+ aspScriptTags : { left: /(&lt;|<)%=?/g, right: /%(&gt;|>)/g },
153
+
154
+ /** <script></script> tags. */
155
+ scriptScriptTags : { left: /(&lt;|<)\s*script.*?(&gt;|>)/gi, right: /(&lt;|<)\/\s*script\s*(&gt;|>)/gi }
156
+ },
157
+
158
+ toolbar : {
159
+ /**
160
+ * Creates new toolbar for a highlighter.
161
+ * @param {Highlighter} highlighter Target highlighter.
162
+ */
163
+ create : function(highlighter)
164
+ {
165
+ var div = document.createElement('DIV'),
166
+ items = sh.toolbar.items
167
+ ;
168
+
169
+ div.className = 'toolbar';
170
+
171
+ for (var name in items)
172
+ {
173
+ var constructor = items[name],
174
+ command = new constructor(highlighter),
175
+ element = command.create()
176
+ ;
177
+
178
+ highlighter.toolbarCommands[name] = command;
179
+
180
+ if (element == null)
181
+ continue;
182
+
183
+ if (typeof(element) == 'string')
184
+ element = sh.toolbar.createButton(element, highlighter.id, name);
185
+
186
+ element.className += 'item ' + name;
187
+ div.appendChild(element);
188
+ }
189
+
190
+ return div;
191
+ },
192
+
193
+ /**
194
+ * Create a standard anchor button for the toolbar.
195
+ * @param {String} label Label text to display.
196
+ * @param {String} highlighterId Highlighter ID that this button would belong to.
197
+ * @param {String} commandName Command name that would be executed.
198
+ * @return {Element} Returns an 'A' element.
199
+ */
200
+ createButton : function(label, highlighterId, commandName)
201
+ {
202
+ var a = document.createElement('a'),
203
+ style = a.style,
204
+ config = sh.config,
205
+ width = config.toolbarItemWidth,
206
+ height = config.toolbarItemHeight
207
+ ;
208
+
209
+ a.href = '#' + commandName;
210
+ a.title = label;
211
+ a.highlighterId = highlighterId;
212
+ a.commandName = commandName;
213
+ a.innerHTML = label;
214
+
215
+ if (isNaN(width) == false)
216
+ style.width = width + 'px';
217
+
218
+ if (isNaN(height) == false)
219
+ style.height = height + 'px';
220
+
221
+ a.onclick = function(e)
222
+ {
223
+ try
224
+ {
225
+ sh.toolbar.executeCommand(
226
+ this,
227
+ e || window.event,
228
+ this.highlighterId,
229
+ this.commandName
230
+ );
231
+ }
232
+ catch(e)
233
+ {
234
+ sh.utils.alert(e.message);
235
+ }
236
+
237
+ return false;
238
+ };
239
+
240
+ return a;
241
+ },
242
+
243
+ /**
244
+ * Executes a toolbar command.
245
+ * @param {Element} sender Sender element.
246
+ * @param {MouseEvent} event Original mouse event object.
247
+ * @param {String} highlighterId Highlighter DIV element ID.
248
+ * @param {String} commandName Name of the command to execute.
249
+ * @return {Object} Passes out return value from command execution.
250
+ */
251
+ executeCommand : function(sender, event, highlighterId, commandName, args)
252
+ {
253
+ var highlighter = sh.vars.highlighters[highlighterId],
254
+ command
255
+ ;
256
+
257
+ if (highlighter == null || (command = highlighter.toolbarCommands[commandName]) == null)
258
+ return null;
259
+
260
+ return command.execute(sender, event, args);
261
+ },
262
+
263
+ /** Collection of toolbar items. */
264
+ items : {
265
+ expandSource : function(highlighter)
266
+ {
267
+ this.create = function()
268
+ {
269
+ if (highlighter.getParam('collapse') != true)
270
+ return;
271
+
272
+ return sh.config.strings.expandSource;
273
+ };
274
+
275
+ this.execute = function(sender, event, args)
276
+ {
277
+ var div = highlighter.div;
278
+
279
+ sender.parentNode.removeChild(sender);
280
+ div.className = div.className.replace('collapsed', '');
281
+ };
282
+ },
283
+
284
+ /**
285
+ * Command to open a new window and display the original unformatted source code inside.
286
+ */
287
+ viewSource : function(highlighter)
288
+ {
289
+ this.create = function()
290
+ {
291
+ return sh.config.strings.viewSource;
292
+ };
293
+
294
+ this.execute = function(sender, event, args)
295
+ {
296
+ var code = sh.utils.fixInputString(highlighter.originalCode).replace(/</g, '&lt;'),
297
+ wnd = sh.utils.popup('', '_blank', 750, 400, 'location=0, resizable=1, menubar=0, scrollbars=1')
298
+ ;
299
+
300
+ code = sh.utils.unindent(code);
301
+
302
+ wnd.document.write('<pre>' + code + '</pre>');
303
+ wnd.document.close();
304
+ };
305
+ },
306
+
307
+ /**
308
+ * Command to copy the original source code in to the clipboard.
309
+ * Uses Flash method if <code>clipboardSwf</code> is configured.
310
+ */
311
+ copyToClipboard : function(highlighter)
312
+ {
313
+ var flashDiv, flashSwf,
314
+ highlighterId = highlighter.id
315
+ ;
316
+
317
+ this.create = function()
318
+ {
319
+ var config = sh.config;
320
+
321
+ // disable functionality if running locally
322
+ if (config.clipboardSwf == null)
323
+ return null;
324
+
325
+ function params(list)
326
+ {
327
+ var result = '';
328
+
329
+ for (var name in list)
330
+ result += "<param name='" + name + "' value='" + list[name] + "'/>";
331
+
332
+ return result;
333
+ };
334
+
335
+ function attributes(list)
336
+ {
337
+ var result = '';
338
+
339
+ for (var name in list)
340
+ result += " " + name + "='" + list[name] + "'";
341
+
342
+ return result;
343
+ };
344
+
345
+ var args1 = {
346
+ width : config.toolbarItemWidth,
347
+ height : config.toolbarItemHeight,
348
+ id : highlighterId + '_clipboard',
349
+ type : 'application/x-shockwave-flash',
350
+ title : sh.config.strings.copyToClipboard
351
+ },
352
+
353
+ // these arguments are used in IE's <param /> collection
354
+ args2 = {
355
+ allowScriptAccess : 'always',
356
+ wmode : 'transparent',
357
+ flashVars : 'highlighterId=' + highlighterId,
358
+ menu : 'false'
359
+ },
360
+ swf = config.clipboardSwf,
361
+ html
362
+ ;
363
+
364
+ if (/msie/i.test(navigator.userAgent))
365
+ {
366
+ html = '<object'
367
+ + attributes({
368
+ classid : 'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000',
369
+ codebase : 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0'
370
+ })
371
+ + attributes(args1)
372
+ + '>'
373
+ + params(args2)
374
+ + params({ movie : swf })
375
+ + '</object>'
376
+ ;
377
+ }
378
+ else
379
+ {
380
+ html = '<embed'
381
+ + attributes(args1)
382
+ + attributes(args2)
383
+ + attributes({ src : swf })
384
+ + '/>'
385
+ ;
386
+ }
387
+
388
+ flashDiv = document.createElement('div');
389
+ flashDiv.innerHTML = html;
390
+
391
+ return flashDiv;
392
+ };
393
+
394
+ this.execute = function(sender, event, args)
395
+ {
396
+ var command = args.command;
397
+
398
+ switch (command)
399
+ {
400
+ case 'get':
401
+ var code = sh.utils.unindent(
402
+ sh.utils.fixInputString(highlighter.originalCode)
403
+ .replace(/&lt;/g, '<')
404
+ .replace(/&gt;/g, '>')
405
+ .replace(/&amp;/g, '&')
406
+ );
407
+
408
+ if(window.clipboardData)
409
+ // will fall through to the confirmation because there isn't a break
410
+ window.clipboardData.setData('text', code);
411
+ else
412
+ return sh.utils.unindent(code);
413
+
414
+ case 'ok':
415
+ sh.utils.alert(sh.config.strings.copyToClipboardConfirmation);
416
+ break;
417
+
418
+ case 'error':
419
+ sh.utils.alert(args.message);
420
+ break;
421
+ }
422
+ };
423
+ },
424
+
425
+ /** Command to print the colored source code. */
426
+ printSource : function(highlighter)
427
+ {
428
+ this.create = function()
429
+ {
430
+ return sh.config.strings.print;
431
+ };
432
+
433
+ this.execute = function(sender, event, args)
434
+ {
435
+ var iframe = document.createElement('IFRAME'),
436
+ doc = null
437
+ ;
438
+
439
+ // make sure there is never more than one hidden iframe created by SH
440
+ if (sh.vars.printFrame != null)
441
+ document.body.removeChild(sh.vars.printFrame);
442
+
443
+ sh.vars.printFrame = iframe;
444
+
445
+ // this hides the iframe
446
+ iframe.style.cssText = 'position:absolute;width:0px;height:0px;left:-500px;top:-500px;';
447
+
448
+ document.body.appendChild(iframe);
449
+ doc = iframe.contentWindow.document;
450
+
451
+ copyStyles(doc, window.document);
452
+ doc.write('<div class="' + highlighter.div.className.replace('collapsed', '') + ' printing">' + highlighter.div.innerHTML + '</div>');
453
+ doc.close();
454
+
455
+ iframe.contentWindow.focus();
456
+ iframe.contentWindow.print();
457
+
458
+ function copyStyles(destDoc, sourceDoc)
459
+ {
460
+ var links = sourceDoc.getElementsByTagName('link');
461
+
462
+ for(var i = 0; i < links.length; i++)
463
+ if(links[i].rel.toLowerCase() == 'stylesheet' && /shCore\.css$/.test(links[i].href))
464
+ destDoc.write('<link type="text/css" rel="stylesheet" href="' + links[i].href + '"></link>');
465
+ };
466
+ };
467
+ },
468
+
469
+ /** Command to display the about dialog window. */
470
+ about : function(highlighter)
471
+ {
472
+ this.create = function()
473
+ {
474
+ return sh.config.strings.help;
475
+ };
476
+
477
+ this.execute = function(sender, event)
478
+ {
479
+ var wnd = sh.utils.popup('', '_blank', 500, 250, 'scrollbars=0'),
480
+ doc = wnd.document
481
+ ;
482
+
483
+ doc.write(sh.config.strings.aboutDialog);
484
+ doc.close();
485
+ wnd.focus();
486
+ };
487
+ }
488
+ }
489
+ },
490
+
491
+ utils : {
492
+ /**
493
+ * Finds an index of element in the array.
494
+ * @ignore
495
+ * @param {Object} searchElement
496
+ * @param {Number} fromIndex
497
+ * @return {Number} Returns index of element if found; -1 otherwise.
498
+ */
499
+ indexOf : function(array, searchElement, fromIndex)
500
+ {
501
+ fromIndex = Math.max(fromIndex || 0, 0);
502
+
503
+ for (var i = fromIndex; i < array.length; i++)
504
+ if(array[i] == searchElement)
505
+ return i;
506
+
507
+ return -1;
508
+ },
509
+
510
+ /**
511
+ * Generates a unique element ID.
512
+ */
513
+ guid : function(prefix)
514
+ {
515
+ return prefix + Math.round(Math.random() * 1000000).toString();
516
+ },
517
+
518
+ /**
519
+ * Merges two objects. Values from obj2 override values in obj1.
520
+ * Function is NOT recursive and works only for one dimensional objects.
521
+ * @param {Object} obj1 First object.
522
+ * @param {Object} obj2 Second object.
523
+ * @return {Object} Returns combination of both objects.
524
+ */
525
+ merge: function(obj1, obj2)
526
+ {
527
+ var result = {}, name;
528
+
529
+ for (name in obj1)
530
+ result[name] = obj1[name];
531
+
532
+ for (name in obj2)
533
+ result[name] = obj2[name];
534
+
535
+ return result;
536
+ },
537
+
538
+ /**
539
+ * Attempts to convert string to boolean.
540
+ * @param {String} value Input string.
541
+ * @return {Boolean} Returns true if input was "true", false if input was "false" and value otherwise.
542
+ */
543
+ toBoolean: function(value)
544
+ {
545
+ switch (value)
546
+ {
547
+ case "true":
548
+ return true;
549
+
550
+ case "false":
551
+ return false;
552
+ }
553
+
554
+ return value;
555
+ },
556
+
557
+ /**
558
+ * Opens up a centered popup window.
559
+ * @param {String} url URL to open in the window.
560
+ * @param {String} name Popup name.
561
+ * @param {int} width Popup width.
562
+ * @param {int} height Popup height.
563
+ * @param {String} options window.open() options.
564
+ * @return {Window} Returns window instance.
565
+ */
566
+ popup: function(url, name, width, height, options)
567
+ {
568
+ var x = (screen.width - width) / 2,
569
+ y = (screen.height - height) / 2
570
+ ;
571
+
572
+ options += ', left=' + x +
573
+ ', top=' + y +
574
+ ', width=' + width +
575
+ ', height=' + height
576
+ ;
577
+ options = options.replace(/^,/, '');
578
+
579
+ var win = window.open(url, name, options);
580
+ win.focus();
581
+ return win;
582
+ },
583
+
584
+ /**
585
+ * Adds event handler to the target object.
586
+ * @param {Object} obj Target object.
587
+ * @param {String} type Name of the event.
588
+ * @param {Function} func Handling function.
589
+ */
590
+ addEvent: function(obj, type, func)
591
+ {
592
+ if (obj.attachEvent)
593
+ {
594
+ obj['e' + type + func] = func;
595
+ obj[type + func] = function()
596
+ {
597
+ obj['e' + type + func](window.event);
598
+ }
599
+ obj.attachEvent('on' + type, obj[type + func]);
600
+ }
601
+ else
602
+ {
603
+ obj.addEventListener(type, func, false);
604
+ }
605
+ },
606
+
607
+ /**
608
+ * Displays an alert.
609
+ * @param {String} str String to display.
610
+ */
611
+ alert: function(str)
612
+ {
613
+ alert(sh.config.strings.alert + str)
614
+ },
615
+
616
+ /**
617
+ * Finds a brush by its alias.
618
+ *
619
+ * @param {String} alias Brush alias.
620
+ * @param {Boolean} alert Suppresses the alert if false.
621
+ * @return {Brush} Returns bursh constructor if found, null otherwise.
622
+ */
623
+ findBrush: function(alias, alert)
624
+ {
625
+ var brushes = sh.vars.discoveredBrushes,
626
+ result = null
627
+ ;
628
+
629
+ if (brushes == null)
630
+ {
631
+ brushes = {};
632
+
633
+ // Find all brushes
634
+ for (var brush in sh.brushes)
635
+ {
636
+ var aliases = sh.brushes[brush].aliases;
637
+
638
+ if (aliases == null)
639
+ continue;
640
+
641
+ // keep the brush name
642
+ sh.brushes[brush].name = brush.toLowerCase();
643
+
644
+ for (var i = 0; i < aliases.length; i++)
645
+ brushes[aliases[i]] = brush;
646
+ }
647
+
648
+ sh.vars.discoveredBrushes = brushes;
649
+ }
650
+
651
+ result = sh.brushes[brushes[alias]];
652
+
653
+ if (result == null && alert != false)
654
+ sh.utils.alert(sh.config.strings.noBrush + alias);
655
+
656
+ return result;
657
+ },
658
+
659
+ /**
660
+ * Executes a callback on each line and replaces each line with result from the callback.
661
+ * @param {Object} str Input string.
662
+ * @param {Object} callback Callback function taking one string argument and returning a string.
663
+ */
664
+ eachLine: function(str, callback)
665
+ {
666
+ var lines = str.split('\n');
667
+
668
+ for (var i = 0; i < lines.length; i++)
669
+ lines[i] = callback(lines[i]);
670
+
671
+ return lines.join('\n');
672
+ },
673
+
674
+ /**
675
+ * This is a special trim which only removes first and last empty lines
676
+ * and doesn't affect valid leading space on the first line.
677
+ *
678
+ * @param {String} str Input string
679
+ * @return {String} Returns string without empty first and last lines.
680
+ */
681
+ trimFirstAndLastLines: function(str)
682
+ {
683
+ return str.replace(/^[ ]*[\n]+|[\n]*[ ]*$/g, '');
684
+ },
685
+
686
+ /**
687
+ * Parses key/value pairs into hash object.
688
+ *
689
+ * Understands the following formats:
690
+ * - name: word;
691
+ * - name: [word, word];
692
+ * - name: "string";
693
+ * - name: 'string';
694
+ *
695
+ * For example:
696
+ * name1: value; name2: [value, value]; name3: 'value'
697
+ *
698
+ * @param {String} str Input string.
699
+ * @return {Object} Returns deserialized object.
700
+ */
701
+ parseParams: function(str)
702
+ {
703
+ var match,
704
+ result = {},
705
+ arrayRegex = new XRegExp("^\\[(?<values>(.*?))\\]$"),
706
+ regex = new XRegExp(
707
+ "(?<name>[\\w-]+)" +
708
+ "\\s*:\\s*" +
709
+ "(?<value>" +
710
+ "[\\w-%#]+|" + // word
711
+ "\\[.*?\\]|" + // [] array
712
+ '".*?"|' + // "" string
713
+ "'.*?'" + // '' string
714
+ ")\\s*;?",
715
+ "g"
716
+ )
717
+ ;
718
+
719
+ while ((match = regex.exec(str)) != null)
720
+ {
721
+ var value = match.value
722
+ .replace(/^['"]|['"]$/g, '') // strip quotes from end of strings
723
+ ;
724
+
725
+ // try to parse array value
726
+ if (value != null && arrayRegex.test(value))
727
+ {
728
+ var m = arrayRegex.exec(value);
729
+ value = m.values.length > 0 ? m.values.split(/\s*,\s*/) : [];
730
+ }
731
+
732
+ result[match.name] = value;
733
+ }
734
+
735
+ return result;
736
+ },
737
+
738
+ /**
739
+ * Wraps each line of the string into <code/> tag with given style applied to it.
740
+ *
741
+ * @param {String} str Input string.
742
+ * @param {String} css Style name to apply to the string.
743
+ * @return {String} Returns input string with each line surrounded by <span/> tag.
744
+ */
745
+ decorate: function(str, css)
746
+ {
747
+ if (str == null || str.length == 0 || str == '\n')
748
+ return str;
749
+
750
+ str = str.replace(/</g, '&lt;');
751
+
752
+ // Replace two or more sequential spaces with &nbsp; leaving last space untouched.
753
+ str = str.replace(/ {2,}/g, function(m)
754
+ {
755
+ var spaces = '';
756
+
757
+ for (var i = 0; i < m.length - 1; i++)
758
+ spaces += '&nbsp;';
759
+
760
+ return spaces + ' ';
761
+ });
762
+
763
+ // Split each line and apply <span class="...">...</span> to them so that
764
+ // leading spaces aren't included.
765
+ if (css != null)
766
+ str = sh.utils.eachLine(str, function(line)
767
+ {
768
+ if (line.length == 0)
769
+ return '';
770
+
771
+ var spaces = '';
772
+
773
+ line = line.replace(/^(&nbsp;| )+/, function(s)
774
+ {
775
+ spaces = s;
776
+ return '';
777
+ });
778
+
779
+ if (line.length == 0)
780
+ return spaces;
781
+
782
+ return spaces + '<code class="' + css + '">' + line + '</code>';
783
+ });
784
+
785
+ return str;
786
+ },
787
+
788
+ /**
789
+ * Pads number with zeros until it's length is the same as given length.
790
+ *
791
+ * @param {Number} number Number to pad.
792
+ * @param {Number} length Max string length with.
793
+ * @return {String} Returns a string padded with proper amount of '0'.
794
+ */
795
+ padNumber : function(number, length)
796
+ {
797
+ var result = number.toString();
798
+
799
+ while (result.length < length)
800
+ result = '0' + result;
801
+
802
+ return result;
803
+ },
804
+
805
+ /**
806
+ * Measures width of a single space character.
807
+ * @return {Number} Returns width of a single space character.
808
+ */
809
+ measureSpace : function()
810
+ {
811
+ var container = document.createElement('div'),
812
+ span,
813
+ result = 0,
814
+ body = document.body,
815
+ id = sh.utils.guid('measureSpace'),
816
+
817
+ // variable names will be compressed, so it's better than a plain string
818
+ divOpen = '<div class="',
819
+ closeDiv = '</div>',
820
+ closeSpan = '</span>'
821
+ ;
822
+
823
+ // we have to duplicate highlighter nested structure in order to get an acurate space measurment
824
+ container.innerHTML =
825
+ divOpen + 'syntaxhighlighter">'
826
+ + divOpen + 'lines">'
827
+ + divOpen + 'line">'
828
+ + divOpen + 'content'
829
+ + '"><span class="block"><span id="' + id + '">&nbsp;' + closeSpan + closeSpan
830
+ + closeDiv
831
+ + closeDiv
832
+ + closeDiv
833
+ + closeDiv
834
+ ;
835
+
836
+ body.appendChild(container);
837
+ span = document.getElementById(id);
838
+
839
+ if (/opera/i.test(navigator.userAgent))
840
+ {
841
+ var style = window.getComputedStyle(span, null);
842
+ result = parseInt(style.getPropertyValue("width"));
843
+ }
844
+ else
845
+ {
846
+ result = span.offsetWidth;
847
+ }
848
+
849
+ body.removeChild(container);
850
+
851
+ return result;
852
+ },
853
+
854
+ /**
855
+ * Replaces tabs with spaces.
856
+ *
857
+ * @param {String} code Source code.
858
+ * @param {Number} tabSize Size of the tab.
859
+ * @return {String} Returns code with all tabs replaces by spaces.
860
+ */
861
+ processTabs : function(code, tabSize)
862
+ {
863
+ var tab = '';
864
+
865
+ for (var i = 0; i < tabSize; i++)
866
+ tab += ' ';
867
+
868
+ return code.replace(/\t/g, tab);
869
+ },
870
+
871
+ /**
872
+ * Replaces tabs with smart spaces.
873
+ *
874
+ * @param {String} code Code to fix the tabs in.
875
+ * @param {Number} tabSize Number of spaces in a column.
876
+ * @return {String} Returns code with all tabs replaces with roper amount of spaces.
877
+ */
878
+ processSmartTabs : function(code, tabSize)
879
+ {
880
+ var lines = code.split('\n'),
881
+ tab = '\t',
882
+ spaces = ''
883
+ ;
884
+
885
+ // Create a string with 1000 spaces to copy spaces from...
886
+ // It's assumed that there would be no indentation longer than that.
887
+ for (var i = 0; i < 50; i++)
888
+ spaces += ' '; // 20 spaces * 50
889
+
890
+ // This function inserts specified amount of spaces in the string
891
+ // where a tab is while removing that given tab.
892
+ function insertSpaces(line, pos, count)
893
+ {
894
+ return line.substr(0, pos)
895
+ + spaces.substr(0, count)
896
+ + line.substr(pos + 1, line.length) // pos + 1 will get rid of the tab
897
+ ;
898
+ };
899
+
900
+ // Go through all the lines and do the 'smart tabs' magic.
901
+ code = sh.utils.eachLine(code, function(line)
902
+ {
903
+ if (line.indexOf(tab) == -1)
904
+ return line;
905
+
906
+ var pos = 0;
907
+
908
+ while ((pos = line.indexOf(tab)) != -1)
909
+ {
910
+ // This is pretty much all there is to the 'smart tabs' logic.
911
+ // Based on the position within the line and size of a tab,
912
+ // calculate the amount of spaces we need to insert.
913
+ var spaces = tabSize - pos % tabSize;
914
+ line = insertSpaces(line, pos, spaces);
915
+ }
916
+
917
+ return line;
918
+ });
919
+
920
+ return code;
921
+ },
922
+
923
+ /**
924
+ * Performs various string fixes based on configuration.
925
+ */
926
+ fixInputString : function(str)
927
+ {
928
+ var br = /<br\s*\/?>|&lt;br\s*\/?&gt;/gi;
929
+
930
+ if (sh.config.bloggerMode == true)
931
+ str = str.replace(br, '\n');
932
+
933
+ if (sh.config.stripBrs == true)
934
+ str = str.replace(br, '');
935
+
936
+ return str;
937
+ },
938
+
939
+ /**
940
+ * Removes all white space at the begining and end of a string.
941
+ *
942
+ * @param {String} str String to trim.
943
+ * @return {String} Returns string without leading and following white space characters.
944
+ */
945
+ trim: function(str)
946
+ {
947
+ return str.replace(/^\s+|\s+$/g, '');
948
+ },
949
+
950
+ /**
951
+ * Unindents a block of text by the lowest common indent amount.
952
+ * @param {String} str Text to unindent.
953
+ * @return {String} Returns unindented text block.
954
+ */
955
+ unindent: function(str)
956
+ {
957
+ var lines = sh.utils.fixInputString(str).split('\n'),
958
+ indents = new Array(),
959
+ regex = /^\s*/,
960
+ min = 1000
961
+ ;
962
+
963
+ // go through every line and check for common number of indents
964
+ for (var i = 0; i < lines.length && min > 0; i++)
965
+ {
966
+ var line = lines[i];
967
+
968
+ if (sh.utils.trim(line).length == 0)
969
+ continue;
970
+
971
+ var matches = regex.exec(line);
972
+
973
+ // In the event that just one line doesn't have leading white space
974
+ // we can't unindent anything, so bail completely.
975
+ if (matches == null)
976
+ return str;
977
+
978
+ min = Math.min(matches[0].length, min);
979
+ }
980
+
981
+ // trim minimum common number of white space from the begining of every line
982
+ if (min > 0)
983
+ for (var i = 0; i < lines.length; i++)
984
+ lines[i] = lines[i].substr(min);
985
+
986
+ return lines.join('\n');
987
+ },
988
+
989
+ /**
990
+ * Callback method for Array.sort() which sorts matches by
991
+ * index position and then by length.
992
+ *
993
+ * @param {Match} m1 Left object.
994
+ * @param {Match} m2 Right object.
995
+ * @return {Number} Returns -1, 0 or -1 as a comparison result.
996
+ */
997
+ matchesSortCallback: function(m1, m2)
998
+ {
999
+ // sort matches by index first
1000
+ if(m1.index < m2.index)
1001
+ return -1;
1002
+ else if(m1.index > m2.index)
1003
+ return 1;
1004
+ else
1005
+ {
1006
+ // if index is the same, sort by length
1007
+ if(m1.length < m2.length)
1008
+ return -1;
1009
+ else if(m1.length > m2.length)
1010
+ return 1;
1011
+ }
1012
+
1013
+ return 0;
1014
+ },
1015
+
1016
+ /**
1017
+ * Executes given regular expression on provided code and returns all
1018
+ * matches that are found.
1019
+ *
1020
+ * @param {String} code Code to execute regular expression on.
1021
+ * @param {Object} regex Regular expression item info from <code>regexList</code> collection.
1022
+ * @return {Array} Returns a list of Match objects.
1023
+ */
1024
+ getMatches: function(code, regexInfo)
1025
+ {
1026
+ function defaultAdd(match, regexInfo)
1027
+ {
1028
+ return [new sh.Match(match[0], match.index, regexInfo.css)];
1029
+ };
1030
+
1031
+ var index = 0,
1032
+ match = null,
1033
+ result = [],
1034
+ func = regexInfo.func ? regexInfo.func : defaultAdd
1035
+ ;
1036
+
1037
+ while((match = regexInfo.regex.exec(code)) != null)
1038
+ result = result.concat(func(match, regexInfo));
1039
+
1040
+ return result;
1041
+ },
1042
+
1043
+ processUrls: function(code)
1044
+ {
1045
+ var lt = '&lt;',
1046
+ gt = '&gt;'
1047
+ ;
1048
+
1049
+ return code.replace(sh.regexLib.url, function(m)
1050
+ {
1051
+ var suffix = '', prefix = '';
1052
+
1053
+ // We include &lt; and &gt; in the URL for the common cases like <http://google.com>
1054
+ // The problem is that they get transformed into &lt;http://google.com&gt;
1055
+ // Where as &gt; easily looks like part of the URL string.
1056
+
1057
+ if (m.indexOf(lt) == 0)
1058
+ {
1059
+ prefix = lt;
1060
+ m = m.substring(lt.length);
1061
+ }
1062
+
1063
+ if (m.indexOf(gt) == m.length - gt.length)
1064
+ {
1065
+ m = m.substring(0, m.length - gt.length);
1066
+ suffix = gt;
1067
+ }
1068
+
1069
+ return prefix + '<a href="' + m + '">' + m + '</a>' + suffix;
1070
+ });
1071
+ },
1072
+
1073
+ /**
1074
+ * Finds all <SCRIPT TYPE="syntaxhighlighter" /> elements.
1075
+ * @return {Array} Returns array of all found SyntaxHighlighter tags.
1076
+ */
1077
+ getSyntaxHighlighterScriptTags: function()
1078
+ {
1079
+ var tags = document.getElementsByTagName('script'),
1080
+ result = []
1081
+ ;
1082
+
1083
+ for (var i = 0; i < tags.length; i++)
1084
+ if (tags[i].type == 'syntaxhighlighter')
1085
+ result.push(tags[i]);
1086
+
1087
+ return result;
1088
+ },
1089
+
1090
+ /**
1091
+ * Strips <![CDATA[]]> from <SCRIPT /> content because it should be used
1092
+ * there in most cases for XHTML compliance.
1093
+ * @param {String} original Input code.
1094
+ * @return {String} Returns code without leading <![CDATA[]]> tags.
1095
+ */
1096
+ stripCData: function(original)
1097
+ {
1098
+ var left = '<![CDATA[',
1099
+ right = ']]>',
1100
+ // for some reason IE inserts some leading blanks here
1101
+ copy = sh.utils.trim(original),
1102
+ changed = false
1103
+ ;
1104
+
1105
+ if (copy.indexOf(left) == 0)
1106
+ {
1107
+ copy = copy.substring(left.length);
1108
+ changed = true;
1109
+ }
1110
+
1111
+ if (copy.indexOf(right) == copy.length - right.length)
1112
+ {
1113
+ copy = copy.substring(0, copy.length - right.length);
1114
+ changed = true;
1115
+ }
1116
+
1117
+ return changed ? copy : original;
1118
+ }
1119
+ }, // end of utils
1120
+
1121
+ /**
1122
+ * Shorthand to highlight all elements on the page that are marked as
1123
+ * SyntaxHighlighter source code.
1124
+ *
1125
+ * @param {Object} globalParams Optional parameters which override element's
1126
+ * parameters. Only used if element is specified.
1127
+ *
1128
+ * @param {Object} element Optional element to highlight. If none is
1129
+ * provided, all elements in the current document
1130
+ * are highlighted.
1131
+ */
1132
+ highlight : function(globalParams, element)
1133
+ {
1134
+ function toArray(source)
1135
+ {
1136
+ var result = [];
1137
+
1138
+ for (var i = 0; i < source.length; i++)
1139
+ result.push(source[i]);
1140
+
1141
+ return result;
1142
+ };
1143
+
1144
+ var elements = element ? [element] : toArray(document.getElementsByTagName(sh.config.tagName)),
1145
+ propertyName = 'innerHTML',
1146
+ highlighter = null,
1147
+ conf = sh.config
1148
+ ;
1149
+
1150
+ // support for <SCRIPT TYPE="syntaxhighlighter" /> feature
1151
+ if (conf.useScriptTags)
1152
+ elements = elements.concat(sh.utils.getSyntaxHighlighterScriptTags());
1153
+
1154
+ if (elements.length === 0)
1155
+ return;
1156
+
1157
+ for (var i = 0; i < elements.length; i++)
1158
+ {
1159
+ var target = elements[i],
1160
+ params = sh.utils.parseParams(target.className),
1161
+ brushName,
1162
+ code,
1163
+ result
1164
+ ;
1165
+
1166
+ // local params take precedence over globals
1167
+ params = sh.utils.merge(globalParams, params);
1168
+ brushName = params['brush'];
1169
+
1170
+ if (brushName == null)
1171
+ continue;
1172
+
1173
+ // Instantiate a brush
1174
+ if (params['html-script'] == 'true' || sh.defaults['html-script'] == true)
1175
+ {
1176
+ highlighter = new sh.HtmlScript(brushName);
1177
+ brushName = 'htmlscript';
1178
+ }
1179
+ else
1180
+ {
1181
+ var brush = sh.utils.findBrush(brushName);
1182
+
1183
+ if (brush)
1184
+ {
1185
+ brushName = brush.name;
1186
+ highlighter = new brush();
1187
+ }
1188
+ else
1189
+ {
1190
+ continue;
1191
+ }
1192
+ }
1193
+
1194
+ code = target[propertyName];
1195
+
1196
+ // remove CDATA from <SCRIPT/> tags if it's present
1197
+ if (conf.useScriptTags)
1198
+ code = sh.utils.stripCData(code);
1199
+
1200
+ params['brush-name'] = brushName;
1201
+ highlighter.highlight(code, params);
1202
+
1203
+ result = highlighter.div;
1204
+
1205
+ if (sh.config.debug)
1206
+ {
1207
+ result = document.createElement('textarea');
1208
+ result.value = highlighter.div.innerHTML;
1209
+ result.style.width = '70em';
1210
+ result.style.height = '30em';
1211
+ }
1212
+
1213
+ target.parentNode.replaceChild(result, target);
1214
+ }
1215
+ },
1216
+
1217
+ /**
1218
+ * Main entry point for the SyntaxHighlighter.
1219
+ * @param {Object} params Optional params to apply to all highlighted elements.
1220
+ */
1221
+ all : function(params)
1222
+ {
1223
+ sh.utils.addEvent(
1224
+ window,
1225
+ 'load',
1226
+ function() { sh.highlight(params); }
1227
+ );
1228
+ }
1229
+ }; // end of sh
1230
+
1231
+ /**
1232
+ * Match object.
1233
+ */
1234
+ sh.Match = function(value, index, css)
1235
+ {
1236
+ this.value = value;
1237
+ this.index = index;
1238
+ this.length = value.length;
1239
+ this.css = css;
1240
+ this.brushName = null;
1241
+ };
1242
+
1243
+ sh.Match.prototype.toString = function()
1244
+ {
1245
+ return this.value;
1246
+ };
1247
+
1248
+ /**
1249
+ * Simulates HTML code with a scripting language embedded.
1250
+ *
1251
+ * @param {String} scriptBrushName Brush name of the scripting language.
1252
+ */
1253
+ sh.HtmlScript = function(scriptBrushName)
1254
+ {
1255
+ var brushClass = sh.utils.findBrush(scriptBrushName),
1256
+ scriptBrush,
1257
+ xmlBrush = new sh.brushes.Xml(),
1258
+ bracketsRegex = null
1259
+ ;
1260
+
1261
+ if (brushClass == null)
1262
+ return;
1263
+
1264
+ scriptBrush = new brushClass();
1265
+ this.xmlBrush = xmlBrush;
1266
+
1267
+ if (scriptBrush.htmlScript == null)
1268
+ {
1269
+ sh.utils.alert(sh.config.strings.brushNotHtmlScript + scriptBrushName);
1270
+ return;
1271
+ }
1272
+
1273
+ xmlBrush.regexList.push(
1274
+ { regex: scriptBrush.htmlScript.code, func: process }
1275
+ );
1276
+
1277
+ function offsetMatches(matches, offset)
1278
+ {
1279
+ for (var j = 0; j < matches.length; j++)
1280
+ matches[j].index += offset;
1281
+ }
1282
+
1283
+ function process(match, info)
1284
+ {
1285
+ var code = match.code,
1286
+ matches = [],
1287
+ regexList = scriptBrush.regexList,
1288
+ offset = match.index + match.left.length,
1289
+ htmlScript = scriptBrush.htmlScript,
1290
+ result
1291
+ ;
1292
+
1293
+ // add all matches from the code
1294
+ for (var i = 0; i < regexList.length; i++)
1295
+ {
1296
+ result = sh.utils.getMatches(code, regexList[i]);
1297
+ offsetMatches(result, offset);
1298
+ matches = matches.concat(result);
1299
+ }
1300
+
1301
+ // add left script bracket
1302
+ if (htmlScript.left != null && match.left != null)
1303
+ {
1304
+ result = sh.utils.getMatches(match.left, htmlScript.left);
1305
+ offsetMatches(result, match.index);
1306
+ matches = matches.concat(result);
1307
+ }
1308
+
1309
+ // add right script bracket
1310
+ if (htmlScript.right != null && match.right != null)
1311
+ {
1312
+ result = sh.utils.getMatches(match.right, htmlScript.right);
1313
+ offsetMatches(result, match.index + match[0].lastIndexOf(match.right));
1314
+ matches = matches.concat(result);
1315
+ }
1316
+
1317
+ for (var j = 0; j < matches.length; j++)
1318
+ matches[j].brushName = brushClass.name;
1319
+
1320
+ return matches;
1321
+ }
1322
+ };
1323
+
1324
+ sh.HtmlScript.prototype.highlight = function(code, params)
1325
+ {
1326
+ this.xmlBrush.highlight(code, params);
1327
+ this.div = this.xmlBrush.div;
1328
+ }
1329
+
1330
+ /**
1331
+ * Main Highlither class.
1332
+ * @constructor
1333
+ */
1334
+ sh.Highlighter = function()
1335
+ {
1336
+ };
1337
+
1338
+ sh.Highlighter.prototype = {
1339
+ /**
1340
+ * Returns value of the parameter passed to the highlighter.
1341
+ * @param {String} name Name of the parameter.
1342
+ * @param {Object} defaultValue Default value.
1343
+ * @return {Object} Returns found value or default value otherwise.
1344
+ */
1345
+ getParam : function(name, defaultValue)
1346
+ {
1347
+ var result = this.params[name];
1348
+ return sh.utils.toBoolean(result == null ? defaultValue : result);
1349
+ },
1350
+
1351
+ /**
1352
+ * Shortcut to document.createElement().
1353
+ * @param {String} name Name of the element to create (DIV, A, etc).
1354
+ * @return {HTMLElement} Returns new HTML element.
1355
+ */
1356
+ create: function(name)
1357
+ {
1358
+ return document.createElement(name);
1359
+ },
1360
+
1361
+ /**
1362
+ * Applies all regular expression to the code and stores all found
1363
+ * matches in the `this.matches` array.
1364
+ * @param {Array} regexList List of regular expressions.
1365
+ * @param {String} code Source code.
1366
+ * @return {Array} Returns list of matches.
1367
+ */
1368
+ findMatches: function(regexList, code)
1369
+ {
1370
+ var result = [];
1371
+
1372
+ if (regexList != null)
1373
+ for (var i = 0; i < regexList.length; i++)
1374
+ // BUG: length returns len+1 for array if methods added to prototype chain (oising@gmail.com)
1375
+ if (typeof (regexList[i]) == "object")
1376
+ result = result.concat(sh.utils.getMatches(code, regexList[i]));
1377
+
1378
+ // sort the matches
1379
+ return result.sort(sh.utils.matchesSortCallback);
1380
+ },
1381
+
1382
+ /**
1383
+ * Checks to see if any of the matches are inside of other matches.
1384
+ * This process would get rid of highligted strings inside comments,
1385
+ * keywords inside strings and so on.
1386
+ */
1387
+ removeNestedMatches: function()
1388
+ {
1389
+ var matches = this.matches;
1390
+
1391
+ // Optimized by Jose Prado (http://joseprado.com)
1392
+ for (var i = 0; i < matches.length; i++)
1393
+ {
1394
+ if (matches[i] === null)
1395
+ continue;
1396
+
1397
+ var itemI = matches[i],
1398
+ itemIEndPos = itemI.index + itemI.length
1399
+ ;
1400
+
1401
+ for (var j = i + 1; j < matches.length && matches[i] !== null; j++)
1402
+ {
1403
+ var itemJ = matches[j];
1404
+
1405
+ if (itemJ === null)
1406
+ continue;
1407
+ else if (itemJ.index > itemIEndPos)
1408
+ break;
1409
+ else if (itemJ.index == itemI.index && itemJ.length > itemI.length)
1410
+ this.matches[i] = null;
1411
+ else if (itemJ.index >= itemI.index && itemJ.index < itemIEndPos)
1412
+ this.matches[j] = null;
1413
+ }
1414
+ }
1415
+ },
1416
+
1417
+ /**
1418
+ * Splits block of text into individual DIV lines.
1419
+ * @param {String} code Code to highlight.
1420
+ * @return {String} Returns highlighted code in HTML form.
1421
+ */
1422
+ createDisplayLines : function(code)
1423
+ {
1424
+ var lines = code.split(/\n/g),
1425
+ firstLine = parseInt(this.getParam('first-line')),
1426
+ padLength = this.getParam('pad-line-numbers'),
1427
+ highlightedLines = this.getParam('highlight', []),
1428
+ hasGutter = this.getParam('gutter')
1429
+ ;
1430
+
1431
+ code = '';
1432
+
1433
+ if (padLength == true)
1434
+ padLength = (firstLine + lines.length - 1).toString().length;
1435
+ else if (isNaN(padLength) == true)
1436
+ padLength = 0;
1437
+
1438
+ for (var i = 0; i < lines.length; i++)
1439
+ {
1440
+ var line = lines[i],
1441
+ indent = /^(&nbsp;|\s)+/.exec(line),
1442
+ lineClass = 'alt' + (i % 2 == 0 ? 1 : 2),
1443
+ lineNumber = sh.utils.padNumber(firstLine + i, padLength),
1444
+ highlighted = sh.utils.indexOf(highlightedLines, (firstLine + i).toString()) != -1,
1445
+ spaces = null
1446
+ ;
1447
+
1448
+ if (indent != null)
1449
+ {
1450
+ spaces = indent[0].toString();
1451
+ line = line.substr(spaces.length);
1452
+ }
1453
+
1454
+ line = sh.utils.trim(line);
1455
+
1456
+ if (line.length == 0)
1457
+ line = '&nbsp;';
1458
+
1459
+ if (highlighted)
1460
+ lineClass += ' highlighted';
1461
+
1462
+ code +=
1463
+ '<div class="line ' + lineClass + '">'
1464
+ + '<table>'
1465
+ + '<tr>'
1466
+ + (hasGutter ? '<td class="number"><code>' + lineNumber + '</code></td>' : '')
1467
+ + '<td class="content">'
1468
+ + (spaces != null ? '<code class="spaces">' + spaces.replace(' ', '&nbsp;') + '</code>' : '')
1469
+ + line
1470
+ + '</td>'
1471
+ + '</tr>'
1472
+ + '</table>'
1473
+ + '</div>'
1474
+ ;
1475
+ }
1476
+
1477
+ return code;
1478
+ },
1479
+
1480
+ /**
1481
+ * Finds all matches in the source code.
1482
+ * @param {String} code Source code to process matches in.
1483
+ * @param {Array} matches Discovered regex matches.
1484
+ * @return {String} Returns formatted HTML with processed mathes.
1485
+ */
1486
+ processMatches: function(code, matches)
1487
+ {
1488
+ var pos = 0,
1489
+ result = '',
1490
+ decorate = sh.utils.decorate, // make an alias to save some bytes
1491
+ brushName = this.getParam('brush-name', '')
1492
+ ;
1493
+
1494
+ function getBrushNameCss(match)
1495
+ {
1496
+ var result = match ? (match.brushName || brushName) : brushName;
1497
+ return result ? result + ' ' : '';
1498
+ };
1499
+
1500
+ // Finally, go through the final list of matches and pull the all
1501
+ // together adding everything in between that isn't a match.
1502
+ for (var i = 0; i < matches.length; i++)
1503
+ {
1504
+ var match = matches[i],
1505
+ matchBrushName
1506
+ ;
1507
+
1508
+ if (match === null || match.length === 0)
1509
+ continue;
1510
+
1511
+ matchBrushName = getBrushNameCss(match);
1512
+
1513
+ result += decorate(code.substr(pos, match.index - pos), matchBrushName + 'plain')
1514
+ + decorate(match.value, matchBrushName + match.css)
1515
+ ;
1516
+
1517
+ pos = match.index + match.length;
1518
+ }
1519
+
1520
+ // don't forget to add whatever's remaining in the string
1521
+ result += decorate(code.substr(pos), getBrushNameCss() + 'plain');
1522
+
1523
+ return result;
1524
+ },
1525
+
1526
+ /**
1527
+ * Highlights the code and returns complete HTML.
1528
+ * @param {String} code Code to highlight.
1529
+ * @param {Object} params Parameters object.
1530
+ */
1531
+ highlight: function(code, params)
1532
+ {
1533
+ // using variables for shortcuts because JS compressor will shorten local variable names
1534
+ var conf = sh.config,
1535
+ vars = sh.vars,
1536
+ div,
1537
+ divClassName,
1538
+ tabSize,
1539
+ important = 'important'
1540
+ ;
1541
+
1542
+ this.params = {};
1543
+ this.div = null;
1544
+ this.lines = null;
1545
+ this.code = null;
1546
+ this.bar = null;
1547
+ this.toolbarCommands = {};
1548
+ this.id = sh.utils.guid('highlighter_');
1549
+
1550
+ // register this instance in the highlighters list
1551
+ vars.highlighters[this.id] = this;
1552
+
1553
+ if (code === null)
1554
+ code = '';
1555
+
1556
+ // local params take precedence over defaults
1557
+ this.params = sh.utils.merge(sh.defaults, params || {});
1558
+
1559
+ // process light mode
1560
+ if (this.getParam('light') == true)
1561
+ this.params.toolbar = this.params.gutter = false;
1562
+
1563
+ this.div = div = this.create('DIV');
1564
+ this.lines = this.create('DIV');
1565
+ this.lines.className = 'lines';
1566
+
1567
+ className = 'syntaxhighlighter';
1568
+ div.id = this.id;
1569
+
1570
+ // make collapsed
1571
+ if (this.getParam('collapse'))
1572
+ className += ' collapsed';
1573
+
1574
+ // disable gutter
1575
+ if (this.getParam('gutter') == false)
1576
+ className += ' nogutter';
1577
+
1578
+ // disable line wrapping
1579
+ if (this.getParam('wrap-lines') == false)
1580
+ this.lines.className += ' no-wrap';
1581
+
1582
+ // add custom user style name
1583
+ className += ' ' + this.getParam('class-name');
1584
+
1585
+ // add brush alias to the class name for custom CSS
1586
+ className += ' ' + this.getParam('brush-name');
1587
+
1588
+ div.className = className;
1589
+
1590
+ this.originalCode = code;
1591
+ this.code = sh.utils.trimFirstAndLastLines(code)
1592
+ .replace(/\r/g, ' ') // IE lets these buggers through
1593
+ ;
1594
+
1595
+ tabSize = this.getParam('tab-size');
1596
+
1597
+ // replace tabs with spaces
1598
+ this.code = this.getParam('smart-tabs') == true
1599
+ ? sh.utils.processSmartTabs(this.code, tabSize)
1600
+ : sh.utils.processTabs(this.code, tabSize)
1601
+ ;
1602
+
1603
+ this.code = sh.utils.unindent(this.code);
1604
+
1605
+ // add controls toolbar
1606
+ if (this.getParam('toolbar'))
1607
+ {
1608
+ this.bar = this.create('DIV');
1609
+ this.bar.className = 'bar';
1610
+ this.bar.appendChild(sh.toolbar.create(this));
1611
+ div.appendChild(this.bar);
1612
+
1613
+ // set up toolbar rollover
1614
+ var bar = this.bar;
1615
+ function hide() { bar.className = bar.className.replace('show', ''); }
1616
+ div.onmouseover = function() { hide(); bar.className += ' show'; };
1617
+ div.onmouseout = function() { hide(); }
1618
+ }
1619
+
1620
+ div.appendChild(this.lines);
1621
+
1622
+ this.matches = this.findMatches(this.regexList, this.code);
1623
+ this.removeNestedMatches();
1624
+
1625
+ code = this.processMatches(this.code, this.matches);
1626
+
1627
+ // finally, split all lines so that they wrap well
1628
+ code = this.createDisplayLines(sh.utils.trim(code));
1629
+
1630
+ // finally, process the links
1631
+ if (this.getParam('auto-links'))
1632
+ code = sh.utils.processUrls(code);
1633
+
1634
+ this.lines.innerHTML = code;
1635
+ },
1636
+
1637
+ /**
1638
+ * Converts space separated list of keywords into a regular expression string.
1639
+ * @param {String} str Space separated keywords.
1640
+ * @return {String} Returns regular expression string.
1641
+ */
1642
+ getKeywords: function(str)
1643
+ {
1644
+ str = str
1645
+ .replace(/^\s+|\s+$/g, '')
1646
+ .replace(/\s+/g, '|')
1647
+ ;
1648
+
1649
+ return '\\b(?:' + str + ')\\b';
1650
+ },
1651
+
1652
+ /**
1653
+ * Makes a brush compatible with the `html-script` functionality.
1654
+ * @param {Object} regexGroup Object containing `left` and `right` regular expressions.
1655
+ */
1656
+ forHtmlScript: function(regexGroup)
1657
+ {
1658
+ this.htmlScript = {
1659
+ left : { regex: regexGroup.left, css: 'script' },
1660
+ right : { regex: regexGroup.right, css: 'script' },
1661
+ code : new XRegExp(
1662
+ "(?<left>" + regexGroup.left.source + ")" +
1663
+ "(?<code>.*?)" +
1664
+ "(?<right>" + regexGroup.right.source + ")",
1665
+ "sgi"
1666
+ )
1667
+ };
1668
+ }
1669
+ }; // end of Highlighter
1670
+
1671
+ return sh;
1672
+ }(); // end of anonymous function
1673
+
1674
+
1675
+ /**
1676
+ * XRegExp 0.6.1
1677
+ * (c) 2007-2008 Steven Levithan
1678
+ * <http://stevenlevithan.com/regex/xregexp/>
1679
+ * MIT License
1680
+ *
1681
+ * provides an augmented, cross-browser implementation of regular expressions
1682
+ * including support for additional modifiers and syntax. several convenience
1683
+ * methods and a recursive-construct parser are also included.
1684
+ */
1685
+
1686
+ // prevent running twice, which would break references to native globals
1687
+ if (!window.XRegExp) {
1688
+ // anonymous function to avoid global variables
1689
+ (function () {
1690
+ // copy various native globals for reference. can't use the name ``native``
1691
+ // because it's a reserved JavaScript keyword.
1692
+ var real = {
1693
+ exec: RegExp.prototype.exec,
1694
+ match: String.prototype.match,
1695
+ replace: String.prototype.replace,
1696
+ split: String.prototype.split
1697
+ },
1698
+ /* regex syntax parsing with support for all the necessary cross-
1699
+ browser and context issues (escapings, character classes, etc.) */
1700
+ lib = {
1701
+ part: /(?:[^\\([#\s.]+|\\(?!k<[\w$]+>|[pP]{[^}]+})[\S\s]?|\((?=\?(?!#|<[\w$]+>)))+|(\()(?:\?(?:(#)[^)]*\)|<([$\w]+)>))?|\\(?:k<([\w$]+)>|[pP]{([^}]+)})|(\[\^?)|([\S\s])/g,
1702
+ replaceVar: /(?:[^$]+|\$(?![1-9$&`']|{[$\w]+}))+|\$(?:([1-9]\d*|[$&`'])|{([$\w]+)})/g,
1703
+ extended: /^(?:\s+|#.*)+/,
1704
+ quantifier: /^(?:[?*+]|{\d+(?:,\d*)?})/,
1705
+ classLeft: /&&\[\^?/g,
1706
+ classRight: /]/g
1707
+ },
1708
+ indexOf = function (array, item, from) {
1709
+ for (var i = from || 0; i < array.length; i++)
1710
+ if (array[i] === item) return i;
1711
+ return -1;
1712
+ },
1713
+ brokenExecUndef = /()??/.exec("")[1] !== undefined,
1714
+ plugins = {};
1715
+
1716
+ /**
1717
+ * Accepts a pattern and flags, returns a new, extended RegExp object.
1718
+ * differs from a native regex in that additional flags and syntax are
1719
+ * supported and browser inconsistencies are ameliorated.
1720
+ * @ignore
1721
+ */
1722
+ XRegExp = function (pattern, flags) {
1723
+ if (pattern instanceof RegExp) {
1724
+ if (flags !== undefined)
1725
+ throw TypeError("can't supply flags when constructing one RegExp from another");
1726
+ return pattern.addFlags(); // new copy
1727
+ }
1728
+
1729
+ var flags = flags || "",
1730
+ singleline = flags.indexOf("s") > -1,
1731
+ extended = flags.indexOf("x") > -1,
1732
+ hasNamedCapture = false,
1733
+ captureNames = [],
1734
+ output = [],
1735
+ part = lib.part,
1736
+ match, cc, len, index, regex;
1737
+
1738
+ part.lastIndex = 0; // in case the last XRegExp compilation threw an error (unbalanced character class)
1739
+
1740
+ while (match = real.exec.call(part, pattern)) {
1741
+ // comment pattern. this check must come before the capturing group check,
1742
+ // because both match[1] and match[2] will be non-empty.
1743
+ if (match[2]) {
1744
+ // keep tokens separated unless the following token is a quantifier
1745
+ if (!lib.quantifier.test(pattern.slice(part.lastIndex)))
1746
+ output.push("(?:)");
1747
+ // capturing group
1748
+ } else if (match[1]) {
1749
+ captureNames.push(match[3] || null);
1750
+ if (match[3])
1751
+ hasNamedCapture = true;
1752
+ output.push("(");
1753
+ // named backreference
1754
+ } else if (match[4]) {
1755
+ index = indexOf(captureNames, match[4]);
1756
+ // keep backreferences separate from subsequent literal numbers
1757
+ // preserve backreferences to named groups that are undefined at this point as literal strings
1758
+ output.push(index > -1 ?
1759
+ "\\" + (index + 1) + (isNaN(pattern.charAt(part.lastIndex)) ? "" : "(?:)") :
1760
+ match[0]
1761
+ );
1762
+ // unicode element (requires plugin)
1763
+ } else if (match[5]) {
1764
+ output.push(plugins.unicode ?
1765
+ plugins.unicode.get(match[5], match[0].charAt(1) === "P") :
1766
+ match[0]
1767
+ );
1768
+ // character class opening delimiter ("[" or "[^")
1769
+ // (non-native unicode elements are not supported within character classes)
1770
+ } else if (match[6]) {
1771
+ if (pattern.charAt(part.lastIndex) === "]") {
1772
+ // for cross-browser compatibility with ECMA-262 v3 behavior,
1773
+ // convert [] to (?!) and [^] to [\S\s].
1774
+ output.push(match[6] === "[" ? "(?!)" : "[\\S\\s]");
1775
+ part.lastIndex++;
1776
+ } else {
1777
+ // parse the character class with support for inner escapes and
1778
+ // ES4's infinitely nesting intersection syntax ([&&[^&&[]]]).
1779
+ cc = XRegExp.matchRecursive("&&" + pattern.slice(match.index), lib.classLeft, lib.classRight, "", {escapeChar: "\\"})[0];
1780
+ output.push(match[6] + cc + "]");
1781
+ part.lastIndex += cc.length + 1;
1782
+ }
1783
+ // dot ("."), pound sign ("#"), or whitespace character
1784
+ } else if (match[7]) {
1785
+ if (singleline && match[7] === ".") {
1786
+ output.push("[\\S\\s]");
1787
+ } else if (extended && lib.extended.test(match[7])) {
1788
+ len = real.exec.call(lib.extended, pattern.slice(part.lastIndex - 1))[0].length;
1789
+ // keep tokens separated unless the following token is a quantifier
1790
+ if (!lib.quantifier.test(pattern.slice(part.lastIndex - 1 + len)))
1791
+ output.push("(?:)");
1792
+ part.lastIndex += len - 1;
1793
+ } else {
1794
+ output.push(match[7]);
1795
+ }
1796
+ } else {
1797
+ output.push(match[0]);
1798
+ }
1799
+ }
1800
+
1801
+ regex = RegExp(output.join(""), real.replace.call(flags, /[sx]+/g, ""));
1802
+ regex._x = {
1803
+ source: pattern,
1804
+ captureNames: hasNamedCapture ? captureNames : null
1805
+ };
1806
+ return regex;
1807
+ };
1808
+
1809
+ /**
1810
+ * Barebones plugin support for now (intentionally undocumented)
1811
+ * @ignore
1812
+ * @param {Object} name
1813
+ * @param {Object} o
1814
+ */
1815
+ XRegExp.addPlugin = function (name, o) {
1816
+ plugins[name] = o;
1817
+ };
1818
+
1819
+ /**
1820
+ * Adds named capture support, with values returned as ``result.name``.
1821
+ *
1822
+ * Also fixes two cross-browser issues, following the ECMA-262 v3 spec:
1823
+ * - captured values for non-participating capturing groups should be returned
1824
+ * as ``undefined``, rather than the empty string.
1825
+ * - the regex's ``lastIndex`` should not be incremented after zero-length
1826
+ * matches.
1827
+ * @ignore
1828
+ */
1829
+ RegExp.prototype.exec = function (str) {
1830
+ var match = real.exec.call(this, str),
1831
+ name, i, r2;
1832
+ if (match) {
1833
+ // fix browsers whose exec methods don't consistently return
1834
+ // undefined for non-participating capturing groups
1835
+ if (brokenExecUndef && match.length > 1) {
1836
+ // r2 doesn't need /g or /y, but they shouldn't hurt
1837
+ r2 = new RegExp("^" + this.source + "$(?!\\s)", this.getNativeFlags());
1838
+ real.replace.call(match[0], r2, function () {
1839
+ for (i = 1; i < arguments.length - 2; i++) {
1840
+ if (arguments[i] === undefined) match[i] = undefined;
1841
+ }
1842
+ });
1843
+ }
1844
+ // attach named capture properties
1845
+ if (this._x && this._x.captureNames) {
1846
+ for (i = 1; i < match.length; i++) {
1847
+ name = this._x.captureNames[i - 1];
1848
+ if (name) match[name] = match[i];
1849
+ }
1850
+ }
1851
+ // fix browsers that increment lastIndex after zero-length matches
1852
+ if (this.global && this.lastIndex > (match.index + match[0].length))
1853
+ this.lastIndex--;
1854
+ }
1855
+ return match;
1856
+ };
1857
+ })(); // end anonymous function
1858
+ } // end if(!window.XRegExp)
1859
+
1860
+ /**
1861
+ * intentionally undocumented
1862
+ * @ignore
1863
+ */
1864
+ RegExp.prototype.getNativeFlags = function () {
1865
+ return (this.global ? "g" : "") +
1866
+ (this.ignoreCase ? "i" : "") +
1867
+ (this.multiline ? "m" : "") +
1868
+ (this.extended ? "x" : "") +
1869
+ (this.sticky ? "y" : "");
1870
+ };
1871
+
1872
+ /**
1873
+ * Accepts flags; returns a new XRegExp object generated by recompiling
1874
+ * the regex with the additional flags (may include non-native flags).
1875
+ * The original regex object is not altered.
1876
+ * @ignore
1877
+ */
1878
+ RegExp.prototype.addFlags = function (flags) {
1879
+ var regex = new XRegExp(this.source, (flags || "") + this.getNativeFlags());
1880
+ if (this._x) {
1881
+ regex._x = {
1882
+ source: this._x.source,
1883
+ captureNames: this._x.captureNames ? this._x.captureNames.slice(0) : null
1884
+ };
1885
+ }
1886
+ return regex;
1887
+ };
1888
+
1889
+ /**
1890
+ * Accepts a context object and string; returns the result of calling
1891
+ * ``exec`` with the provided string. the context is ignored but is
1892
+ * accepted for congruity with ``Function.prototype.call``.
1893
+ * @ignore
1894
+ */
1895
+ RegExp.prototype.call = function (context, str) {
1896
+ return this.exec(str);
1897
+ };
1898
+
1899
+ /**
1900
+ * Accepts a context object and arguments array; returns the result of
1901
+ * calling ``exec`` with the first value in the arguments array. the context
1902
+ * is ignored but is accepted for congruity with ``Function.prototype.apply``.
1903
+ * @ignore
1904
+ */
1905
+ RegExp.prototype.apply = function (context, args) {
1906
+ return this.exec(args[0]);
1907
+ };
1908
+
1909
+ /**
1910
+ * Accepts a pattern and flags; returns an XRegExp object. if the pattern
1911
+ * and flag combination has previously been cached, the cached copy is
1912
+ * returned, otherwise the new object is cached.
1913
+ * @ignore
1914
+ */
1915
+ XRegExp.cache = function (pattern, flags) {
1916
+ var key = "/" + pattern + "/" + (flags || "");
1917
+ return XRegExp.cache[key] || (XRegExp.cache[key] = new XRegExp(pattern, flags));
1918
+ };
1919
+
1920
+ /**
1921
+ * Accepts a string; returns the string with regex metacharacters escaped.
1922
+ * the returned string can safely be used within a regex to match a literal
1923
+ * string. escaped characters are [, ], {, }, (, ), -, *, +, ?, ., \, ^, $,
1924
+ * |, #, [comma], and whitespace.
1925
+ * @ignore
1926
+ */
1927
+ XRegExp.escape = function (str) {
1928
+ return str.replace(/[-[\]{}()*+?.\\^$|,#\s]/g, "\\$&");
1929
+ };
1930
+
1931
+ /**
1932
+ * Accepts a string to search, left and right delimiters as regex pattern
1933
+ * strings, optional regex flags (may include non-native s, x, and y flags),
1934
+ * and an options object which allows setting an escape character and changing
1935
+ * the return format from an array of matches to a two-dimensional array of
1936
+ * string parts with extended position data. returns an array of matches
1937
+ * (optionally with extended data), allowing nested instances of left and right
1938
+ * delimiters. use the g flag to return all matches, otherwise only the first
1939
+ * is returned. if delimiters are unbalanced within the subject data, an error
1940
+ * is thrown.
1941
+ *
1942
+ * This function admittedly pushes the boundaries of what can be accomplished
1943
+ * sensibly without a "real" parser. however, by doing so it provides flexible
1944
+ * and powerful recursive parsing capabilities with minimal code weight.
1945
+ *
1946
+ * Warning: the ``escapeChar`` option is considered experimental and might be
1947
+ * changed or removed in future versions of XRegExp.
1948
+ *
1949
+ * unsupported features:
1950
+ * - backreferences within delimiter patterns when using ``escapeChar``.
1951
+ * - although providing delimiters as regex objects adds the minor feature of
1952
+ * independent delimiter flags, it introduces other limitations and is only
1953
+ * intended to be done by the ``XRegExp`` constructor (which can't call
1954
+ * itself while building a regex).
1955
+ *
1956
+ * @ignore
1957
+ */
1958
+ XRegExp.matchRecursive = function (str, left, right, flags, options) {
1959
+ var options = options || {},
1960
+ escapeChar = options.escapeChar,
1961
+ vN = options.valueNames,
1962
+ flags = flags || "",
1963
+ global = flags.indexOf("g") > -1,
1964
+ ignoreCase = flags.indexOf("i") > -1,
1965
+ multiline = flags.indexOf("m") > -1,
1966
+ sticky = flags.indexOf("y") > -1,
1967
+ /* sticky mode has its own handling in this function, which means you
1968
+ can use flag "y" even in browsers which don't support it natively */
1969
+ flags = flags.replace(/y/g, ""),
1970
+ left = left instanceof RegExp ? (left.global ? left : left.addFlags("g")) : new XRegExp(left, "g" + flags),
1971
+ right = right instanceof RegExp ? (right.global ? right : right.addFlags("g")) : new XRegExp(right, "g" + flags),
1972
+ output = [],
1973
+ openTokens = 0,
1974
+ delimStart = 0,
1975
+ delimEnd = 0,
1976
+ lastOuterEnd = 0,
1977
+ outerStart, innerStart, leftMatch, rightMatch, escaped, esc;
1978
+
1979
+ if (escapeChar) {
1980
+ if (escapeChar.length > 1) throw SyntaxError("can't supply more than one escape character");
1981
+ if (multiline) throw TypeError("can't supply escape character when using the multiline flag");
1982
+ escaped = XRegExp.escape(escapeChar);
1983
+ /* Escape pattern modifiers:
1984
+ /g - not needed here
1985
+ /i - included
1986
+ /m - **unsupported**, throws error
1987
+ /s - handled by XRegExp when delimiters are provided as strings
1988
+ /x - handled by XRegExp when delimiters are provided as strings
1989
+ /y - not needed here; supported by other handling in this function
1990
+ */
1991
+ esc = new RegExp(
1992
+ "^(?:" + escaped + "[\\S\\s]|(?:(?!" + left.source + "|" + right.source + ")[^" + escaped + "])+)+",
1993
+ ignoreCase ? "i" : ""
1994
+ );
1995
+ }
1996
+
1997
+ while (true) {
1998
+ /* advance the starting search position to the end of the last delimiter match.
1999
+ a couple special cases are also covered:
2000
+ - if using an escape character, advance to the next delimiter's starting position,
2001
+ skipping any escaped characters
2002
+ - first time through, reset lastIndex in case delimiters were provided as regexes
2003
+ */
2004
+ left.lastIndex = right.lastIndex = delimEnd +
2005
+ (escapeChar ? (esc.exec(str.slice(delimEnd)) || [""])[0].length : 0);
2006
+
2007
+ leftMatch = left.exec(str);
2008
+ rightMatch = right.exec(str);
2009
+
2010
+ // only keep the result which matched earlier in the string
2011
+ if (leftMatch && rightMatch) {
2012
+ if (leftMatch.index <= rightMatch.index)
2013
+ rightMatch = null;
2014
+ else leftMatch = null;
2015
+ }
2016
+
2017
+ /* paths*:
2018
+ leftMatch | rightMatch | openTokens | result
2019
+ 1 | 0 | 1 | ...
2020
+ 1 | 0 | 0 | ...
2021
+ 0 | 1 | 1 | ...
2022
+ 0 | 1 | 0 | throw
2023
+ 0 | 0 | 1 | throw
2024
+ 0 | 0 | 0 | break
2025
+ * - does not include the sticky mode special case
2026
+ - the loop ends after the first completed match if not in global mode
2027
+ */
2028
+
2029
+ if (leftMatch || rightMatch) {
2030
+ delimStart = (leftMatch || rightMatch).index;
2031
+ delimEnd = (leftMatch ? left : right).lastIndex;
2032
+ } else if (!openTokens) {
2033
+ break;
2034
+ }
2035
+
2036
+ if (sticky && !openTokens && delimStart > lastOuterEnd)
2037
+ break;
2038
+
2039
+ if (leftMatch) {
2040
+ if (!openTokens++) {
2041
+ outerStart = delimStart;
2042
+ innerStart = delimEnd;
2043
+ }
2044
+ } else if (rightMatch && openTokens) {
2045
+ if (!--openTokens) {
2046
+ if (vN) {
2047
+ if (vN[0] && outerStart > lastOuterEnd)
2048
+ output.push([vN[0], str.slice(lastOuterEnd, outerStart), lastOuterEnd, outerStart]);
2049
+ if (vN[1]) output.push([vN[1], str.slice(outerStart, innerStart), outerStart, innerStart]);
2050
+ if (vN[2]) output.push([vN[2], str.slice(innerStart, delimStart), innerStart, delimStart]);
2051
+ if (vN[3]) output.push([vN[3], str.slice(delimStart, delimEnd), delimStart, delimEnd]);
2052
+ } else {
2053
+ output.push(str.slice(innerStart, delimStart));
2054
+ }
2055
+ lastOuterEnd = delimEnd;
2056
+ if (!global)
2057
+ break;
2058
+ }
2059
+ } else {
2060
+ // reset lastIndex in case delimiters were provided as regexes
2061
+ left.lastIndex = right.lastIndex = 0;
2062
+ throw Error("subject data contains unbalanced delimiters");
2063
+ }
2064
+
2065
+ // if the delimiter matched an empty string, advance delimEnd to avoid an infinite loop
2066
+ if (delimStart === delimEnd)
2067
+ delimEnd++;
2068
+ }
2069
+
2070
+ if (global && !sticky && vN && vN[0] && str.length > lastOuterEnd)
2071
+ output.push([vN[0], str.slice(lastOuterEnd), lastOuterEnd, str.length]);
2072
+
2073
+ // reset lastIndex in case delimiters were provided as regexes
2074
+ left.lastIndex = right.lastIndex = 0;
2075
+
2076
+ return output;
2077
+ };
2078
+ /**
2079
+ * SyntaxHighlighter
2080
+ * http://alexgorbatchev.com/
2081
+ *
2082
+ * SyntaxHighlighter is donationware. If you are using it, please donate.
2083
+ * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate
2084
+ *
2085
+ * @version
2086
+ * 2.0.320 (May 03 2009)
2087
+ *
2088
+ * @copyright
2089
+ * Copyright (C) 2004-2009 Alex Gorbatchev.
2090
+ *
2091
+ * @license
2092
+ * This file is part of SyntaxHighlighter.
2093
+ *
2094
+ * SyntaxHighlighter is free software: you can redistribute it and/or modify
2095
+ * it under the terms of the GNU Lesser General Public License as published by
2096
+ * the Free Software Foundation, either version 3 of the License, or
2097
+ * (at your option) any later version.
2098
+ *
2099
+ * SyntaxHighlighter is distributed in the hope that it will be useful,
2100
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2101
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2102
+ * GNU General Public License for more details.
2103
+ *
2104
+ * You should have received a copy of the GNU General Public License
2105
+ * along with SyntaxHighlighter. If not, see <http://www.gnu.org/copyleft/lesser.html>.
2106
+ */
2107
+ SyntaxHighlighter.brushes.Xml = function()
2108
+ {
2109
+ function process(match, regexInfo)
2110
+ {
2111
+ var constructor = SyntaxHighlighter.Match,
2112
+ code = match[0],
2113
+ tag = new XRegExp('(&lt;|<)[\\s\\/\\?]*(?<name>[:\\w-\\.]+)', 'xg').exec(code),
2114
+ result = []
2115
+ ;
2116
+
2117
+ if (match.attributes != null)
2118
+ {
2119
+ var attributes,
2120
+ regex = new XRegExp('(?<name> [\\w:\\-\\.]+)' +
2121
+ '\\s*=\\s*' +
2122
+ '(?<value> ".*?"|\'.*?\'|\\w+)',
2123
+ 'xg');
2124
+
2125
+ while ((attributes = regex.exec(code)) != null)
2126
+ {
2127
+ result.push(new constructor(attributes.name, match.index + attributes.index, 'color1'));
2128
+ result.push(new constructor(attributes.value, match.index + attributes.index + attributes[0].indexOf(attributes.value), 'string'));
2129
+ }
2130
+ }
2131
+
2132
+ if (tag != null)
2133
+ result.push(
2134
+ new constructor(tag.name, match.index + tag[0].indexOf(tag.name), 'keyword')
2135
+ );
2136
+
2137
+ return result;
2138
+ }
2139
+
2140
+ this.regexList = [
2141
+ { regex: new XRegExp('(\\&lt;|<)\\!\\[[\\w\\s]*?\\[(.|\\s)*?\\]\\](\\&gt;|>)', 'gm'), css: 'color2' }, // <![ ... [ ... ]]>
2142
+ { regex: new XRegExp('(\\&lt;|<)!--\\s*.*?\\s*--(\\&gt;|>)', 'gm'), css: 'comments' }, // <!-- ... -->
2143
+ { regex: new XRegExp('(&lt;|<)[\\s\\/\\?]*(\\w+)(?<attributes>.*?)[\\s\\/\\?]*(&gt;|>)', 'sg'), func: process }
2144
+ ];
2145
+ };
2146
+
2147
+ SyntaxHighlighter.brushes.Xml.prototype = new SyntaxHighlighter.Highlighter();
2148
+ SyntaxHighlighter.brushes.Xml.aliases = ['xml', 'xhtml', 'xslt', 'html', 'xhtml'];
2149
+ /**
2150
+ * SyntaxHighlighter
2151
+ * http://alexgorbatchev.com/
2152
+ *
2153
+ * SyntaxHighlighter is donationware. If you are using it, please donate.
2154
+ * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate
2155
+ *
2156
+ * @version
2157
+ * 2.0.320 (May 03 2009)
2158
+ *
2159
+ * @copyright
2160
+ * Copyright (C) 2004-2009 Alex Gorbatchev.
2161
+ *
2162
+ * @license
2163
+ * This file is part of SyntaxHighlighter.
2164
+ *
2165
+ * SyntaxHighlighter is free software: you can redistribute it and/or modify
2166
+ * it under the terms of the GNU Lesser General Public License as published by
2167
+ * the Free Software Foundation, either version 3 of the License, or
2168
+ * (at your option) any later version.
2169
+ *
2170
+ * SyntaxHighlighter is distributed in the hope that it will be useful,
2171
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2172
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2173
+ * GNU General Public License for more details.
2174
+ *
2175
+ * You should have received a copy of the GNU General Public License
2176
+ * along with SyntaxHighlighter. If not, see <http://www.gnu.org/copyleft/lesser.html>.
2177
+ */
2178
+ SyntaxHighlighter.brushes.JScript = function()
2179
+ {
2180
+ var keywords = 'break case catch continue ' +
2181
+ 'default delete do else false ' +
2182
+ 'for function if in instanceof ' +
2183
+ 'new null return super switch ' +
2184
+ 'this throw true try typeof var while with'
2185
+ ;
2186
+
2187
+ this.regexList = [
2188
+ { regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line comments
2189
+ { regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' }, // multiline comments
2190
+ { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // double quoted strings
2191
+ { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // single quoted strings
2192
+ { regex: /\s*#.*/gm, css: 'preprocessor' }, // preprocessor tags like #region and #endregion
2193
+ { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' } // keywords
2194
+ ];
2195
+
2196
+ this.forHtmlScript(SyntaxHighlighter.regexLib.scriptScriptTags);
2197
+ };
2198
+
2199
+ SyntaxHighlighter.brushes.JScript.prototype = new SyntaxHighlighter.Highlighter();
2200
+ SyntaxHighlighter.brushes.JScript.aliases = ['js', 'jscript', 'javascript'];
2201
+
2202
+
2203
+ SyntaxHighlighter.config.clipboardSwf = 'syntax/clipboard.swf';
2204
+ $(function () {
2205
+ var divs = $([]);
2206
+ $("#container .source").each(function () {
2207
+ var code = $(this).html().replace(/</g,'&lt;').replace(/>/g,'&gt;'),
2208
+ div = $('<div class="code"><pre class="brush:' + ( $(this).is("script") ? 'js' : 'xml' ) + ';">' + code + '</pre></div>'),
2209
+ demo = $(this).prevAll(".demo:eq(0)");
2210
+ $(this).after(div);
2211
+ if(!$(this).hasClass("below")) divs = divs.add(div);
2212
+ });
2213
+ SyntaxHighlighter.all();
2214
+
2215
+ setTimeout((function (divs) {
2216
+ return function () {
2217
+ divs.each(function () {
2218
+ var div = $(this),
2219
+ demo = $(this).prevAll(".demo:eq(0)"),
2220
+ h = false;
2221
+ var h = Math.max(demo[0].offsetHeight, div[0].offsetHeight);
2222
+ if(h) {
2223
+ if(h < 198) h = 198;
2224
+ div.height(h);
2225
+ demo.height(h);
2226
+ }
2227
+ });
2228
+ }
2229
+ })(divs), 500);
2230
+
2231
+ // $(".panel").hide().prev().click(function () { $(this).next().toggle(); }).css("cursor","pointer");
2232
+ });