Item11271: Assertion (Junk after </html> ... failed

pencil
Priority: Enhancement
Current State: Proposal Required
Released In: n/a
Target Release: n/a
Applies To: Engine
Component: FoswikiRender
Branches:
Reported By: PaulHarvey
Waiting For:
Last Change By: MichaelDaum
When bin/LocalLib.cfg has FOSWIKI_ASSERTS=1, and NatEditPlugin is used, editing a page yields:

Assertion (Junk after </html>: <!-- template: edit.natedit.tmpl -->
<p></p>
<!-- edittoolbar// -->
<!-- template: edittoolbar.natedit.tmpl -->
<!-- edittoolbar// -->
<!-- edithelp// -->
<!-- template: editidialog.natedit.tmpl -->
<!-- editdialog// -->
<!-- uploadplugin// -->. Templates may be bogus
- Check for excess blank lines at ends of .tmpl files
-  or newlines after %TMPL:INCLUDE
- You can enable TRACE in Foswiki::Templates to help debug
) failed!
 at /usr/local/src/github.com/foswiki/core/lib/Assert.pm line 80
   Assert::ASSERT(0, 'Junk after </html>: <!-- template: edit.natedit.tmpl -->
<p><...') called at /usr/local/src/github.com/foswiki/core/lib/Foswiki.pm line 827
   Foswiki::writeCompletePage('Foswiki=HASH(0x2f40248)', '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN...', 'edit', 'text/html') called at /usr/local/src/github.com/foswiki/core/lib/Foswiki/UI/Edit.pm line 457
   Foswiki::UI::Edit::finalize_edit('Foswiki=HASH(0x2f40248)', 'Foswiki::Plugins::MongoDBPlugin::Meta=HASH(0x49af998)', '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN...') called at /usr/local/src/github.com/foswiki/core/lib/Foswiki/UI/Edit.pm line 35
   Foswiki::UI::Edit::edit('Foswiki=HASH(0x2f40248)') called at /usr/local/src/github.com/foswiki/core/lib/Foswiki/UI.pm line 316
   Foswiki::UI::__ANON__() called at /usr/share/perl5/Error.pm line 416
   eval {...} called at /usr/share/perl5/Error.pm line 408
   Error::subs::try('CODE(0x2569f60)', 'HASH(0x2f3fdf8)') called at /usr/local/src/github.com/foswiki/core/lib/Foswiki/UI.pm line 435
   Foswiki::UI::_execute('Foswiki::Request=HASH(0x2f15ba0)', 'CODE(0x2e3bad8)', 'edit', 1) called at /usr/local/src/github.com/foswiki/core/lib/Foswiki/UI.pm line 274
   Foswiki::UI::handleRequest('Foswiki::Request=HASH(0x2f15ba0)') called at /usr/local/src/github.com/foswiki/core/lib/Foswiki/Engine/CGI.pm line 37
   Foswiki::Engine::CGI::run('Foswiki::Engine::CGI=HASH(0x28e74a8)') called at /usr/local/src/github.com/foswiki/core/bin/edit line 29
 at /usr/local/src/github.com/foswiki/core/lib/Assert.pm line 80
   Assert::ASSERT(0, 'Junk after </html>: <!-- template: edit.natedit.tmpl -->
<p><...') called at /usr/local/src/github.com/foswiki/core/lib/Foswiki.pm line 827
   Foswiki::writeCompletePage('Foswiki=HASH(0x2f40248)', '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN...', 'edit', 'text/html') called at /usr/local/src/github.com/foswiki/core/lib/Foswiki/UI/Edit.pm line 457
   Foswiki::UI::Edit::finalize_edit('Foswiki=HASH(0x2f40248)', 'Foswiki::Plugins::MongoDBPlugin::Meta=HASH(0x49af998)', '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN...') called at /usr/local/src/github.com/foswiki/core/lib/Foswiki/UI/Edit.pm line 35
   Foswiki::UI::Edit::edit('Foswiki=HASH(0x2f40248)') called at /usr/local/src/github.com/foswiki/core/lib/Foswiki/UI.pm line 316
   Foswiki::UI::__ANON__() called at /usr/share/perl5/Error.pm line 416
   eval {...} called at /usr/share/perl5/Error.pm line 408
   Error::subs::try('CODE(0x2569f60)', 'HASH(0x2f3fdf8)') called at /usr/local/src/github.com/foswiki/core/lib/Foswiki/UI.pm line 435
   Foswiki::UI::_execute('Foswiki::Request=HASH(0x2f15ba0)', 'CODE(0x2e3bad8)', 'edit', 1) called at /usr/local/src/github.com/foswiki/core/lib/Foswiki/UI.pm line 274
   Foswiki::UI::handleRequest('Foswiki::Request=HASH(0x2f15ba0)') called at /usr/local/src/github.com/foswiki/core/lib/Foswiki/Engine/CGI.pm line 37
   Foswiki::Engine::CGI::run('Foswiki::Engine::CGI=HASH(0x28e74a8)') called at /usr/local/src/github.com/foswiki/core/bin/edit line 29.

and so I've done

diff --git a/templates/edit.natedit.tmpl b/templates/edit.natedit.tmpl
index 1de4a09..486e039 100644
--- a/templates/edit.natedit.tmpl
+++ b/templates/edit.natedit.tmpl
@@ -1,9 +1,9 @@
-%TMPL:INCLUDE{"edit"}%<!-- template: edit.natedit.tmpl -->
-%TMPL:INCLUDE{"editjavascript"}%<!-- edittoolbar// -->
-%TMPL:INCLUDE{"edittoolbar"}%<!-- edittoolbar// -->
-%TMPL:INCLUDE{"edithelp"}%<!-- edithelp// -->
-%TMPL:INCLUDE{"editdialog"}%<!-- editdialog// -->
-%TMPL:INCLUDE{"uploadplugin"}%<!-- uploadplugin// -->
+%TMPL:INCLUDE{"edit"}%
+%TMPL:INCLUDE{"editjavascript"}%
+%TMPL:INCLUDE{"edittoolbar"}%
+%TMPL:INCLUDE{"edithelp"}%
+%TMPL:INCLUDE{"editdialog"}%
+%TMPL:INCLUDE{"uploadplugin"}%
 %TMPL:DEF{"titleaction"}%(%IF{"defined 'rev'" 
   then="%MAKETEXT{"restore"}%" 
   else="%IF{"istopic '%WEB%.%TOPIC%'" 
@@ -135,4 +135,3 @@
   else=""
 }%
 <!-- //revCommentPluginOptions -->%TMPL:END%
-
diff --git a/templates/editdialog.natedit.tmpl b/templates/editdialog.natedit.tmpl
index f226213..bc2109f 100644
--- a/templates/editdialog.natedit.tmpl
+++ b/templates/editdialog.natedit.tmpl
@@ -1,4 +1,4 @@
-%TMPL:INCLUDE{"dialog"}%<!-- template: editidialog.natedit.tmpl -->
+%TMPL:INCLUDE{"dialog"}%
 %TMPL:DEF{"inserttable"}%<div id="natEditInsertTable" class="foswikiDialog foswikiFormSteps" style="display:none">
 %ADDTOZONE{
   "script"
diff --git a/templates/edittoolbar.natedit.tmpl b/templates/edittoolbar.natedit.tmpl
index 8930271..4a4cf1c 100644
--- a/templates/edittoolbar.natedit.tmpl
+++ b/templates/edittoolbar.natedit.tmpl
@@ -1,4 +1,3 @@
-<!-- template: edittoolbar.natedit.tmpl -->
 %TMPL:DEF{"bottomtopicactions"}%<!-- -->
 <div class="natEditBottomBar">
 <ul>

-- PaulHarvey - 21 Nov 2011

Actually the foswiki core should strip off anything after the closing </html> automatically. Something as easy as

$_[0] =~ s/(<\/html>).*?$/$1/gs;

That's a lot easier than having to take care of it in all of the tmpl files.

-- MichaelDaum - 10 Jan 2012

Well, I guess you have a point, but I feel it shouldn't be up to the engine to babysit and second-guess the markup - not to mention adding yet another straw in the haystack of re-re-re-re-regexing...

Especially given that the fix isn't hard (see patch above).

You removed NatEditPlugin from Component field, I assume you want this to be assigned to FoswikiRender now. Assigned.

-- PaulHarvey - 10 Jan 2012

Changing this from New to Proposal Required. I think it's worth some discussion to decide should Foswiki just cleanup template issues, or assert to find and resolve them during development. I think our current implementation is better as the cruft can be found and removed rather than silently scrubbed.

-- GeorgeClark - 19 Jun 2014

Implemented as PageOptimizerPlugin.

-- MichaelDaum - 20 Jun 2014
 

ItemTemplate edit

Summary Assertion (Junk after </html> ... failed
ReportedBy PaulHarvey
Codebase trunk
SVN Range
AppliesTo Engine
Component FoswikiRender
Priority Enhancement
CurrentState Proposal Required
WaitingFor
Checkins
TargetRelease n/a
ReleasedIn n/a
CheckinsOnBranches
trunkCheckins
Release01x01Checkins
Topic revision: r5 - 20 Jun 2014, MichaelDaum - This page was cached on 20 Nov 2020 - 08:07.

The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy