handlebars.js 895 B

123456789101112131415161718192021222324252627282930313233
  1. module.exports = function(hljs) {
  2. var BUILT_INS = {'builtin-name': 'each in with if else unless bindattr action collection debugger log outlet template unbound view yield'};
  3. return {
  4. aliases: ['hbs', 'html.hbs', 'html.handlebars'],
  5. case_insensitive: true,
  6. subLanguage: 'xml',
  7. contains: [
  8. hljs.COMMENT('{{!(--)?', '(--)?}}'),
  9. {
  10. className: 'template-tag',
  11. begin: /\{\{[#\/]/, end: /\}\}/,
  12. contains: [
  13. {
  14. className: 'name',
  15. begin: /[a-zA-Z\.-]+/,
  16. keywords: BUILT_INS,
  17. starts: {
  18. endsWithParent: true, relevance: 0,
  19. contains: [
  20. hljs.QUOTE_STRING_MODE
  21. ]
  22. }
  23. }
  24. ]
  25. },
  26. {
  27. className: 'template-variable',
  28. begin: /\{\{/, end: /\}\}/,
  29. keywords: BUILT_INS
  30. }
  31. ]
  32. };
  33. };