prism-ejs.js 618 B

1234567891011121314151617181920212223242526
  1. (function (Prism) {
  2. Prism.languages.ejs = {
  3. 'delimiter': {
  4. pattern: /^<%[-_=]?|[-_]?%>$/,
  5. alias: 'punctuation'
  6. },
  7. 'comment': /^#[\s\S]*/,
  8. 'language-javascript': {
  9. pattern: /[\s\S]+/,
  10. inside: Prism.languages.javascript
  11. }
  12. };
  13. Prism.hooks.add('before-tokenize', function (env) {
  14. var ejsPattern = /<%(?!%)[\s\S]+?%>/g;
  15. Prism.languages['markup-templating'].buildPlaceholders(env, 'ejs', ejsPattern);
  16. });
  17. Prism.hooks.add('after-tokenize', function (env) {
  18. Prism.languages['markup-templating'].tokenizePlaceholders(env, 'ejs');
  19. });
  20. Prism.languages.eta = Prism.languages.ejs;
  21. }(Prism));