Edit detail for #1342 raw html/dtml in restructured text, working or not ? revision 6 of 6

1 2 3 4 5 6
Editor: simon
Time: 2009/02/17 13:50:15 GMT-8
Note: update

added:

From simon Tue Feb 17 13:50:14 -0800 2009
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: base64
From: simon
Date: Tue, 17 Feb 2009 13:50:14 -0800
Subject: update
Message-ID: <[email protected]>

Status: open => closed 

As betabug noted, the one-line raw-html declaration still works with current Zwiki/Zope/docutils. To enable full raw html - which is sometimes useful for site building, without it you are forced back to using structured text - I've just added the rst_raw_enabled property to Zwiki 2, incorporating the above zope patch so it works with current and older Zopes.

Submitted by : simon at: 2007-05-04T19:31:03+00:00 (14 years ago)
Name :
Category : Severity : Status :
Optional subject :  
Optional comment :

This may or may not work, or at least is done differently, in various versions of zope. Investigate, document!

Works for me --betabug, Fri, 04 May 2007 23:43:41 -0700 reply

Works with Zope 2.8 (yeah, old), Zwiki 0.59: http://www.graphicsgarage.gr/NutsAndBolts (see: /text for source)

.. role:: raw-html(raw)
   :format: html
:raw-html:`<dtml-var expr="tools.nutsnavi()">`

.. image:: images/nb1.jpg

Nuts and bolts...
====================

The stuff that keeps it all together and the toys to let you play.

The generated HTML isn't so nice though, it wraps a <span class="raw-html"> around the <div> I'm inserting. That's why the HTML doesn't validate on that particular page any more.

raw is disabled by zope - but it kind of works anyway --betabug, Tue, 06 Nov 2007 01:35:52 -0800 reply

in reStructuredText/__init__.py in the Zope source, the render() method forces raw to "off":

settings['raw_enabled'] = 0

This is after any settings from the HTML() method are passed, so the client programmer's choice is always overriden. I don't know if this is a bug or if it's intentionally like that. The :raw-html: bit seems to work independently of this -- I guess that would be a reST bug we're abusing there.

In fact this works in a Zwiki page, even though we don't declare the "raw" directive:

:raw-html:`<b>this works</b> in Zwiki`

While this one doesn't:

.. role:: raw-html(raw)
   :format: html

.. raw:: html
   <b>format given by rst docs</b> - this does not work
   <p>Because "raw" is actually disabled</p>

See also --betabug, Tue, 06 Nov 2007 01:49:51 -0800 reply

https://bugs.launchpad.net/zope2/+bug/143852

update --simon, Tue, 17 Feb 2009 13:50:14 -0800 reply

Status: open => closed

As betabug noted, the one-line raw-html declaration still works with current Zwiki/Zope/docutils. To enable full raw html - which is sometimes useful for site building, without it you are forced back to using structured text - I've just added the rst_raw_enabled property to Zwiki 2, incorporating the above zope patch so it works with current and older Zopes.