Feature Proposal: Make Foswiki::Render pluggable
Motivation
Foswiki::Render is a major weakness of Foswiki. Let's make it pluggable, so we can explore deep changes or even replacement in a robust way without disrupting our wider userbase.
The following bugs in particular are quite painful and would benefit from more adventurous explorations of
Foswiki::Render
:
- Item11316
Foswiki::Render
inappropriately (ab)uses empty <p>
tags
- Item11366 Ampersands in
[[squab?queries]]
are double-encoded
- Item9771 putting a foswiki table into a list can produce broken html
- Item12061 ICON macro should produce single quotes
Description and Documentation
There are these main ways to get TML rendered, AFAICS:
-
Foswiki::Func::renderText( $text, $web, $topic ) -> $html
- official API
-
Foswiki::Meta->renderTML($tml) -> $html
- Semi-official API
-
Foswiki::Render::getRenderedVersion($tml, $topicObject) -> $html
- legacy; many plugins in svn
-
$session->renderer()->getRenderedVersion($tml, $topicObject) -> $html
- core, tests & some plugins
Need to make all these forms wrappers to a thing which determines the correct renderer class for the job.
Examples
Impact
- Performance
- Must support an eventual FoswikiDOM renderer
- Should allow different renderers to be used for different content-types (actual content negotiation is outside the scope of this proposal, except that this work should support an a future content-negotiation mechanism).
Implementation
--
Contributors: PaulHarvey - 01 Feb 2012
Discussion