Jump to content

Module talk:Format link

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

+|target=

[edit]

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 (talkcontribs) please always ping! 16:04, 29 December 2021 (UTC)[reply]

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 parseLink rather 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)[reply]
@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:塩 § 原料. 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 when display is given. All three should never be given. Psiĥedelisto (talkcontribs) please always ping! 19:55, 30 December 2021 (UTC)[reply]
@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)[reply]
@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 (talkcontribs) please always ping! 22:24, 30 December 2021 (UTC)[reply]
@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 (talkcontribs) please always ping! 02:20, 31 December 2021 (UTC)[reply]

() @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)[reply]

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)[reply]
Thanks. Psiĥedelisto (talkcontribs) please always ping! 10:11, 4 January 2022 (UTC)[reply]
@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)[reply]
@Nihiltres: Only had one suggestion, to use Module:Error. [1]. Looks good!~ Psiĥedelisto (talkcontribs) please always ping! 10:11, 4 January 2022 (UTC)[reply]
@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)[reply]