Re: pragma supplementation-page
On Tue, Sep 09, 2025 at 09:07:56AM +0100, Jonathan Dowland wrote:
> On Mon Sep 8, 2025 at 4:39 PM BST, Andrew Sayers wrote:
> > That's a good point, but relative links in <<Include>>d blocks are
> > interpreted relative to the original page - for example, the discussion
> > link on it/Aptitude points to Aptitude/Discussion, but the same link on
> > es/Aptitude points to es/Aptitude/Discussion, because the former uses an
> > <<Include>> while the latter copy/pastes.
>
> Of the two behaviours, I think language-namespaced discussion is probably
> preferable, e.g., es/Aptitude/Discussion. So that's a drawback of including
> a Discussion link in the english-pages translation header and transcluding
> it. The pragma results in a language-namespaced discussion link.
>
> The current translation header (in DefaultTemplate) doesn't have the link at
> all, because I removed it and added the pragma (outside of the translation
> header bit) Yesterday.
>
> If we're editing the translation header in a translated page to address a
> discussion link, we should probably update the translation header to the
> current version from DefaultTemplate, i.e., replace it with just
>
> <<Include(BASEPAGE, ,from="^##TAG:TRANSLATION-HEADER-START",to="^##TAG:TRANSLATION-HEADER-END")>>
>
> (substituting BASEPAGE); and probably add the pragma as well.
I'm planning to do this, but am juggling a lot of things and might forget.
One to mention when we're reviewing a more complete solution :)
>
> > Short answer - the first is more pragmatic, but will need a different
> > approach.
>
> OK.
>
> WRT bulk and machine-assisted edits. I recall a long time ago a Perl module
> for interacting with Mediawiki like a VCS¹. It was very useful for these
> kind of operations.
>
> Has anyone surveyed for something similar for MoinMoin? If not I will take a
> look. There's at least moin-cli² which I haven't tried, it depends on
> XML-RPC being enabled, which it isn't, but perhaps we can get it turned on
> (possibly locked down in some way if necessary)
>
> [1] https://metacpan.org/dist/WWW-Mediawiki-Client
> [2] https://github.com/toracle/moin-cli
I've pushed some commits that sketch out a new approach based on this thread.
I'll doubtless make a lot of changes in the coming days, but would appreciate
feedback in the meantime.
I've added three new Perl libraries:
lib/MWR/Cache.pm - a local cache of MoinMoin pages. This is inspired by the
bin/make-current-pages.pl script I mentioned yesterday - it manages
a directory of pages with MoinMoin-escaped filenames, and provides an API
based on normal (unescaped) page names.
lib/MWR/Client.pm - a simple MoinMoin client, which checks nobody else
has edited a page before committing changes. This is similar to the moin-cli
library, but works with the normal HTTP interface. It needs you to put some
cookies in config.yaml before it will work. It can optionally update a cache
directory whenever it downloads a page, making it easier to work with a DB dump
that's slowly going out of date.
lib/MWR/Parser.pm - convert a MoinMoin page to a structured representation.
This is will most likely need to be imported into the converter.
It's currently just a skeleton of a module that will get quite complex,
and I want to look at it with fresh eyes tomorrow before documenting it fully.
I've also added bin/mwr.pl - a script to do standard manipulations. Right now
`mwr.pl import /path/to/pages` imports a dump into a cache directory
(replacing bin/make-current-pages.pl), and `mwr.pl parse <page-name>`
shows the structured representation for a page that exists in that cache.
My current plan is to teach `MWR::Parser` to recognise different types
of translation header, patterns from `get-interesting-links.pl`, etc.;
then write custom scripts to parse a set of pages, cache a set of changes,
and commit them with the client.
The next step will be to polish up the libraries, add parsers for various
types of translation header, then write a script that outputs a new header
and supplemental_page pragma.
Reply to: