|
Cookbook /
SectionEditSummary: Split a wiki page into separately editable sections with an edit link for each section
Version: 2.2.3 dated: 2013-02-06
Prerequisites: at least PmWiki 2.2.0, last tested with version 2.2.0-stable.
previous 2.1.x versions of the recipe, compatible with PmWiki 2.1.6 (??) can be found in the Development-Archive Requires: SignalWhenMarkup and MarkupToUnstyled
Status: Stable
Maintainer: Klonk
Categories: Editing, WikipediaSuite
Discussion: SectionEdit-Talk
Solution
Version 2.2.xUsing the recent V 2.1.8 I thought that with a bit of taming SectionEdit would be a great recipe. So I started editing the source to apply some minor enhancements and ended up with a complete rewrite. New Features and Fixed Bugs:
To have a working TOC - use SlimTableOfContents Hint: Previous 2.0 and 2.1 Versions can be found in the Development-Archive DescriptionInformationThis recipe is based on Sections are automatically generated by default. Every heading in the wiki text then marks the beginning of a new section. By default the sections are generated in MediaWiki style. This means, when editing a section beginning with a header the section contains everything (even subheadings) until a new section with the same or higher heading level starts. This behaviour can be switched to standard style. See Customization for details. To edit simply click on the edit link above the desired section. To edit the section in a new window do a right-click on the edit window and select open in new window (depending on your browser). When editing a section you'll see either the heading or the Sections are also automatically generated for included pages. This behaviour can be deactivated (see below). When editing the main page you will only edit the text of that page, i.e. you'll see the Links for editing section are only visible when you have "edit" rights, i.e. authenticated for edit. Take a look at the source when you're interested in the history. The history for the 2.x versions can be found in the Development-Archive. This recipe also supports Site.EditForm. CaveatsWhen editing a section the section marker is visible in the edit window. You should not remove the marker ( When placing LimitationsNot really a limitation, but you should keep it in your mind: Sections are only generated for the main wiki page. Every other text that is included through the skin will not contain any section editing capabilities. Well not really a limitation more kind of warning. If it happens that a section of a page or different sections of the same page are edited, you'll get a message that the page has changed (see SimultaneousEdits for more information). You then are editing the whole wiki page, not only the actual section. The reason is simply that otherwise you won't see or recognize the conflicts correctly. When previewing you won't see any "edit section" links. This is normal behaviour.
Apparently does not work with the following skins: BeeblebroxNetGila, Simple, Sinorca To make section edit work with Sinorca and BeeblebroxNetGila, just change "clear:both" to "clear:none" inside div.sectionedit css rule. CarlosAB July 22, 2007, at 03:28 PM
SectonEdit does not work with FoxForum, since FoxForum uses one Possible CustomizationConfigurationThese Customizations have to be set before including the script! $SectionEditWithoutHeaders = true; Disables the automatic generation of sections, i.e. only $SectionEditAutoDepth = 2; This variable defines up to which level the headings are used to mark the beginning of a new section. Default is $SectionEditHeaderLinkSpan = true; When true the "Edit link" for headings is appended in a span at the end of the heading text. Default is false. $SectionEditMediaWikiStyle = false; Disables the default MediaWiki autosectioning style. The default value is value:TRUE (sections) FALSE (sections) meanings:
Text Text Start of section: \
!Head1 \ !Head1 \ Middle of section: |
Text | Text / End of section: /
!!Head2 \ | !!Head2 \
Text | | Text /
!!!Head3 \ | | !!!Head3 \
Text | | | Text /
==== \ | | | ==== \
Text / | | | Text /
!!!!Head4 \ | | | !!!!Head4 \
Text / / | | Text /
!!!Head5 \ | | !!!Head5 \
Text / / / Text /
!Head6 \ !Head6 \
Text / Text /
$SectionEditInIncludes = false;
Disables the creation of sections for included pages. Default value is Horizontal Line Sectioning: $SectionEditHorzLines = true; By default the value is false; StylingThe only default style applied by the script is div.sectionedit { text-align:right;font-size:smaller;clear:both;}
I suggest that you add something like that to your CSS file: /* default for edit link */
div.sectionedit { text-align:center;font-size:smaller;clear:none;}
/* enhanced styling for different types of edit links */
/* edit link created by horizontal line markup ---- */
div.sectionhorzline{}
/* edit link created by section markup ==== */
div.sectionsplit{border-top:1px dotted #369; }
/* edit link created by header markup !!! when $SectionEditHeaderLinkSpan is false */
div.sectionhead {border-top:1px dotted #369; }
/* edit link created at the beginning of included page */
div.sectionpage{border-top:3px double #00c; }
/* edit link created by header markup !!! when $SectionEditHeaderLinkSpan is true
* decrease font size according to your h1..h6 font size to make link the same size
* in all headings
*/
span.sectionedit { font-size:smaller; font-weight:normal;}
h1 .sectionedit{ font-size:0.4em; }
h2 .sectionedit{ font-size:0.52em; }
h3 .sectionedit{ font-size:0.6em; }
h4 .sectionedit{ font-size:0.7em; }
h5 .sectionedit{ font-size:0.75em; }
h6 .sectionedit{ font-size:0.75em; font-variant: normal;}
/* don't print edit links */
@media print {
span.sectionedit,
div.sectionedit { display:none; visibility:hidden;}
}
Provided MarkupThe directives below work also when placed in the GroupHeader or GroupFooter and can be used within conditional markup. After this markup a new section begins. The setting of This markup disables the separation into sections. Could be used for e.g. ConditionalMarkup or other purposes. This markup overrides the settings of With this markup the automatic generation of sections is deactivated. ( This markup disables the generation of sections for included pages. This markup enables the generation of sections for each horizontal line. This markup disables the generation of sections for each horizontal line. Changing the default
|