Last modified: 2009-11-26 03:38:45 UTC
I made some templates with many sections. If such a template is included in a page, the page displays edit links for each section. Clicking on the edit links for sections in the template opens the edit window for the template. In my case, I do not want casual users editing the templates. This "feature" by which templates can be edited from pages using templates can be blocked by including __NOEDITSECTION__ in the template, but this also blocks editing of sections that do not come from the template. Is there a way to restrict the action of __NOEDITSECTION__ to only the sections in the template containing __NOEDITSECTION__ ? Alternatively, edit links that open templates for editing should be made to look different or give a warning about the fact that a template is being edited.
Created attachment 2433 [details] adds __NOEDITTHISSECTION__ This small patch adds a new directive, __NOEDITTHISSECTION__. Any section with this directive in it won't have an edit link in the heading. I've only tested it on my personal wiki, but I haven't found any problems. Not sure if this is the best way to implement the feature, but it's an easy way. If there's a better way to implement it, I'd appreciate the advice.
the patch is broken atm.
Created attachment 3020 [details] reworked patch fixed the patch to work against current svn, also fixed some minor inconsistency and reviewded it
Created attachment 3021 [details] updated patch added the logic that a sub section of a disabled section, shouldn't either have an edit link
Created attachment 3022 [details] same patch forgot to remove a debug-statement
Created attachment 3024 [details] new patch added keyword __FORCEEDITTHISSECTION__ to enable edit section on a subsection that is under a __NOEDITTHISSECTION__
This test case did I use: ==Foo== __NOEDITTHISSECTION__ ==Bar== d ==Baz== __NOEDITTHISSECTION__ ===a=== ===b=== ====c==== __FORCEEDITTHISSECTION__ ===d=== ==Quux== __NOEDITTHISSECTION__ ==Quuux== ===e=== ====f==== __NOEDITTHISSECTION__ ==Quuuux==
No, fix the problem, don't add in another hack to work around it.
Hmm, and here I was getting close to committing. Oh, well.
8515 proposes the same solution to this problem, although these are not exactly duplicates. Marked as dependent
With the new preprocessor, you can use now <h2>Heading</h2> to generate a section without edit links. Marking as WORKSFORME.