keep quotes and brackets outside the html() span, refs #1154

This commit is contained in:
dualfroz committed 2026-10-14 19:36:07 +02:00
1 parent 80f71d084f
commit f10373c4f7
2 files changed
+18 -2

No files matched your search

+16
View File
@@ -59,3 +59,19 @@ test('html-implicit', function (t) {
t.equal(out, `he's cool`, here + 'implict')
t.end()
})
test('html-punctuation', function (t) {
let doc = nlp(`This is a "test". Hello "World."`)
let html = doc.html({ '.red': '(test|world)' })
t.equal(html, `This is a "<span class="red">test</span>". Hello "<span class="red">World</span>."`, here + 'quotes')
doc = nlp(`he said "hello world" twice`)
html = doc.html({ '.red': 'hello world' })
t.equal(html, `he said "<span class="red">hello world</span>" twice`, here + 'quoted phrase')
doc = nlp(`my dog (spot) is cute`)
html = doc.html({ '.red': 'spot' })
t.equal(html, `my dog (<span class="red">spot</span>) is cute`, here + 'parentheses')
t.end()
})