Sam Wilson's Website

T1925: extensions

RSS feed icon. RSS feed for the "extensions" tag

  1. A new extension this week: CopyCreds

    The CopyCreds extension registers two new tags <pw> and <un>, which make the text inside them visually distinctive, and allows for click-to-copy. The goal is to make life easier for those who document usernames and passwords in MediaWiki.

    I like the idea of a simple click-to-copy system for a wiki, but I’m not sure it warrants two new tags. Personally I’d prefer something like <copy class='pwd'>foo</copy> or something like that, with a means to customize the colour etc. of the displayed value. Actually, maybe that’s what CopyLink does. There used to be one called CopyToClipboard which also did something similar.

    Maybe someone should write the Copyencabulator 2000, to unite them all…

  2. I was writing some user documentation for RedirectManager just now, and wrote this sentence-and-a-bit:

    If you provide a name of an existing page to create as a redirect, an error message will be shown and no redirect will be created. Similarly, if you

    I was going to say something about how it’s not possible to create a redirect to a page that doesn’t exist. This isn’t a limitation of MediaWiki, but when I was writing the RedirectManager API I thought it would be good to prevent these “dangling redirects”. It wasn’t until I came to write the documentation that I realised the most obvious use-case: creating a redirect to a page that you’re in the process of creating! As in, while writing a new page, you want to add a shortcut to it — hardly a rare thing, I think.

    This is why I really like “documentation-driven development”, where one writes the docs first and pretends that they’re describing features that already exist. It really does help focus the mind on what’s required of the code, and (as in today’s example) highlights things that might otherwise be overlooked.

    So I’ll now go and change the API error to a warning, and not show it at all in the UI (although it might be worth having some indication that the target page doesn’t exist).

  3. On the weekend I made a new MediaWiki extension:

    It’s because I kept getting annoyed at having to open a new tab to create a shortcut redirect to the page I was editing, and wanted a simple way to a) see what redirects exist already; b) create new ones without leaving the editing form; and b) have the wiki suggest an available shortcut to the current page. The first two points are working in the RedirectManager extension, and I’ll add the third soon I hope.

    I was surprised to find that there’s no existing API for creating redirects, so the extension includes its own. In building that I realised that content types other than wikitext also support redirects — I don’t know if I’ve ever seen them in the wild, but JS and CSS pages can be redirected (and probably other custom types too, although it looks like^1 maybe only wikitext-based ones).

    I can now get on with making short URLs for a bunch of things on ArchivesWiki (I’ve been adding links from places like WikiTree to biographies on ArchivesWiki, and sometimes the full page name is a bit long and ugly).

  4. A few new extensions have had their pages on created in the last week:

  5. It’s a beautiful day here, for day 3 of Wikimania. I’m sitting outside the cemetery cafe, working on the extsjsonuploader tool:

    Yesterday I deployed the new thing that creates a JSON file of the same extension.json data, which means a version-checking thing for mwcli will be possible now (e.g. mwcli extensions:outdated --wiki foo to show a list of current and available versions of extensions for any wiki).

    I was just wondering why there are lots of old people coming and going from here, but I guess it’s just that it’s Monday morning and most people have work to do. I feel rather blessed to be able to work from wherever I can sit in the shade.

    This café is on OpenStreetMap, but there aren’t enough details, so I’ll fix that up in a minute. There’s a huge amount of other mapping to do around here too, but I think that’s going to have to wait for another day. I’ve got a bunch of family graves that I want to get photos of too: