Module talk:Format link
Add topic+|target=
[edit]This edit request has been answered. Set the |answered= parameter to no to reactivate your request. |
I request the module be edited to reflect the changes in Special:PermaLink/1062625990, which add a |target= parameter. The intention of this parameter is mostly for humor (to look like a fancy link to one thing but really be a link to another thing) in talk and project space. It also has some use in {{format linkr}} as it can allow users to link to pages which would be URL-encoding converted right now. Tests were added in Special:PermaLink/1061891226.
FYI, Nihiltres, sorry I keep pinging you, I just have found a lot of issues with your recent update slowly at different times is all, otherwise I would've combined them, but you forgot to update the sandbox of {{format link}} to point to the sandbox(!) when you updated the module's name, boy was that an annoying bug to track down while writing this diff, easily accounts for 75% of time spent. I'm not that bright, though, a sharper student would've gotten it quickly.
Psiĥedelisto (talk • contribs) please always ping! 16:04, 29 December 2021 (UTC)
- I don't see the benefit of this change given that the first positional parameter already specifies the target, and the second already specifies the display. It seems like it complicates the code needlessly, especially as implemented (I'd override the output of
parseLinkrather than integrate a second parameter to it). That said, perhaps I'm not interpreting the use-case quite right. What does this add that the template/module can't already do? {{Nihiltres |talk |edits}} 18:21, 29 December 2021 (UTC)- @Nihiltres: I don't mind reimplementing, but we should probably agree it's useful before I bother. So, consider e.g.
{{format linkr|:ja:%E5%A1%A9#原料||:ja:%E3%82%B3%E3%82%B7%E3%83%A7%E3%82%A6}}which would create ja:%E5%A1%A9 § 原料. It is intended mostly for use with {{format linkr}}, mostly where you rely heavily on that template's auto-formatting to remove underscores, URL encoding, etc., and is useless whendisplayis given. All three should never be given. Psiĥedelisto (talk • contribs) please always ping! 19:55, 30 December 2021 (UTC)- @Psiĥedelisto: I think I might still not understand—in particular, the double pipe in your example really complicates it (is it an error?)—but translating to a functional goal, my guess is that you essentially want the option of applying the link formatting to the display, so that e.g.
{{format link|Display#Section|target=Target}}would resolve to[[:Target|Display § Section]]. Is that a reasonable interpretation? I'm concerned that it's over-specialized, but if it isn't awful to implement and doesn't introduce edge-cases to extant uses, I don't see why not. {{Nihiltres |talk |edits}} 21:27, 30 December 2021 (UTC)- @Nihiltres: Not an error. It skips
|display=, which is also possible. Your example, byte for byte, already works with my sandbox version: Display § Section. Now, whether or not this is marginal use is somewhat debatable…I think more people would use {{format linkr}} if they knew about it, because it really speeds up section linking, especially on foreign-language wikis (I bet this is why it was so quickly copied to Vietnamese Wikipedia). URL encoding and underlines really slow me down.
Psiĥedelisto (talk • contribs) please always ping! 22:24, 30 December 2021 (UTC) - @Nihiltres: I thought of another use for the feature, which I just used on Talk:Furry fandom—often I want to link to a section in the article but write it on talk. So I subst'd the /sandbox form of {{format linkr}} with args
{{format linkr/sandbox|#BDSM||Furry fandom#BDSM}}to get § BDSM. That's actually very useful in practice, so I hope you'll reconsider this feature's utility. Psiĥedelisto (talk • contribs) please always ping! 02:20, 31 December 2021 (UTC)
- @Nihiltres: Not an error. It skips
- @Psiĥedelisto: I think I might still not understand—in particular, the double pipe in your example really complicates it (is it an error?)—but translating to a functional goal, my guess is that you essentially want the option of applying the link formatting to the display, so that e.g.
- @Nihiltres: I don't mind reimplementing, but we should probably agree it's useful before I bother. So, consider e.g.
(←) @Psiĥedelisto: I think you've made the case for including the feature, but I'd like to see a sandbox version that doesn't pollute parseLink, so as to uphold the single-responsibility principle. I'll poke at making a version like that; the main annoyance is that I'll probably need to extract the functionality that does the formatting §nbsp;for display to separate it from the part that makes a [[:link]]. I'll probably work on that, oh, next year (remember the current date). ;) {{Nihiltres |talk |edits}} 20:31, 31 December 2021 (UTC)
- Deactivating edit request since I see no need for an uninvolved template editor to do anything here (Nihiltres is an admin and can make then change themselves once they are satisfied) * Pppery * it has begun... 05:16, 1 January 2022 (UTC)
- Thanks. Psiĥedelisto (talk • contribs) please always ping! 10:11, 4 January 2022 (UTC)
- @Psiĥedelisto: I've implemented a version that's a bit cleaner. Would you please review it? It passes extant tests, but I think that we could probably add a few more to make certain edge-case behaviours more explicit. {{Nihiltres |talk |edits}} 22:53, 1 January 2022 (UTC)
- @Nihiltres: Only had one suggestion, to use Module:Error. . Looks good!~ Psiĥedelisto (talk • contribs) please always ping! 10:11, 4 January 2022 (UTC)
- @Psiĥedelisto: Great, I'll make the update as soon as I've got the time to also update the documentation with all the new stuff. :) {{Nihiltres |talk |edits}} 18:07, 4 January 2022 (UTC)
- @Nihiltres: Only had one suggestion, to use Module:Error. . Looks good!~ Psiĥedelisto (talk • contribs) please always ping! 10:11, 4 January 2022 (UTC)
Section links within same page
[edit]When used with a section without a page, this is linking to the main page instead of the current page.
[[#Section links within same page]]produces the correct link #Section links within same page{{format link|#Section links within same page}}produces the incorrect link § Section links within same page
Noticed this at Wikipedia:Manual of Style#Possessives's hatnote to § Apostrophes. ~ Jenson (SilverLocust 💬) 14:36, 6 August 2026 (UTC)
This edit request has been answered. Set the |answered= parameter to no to reactivate your request. |
- Another editor just triggered the same bug in Wikipedia:Arguments to avoid in deletion discussions#It's interesting@15:20, 11 August 2026. The underlying cause seems to be that this module prefixes everything with a colon, not just category and file names, converting #Internal section link to [[:#Internal section link]]; when clicked, this link redirects to [[Main_Page#Internal section link]].
- To fix the bug, I think we just need to update the "Format the result as a link" section to omit the colon prefix when
parsed.pageis nil. - Pinging @Nihiltres / @Pppery: does this sound right to you? If it checks out, I can help you test a fix in Module:Format link/sandbox? Preimage (talk) 16:02, 7 September 2026 (UTC)
- Just to note that this is caused by Parsoid handling these links differently, and is tracked at Phabricator as T433562. It's causing issues at at least a few more templates, so I raised the issue here and had this reply from WMF staff:
Is there a reason why the template wants to colon-escape that link? Dropping the colon would fix the issue, no? Note that
So it seems removing the leading colon would be a good fix for this bug, unless you can convince the Parsoid team to support this link format. --YodinT 12:13, 9 September 2026 (UTC)[[:]]is not a valid wikilink so it's questionable that[[:#this]]would be.
- Just to note that this is caused by Parsoid handling these links differently, and is tracked at Phabricator as T433562. It's causing issues at at least a few more templates, so I raised the issue here and had this reply from WMF staff:
- The module has now been edited by Ahecht. Thanks. ~ Jenson (SilverLocust 💬) 14:41, 9 September 2026 (UTC)
Minor tweak
[edit]I've renamed the variable from colon to prefix and changed the comment. No objection to removing the comment completely, or better replacing it with an explanation of why and when a colon is needed. (Including a link to the bug perhaps?)
[I also noticed that three testcases were failing. I think the current behaviour is correct so have changed the testcases.]
Please update sandbox to live if you are happy with the changes. All the best: Rich Farmbrough 14:39, 10 September 2026 (UTC).