php-template.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*
  2. Language: PHP Template
  3. Requires: xml.js, php.js
  4. Author: Josh Goebel <hello@joshgoebel.com>
  5. Website: https://www.php.net
  6. Category: common
  7. */
  8. function phpTemplate(hljs) {
  9. return {
  10. name: "PHP template",
  11. subLanguage: 'xml',
  12. contains: [
  13. {
  14. begin: /<\?(php|=)?/,
  15. end: /\?>/,
  16. subLanguage: 'php',
  17. contains: [
  18. // We don't want the php closing tag ?> to close the PHP block when
  19. // inside any of the following blocks:
  20. {
  21. begin: '/\\*',
  22. end: '\\*/',
  23. skip: true
  24. },
  25. {
  26. begin: 'b"',
  27. end: '"',
  28. skip: true
  29. },
  30. {
  31. begin: 'b\'',
  32. end: '\'',
  33. skip: true
  34. },
  35. hljs.inherit(hljs.APOS_STRING_MODE, {
  36. illegal: null,
  37. className: null,
  38. contains: null,
  39. skip: true
  40. }),
  41. hljs.inherit(hljs.QUOTE_STRING_MODE, {
  42. illegal: null,
  43. className: null,
  44. contains: null,
  45. skip: true
  46. })
  47. ]
  48. }
  49. ]
  50. };
  51. }
  52. module.exports = phpTemplate;