handlebars.min.js 2.3 KB

1234567891011121314151617181920212223242526272829
  1. /*! `handlebars` grammar compiled for Highlight.js 11.7.0 */
  2. var hljsGrammar=(()=>{"use strict";return e=>{const a=e.regex,n={
  3. $pattern:/[\w.\/]+/,
  4. built_in:["action","bindattr","collection","component","concat","debugger","each","each-in","get","hash","if","in","input","link-to","loc","log","lookup","mut","outlet","partial","query-params","render","template","textarea","unbound","unless","view","with","yield"]
  5. },t=/\[\]|\[[^\]]+\]/,s=/[^\s!"#%&'()*+,.\/;<=>@\[\\\]^`{|}~]+/,i=a.either(/""|"[^"]+"/,/''|'[^']+'/,t,s),r=a.concat(a.optional(/\.|\.\/|\//),i,a.anyNumberOfTimes(a.concat(/(\.|\/)/,i))),l=a.concat("(",t,"|",s,")(?==)"),c={
  6. begin:r},m=e.inherit(c,{keywords:{$pattern:/[\w.\/]+/,
  7. literal:["true","false","undefined","null"]}}),o={begin:/\(/,end:/\)/},d={
  8. className:"attr",begin:l,relevance:0,starts:{begin:/=/,end:/=/,starts:{
  9. contains:[e.NUMBER_MODE,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,m,o]}}},g={
  10. contains:[e.NUMBER_MODE,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,{begin:/as\s+\|/,
  11. keywords:{keyword:"as"},end:/\|/,contains:[{begin:/\w+/}]},d,m,o],returnEnd:!0
  12. },b=e.inherit(c,{className:"name",keywords:n,starts:e.inherit(g,{end:/\)/})})
  13. ;o.contains=[b];const u=e.inherit(c,{keywords:n,className:"name",
  14. starts:e.inherit(g,{end:/\}\}/})}),h=e.inherit(c,{keywords:n,className:"name"
  15. }),N=e.inherit(c,{className:"name",keywords:n,starts:e.inherit(g,{end:/\}\}/})})
  16. ;return{name:"Handlebars",
  17. aliases:["hbs","html.hbs","html.handlebars","htmlbars"],case_insensitive:!0,
  18. subLanguage:"xml",contains:[{begin:/\\\{\{/,skip:!0},{begin:/\\\\(?=\{\{)/,
  19. skip:!0},e.COMMENT(/\{\{!--/,/--\}\}/),e.COMMENT(/\{\{!/,/\}\}/),{
  20. className:"template-tag",begin:/\{\{\{\{(?!\/)/,end:/\}\}\}\}/,contains:[u],
  21. starts:{end:/\{\{\{\{\//,returnEnd:!0,subLanguage:"xml"}},{
  22. className:"template-tag",begin:/\{\{\{\{\//,end:/\}\}\}\}/,contains:[h]},{
  23. className:"template-tag",begin:/\{\{#/,end:/\}\}/,contains:[u]},{
  24. className:"template-tag",begin:/\{\{(?=else\}\})/,end:/\}\}/,keywords:"else"},{
  25. className:"template-tag",begin:/\{\{(?=else if)/,end:/\}\}/,keywords:"else if"
  26. },{className:"template-tag",begin:/\{\{\//,end:/\}\}/,contains:[h]},{
  27. className:"template-variable",begin:/\{\{\{/,end:/\}\}\}/,contains:[N]},{
  28. className:"template-variable",begin:/\{\{/,end:/\}\}/,contains:[N]}]}}})()
  29. ;export default hljsGrammar;