dust.js 979 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. Language: Dust
  3. Requires: xml.js
  4. Author: Michael Allen <michael.allen@benefitfocus.com>
  5. Description: Matcher for dust.js templates.
  6. Website: https://www.dustjs.com
  7. Category: template
  8. */
  9. /** @type LanguageFn */
  10. function dust(hljs) {
  11. const EXPRESSION_KEYWORDS = 'if eq ne lt lte gt gte select default math sep';
  12. return {
  13. name: 'Dust',
  14. aliases: ['dst'],
  15. case_insensitive: true,
  16. subLanguage: 'xml',
  17. contains: [
  18. {
  19. className: 'template-tag',
  20. begin: /\{[#\/]/,
  21. end: /\}/,
  22. illegal: /;/,
  23. contains: [{
  24. className: 'name',
  25. begin: /[a-zA-Z\.-]+/,
  26. starts: {
  27. endsWithParent: true,
  28. relevance: 0,
  29. contains: [hljs.QUOTE_STRING_MODE]
  30. }
  31. }]
  32. },
  33. {
  34. className: 'template-variable',
  35. begin: /\{/,
  36. end: /\}/,
  37. illegal: /;/,
  38. keywords: EXPRESSION_KEYWORDS
  39. }
  40. ]
  41. };
  42. }
  43. module.exports = dust;