[Mediawiki-l] Easy creation of page sequences

Jean-Marc van Leerdam j.m.van.leerdam at gmail.com
Mon Sep 14 21:10:55 UTC 2009


Hi,

I have been trying to create a maintainable way of grouping pages
together and allowing readers to page through them in sequence. Most
samples I've seen use templates that require you to supply the
'previous' and 'next' page. This however results in three page edits
to insert a new page between two existing pages and does not guarantee
that your prev-sequence is identical to the next-sequence...

Being a programmer, that is way too much duplicate and error-prone
work for me ;-) There must be a better way to do this and I was hoping
to solve it with a plain MW installation (with ParserFunctions and
DynamicPageList at the moment).

Given an 'index' page that holds a list of all page titles in the
preferred order, isn't it possible to create a template that selects
the correct previous and next page title given the current page title?

I get stuck in getting the correct lines from the index page. DPL can
select based on section name (= page title), but then the contents of
that index section must be the prev/next links themselves:

=First Page=
Prev [[Second Page|Next]]
=Second Page=
[[First Page|Prev]] [[Third Page|Next]]
=Third Page=
.. etc.

This works, except that it is still a lot of duplication of page names
(but the edits are contained in a single page, big plus).

I hoped to simplify the index page by creating a template that writes
the section header and prev/next links, but then DPL no longer
recognizes the sections :-( Apparently DPL 'sees' the page text before
the templates are called ({{Page|Prev page|Page title|Next page}}:

{{Page||First Page|Second Page}}
{{Page|First Page|Second Page|Third Page}}
{{Page|Second Page|Third Page|Fourth Page}}

Basically my questions are:
1. Am I completely off track here?
2. Can DPL be coerced to evaluate templates before looking at the page
3. Can DPL (or another extension) select the text from a section
before/after a matched section?
4. Is it possible to determine the section sequence number given the
section name (so 'Second Page' results in 2, allowing me to use DPL to
retrieve the name of section 2 -/- 1 and 2 + 1 to create the prev/next
links?

Apologies for the long post, hopefully someone can point me to some
good resources (I've been to Meta, Wikibooks, Medawiki.org but could
very well have overlooked something there as the amount of info is a
bit overwhelming and it is difficult to judge how up to date it is).

-- 
Regards,

Jean-Marc



More information about the MediaWiki-l mailing list