Feature Proposal: EditChapter should always show body of a chapter, not just a title.
Motivation
To provide a consistent user experience, where the editor always shows some body text.
Description and Documentation
In a typically outline formatted document, "
EditChapter" plugin suddenly becomes "EditChapterTitleOnly".
Examples
---+ Section 1
---++ Section 1.1
---+++ Section 1.1.1
This is some body text.
---+++ Section 1.1.2
This is some body text.
---++ Section 1.2
...
- If a user clicks on the headers for Section 1.1.1 or 1.1.2, the (useful) edit screen contains that section's body text.
- On the other hand, click on the headers for Section 1 or 1.1 and the (relatively useless) edit screen contains only the one line of text with the section title. I think it's a reasonable expectation to see all the text "below" that point in the hierarchy, i.e., Sections 1.1.1 and 1.1.2 (but excluding Section 1.2).
Impact
Implementation
There should probably be a setting to allow the "old" (current) rendering method, for those who prefer it.
--
Discussion
I like it. Let's create a
task for it and go ahead. Sean, are you able to try a patch?
Btw.
EditChapterPlugin is not a core plugin. So we don't need to go through a full change proposal process. This is a very reasonable feature request. So let's just do it
--
MichaelDaum - 22 Dec 2009
> are you able to try a patch?
I kind of doubt it, your code is a bit too subtle for me. Especially the regular expression that is the work-horse for this. If can I add some annotation to it to help show where my difficulties are (starting at line 120 of
/lib/Foswiki/Plugins/EditChapterPlugin/Core.pm
):
# loop over all lines
my $chapterNumber = 0;
$text =~ s/
(^) # $1: begin line
(---+[\+#]{$this->{minDepth},$this->{maxDepth}}[0-9]*(?:!!)?) # $2: ---+[\+#]{n,m}[0-9]*(?:!!)?
([^$this->{translationToken}\+#!].+?) # $3: ??
($) # $4: end of line
/
$1.
$this->handleSection($web, $topic, \$chapterNumber, $3, $2, $4, $enabled)
/gme;
Question about $2: Eventually I realized that
[\+#]
is for compatibility with
Extensions.ExplicitNumberingPlugin, and
(?:!!)?
is for headings that are not to appear in the TOC. But what is
[0-9]*
for?
Q about $3: how does
translationToken
work? And how does this pattern increment
$chapterNumber
?
--
SeanMorgan - 24 Dec 2009