var html_line = html.replace(/[\r\t\n]+/g, "\n").split(/\n/)
var tpl = `var _h = []`
var _begin = ‘<?‘ , _end = ‘?>‘
,_is = true
html_line.forEach(function(line){
while(true){
var _pos = line.indexOf(_is ? _begin : _end)
if (_pos !== -1){
var _part = line.slice(0 ,_pos )
line = line.slice(_pos + 2 )
if (_is) {
_part = _part.replace(/\"/g,`\\\"`)
if (_part.length) {
tpl += ` _h.push( "${_part}");`
}
} else {
if (‘=‘ == _part.slice(0,1)) {
_part = _part.slice(1)
tpl += ` _h.push( ${_part});`
}else{
tpl += ` ${_part}`
}
}
}else {
if (_is) {
line = line.replace(/\"/g,`\\\"`)
if (line.length) {
tpl += ` _h.push( "${line}");`
}
} else {
tpl += ` ${line}`
}
break
}
_is = !_is
}
})
tpl += ‘\n return _h.join("")‘