Remove 'nest-whitespace-under-previous-line' logic and move it out to the same level, simplifying parser logic. Users of this lib can implement such behavior if they'd like.

This commit is contained in:
Joshua Bemenderfer
2023-02-04 10:01:17 -05:00
parent f54e29acbf
commit 94767772b4
8 changed files with 61 additions and 82 deletions

View File

@@ -110,10 +110,10 @@ async function main() {
if (match('name')) author.name = tail().trim()
else if (match('email')) author.email = tail().trim()
else {
if (!author['#text']) author['#text'] = [line()]
if (!author['#text']) author['#text'] = [level(), line(l + 1)]
// Loop through all remaining lines to avoid re-matching name or email above.
while(await next(l)) {
author['#text'].push(line())
author['#text'].push(level(), line(l + 1))
}
}
}