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

[Feature request] Add wikiexpand support to expand templates #114

Open
cbrender-deploy1 opened this issue May 6, 2023 · 1 comment
Open

Comments

@cbrender-deploy1
Copy link

Thank you very much for your work in wikitextparser! I've been using wikitextparser for a few hours to convert wikitext to Markdown, and I've already made substantial progress using your tool.

That said, I found this tool called wikiexpand (Source code), which basically expands transclusions and magic words, thus allowing for completely offline parsing of templates. I would like to request adding it in wikitextparser.

This way, if we have a list of all templates needed for a page, we can tell it to recursively expand all the templates, instead of calling Special:ExpandTemplates.

Here are some things to note:

  • wikiexpand is dependent on mwparserfromhell, so the code must be ported/adopted to wikitextparser to remove the dependency
  • even though it still works, wikiexpand is a bit dated and unmaintained
  • a template store object to store the source code for all the templates

What do you think?

Thanks in advance!

@5j9
Copy link
Owner

5j9 commented May 19, 2023

Thanks for the feedback!
I actually had something like this in mind when I started _config.py, but never found the time to actually go through with it. It is a lot of work. Requires evaluating parser functions and magic words, handling localization for namespaces and functions, etc. I don't think I can continue to work on it with my current limited time.

I would encourage anyone interested in working on such a feature/package to create a separate package, similar to how wikiexpand authors have done for mwparserfromhell. Maybe create a fork if that helps. At this stage, mixing it with wikitextparser might hinder your work due to my lack of time in engaging with the new features. Please let me know how things go and if there are any improvement in wikitextparser's API that could help.

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

2 participants