regression.1794.js 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. function pug_attr(t, e, n, f) {
  2. return !1 !== e && null != e && (e || "class" !== t && "style" !== t) ? !0 === e ? " " + (f ? t : t + '="' + t + '"') : ("function" == typeof e.toJSON && (e = e.toJSON()),
  3. "string" == typeof e || (e = JSON.stringify(e), n || -1 === e.indexOf('"')) ? (n && (e = pug_escape(e)),
  4. " " + t + '="' + e + '"') : " " + t + "='" + e.replace(/'/g, "'") + "'") : "";
  5. }
  6. function pug_attrs(t, r) {
  7. var a = "";
  8. for (var s in t) if (pug_has_own_property.call(t, s)) {
  9. var u = t[s];
  10. if ("class" === s) {
  11. u = pug_classes(u), a = pug_attr(s, u, !1, r) + a;
  12. continue;
  13. }
  14. "style" === s && (u = pug_style(u)), a += pug_attr(s, u, !1, r);
  15. }
  16. return a;
  17. }
  18. function pug_classes(s, r) {
  19. return Array.isArray(s) ? pug_classes_array(s, r) : s && "object" == typeof s ? pug_classes_object(s) : s || "";
  20. }
  21. function pug_classes_array(r, a) {
  22. for (var s, e = "", u = "", c = Array.isArray(a), g = 0; g < r.length; g++) (s = pug_classes(r[g])) && (c && a[g] && (s = pug_escape(s)),
  23. e = e + u + s, u = " ");
  24. return e;
  25. }
  26. function pug_classes_object(r) {
  27. var a = "", n = "";
  28. for (var o in r) o && r[o] && pug_has_own_property.call(r, o) && (a = a + n + o,
  29. n = " ");
  30. return a;
  31. }
  32. function pug_escape(e) {
  33. var a = "" + e, t = pug_match_html.exec(a);
  34. if (!t) return e;
  35. var r, c, n, s = "";
  36. for (r = t.index, c = 0; r < a.length; r++) {
  37. switch (a.charCodeAt(r)) {
  38. case 34:
  39. n = "&quot;";
  40. break;
  41. case 38:
  42. n = "&amp;";
  43. break;
  44. case 60:
  45. n = "&lt;";
  46. break;
  47. case 62:
  48. n = "&gt;";
  49. break;
  50. default:
  51. continue;
  52. }
  53. c !== r && (s += a.substring(c, r)), c = r + 1, s += n;
  54. }
  55. return c !== r ? s + a.substring(c, r) : s;
  56. }
  57. var pug_has_own_property = Object.prototype.hasOwnProperty;
  58. var pug_match_html = /["&<>]/;
  59. function pug_merge(e, r) {
  60. if (1 === arguments.length) {
  61. for (var t = e[0], g = 1; g < e.length; g++) t = pug_merge(t, e[g]);
  62. return t;
  63. }
  64. for (var l in r) if ("class" === l) {
  65. var n = e[l] || [];
  66. e[l] = (Array.isArray(n) ? n : [ n ]).concat(r[l] || []);
  67. } else if ("style" === l) {
  68. var n = pug_style(e[l]);
  69. n = n && ";" !== n[n.length - 1] ? n + ";" : n;
  70. var a = pug_style(r[l]);
  71. a = a && ";" !== a[a.length - 1] ? a + ";" : a, e[l] = n + a;
  72. } else e[l] = r[l];
  73. return e;
  74. }
  75. function pug_style(r) {
  76. if (!r) return "";
  77. if ("object" == typeof r) {
  78. var t = "";
  79. for (var e in r) pug_has_own_property.call(r, e) && (t = t + e + ":" + r[e] + ";");
  80. return t;
  81. }
  82. return r + "";
  83. }
  84. function template(locals) {
  85. var pug_html = "", pug_mixins = {}, pug_interp;
  86. pug_mixins["test"] = pug_interp = function() {
  87. var block = this && this.block, attributes = this && this.attributes || {};
  88. pug_html = pug_html + "<div" + pug_attrs(pug_merge([ {
  89. class: "test"
  90. }, attributes ]), false) + "></div>";
  91. };
  92. pug_mixins["test"]();
  93. return pug_html;
  94. }