Patch Proposal: eliminate %TOC% "error" messages
Motivation
The "helpful" error message can get in the way when employing
%TOC% in includes and templates and just generally trying to develop a
TWikiApplication.
Description
This simple patch eliminates the error message. It seems to serve no useful purpose when viewed in the context of one twiki part incorporating or building on another.
Documentation
N/A
Examples
N/A
Implementation
Index: TWiki.pm
===================================================================
--- TWiki.pm (revision 3507)
+++ TWiki.pm (working copy)
@@ -1604,7 +1604,7 @@
return $result;
} else {
- return _inlineError("TOC: No TOC in $web.$topicname");
+ return "";
}
}
Alternative Implementations
- Instead of returning an empty string, it would be possible to
return qq{<!-- TOC: No TOC in "$web.$topicname" -->}; in the interest of backwards compatability for existing ScreenScrapers.
- Another possibility is to add a
warn parameter à la INCLUDE.
Note: Patch is attached as
https://www.twiki.org/p/pub/Codev/TocNotFoundNoError/TocNotFoundNoError.diff. The patch is against
SVN 03 Aug 2004
Discussion:
I'd favour the "forget it" approach. If there is nothing to TOC, I don't want to know about it!
--
CrawfordCurrie - 17 Jan 2005
Agreed, and empty TOC has nothing to say and should remain quiet. I do not expect any side effects.
--
PeterThoeny - 18 Jan 2005
Updated patch merged into DEVELOP r3536
--
WillNorris - 18 Jan 2005