Module talk:Check for unknown parameters/Archive 1: Difference between revisions

Content deleted Content added
m Archiving 1 discussion(s) from Module talk:Check for unknown parameters) (bot
m Archiving 1 discussion(s) from Module talk:Check for unknown parameters) (bot
 
(One intermediate revision by the same user not shown)
Line 389:
:[[:Module:Check for deprecated parameters]]. – [[User:Jonesey95|Jonesey95]] ([[User talk:Jonesey95|talk]]) 16:06, 5 December 2023 (UTC)
::Thanks &mdash;&nbsp;Martin <small>([[User:MSGJ|MSGJ]]&nbsp;·&nbsp;[[User talk:MSGJ|talk]])</small> 17:42, 5 December 2023 (UTC)
 
== Error category should also be added in preview ==
 
If there is an error category for unknown parameters then it's only added in the rendered page, not previews which instead show a preview warning. That can be very confusing. Consider for example [[Copa Libertadores Femenina]] ([https://en.wikipedia.org/w/index.php?title=Copa_Libertadores_Femenina&oldid=1181533151 permanent link]) with [[:Category:Pages using flagicon template with unknown parameters]]. The page has 135 {{tl|flagicon}}. The unknown parameter is in <code><nowiki>{{flagicon|BRA|side=30px}}</nowiki></code> (should have said size). It's common to track down where a category is added by previewing different parts of the code. That fails here when the category is never added in preview. You can search for the preview warning in the preview but users may not know that. Previews can add things but shouldn't remove things. [[User:PrimeHunter|PrimeHunter]] ([[User talk:PrimeHunter|talk]]) 11:36, 9 December 2023 (UTC)
 
== Lua patterns ==
 
Is it possible to add a function to use Lua patterns and also limit the number? For example, if the parameter {{para|date}} can be between {{para|date1}} and {{para|date8}} and using <code>regexp1 = "date[%d]+"</code> and something like <code>reglimit1=8</code> to limit the allowed parameters? [[User:Gonnym|Gonnym]] ([[User talk:Gonnym|talk]]) 12:26, 23 June 2024 (UTC)
:Why not write a specific pattern? <syntaxhighlight lang="lua" inline="1">regexp1 = "date[1-8]"</syntaxhighlight>
:—[[User:Trappist the monk|Trappist the monk]] ([[User talk:Trappist the monk|talk]]) 12:59, 23 June 2024 (UTC)
::Didn't even cross my mind to do that for some reason. I'll try that out, thanks! [[User:Gonnym|Gonnym]] ([[User talk:Gonnym|talk]]) 13:01, 23 June 2024 (UTC)
::@[[User:Trappist the monk|Trappist the monk]] doesn't work. Tested it on [[TNA Impact!]] by using the /sandbox version in preview. [[User:Gonnym|Gonnym]] ([[User talk:Gonnym|talk]]) 13:06, 23 June 2024 (UTC)
:::Nevermind, got it to work without the quotes of course. I'll update the /doc here. [[User:Gonnym|Gonnym]] ([[User talk:Gonnym|talk]]) 13:09, 23 June 2024 (UTC)
::::You could also look at the check at {{tl|Interlinear}} for a fun example. It supports values of 1–99 for some parameters (actually 1 and higher, but I'm hoping nobody will put in more than 99 unnamed parameters). – [[User:Jonesey95|Jonesey95]] ([[User talk:Jonesey95|talk]]) 19:43, 24 June 2024 (UTC)
:::::The pattern <code>[1-9][%d]*</code> (should probably be written <code>[1-9]%d*</code>) is not limited to the range 1–99. <code>%d*</code> means 0 or more digits. So, as long as the first digit is not zero, any number of digits (within reason) will be accepted. If you want to actually limit the range to 1–99 you might use <code>%f[%d][1-9]%d?$</code> where (right to left) <code>$</code> anchors the pattern to the end of the parameter name string; <code>%d?</code> means 0 or 1 digits; <code>[1-9]</code> requires the first digit of the enumeration to be in the range 1–9; <code>%f[%d]</code> is the frontier pattern where the next character is a digit but the previous character is not a digit – in <code>abc123</code> the pattern finds the boundary between <code>c</code> (parameter name) and <code>1</code> (first digit of the enumerator).
:::::—[[User:Trappist the monk|Trappist the monk]] ([[User talk:Trappist the monk|talk]]) 22:00, 24 June 2024 (UTC)