Skip to content

Commit

Permalink
fixed > in expr
Browse files Browse the repository at this point in the history
  • Loading branch information
Gcaufy committed May 2, 2017
1 parent 2d6b365 commit b441dd9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
6 changes: 3 additions & 3 deletions packages/wepy-cli/src/compile-template.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export default {
});
*/
let doc = new DOMImplementation().createDocument();
let node = new DOMParser().parseFromString(content);
let node = cWpy.createParser().parseFromString(content);
let template = [].slice.call(node.childNodes || []).filter((n) => n.nodeName === 'template');

[].slice.call(template[0].childNodes || []).forEach((n) => {
Expand Down Expand Up @@ -474,7 +474,7 @@ export default {

compile (template) {
let lang = template.type;
let content = template.code;
let content = util.attrReplace(template.code);

let config = util.getConfig();
let src = cache.getSrc();
Expand All @@ -490,7 +490,7 @@ export default {


compiler(content, config.compilers[lang] || {}).then(content => {
let node = new DOMParser().parseFromString(content);
let node = cWpy.createParser().parseFromString(content);
node = this.compileXML(node, template);
let target = util.getDistPath(path.parse(template.src), 'wxml', src, dist);

Expand Down
3 changes: 3 additions & 0 deletions packages/wepy-cli/src/compile-wpy.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ export default {
// ignore warnings
} else
util.warning(x);
},
error (x) {
util.error(x);
}
}});
},
Expand Down
3 changes: 2 additions & 1 deletion packages/wepy-cli/src/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,8 @@ const utils = {
// 用户可以通过临时加入 knownTags 的方法兼容
knownTags.push.apply(knownTags, configTags);
}
return content.replace(/<([\w-\_]*)\s[^>]*>/ig, (tag, tagName) => {
// Exp error when using this code: <input focus wx:if="{{test >
return content.replace(/<([\w-]+)\s*[\s\S]*?(\/|<\/[\w-]+)>/ig, (tag, tagName) => {
tagName = tagName.toLowerCase();
const isKnownTag = knownTags.indexOf(tagName) >= 0;
return tag.replace(/\s+:([\w-_]*)([\.\w]*)\s*=/ig, (attr, name, type) => { // replace :param.sync => v-bind:param.sync
Expand Down

0 comments on commit b441dd9

Please sign in to comment.