Module talk:File link
Appearance
Do we really need this?
@Mr. Stradivarius: We're going to have a library like this tied into PHP soon-ish. Are you sure it's worth building this one? Jackmcbarn (talk) 02:32, 30 May 2014 (UTC)
- @Jackmcbarn: Maybe not, if the PHP library also formats image wikilinks. Do you have a link to it? — Mr. Stradivarius ♪ talk ♪ 02:35, 30 May 2014 (UTC)
- The WIP is at gerrit:67588, though there's not much to see there (most of the work is being done elsewhere in MediaWiki core). Jackmcbarn (talk) 02:38, 30 May 2014 (UTC)
- I don't see anything there that indicates an overlap - this module is about formatting the image wikitext, not about anything to do with file metadata. So the question is, would there be an overlap between the functionality in core and what I've written here? Or in other words, is the new Scribunto library aiming to format wikitext, or just to provide image data? — Mr. Stradivarius ♪ talk ♪ 02:48, 30 May 2014 (UTC)
- I don't think there will be an overlap then. Carry on. Jackmcbarn (talk) 02:53, 30 May 2014 (UTC)
- I don't see anything there that indicates an overlap - this module is about formatting the image wikitext, not about anything to do with file metadata. So the question is, would there be an overlap between the functionality in core and what I've written here? Or in other words, is the new Scribunto library aiming to format wikitext, or just to provide image data? — Mr. Stradivarius ♪ talk ♪ 02:48, 30 May 2014 (UTC)
- The WIP is at gerrit:67588, though there's not much to see there (most of the work is being done elsewhere in MediaWiki core). Jackmcbarn (talk) 02:38, 30 May 2014 (UTC)
Colon trick
I sometimes use the colon trick to have the link spelled out like [[:File:Example.png]]
. (That is in talkpage and debugging mostly). Does the object provide that option? -DePiep (talk) 08:29, 3 June 2014 (UTC)
- Not at the moment, but I have been thinking of adding it in. The question is, how should we set the display value? Using the colon trick on the code
[[:File:Example.png|thumb|220px|alt=Foo|Bar]]
produces an output of "thumb|220px|alt=Foo|Bar", so we will have to set the display value explicitly. How about anescape
method with parametersobj:escape(isEscaped, display)
? The link would only be escaped if isEscaped was true, and display would set a custom display value, with the default being the full filename. Let me know what you think. — Mr. Stradivarius ♪ talk ♪ 08:50, 3 June 2014 (UTC)- I've gone ahead and added the escape method to Module:File link/sandbox. — Mr. Stradivarius ♪ talk ♪ 09:18, 3 June 2014 (UTC)
- Yes, a fine solution (btw, not my specialty, but there are no iw or sister project prefixes involved?). -DePiep (talk) 09:31, 3 June 2014 (UTC)
- It's possible to use an interwiki link to link to a file, yes. But it's not possible to display that file on your local wiki, as far as I know - unless it's on Commons and you're using InstantCommons. If we want to set interwiki prefixes for files, it brings up the question of how those interwiki prefixes get set, and of what happens when the file is not escaped but an interwiki prefix is set. Do you ignore the prefix, and output what may be a completely different file? Or do you output an escaped link, where the author was expecting a file to be displayed? I think it would be best to skirt around this issue by not providing any interwiki prefix options at all - at least that way the module would be consistent. — Mr. Stradivarius ♪ talk ♪ 10:21, 3 June 2014 (UTC)
- OK, I can get it. -DePiep (talk) 18:02, 3 June 2014 (UTC)
- It's possible to use an interwiki link to link to a file, yes. But it's not possible to display that file on your local wiki, as far as I know - unless it's on Commons and you're using InstantCommons. If we want to set interwiki prefixes for files, it brings up the question of how those interwiki prefixes get set, and of what happens when the file is not escaped but an interwiki prefix is set. Do you ignore the prefix, and output what may be a completely different file? Or do you output an escaped link, where the author was expecting a file to be displayed? I think it would be best to skirt around this issue by not providing any interwiki prefix options at all - at least that way the module would be consistent. — Mr. Stradivarius ♪ talk ♪ 10:21, 3 June 2014 (UTC)
- Yes, a fine solution (btw, not my specialty, but there are no iw or sister project prefixes involved?). -DePiep (talk) 09:31, 3 June 2014 (UTC)
- I've gone ahead and added the escape method to Module:File link/sandbox. — Mr. Stradivarius ♪ talk ♪ 09:18, 3 June 2014 (UTC)