• Do not register here on develop.twiki.org, login with your twiki.org account.
• Use View topic Item7700 for generic doc work for TWiki-6.0.2. Use View topic Item7703 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.

Item7745: Trailing paragraph after html

Item Form Data

AppliesTo: Component: Priority: CurrentState: WaitingFor: TargetRelease ReleasedIn
Engine TWiki::Templates Normal No Action Required TWiki:Main.StefanWalter    

Edit Form Data

Reported By:
Applies To:
Current State:
Waiting For:
Target Release:
Released In:


We have our own skin at our site but every viewed HTML page has a trailing <p /> after the </html> tag. I have tracked down the reason to poor handling of empty lines in TWiki::Template::readTemplate():

The function at some point removes all the TMPL:DEF blocks leaving only the text that is left, typically something like this for a page view:


With our template there are both empty lines before and after that. Some of them come from removed comment lines but some I have not been able to remove all of them by reformating the templates.

I think that all empty lines before and after the remaining template text should be removed. The attached patch to readTemplate() did the job and removes the trailing paragraphs.

Can you please implement this (or a similar fix) in the main TWiki code?

-- TWiki:Main/StefanWalter - 2016-06-16

Sorry that you stumbled over this, but I'm afraid this patch can't make it into the code.

The current behaviour, to keep newlines exactly as the template author wrote them, was introduced in TWiki 4 (Dakar release) after some discussion, because it was required to make some templating stuff work, in particular with the TWiki:Plugins.CommentPlugin. Back then, all the Skins shipped with TWiki were adapted, and therefore today you see bodyend usually written like this: %TMPL:DEF{"bodyend"}%</div><!--/twikiPage--></body></html>%TMPL:END%. Note there's no newline between the end tags and %TMPL:END%!

TWiki:TWiki.TWikiSkins has an - easily overlooked - warning to "Make sure templates do not end with a newline", mentioning the spurious extra paragraph this can cause. In many places this is ugly but harmless, but for bodyend as well as for all templates expanded in the head element, you get invalid HTML.

If you just adapt your bodyend definition in your template then the extra paragraph should go away!

-- TWiki:Main.HaraldJoerg - 2016-06-16

18 months passed, so I'm marking this now as 'No action required' before the next release.

-- TWiki:Main.HaraldJoerg - 2017-12-19

Summary Trailing paragraph after html
ReportedBy TWiki:Main.StefanWalter
Codebase 6.0.2
SVN Range TWiki-6.0.2-trunk, Thu, 05 May 2016, build 30177
AppliesTo Engine
Component TWiki::Templates
Priority Normal
CurrentState No Action Required
WaitingFor TWiki:Main.StefanWalter



Topic attachments
I Attachment History Action Size Date Who Comment
Texttxt patch.txt r1 manage 0.4 K 2016-06-16 - 09:31 StefanWalter Patch
Edit | Attach | Watch | Print version | History: r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r3 - 2017-12-19 - HaraldJoerg
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2018 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback