Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#if: magic word is not parsed correctly when tags are inside the argument #251

Open
lahwaacz opened this issue Aug 9, 2020 · 1 comment

Comments

@lahwaacz
Copy link
Contributor

lahwaacz commented Aug 9, 2020

Consider this wikicode:

>>> w = mwparserfromhell.parse("foo{{#if:<nowiki>bar</nowiki>|true|false}}baz")                                                                                                  
>>> print(w.get_tree())                                                                                                                                                          
foo{{#if:
<
      nowiki
>
      bar
</
      nowiki
>
|true|false}}baz

The {{#if:...}} magic word was clearly not parsed correctly, it is part of the surrounding text. It is probably because mwparserfromhell parses it as a regular template and tags are not allowed inside template names. However, MediaWiki allows tags inside the {{#if:...}} magic word.

@lahwaacz
Copy link
Contributor Author

The same thing happens even when there are square brackets (without a link):

>>> w = mwparserfromhell.parse("foo{{#if:[bar]|true|false}}baz")
>>> print(w.get_tree())
foo{{#if:[bar]|true|false}}baz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant