feat(parser): automatically escape attributes in template strings
This commit is contained in:
parent
1cce5c79a2
commit
cd88a3a74a
1 changed files with 6 additions and 2 deletions
|
@ -26,8 +26,12 @@ export function html(
|
|||
sub.forEach((it, idx) => {
|
||||
if (typeof it === 'boolean' || !it) return
|
||||
|
||||
if (typeof it === 'string') it = HtmlMessageEntityParser.escape(it)
|
||||
else {
|
||||
if (typeof it === 'string') {
|
||||
it = HtmlMessageEntityParser.escape(
|
||||
it,
|
||||
!!str.match(/=['"]$/)
|
||||
)
|
||||
} else {
|
||||
if (it.mode && it.mode !== 'html')
|
||||
throw new Error(`Incompatible parse mode: ${it.mode}`)
|
||||
it = it.value
|
||||
|
|
Loading…
Reference in a new issue