handlebars.js 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /*
  2. Language: Handlebars
  3. Requires: xml.js
  4. Author: Robin Ward <[email protected]>
  5. Description: Matcher for Handlebars as well as EmberJS additions.
  6. Category: template
  7. */
  8. function(hljs) {
  9. var BUILT_INS = {'builtin-name': 'each in with if else unless bindattr action collection debugger log outlet template unbound view yield'};
  10. return {
  11. aliases: ['hbs', 'html.hbs', 'html.handlebars'],
  12. case_insensitive: true,
  13. subLanguage: 'xml',
  14. contains: [
  15. hljs.COMMENT('{{!(--)?', '(--)?}}'),
  16. {
  17. className: 'template-tag',
  18. begin: /\{\{[#\/]/, end: /\}\}/,
  19. contains: [
  20. {
  21. className: 'name',
  22. begin: /[a-zA-Z\.-]+/,
  23. keywords: BUILT_INS,
  24. starts: {
  25. endsWithParent: true, relevance: 0,
  26. contains: [
  27. hljs.QUOTE_STRING_MODE
  28. ]
  29. }
  30. }
  31. ]
  32. },
  33. {
  34. className: 'template-variable',
  35. begin: /\{\{/, end: /\}\}/,
  36. keywords: BUILT_INS
  37. }
  38. ]
  39. };
  40. }