xml.js 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /*
  2. Copyright (c) 2004-2012, The Dojo Foundation All Rights Reserved.
  3. Available via Academic Free License >= 2.1 OR the modified BSD license.
  4. see: http://dojotoolkit.org/license for details
  5. */
  6. if(!dojo._hasResource["dojox.highlight.languages.pygments.xml"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
  7. dojo._hasResource["dojox.highlight.languages.pygments.xml"] = true;
  8. dojo.provide("dojox.highlight.languages.pygments.xml");
  9. dojo.require("dojox.highlight._base");
  10. dojox.highlight.languages.pygments.xml = {a: 1};
  11. dojox.highlight.languages.xml = {
  12. defaultMode: {
  13. contains: [
  14. "name entity",
  15. "comment", "comment preproc",
  16. "_tag"
  17. ]
  18. },
  19. modes: [
  20. // comments
  21. {
  22. className: "comment",
  23. begin: "<!--", end: "-->"
  24. },
  25. {
  26. className: "comment preproc",
  27. begin: "\\<\\!\\[CDATA\\[", end: "\\]\\]\\>"
  28. },
  29. {
  30. className: "comment preproc",
  31. begin: "\\<\\!", end: "\\>"
  32. },
  33. {
  34. className: "comment preproc",
  35. begin: "\\<\\?", end: "\\?\\>",
  36. relevance: 5
  37. },
  38. // strings
  39. {
  40. className: "string",
  41. begin: "'", end: "'",
  42. illegal: "\\n",
  43. relevance: 0
  44. },
  45. {
  46. className: "string",
  47. begin: '"',
  48. end: '"',
  49. illegal: "\\n",
  50. relevance: 0
  51. },
  52. // names
  53. {
  54. className: "name entity",
  55. begin: "\\&[a-z]+;", end: "^"
  56. },
  57. {
  58. className: "name tag",
  59. begin: "\\b[a-z0-9_\\:\\-]+\\b", end: "^"
  60. },
  61. {
  62. className: "name attribute",
  63. begin: "\\b[a-z0-9_\\:\\-]+=", end: "^",
  64. relevance: 0
  65. },
  66. {
  67. className: "_tag",
  68. begin: "\\<", end: "\\>",
  69. contains: ["name tag", "name attribute", "string"]
  70. },
  71. {
  72. className: "_tag",
  73. begin: "\\</", end: "\\>",
  74. contains: ["name tag"]
  75. }
  76. ]
  77. };
  78. }