Properly trim white space of text nodes
Mike McCrary authored 5 years ago
J. Elliot Taylor committed 4 years ago
398 | 398 |
if ctx.isPre {
|
399 | 399 |
data = node.Data
|
400 | 400 |
} else {
|
401 | |
data = strings.Trim(spacingRe.ReplaceAllString(node.Data, " "), " ")
|
|
401 |
data = strings.TrimSpace(spacingRe.ReplaceAllString(node.Data, " "))
|
402 | 402 |
}
|
403 | 403 |
return ctx.emit(data)
|
404 | 404 |
|
668 | 668 |
"Test 1<div>Test 2</div> <div>Test 3</div>Test 4",
|
669 | 669 |
"Test 1\nTest 2\nTest 3\nTest 4",
|
670 | 670 |
},
|
|
671 |
{
|
|
672 |
"Test 1<div> Test 2 </div>",
|
|
673 |
"Test 1\nTest 2",
|
|
674 |
},
|
671 | 675 |
}
|
672 | 676 |
|
673 | 677 |
for _, testCase := range testCases {
|