I've just spent ages to find why a page title wouldn't change when I really did change it in a template. It occurred that the obscure edittext.pattern.tmpl was being called.
I guess that it's as simple as putting a HTML comment in specific template parts (one per template, if that is not a conditional part).
See the just checked in
edittext.pattern.tmpl
for instance (revision 6714).
AC
this
doesn't work:
Index: Templates.pm
===================================================================
--- Templates.pm (revision 6751)
+++ Templates.pm (working copy)
@@ -341,7 +341,8 @@
# if the name ends in .tmpl, then this is an explicit include from
# the templates directory. No further searching required.
if( $name =~ /\.tmpl$/ ) {
- return TWiki::readFile( $TWiki::cfg{TemplateDir}.'/'.$name );
+ my $filenameTemplate = $TWiki::cfg{TemplateDir}.'/'.$name;
+ return "<!-- $filenameTemplate -->" . TWiki::readFile( $filenameTemplate );
}
my @skinList = split( /,+/, $skins );
@@ -444,7 +445,7 @@
my $retrieve = $candidate->{retrieve};
my $name = $candidate->{name};
if( &$validate( $name )) {
- return &$retrieve( $name );
+ return "<!-- $name -->" . &$retrieve( $name );
}
}
however, this is a snippet of what that produces:
<!-- /home/.balder/wbniv/twiki/templates/view.pattern.tmpl --><!-- /home/.balder/wbniv/twiki/templates/twiki.pattern.tmpl -->
<p />
<p />
<p />
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
this is harder to do than it appears, i guess a second pass cleans up empty =P='s at the head of the topic. so, while it
would be useful, i doubt it's going to happen for Dakar; therefore, i'm deferring this. also,
for purely debugging purposes, you can use the above patch; it won't produce valid HTML, but it can help you in debugging.
also, how would you control whether this output is turned on or not?
WN
Undeferred, post Dakar
CC
Current code has a
TRACE
option in
Foswiki::Templates
that inserts a comment into ever template.
# Enable TRACE to get HTML comments in the output showing where templates
# (both DEFs and files) open and close. Will probably bork the output, so
# normally you should use it with a bin/view command-line.
use constant TRACE => 0;
Is this a sufficient fix?
--
GeorgeClark - 15 Mar 2011