• Do not register here on develop.twiki.org, login with your twiki.org account.
• Use View topic Item7848 for generic doc work for TWiki-6.1.1. Use View topic Item7851 for doc work on extensions that are not part of a release. More... Close
• Anything you create or change in standard webs (Main, TWiki, Sandbox etc) will be automatically reverted on every SVN update.
Does this site look broken?. Use the LitterTray web for test cases.
I worked with %INCLUDE and the possibility to use %START/STOPINCLUDE and %START/ENDSECTION. There I located one error in TWiki.pm.

Have a look to following


This is text inside of global INCLUDE

%STARTSECTION{ "part1" }
This is text inside of part 1
%ENDSECTION{ "part1" }

%STARTSECTION{ "part2" }
This is text inside of part 2
%ENDSECTION{ "part2" }


If you want to use this now with %INCLUDE following happens

%INCLUDE{ "MyTopic" } => you will see all 3 text elements

%INCLUDE{ "MyTopic" section="part1" } => you will see text element 1

%INCLUDE{ "MyTopic" section="part0" } => you will see the complete Topic, %<nop>START/STOPINCLUDE% elements are totally ignored!

I think the last one is wrong, it has to be following result: You should see nothing, because you want to import a non existing section.

I patched TWiki.pm as followed, I hope you will agree to this

--- TWiki.pm    2006-11-14 01:13:12.000000000 +0100
+++ TWiki.pm    2006-11-14 22:30:10.000000000 +0100
@@ -2757,7 +2757,7 @@
     # handle sections
     my( $ntext, $sections ) = _parseSections( $text );

-    my $interesting = 0;
+    my $interesting = ( defined $section );
     if( scalar( @$sections )) {
         # Rebuild the text from the sections
         $text = '';

-- ThomasFreudenberg - 15 Nov 2006

That makes sense. Please file a bug report, Bugs:WebHome.

-- PTh - 15 Nov 2006

Thanks Thomas, is now in SVN, 12001.

-- PTh

I feel a little uncomfortable with this, since it changes the current (though undocumented) behaviour.

In pre-12001, if I %INCLUDE{...}% a section which doesn't exist, then the whole topic gets included, regardless of whether it contains %STARTINCLUDE%/%STOPINCLUDE% markers.

I agree that this is a questionable behaviour, but I can see three alternative "improvements":

  1. If a non-existing section is included, behave as if the section parameter were absent. This means that, unlike pre-12001, the %STARTINCLUDE%/%STOPINCLUDE% markers should be respected
  2. If a non-existing section is included, don't include anything, as in 12001.
  3. If a non-existing section is included, return an error message, similar to that which you get if a non-existent topic is included.

I apologize for standing in the way - but if that behavioural change of revision 12001 is acceptable, I'd ask for three things:

  1. Urgent: TWiki:Codev.AddSectionParam and %INCLUDE{...}% must behave identically in case of non-existent sections. Currently, view with a non-existing section returns the whole topic, as did %INCLUDE{...}% before r12001, and there is a test case in /test/unit/ViewParamSectionTests.pm to confirm that.
  2. Low: An improvement of the documentation, which would apply to both VarINCLUDE and view in TWikiScripts (and could be done regardless of whether the change is approved or reverted).
  3. Enhancement: A test case differentiating between "before the fix" and "after the fix"

-- haj

On the alternative improvements, the current one is the most logical one imho.

Good point on documentation and test cases; more work needs to be done.

On TWiki:Codev.AddSectionParam spec change/clarification, let's track that in new bugs Item3170.

-- PTh

PTh has augmented the documentation in VarINCLUDE (12006), and I have added a testcase (12009). So we can mark it as "Waiting for Release" again. Sorry for the interruption smile

-- haj

No, that is collaboration at its best! Thanks for adding a test case smile

-- PTh

4.1.0 released


I reopened the item again. If no section is defined at all, the inclusion of a non existing section will return the whole topic. That behaviour is the opposite of the documented behaviour.

-- OK - 07 Mar 2007

I just got bitten by the bahviour Olli describes. Confirmed, and fixed on MAIN.


Summary Don't include anything when trying to include a non existing section
ReportedBy TWiki:Main.ThomasFreudenberg
Codebase 4.0.5, ~twiki4
SVN Range TWiki-4.1, Thu, 09 Nov 2006, build 11947
AppliesTo Engine

Priority Normal
CurrentState Closed

Checkins TWikirev:12001 TWikirev:12006 TWikirev:12009 TWikirev:13539
TargetRelease minor
ReleasedIn 4.2.0
Edit | Attach | Watch | Print version | History: r16 < r15 < r14 < r13 < r12 | Backlinks | Raw View |  Raw edit | More topic actions
Topic revision: r16 - 2008-01-22 - KennethLavrsen
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2023 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback