Module talk:Wikitext Parsing
Add topic| Module:Wikitext Parsing is indefinitely protected from editing as it is a heavily used or highly visible module. Substantial changes should first be proposed and discussed here on this page. If the proposal is uncontroversial or has been discussed and is supported by consensus, editors may use {{edit protected}} to notify an administrator to make the requested edit.
|
| This is the talk page for discussing improvements to the Wikitext Parsing module. |
|
Find out if template is inside another template
[edit]I am looking for an off-the-shelf method of determining if a template like {{WikiProject Cycling}} lies inside {{WikiProject banner shell}} or any of its redirects. Can this module's ParseTemplates function provide this efficiently? — Martin (MSGJ · talk) 09:05, 2 July 2024 (UTC)
- ParseTemplates is not in the best shape last I remember, and it would probably need quite a bit of work to reliably determine something like that in most cases (there's a reason I've marked it as a beta feature, and even that might be a bit generous thinking about it now - really should get back into wikipedia and fix that some day).
- In your specific case, though, I imagine it would work out of the box (though since there's no concept of a "parent" you would explicitly have to check the Children of any WPbs instead). However, due to how it works, ParseTemplates is designed for getting things as right as possible, which is probably overkill (and not very efficient) for what you describe. Might want to consider if there's an alternative solution (though what that would be I'm not sure - A basic
:find()on the entirety of WPbs's text if that's available already in your case?). Aidan9382 (talk) 18:51, 2 July 2024 (UTC)- Wow, wasn't expecting a quick reply as I saw you were inactive for a couple of weeks. But glad to see you back! My goal is actually to find project banners which have been placed outside the banner shell (but I see my question was not very clear). So I will be looking to see if
{{WikiProject Cycling ... }}lies in between{{WikiProject banner shelland its closing braces}}or not. This is probably a bit beyond my abilities — Martin (MSGJ · talk) 20:45, 2 July 2024 (UTC)- I'm inactive in the sense that I haven't had the motivation to do much proactively, but I'm still actively checking my watchlist and emails incase something comes up.
- If you can pick up the entire text of the template for WikiProject banner shell on a page (Module:Template parameter value has
getTemplateto get the text of a template, which you might already be using or might not be, I'm not sure), surely you could do a :find() on it for{{%s*[Ww]ikiProject Cycling%s*[|}]? This obviously doesn't account for strange scenarios like the template being on the page twice, but I don't think that's something the module should be reasonably expected to handle perfectly since there could be a number of wrong things going on there. Aidan9382 (talk) 20:53, 2 July 2024 (UTC)
- Wow, wasn't expecting a quick reply as I saw you were inactive for a couple of weeks. But glad to see you back! My goal is actually to find project banners which have been placed outside the banner shell (but I see my question was not very clear). So I will be looking to see if
Protection change request
[edit]This edit request to Module:Wikitext Parsing/sandbox has been answered. Set the |answered= parameter to no to reactivate your request. |
Could an admin remove the protection on the sandbox now that the transclusions have finally reset? Aidan9382 (talk) 21:29, 19 May 2025 (UTC)
Not done: requests for decreases to the page protection level should be directed to the protecting admin or to Wikipedia:Requests for page protection if the protecting admin is not active or has declined the request. P.I. Ellsworth , ed. put'er there 01:41, 20 May 2025 (UTC)
Edit request 25 July 2026 - Performance/cleanup
[edit]| It is requested that an edit be made to the fully protected module at Module:Wikitext Parsing. (edit · history · last · links · sandbox · edit sandbox · sandbox history · sandbox last edit · sandbox diff · test cases · transclusion count · protection log) This template must be followed by a complete and specific description of the request, so that an editor unfamiliar with the subject matter could complete the requested edit immediately.
Edit requests to fully protected pages should only be used for edits that are either uncontroversial or supported by consensus. If the proposed edit might be controversial, discuss it on the protected page's talk page before using this template. Consider making changes first to the module's sandbox and test them thoroughly here before submitting an edit request. To request that a page be protected or unprotected, make a protection request. When the request has been completed or denied, please add the |
This change improves the performance by a bit to try help with long-load-time talk pages like Talk:World War II, as well as cleaning up some of the code and removing the old, unfinished, overkill, and unused ParseTemplates feature (and I say that as the person who wrote it).
The direct sandbox diff is a bit messy, so here are the changes in parts:
- General code and comment cleanup (diff)
- Improve the string.find usage (diff)
- Reduce the amount of string.sub calls being made (diff)
- Slightly optimise global usage (1, 2, final)
- Removed ParseTemplates (diff)
Testcase results can be found at Module talk:Wikitext Parsing/testcases and Module talk:Template parameter value/testcases. Aidan9382 (talk) 19:30, 25 July 2026 (UTC)