Edge Rewrite
// HTMLRewriter · presentation

This page was redesigned at the edge.

Cloudflare fetched the original article and streamed it through HTMLRewriter to apply an entirely new visual system without rebuilding the source page.

Jump to content

Template talk:Urltowiki

Page contents not supported in other languages.
Add topic
From Wikipedia, the free encyclopedia
(Redirected from Module talk:Urltowiki)
Latest comment: 7 months ago by Mr. Stradivarius in topic Wikilinktourl
[edit]

Remove redundant piped text

[edit]

Currently {{subst:urltowiki|https://en.wikipedia.org/wiki/Example|Example}} results in [[Example|Example]], which is redundant and confusing. It seems like it would be easy for the module to check if the display and page title are the same, and if so, only include the page title. I think it would entail switching line 188 from

        if display then

to

        if display and display ~= wikitext then

(I would add it myself, but I'm not confident in my Lua skills.) Thanks, /~huesatlum/ 15:09, 27 July 2015 (UTC)Reply

@HueSatLum: Very good point! I've fixed it. — Mr. Stradivarius  talk  08:29, 28 July 2015 (UTC)Reply

error=no?

[edit]

@Ahecht: When would error=no ever be useful or desirable? Jackmcbarn (talk) 17:54, 28 August 2015 (UTC)Reply

I was just thinking the same thing. Ahecht, what is your use-case here? I'm guessing that there's probably an easier way of doing whatever you're trying to do. — Mr. Stradivarius  talk  20:22, 28 August 2015 (UTC)Reply
@Jackmcbarn: The template already gracefully handles other input options, either a valid URL or a non-URL string, so this lets it gracefully handle a missing input if desired. This is similar to the |ignore_errors=1 parameter in module:String. One example where it came in handy is in {{Request redirect/post}}, where I want a blank input to result in a blank output. I could add a statement such as {{safesubst<noinclude/>:#if{{{input|}}}|{{safesubst<noinclude/>:u2w|{{{input}}}}}|}}, but it seemed cleaner this way. I suppose, for consistences sake, I should've used ignore_errors=1 instead of error=no (I can change it if you like) --Ahecht (TALK
PAGE
) 04:19, 29 August 2015 (UTC)Reply
If you're accessing Module:UrlToWiki from a Lua module, then you can just use pcall rather than having to change the module itself. #iferror will work from templates as well, although the page will be categorised into Category:Pages with script errors. To avoid the categorisation when calling it from wikitext, we could add another function to the module that is routed through pcall. That would at least avoid the need for if/then blocks to check for errors. — Mr. Stradivarius  talk  07:24, 29 August 2015 (UTC)Reply
Since the template is being substituted rather than transcluded in that use case, the page won't end up in Category:Pages with script errors no matter what, so no extra logic for that will be needed. Jackmcbarn (talk) 16:01, 29 August 2015 (UTC)Reply

Requested move 30 October 2019

[edit]
The following is a closed discussion of a requested move. Please do not modify it. Subsequent comments should be made in a new section on the talk page. Editors desiring to contest the closing decision should consider a move review after discussing it on the closer's talk page. No further edits should be made to this discussion.

The result of the move request was: Moved (closed by non-admin page mover) Wug·a·po·des05:04, 8 November 2019 (UTC)Reply


– Match name with template. * Pppery * it has begun... 21:57, 30 October 2019 (UTC)Reply


The above discussion is preserved as an archive of a requested move. Please do not modify it. Subsequent comments should be made in a new section on this talk page or in a move review. No further edits should be made to this section.

Special:MobileDiff

[edit]

For whatever reason, diffs are displayed in the mobile interface not using the regular diff but via this special page. Can this template support it, for the benefit of mobile users? Hairy Dude (talk) 20:51, 29 December 2022 (UTC)Reply

Wikilinktourl

[edit]

Hello, Mr. Stradivarius. I need the reverse operation, namely convert wikilink to url. (The reason is because of sister projects like Serbian or Chinese Wikipedia that have two or more scripts and the difference is expressed in the query string. For example, Serbian has Latin and Cyrillic scripts, expressed as &variant=sh-latn and &variant=sh-cyrl in the url, so I need the url so I can append the param and link the right one. See this discussion.) I know how to code this in a template, but I thought I'd check with you in case your module already has bits that could be exported and make it trivial by invoking it. Otherwise, I'll just code the whole thing as a template. Thanks, Mathglot (talk) 04:36, 6 December 2025 (UTC)Reply

P.S. I'm thinking of requiring legitimate wikipedia variant values, so using a #switch to verify and grab the values, and dumping some kind of big red error in the default case if it doesn't match one of the known good values. But I'd like to maintain some consistency with however you've done this template, so if you have a different approach you'd prefer, then please lmk. Mathglot (talk) 05:08, 6 December 2025 (UTC)Reply
@Mathglot: I don't think there's anything you could use in this module straight away, but you might want to check out Module:Delink which does some parsing of wikilinks. The data at Module:InterwikiTable might also be of use. — Mr. Stradivarius  talk  14:52, 13 December 2025 (UTC)Reply