This plugin implements a simple section editing feature comparable to
the one available for MediaWiki.
It adds link urls to headings so that users can edit the section below. Edit links are
enabeld only for those users that have edit access. Edit links are hidden unless you hover
with the mouse pointer over them and then displays the "Universal Wiki Edit Button"
.
Once installed, the plugin automatically enables sectional editing without any further
provisions. Note, that it will only detect headings created using TWiki-markup, that is
writing ---++ heading and the like. It is not sensitive to normal HTML-markup, so it
does not add an edit link to normal <h2>headings</h2>.
Sections might be included into the current topic using INCLUDE. The
edit link will be adjusted approriately, allowing to edit the correct target topic and
then redirect back to the current topic it has been included to.
Previous work
There are a couple of other plugins that try to implement a section editing feature, along with some
other more exotic features. The first plugin of that kind was TWiki:Plugins/SectionalEditPlugin.
Later on, its functionality was extended to process sections in a broader sense in the
TWiki:Plugins/MultiEditPlugin. By the time of this writing both plugins were about to
be merged again into one TWiki:Plugins/EditSectionPlugin. These three plugins all depend
on an extra package called TWiki:Plugins/EditContrib which factors out common code. In addition
EditContrib contains a patch to the TWiki core engine, available for TWiki-4.0 and TWiki-4.1.x.
All these plugins are currently non-functional on TWiki-4.2.
While first looking at the code of SectionalEditPlugin, it was clear very soon, that it
would be better to start from scratch and remove some features for the sake of a cleaner
implementation, that is in sync with recent developments, i.e. PatternSkin, NatSkin
and NatEditContrib in this area.
The other substantial difference between SectionalEditPlugin and EditChapterPlugin is
that while the former introduces additional code to save an isolated subsection back into the topic,
the latter always saves complete topics, despite the fact that only part of it is editable.
Configuration
There are a couple of preference variables to influence how and which headings are processed:
In addition to enable/disable the plugin using the EDITCHAPTERPLUGIN_ENABLE
preference variable, it can also be enabled disabled using the %ENABLEEDITCHAPTER% / %DISABLEEDITCHAPTER%
tags.
EXTRACTCHAPTER
Dedicated chapters of a topic can be extracted using the %EXTRACTCHAPTER{}% tag.
it takes the following parameters:
See the edit.chapter.tmpl for a real-world example, used as a cover to the standard edit
templates, thus hooking in section editing into the standard editing process.
Limitations
For the purpose of simplicity a couple of shortcomings have to be accepted.
parametrized includes: the plugin does not know anything about parametrized includes, that is it won't work as expected if a topic includes text from a named section of another topic using %INCLUDE{"TargetTopic" section="onlythis"}%.
explicit sectioning: users can't specify any other section to be editable in isolation (e.g. using some <section> ... </section> markup) other than by giving the respective section a heading.