Fix bug with unclosed bold and italics in succession#372
Merged
kristian-clausal merged 1 commit intomainfrom Apr 14, 2025
Merged
Fix bug with unclosed bold and italics in succession#372kristian-clausal merged 1 commit intomainfrom
kristian-clausal merged 1 commit intomainfrom
Conversation
Fixes wiktextract issue #1120 and others What was broken: if you had text like `aaa '''bolded''` with a typo that makes the formatters unbalanced, the earlier token would eat the rest of the article. Issue was fixed by adding `continue` into text_fn() in parser.py, in the `while True` block that would loop over the current parser stack in reverse and pop its items, to handle end-of-line breakpoints for those items. The `elif` entry for italics and bolds were missing a continue, and so the `break` after the `if` block would execute, meaning the bold token was never popped and parsing continued with everything following being its children.
xxyzz
added a commit
to xxyzz/wikitextprocessor
that referenced
this pull request
Apr 15, 2025
Collaborator
|
The test process should be killed with sigkill or sigterm. |
xxyzz
added a commit
that referenced
this pull request
Apr 15, 2025
Add test for previous pull request #372
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes wiktextract issue #1120 and others
What was broken: if you had text like
aaa '''bolded''with a typo that makes the formatters unbalanced,the earlier token would eat the rest of the article.
Issue was fixed by adding
continueinto text_fn() in parser.py, in thewhile Trueblock that would loop over the current parser stack in reverse and pop its items, to handle end-of-line breakpoints for those items.The
elifentry for italics and bolds were missing a continue, and so thebreakafter theifblock would execute, meaning the bold token was never popped and parsing continued with everything following being its children.Also, I just spent too damn long trying to figure out why
python -m unittestwas stuck (couldn't even kill it with SIGINT)... It was because my uncommitted debugging code hadbreakpoint(), which of course opened the python debugger in the background of certain tests... I don't use the pdb enough for this to not be a surprise.