var t;
(t = (function () {
function t(t, e) {
for (var n = 0; n < e.length; n++) {
var i = e[n];
(i.enumerable = i.enumerable || !1),
(i.configurable = !0),
"value" in i && (i.writable = !0),
Object.defineProperty(t, i.key, i);
}
}
return function (e, n, i) {
return n && t(e.prototype, n), i && t(e, i), e;
};
})()),
new ((function () {
function e(t) {
!(function (t, e) {
if (!(t instanceof e))
throw new TypeError("Cannot call a class as a function");
})(this, e);
var n = this;
for (var i in ((n.config = {}), (t = t || {}))) n.config[i] = t[i];
var a = require("./main");
n.m = { fs: require("fs"), path: require("path"), towxml: new a() };
}
return (
t(e, [
{
key: "init",
value: function () {
var t = this;
t.outtag();
var e = t.outwxml();
t.m.fs.writeFileSync("./renderTemplate.wxml", e);
},
},
{
key: "outtag",
value: function (t) {
var e = "",
n = this.outattr();
return (
this.m.towxml.wxmlTag.forEach(function (i, a) {
var r = "";
"image" === i && (r = 'mode="widthFix"'),
(e +=
"\n <" +
i +
" wx:if=\"{{item.node === 'element' && item.tag === '" +
i +
"'}}\" " +
n +
" " +
r +
'>\n \n \n \n ' +
i +
">\n ");
}),
e
);
},
},
{
key: "outattr",
value: function () {
var t = "";
return (
[
"class",
"width",
"height",
"data",
"src",
"id",
"style",
].forEach(function (e, n) {
t +=
"class" === e
? e + '="{{item.attr.className}}"'
: e + '="{{item.attr.' + e + '}}"';
}),
t
);
},
},
{
key: "outwxml",
value: function () {
for (var t = "", e = 0, n = this.config.depth; e < n; e++) {
var i = e < n - 1 ? e + 1 : e;
t +=
'{{item.text}}' +
this.outtag(i) +
"";
}
return t;
},
},
]),
e
);
})())({ depth: 10 }).init();