Item11766: templatetopics seems to go awry when there is another nested SECTION
Priority: Urgent
Current State: Closed
Released In: 2.0.0
Target Release: major
Applies To: Engine
Component:
Branches: trunk
when you make a templatetopic like
%STARTSECTION{"exclude" type="templateonly"}%
---+!! Wiki Applications
_This page will help you create new Wiki Applications that use DataForms_
%TOC%
---++ Create a new DataForm definition topic
%STARTSECTION{"createdataform"}%
<form method="post" action="%SCRIPTURL{save}%/Sandbox" name="fastCreateDataForm" id="fastCreateDataForm">
<input type="hidden" name="topicparent" value="%SYSTEMWEB%.WikiApplications" />
<input type="hidden" name="formtemplate" value="%SYSTEMWEB%.WikiApplications" />
<input type="hidden" name="templatetopic" value="%SYSTEMWEB%.WikiApplications" />
<input type="text" name="topic" value="ItemAUTOINC1" />
<select disabled name="web" class="foswikiSelect">
<option>Sandbox</option>
%SEARCH{
type="query"
web="all,-Sandbox"
topic="%WEBPREFSTOPIC%"
"1"
format="<option>$web</option>"
nonoise="on"
}% </select>
<input type="submit" value="Create topic" class="foswikiSubmit" />
</form>
%ENDSECTION{"createdataform"}%
---+++ TODO:
* add the topic-name js to the topic textbox
* remove Sandbox and implement http://foswiki.org/Development/AddWebParamToAllCgiScripts
* fix http://foswiki.org/Tasks/Item11765
---
*Related Topics:* %SYSTEMWEB%.DeveloperDocumentationCategory, %SYSTEMWEB%.TemplateTopics, %SYSTEMWEB%.DataForms, %SYSTEMWEB%.FAQAnApplicationWithWikiForm
<!-- %JQREQUIRE{"chili"}% -->
%ENDSECTION{"exclude" type="templateonly"}%
%EDITTABLE{header="| *Name* | *Type* | *Size* | *Values* | *Tooltip message* | *Attributes* |" format="| text, 20, init | select, 1, text, select, select+multi, select+values, checkbox, checkbox+buttons, radio, label,textarea, date | text, 5, 16 | text, 30, | text, 30, | checkbox, 3, H, M |" changerows="on" }%
| *Name* | *Type* | *Size* | *Values* | *Tooltip message* | *Attributes* |
| Description | text | 80 | | Wiki Application description | |
you instead get:
Topics, %SYSTEMWEB%.DataForms, %SYSTEMWEB%.FAQAnApplicationWithWikiForm
<!-- %JQREQUIRE{"chili"}% -->
%EDITTABLE{header="| *Name* | *Type* | *Size* | *Values* | *Tooltip message* | *Attributes* |" format="| text, 20, init | select, 1, text, select, select+multi, select+values, checkbox, checkbox+buttons, radio, label,textarea, date | text, 5, 16 | text, 30, | text, 30, | checkbox, 3, H, M |" changerows="on" }%
| *Name* | *Type* | *Size* | *Values* | *Tooltip message* | *Attributes* |
| Description | text | 80 | | Wiki Application description | |
if i remove the
STARTSECTION{"createdataform"}
it works as expected.
--
SvenDowideit - 17 Apr 2012
Reproduced and analysed.
The error happens because the
templateonly
section is stripped from the text in
expandMacrosOnTopicCreation
using offsets that were calculated based on the removal of any STARTSECTION/ENDSECTION tags, but it's called on text that still has those lower-level tags in. So the offset is out by the length of those two tags. The removal of templateonly sections has to be done as a separate pass
before other section macros are restored.
--
CrawfordCurrie - 25 Mar 2013