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

Date header not parsed with socklist template #212

Closed
roysmith opened this issue Feb 24, 2022 · 5 comments
Closed

Date header not parsed with socklist template #212

roysmith opened this issue Feb 24, 2022 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@roysmith
Copy link
Owner

Wikipedia:Sockpuppet investigations/Tounom

23 February 2022 is missing.

@roysmith roysmith added the bug Something isn't working label Feb 24, 2022
@roysmith roysmith self-assigned this Feb 24, 2022
@TamzinHadasa
Copy link
Contributor

@roysmith I will look closer at this shortly, but just off the bat, I don't thing mwparserfromhell distinguishes between {{foo|bar}} and {{foo|1=bar}}, so I'm wondering why this would be an issue. But again, will look closer soon.

@roysmith
Copy link
Owner Author

As far as I can tell, mwparserfromhell doesn't provide a way to iterate over just the positional parameters; you need to look at the parameter name and see if its an integer. Maybe I'm just missing something in the API?

roysmith referenced this issue Feb 24, 2022
explicit numeric names, i.e. {{socklist|1=user1|2=user2}}.
@roysmith
Copy link
Owner Author

Fixed in 664371f

@TamzinHadasa
Copy link
Contributor

@roysmith param.name will only be an empty string if someone passes {{foo|=bar}}. Meanwhile, for a positional param, param.name will always be an all-digits string, and that's true whether or not n= is made explicit. For instance:

>>> text = "{{foo|bar|2=baz}}"
>>> template = mwparserfromhell.parse(text).filter_templates()[0]
>>> [i.name for i in template.params]
['1', '2']

So to see if a param is positional, I'd think all you need to do is check whether param.name.isdigit().

@roysmith
Copy link
Owner Author

I had forgotten about isdigit(). What I did works, but isdigit() would have made it simpler.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants