Content deleted Content added
m Reverted edit by 103.28.116.119 (talk) to last version by Cewbot |
|||
(19 intermediate revisions by 8 users not shown) | |||
Line 1:
{{WikiProject banner shell|
{{WikiProject Redirect}}
}}
== Why am I confused? ==
Line 198 ⟶ 199:
:::<code><nowiki>{{#invoke:redirect|main|User:Trappist the monk/sandbox|fulltext=yes}}</nowiki></code> → {{#invoke:redirect|main|User:Trappist the monk/sandbox|fulltext=yes}}
::—[[User:Trappist the monk|Trappist the monk]] ([[User talk:Trappist the monk|talk]]) 14:17, 25 February 2022 (UTC)
:::Interesting... if I add a section to the link to your sandbox page, it overrides the section in the target of the redirect: [[User:Trappist the monk/sandbox#Foobar]]. This is opposite to what I expected would happen. <span class=nowrap>「[[User:Dinoguy1000|<span style=color:#00f>ディノ</span><span style=color:#080>奴</span>]][[Special:Contributions/Dinoguy1000|<span style=color:#F90>千?!</span>]]」<sup>[[User talk:Dinoguy1000#top|☎ Dinoguy1000]]</sup></span> 08:34, 26 February 2022 (UTC)
::::I don't know why that is but I do know that it has nothing to do with [[Module:redirect]] because <code><nowiki>[[User:Trappist the monk/sandbox#Foobar]]</nowiki></code> is a generic, everyday, wikilink. Just as a test, I added a section §Foobar to my sandbox. That did not change anything; [[User:Trappist the monk/sandbox#Foobar]] redirects to the top of this page. Perhaps ask at [[WP:VPT]]?
::::—[[User:Trappist the monk|Trappist the monk]] ([[User talk:Trappist the monk|talk]]) 18:50, 26 February 2022 (UTC)
:::::My point with it was that, if this module is changed to preserve sections on input, then it would have to handle the case where a section is passed in, but the input title is a redirect that includes a section itself. The obvious way to handle this case is to mirror what MediaWiki does. Beyond this, I have no particular opinion on the functionality in general. <span class=nowrap>「[[User:Dinoguy1000|<span style=color:#00f>ディノ</span><span style=color:#080>奴</span>]][[Special:Contributions/Dinoguy1000|<span style=color:#F90>千?!</span>]]」<sup>[[User talk:Dinoguy1000#top|☎ Dinoguy1000]]</sup></span> 12:08, 27 February 2022 (UTC)
== Exception for redirects that intentionally have Wikidata objects? ==
I have utilzed this nice module in {{tlp|Get QID|<Wikipedia page title>}} to follow redirects. Then Get QID still works if a page is moved.
However, there are redirects that intentionally have their own Wikidata objects. See [[:Category:Wikidata_redirects]]. In that case I want that template to give the QID of the source page, and not of the redirect destination page. Should I implement that in the template as an ugly work-around, or could this module take care of that problem?
For example, <nowiki>{{Q|{{get QID|388282 ʻAkepa}}}}</nowiki> gives <s>{{Q|18678271}}</s> {{Q|{{get QID|388282 ʻAkepa}}}}. I want it to result in {{Q|Q32037018}}.
Meaning: <nowiki>[[{{#invoke:redirect|main|388282 ʻAkepa}}]]</nowiki> now gives [[{{#invoke:redirect|main|388282 ʻAkepa}}]], but my question is if it can make an exception because the page belongs to the above mentioned category, and respond with [[388282 ʻAkepa]] ?
[[User:Tomastvivlaren|Tomastvivlaren]] ([[User talk:Tomastvivlaren|talk]]) 10:40, 1 March 2022 (UTC)
:I solved the problem temporarily using ugly template code in {{tl|Get QID}}.[[User:Tomastvivlaren|Tomastvivlaren]] ([[User talk:Tomastvivlaren|talk]]) 17:16, 1 March 2022 (UTC)
== Protected edit request on 16 April 2023 ==
{{edit fully-protected|Module:Redirect|answered=yes}}
This might be a little excessive for an edit to a fully protected module, but:
I would like to simplify the following (lines 103-107, in function <code>p.luaIsRedirect</code>):
<syntaxhighlight lang="lua">
if titleObj.isRedirect then
return true
else
return false
end
</syntaxhighlight>
to:
<syntaxhighlight lang="lua">
return titleObj.isRedirect
</syntaxhighlight>
because <code>titleObj.isRedirect</code> will only ever yield "true" or "false".
([https://en.wikipedia.org/wiki/Special:ComparePages?page1=Module%3ARedirect&rev1=1043472510&page2=Module%3ARedirect%2Fsandbox&rev2=1150203250&action=&unhide=&diffmode=source diff]) {{'''[[User:Lemondoge|Lemondoge]]'''|[[User talk:Lemondoge|Talk]]|[[Special:Contributions/Lemondoge|Contributions]]}} 21:43, 16 April 2023 (UTC)
:Has this been tested? Scibunto manual does not explicitly say that isRedirect will be true or false. — Martin <small>([[User:MSGJ|MSGJ]] · [[User talk:MSGJ|talk]])</small> 07:38, 17 April 2023 (UTC)
:@Lemondoge: I have noticed your edits to sandbox modules that I monitor. Thanks for the tweaks and thanks for finding the bug noted [[Template talk:Navbox#Short-circuit in ternary expression at line 143|here]]. However, I am not sure there is any benefit from optimizing code unless done as part of a significant effort by someone deeply invested in the particular module. Take this edit request—you are probably correct but who knows and who cares? It can be very challenging to verify rearrangements to boolean expressions. The original here is bulletproof. More importantly, it is easily seen to be bulletproof. I would leave it as is. It's not particularly important, but the edit request would result in uncertainty about what return values can occur while the original code removes any doubt. [[User:Johnuniq|Johnuniq]] ([[User talk:Johnuniq|talk]]) 07:59, 17 April 2023 (UTC)
:: Aye, fair enough. {{Withdrawn}} {{'''[[User:Lemondoge|Lemondoge]]'''|[[User talk:Lemondoge|Talk]]|[[Special:Contributions/Lemondoge|Contributions]]}} 12:43, 17 April 2023 (UTC)
|