mixin-hoist.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. function pug_escape(e) {
  2. var a = "" + e, t = pug_match_html.exec(a);
  3. if (!t) return e;
  4. var r, c, n, s = "";
  5. for (r = t.index, c = 0; r < a.length; r++) {
  6. switch (a.charCodeAt(r)) {
  7. case 34:
  8. n = "&quot;";
  9. break;
  10. case 38:
  11. n = "&amp;";
  12. break;
  13. case 60:
  14. n = "&lt;";
  15. break;
  16. case 62:
  17. n = "&gt;";
  18. break;
  19. default:
  20. continue;
  21. }
  22. c !== r && (s += a.substring(c, r)), c = r + 1, s += n;
  23. }
  24. return c !== r ? s + a.substring(c, r) : s;
  25. }
  26. var pug_match_html = /["&<>]/;
  27. function template(locals) {
  28. var pug_html = "", pug_mixins = {}, pug_interp;
  29. var locals_for_with = locals || {};
  30. (function(title) {
  31. pug_mixins["foo"] = pug_interp = function() {
  32. var block = this && this.block, attributes = this && this.attributes || {};
  33. pug_html = pug_html + "<h1>" + pug_escape(null == (pug_interp = title) ? "" : pug_interp) + "</h1>";
  34. };
  35. pug_html = pug_html + "<html><body>";
  36. pug_mixins["foo"]();
  37. pug_html = pug_html + "</body></html>";
  38. }).call(this, "title" in locals_for_with ? locals_for_with.title : typeof title !== "undefined" ? title : undefined);
  39. return pug_html;
  40. }