Page MenuHomePhabricator

Add ability for FilePage to generate wikitext for links that include media options such as size
Open, Needs TriagePublic

Description

Currently, I can use page.title() with the kwarg asLink=True to create a link. Example:

>>> page=pywikibot.FilePage(site, 'File:Codabar-example.svg')
>>> page.title(asLink=True)
u'[[File:Codabar-example.svg]]'

In commons, I want to make a link to a page, but specify some additional options, like the size of the image: https://www.mediawiki.org/wiki/Help:Images#Size_and_frame

I can't seem to find any way of getting the link to use for that.

Event Timeline

Danny_B renamed this task from pywikibot title - Add options when asLink=True to Add options when asLink=True.Jun 6 2016, 3:57 PM
jayvdb renamed this task from Add options when asLink=True to Add ability for FilePage to generate wikitext for links that include media options such as size.Jun 6 2016, 4:12 PM

I think it would be wise to avoid doing more in title() , as it already has a messy set of parameters (we have a patch that tries to clean it up).

This might be a good reason to un-deprecate Page.aslink, or create a new specialised method just for FilePage , but note that special pages (no subclass for these) also have parameters, and so do Category pages (sortKey which is incorrectly a instance attribute).