Item9434: RENDERZONE macro fails to render head
and body
zones
Priority: Urgent
Current State: Closed
Released In: 1.1.0
Target Release: minor
Applies To: Engine
Component: Foswiki.pm
Branches:
I'm trying to create a custom RSS feed for internal use in my organization and ran into the following issue:
The
<head>
element of the XML document gets added a
<script>
tag by a plugin that happens to be loaded in Fowsiki (TimeTablePlugin). Obviously the plugin needs that piece of JS, but not if an XML is being generated.
Generally, unless HTML is being generated, extra elements in a tag that happens to be
<head>
don't make sense.
SvenDowideit suggested "if you can use doctype, and then allow for an additional param in ADDTOHEAD for different doc types, we'd win more".
--
DanDascalescu - 04 Aug 2010
I'm not sure ADDTOHEAD is the proper place for any doctype specification. It gives the opportunity for some ADDs to be for different doctyps on the document.
In 1.1 we have RENDERZONE/ADDTOZOHE, where ADDTOHEAD is an alias of the form
ADDTOZONE{"head" ....}.
By default, Foswiki core will call
Foswiki::renderZone()
automatically if
%RENDERZONE%
of head or body has not occurred in your skin templates
You should be able to get the desired effect by "flushing" the head and body zones like so:
%RENDERZONE{"head" format=" "}
%RENDERZONE{"body" format=" "}
If this doesn't work then we need to raise a bug.
You can mimic this functionality on 1.0.9 by installing
ZonePlugin (it monkey-patches addToHead with the 1.1 functionality).
Sadly I haven't had time to back-port the latest RENDERZONE changes to
ZonePlugin (see
Item9317) but I don't think that will affect you in this case.
--
PaulHarvey - 04 Aug 2010
It's a bug.
http://trunk.foswiki.org/Sandbox/TestTopic1 confirms it.
Dan, would you like to re-purpose this task?
"RENDERZONE macro fails to render
head
and
body
zones"
--
PaulHarvey - 04 Aug 2010
Repurposed.
--
DanDascalescu - 05 Aug 2010
RENDERZONE uses
$Foswiki::TranslationToken
. This clashes with
$Foswiki::Render::REMARKER
. Both are defined as \0. These are cleaned up in
Foswiki::Render::getRenderedVersion
before they can be used by RENDERZONEs in
Foswiki::writeCompletePage
. Redefining
$Foswiki::TranslationToken
to something else, e.g. \3, cures the problem.
Test to reproduce:
%RENDERZONE{"test"}%
%ADDTOZONE{"test" text="test1"}%
%ADDTOZONE{"test" text="test2"}%
%ADDTOZONE{"test" text="test3"}%
ZonePlugin does not have this problem because it already uses a different translation token.
--
MichaelDaum - 08 Aug 2010
Re-opened because the documentation on both the markers, and the zone behaviour itself, is inadequate.
--
CrawfordCurrie - 09 Aug 2010