dust.js 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. {
  25. className: 'name',
  26. begin: /[a-zA-Z\.-]+/,
  27. starts: {
  28. endsWithParent: true,
  29. relevance: 0,
  30. contains: [ hljs.QUOTE_STRING_MODE ]
  31. }
  32. }
  33. ]
  34. },
  35. {
  36. className: 'template-variable',
  37. begin: /\{/,
  38. end: /\}/,
  39. illegal: /;/,
  40. keywords: EXPRESSION_KEYWORDS
  41. }
  42. ]
  43. };
  44. }
  45. export { dust as default };