mm_tpl 2.2.2 → 2.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cache/test.cache.html +1 -0
- package/index.js +9 -9
- package/package.json +1 -1
- package/template/game/bar.html +1 -0
- package/test.js +2 -1
package/cache/test.cache.html
CHANGED
package/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
require('mm_expand');
|
|
2
2
|
const template = require('art-template');
|
|
3
3
|
const Hook = require('./hook.js');
|
|
4
4
|
const {
|
|
@@ -35,8 +35,8 @@ class Tpl {
|
|
|
35
35
|
*/
|
|
36
36
|
this.config = {
|
|
37
37
|
root: $.runPath + '',
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
default_dir: "./template/",
|
|
39
|
+
default_theme: 'default',
|
|
40
40
|
extname: ".html",
|
|
41
41
|
rules: [nativeRule, artRule, htmlRule, jsRule, pyRule, pyRule2],
|
|
42
42
|
cache_root: './cache'.fullname(),
|
|
@@ -64,7 +64,7 @@ class Tpl {
|
|
|
64
64
|
/**
|
|
65
65
|
* 当前主题
|
|
66
66
|
*/
|
|
67
|
-
this.current_theme = this.config.
|
|
67
|
+
this.current_theme = this.config.default_theme;
|
|
68
68
|
|
|
69
69
|
/**
|
|
70
70
|
* 错误提示
|
|
@@ -146,10 +146,10 @@ Tpl.prototype.render_before = function(body, model, options) {
|
|
|
146
146
|
Tpl.prototype.loadFunc = function(m) {
|
|
147
147
|
var _this = this;
|
|
148
148
|
m.view = function(file, model, options) {
|
|
149
|
-
return _this.view(file, model, options);
|
|
149
|
+
return _this.view(file, Object.assign({}, m, model), options);
|
|
150
150
|
}
|
|
151
151
|
m.render = function(body, model, options) {
|
|
152
|
-
return _this.render(body, model, options);
|
|
152
|
+
return _this.render(body, Object.assign({}, m, model), options);
|
|
153
153
|
}
|
|
154
154
|
m.hook_action = function(name, ...args) {
|
|
155
155
|
return $.hook.runAction(name, m, ...args);
|
|
@@ -248,11 +248,11 @@ Tpl.prototype.view = function(file, model, options) {
|
|
|
248
248
|
}
|
|
249
249
|
var f = file.fullname(this.dir + this.current_theme);
|
|
250
250
|
if (!f.hasFile()) {
|
|
251
|
-
f = file.fullname(this.dir + this.config.
|
|
251
|
+
f = file.fullname(this.dir + this.config.default_theme);
|
|
252
252
|
if (!f.hasFile()) {
|
|
253
|
-
f = file.fullname(this.config.
|
|
253
|
+
f = file.fullname(this.config.default_dir + this.current_theme);
|
|
254
254
|
if (!f.hasFile()) {
|
|
255
|
-
f = file.fullname(this.config.
|
|
255
|
+
f = file.fullname(this.config.default_dir + this.config.default_theme);
|
|
256
256
|
}
|
|
257
257
|
}
|
|
258
258
|
}
|
package/package.json
CHANGED
package/template/game/bar.html
CHANGED