|Title|Named Sections
|Date|28-Jun-2006 17:10:44 EEST
|JSPWiki version|2.4.x
|Submitter|Jerome Duprez
|[Idea Category]|MarkupIdea
|Reference|
|_cmdline|form='ideaform' category='GenericIdea' status='NewIdea' title='Named Sections' page='Idea'  map='title=Title;version=JSPWiki version;url=Reference;category=[Idea Category];x;status=[Idea Status]'
|[Idea Status]|NewIdea

[InsertPagePlugin] enables to insert the content of a specific "section" of a page, but the definition of a section is rather limited: a ''section'' as per this plugin is a portion delimlited by {{----}} markers, and the plugin enables to specify the section by its index ({{{[{InsertPage page=SomePageName section=1}]}}}).

The choice of the delimiter[1] seems to be an afterthought, or an arbitrary choice by the plugin developer; I don't know if it corresponds to any notion of "section" in the engine: for example, the [TextFormattingRules] mention {{----}} as "horizontal ruler, nothing suggests it's also a structural marker.

It's a relatiely good choice anyway, as it is visually very expressive in the page's text.
However, it's a bit unsafe to rely on the index to identify the section itself. Anyone could modif the inserted page and add/remove/reorder {{----}} rulers, and the inserting page would then insert the wrong content.

I'd like to be able to specify an identifier for the section. The ruler marker could still be used, though with augmented syntax, such as:
{{{ ----{[Section name="Section Foo"]} }}}
And the InsertPagePlugin would support:
{{{[{InsertPage page=SomePageName section="Section Foo"}]}}}.

Additionally, titles should implicitly define sections of their own (they already induce anchors that can be linked to).
So if a page contains a {{ !! Some title}}, the InsertPagePlugin should support a directive such as
{{{[{InsertPage page=SomePageName section="Some Title"}]}}}, and insert the whole corresponding "paragraph" (all contents until the next heading of the same level).

[#1] Indeed {{{----}}} as the section delimiter mixes structuring and rendering information. There are situations where you want to structure a page in sections without explicitly ''rendering'' section limits (see [Bug Problem With Including Commented Out Sections]). This specific point may call for a separate idea [Idea Structural Section Markup], and is part of a wider [Idea Page Structure] to be developped.