Processing Instruction - Default Action
Background and rationale
MoinMoin pages, unless otherwise specified in the URL query string, are displayed with the default action show, which is of course quite appropriate for most situations. If another action is preferred, it is possible to provide a page link specifying that action, for example [[PageName||&action=print]] or [[http://wiki.net.PageName?action=print]]. However, it would be useful to have a processing instruction that overrides the default action, especially for pages intended for users that only have read rights.
The motivation here was to allow pages to be displayed by default as a PDF using the user-defined action, PDF.py. This would be useful where you want users to save a format-stable copy of the the page for future reference from the web, rather than having to supply it as an attached file, either to a MoinMoin page or an email.
Description
A new processing instruction, #action, is included to override the default action=show.
Setting this new processing instruction does not override any action request explicitly given in the page link or URL.
Usage
Specify a default action (action-name) for the page if none is otherwise requested.
#action action-name
Where, action-name is either a system-defined or user-defined action.
Example
The raw content of PiAction/Example is:
#action PDF <<Include(PiAction)>>
The processing instruction #action PDF makes the PDF action (see PDF.py) the default and, for the purpose the an example, the Include macro gives the page content from here (i.e. PiAction).
Click on the page link, PiAction/Example, to see it displayed as a PDF.
Prerequisites
To allow the processing instruction #action to be recognised MoinMoin.page.py needs to be modified in the following two places.
In the function MoinMoin.page.parse_processing_instructions, add the following code in the position indicated.
Additional code 1
Insertion position 1
In the function MoinMoin.page.send_page, add the following code in the position indicated.
Additional code 2
Insertion position 2
History
Developed with inspiration and MoinMoin code from:
@copyright: 2000-2004 by Juergen Hermann <jh@web.de>
@copyright: 2005-2008 by ThomasWaldmann
@copyright: 2006 by FlorianFesti
@copyright: 2007 by ReimarBauer
Copyright
@copyright: 2014 Ian Riley <ian@riley.asia>
License
GNU GPL, see COPYING for details.
Known issues and limitations
- None identified.
- Hits
15176