utopia 2.13.4 → 2.14.0

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