Jump to content

Module talk:File link

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

Do we really need this?

[edit]

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

@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)[reply]
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)[reply]
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)[reply]
I don't think there will be an overlap then. Carry on. Jackmcbarn (talk) 02:53, 30 May 2014 (UTC)[reply]

Colon trick

[edit]

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

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 an escape method with parameters obj: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)[reply]
I've gone ahead and added the escape method to Module:File link/sandbox. — Mr. Stradivarius ♪ talk ♪ 09:18, 3 June 2014 (UTC)[reply]
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)[reply]
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)[reply]
OK, I can get it. -DePiep (talk) 18:02, 3 June 2014 (UTC)[reply]

Size in number or in numberpx

[edit]

I understand that the size is to be entered as a number for number-of-px (say "250"). My (feature) suggestion is to allow & accept "250px" too. I remember always having to go to the documentation for a given template, to check whether the unit should be present or absent. To compare, module:InfoboxImage requires "250px" not "250" (here I sigh). Seen from the editors point, it would be an obvious feature. (What also could be in play, is when this object replaces existing wikicode templates -- they can have the 'wrong' format. Must say, I do not oversee this point). -DePiep (talk) 18:13, 3 June 2014 (UTC)[reply]

That's a good idea, and I've added the code to the sandbox. I also added a check to make sure that the number given is a positive integer. I've also been toying the idea of adding a size method, where you can specify any of width, height, upright and upright ratio, and the method works out which ones you entered. Do you think that would be useful, or is it redundant to the width, height and upright methods already included? — Mr. Stradivarius ♪ talk ♪ 06:19, 4 June 2014 (UTC)[reply]
Thx. I have too little experience with the issue you mention. When I encounter this need, I always make a little research & documentation check (starting at WP:EIS). That existing parameter interacting logic is a puzzle (also with border & format & caption interactions).
If you mean to reproduce file linking as it already does (reading that "x250px" is a height setting &tc), that sounds like a covering of existing parameter option, so that could be good from programmers POV. -DePiep (talk) 13:42, 4 June 2014 (UTC)[reply]

More general

[edit]

Mr. Stradivarius Please allow me. This is not about this specific module.Read and use as you think good.
In [[:File]] usage I encounter logic that says: "thumb does not show a border, but it will not show the caption (unless alt= is set); then do not set width."
This is pre-wiki logic (logic it is), and I will not spend time on it. For an article editor, this is deadly. For a template builder (like me), it is deadly too. -DePiep (talk) 21:21, 6 June 2014 (UTC)[reply]

What do you mean? for [[:File]], the whole link is escaped, so thumb, caption and width have no meaning. — Mr. Stradivarius ♪ talk ♪ 00:19, 7 June 2014 (UTC)[reply]
(into a subsection topic). I meant to give an example if interacting parameter settings, with complicated logic. My text example was made up. For real (from the documentation): "frameless, like thumbnail, respect user preferences for image width, but without border and no right float" (+ a caption effect; DP). That is not parameters set independently. A more modern user interface could provide a editor-oriented set of independent parameters. I see no obvious logic to disappear the caption (I intentionally entered as a caption) because of a border setting. -DePiep (talk) 13:38, 9 June 2014 (UTC)[reply]

class

[edit]

What does the class add, exactly? Do I understand that is/are supposed to be class names? Any WP: link? -DePiep (talk)

See mw:Help:Images#Syntax. I've updated the module documentation. — Mr. Stradivarius ♪ talk ♪ 00:27, 7 June 2014 (UTC)[reply]