Submitted by : simon at: 2003-10-26T21:31:32+00:00 (14 years ago)
Name :
Category : Severity : Status :
Optional subject :  
Optional comment :

See also the posts in GeneralDiscussion ~2002/03/03:

 > Just right click on this page and view the nasty html. *Extra* html
 > body tags - no doctype, etc. How can I help get this in shape. 

It sounds like a zope fix is required (in structured text).


SimonMichael, 2002/03/10 12:59 GMT (via web):
(cc from GeneralDiscussion:)
Simon Michael <simon@joyful.com>, 2002/03/10 12:55 GMT (via mail):

> textual substitution procedures. Quite frankly, it's disappointing
> that with all the work people have obviously put into zope and zwiki
> that they didn't put in the right codes in the right order to
> validate.

We were waiting for you to come along. Thanks! Filed in the tracker as Issue0112.

I do care about html and accessibility standards. It's good to know about the extra html & body tags, I'm guessing that started with the move to STXNG. The problem with fixing structured text is that it's part of zope, and so fixes need to go in via http://collector.zope.org/Zope . I'm sure a lot of people would like to see structured text made (X)HTML-clean.

That said, I have compensated for stx bugs in zwiki on occasion. If there are easy workarounds we can add as interim measures, I'm interested.


the scoop, cc'd here:

I've also noticed the unwanted extra tags in ZWiki, and belive I have discovered a way to remove them. I've only tested this with the default structured-text wiki pages with Zope 2.4 and above.

For structured-text wiki pages extra tags are inserted by the structured-text parser used. The StructuredText module included with Zope does not pass the header keyword arguement, and thus when the source is rendered it assumes the default which is to add aditional html and body tags. I assume that when the module was created if the author wished to pass keyword arguements from a dictionary it required using the apply function, and the choice was made not to use apply. Python 2.0 added the ability to pass keyword arguements using a dictionary by prefixing them with a double astrik. So....

Edit the ZWikiPage function _structured_text in the else: block used for Zope 2.4
from: text = str(StructuredText.HTML(text,level=3))

to: text = str(StructuredText.HTML(text,level=3,header=0)) # passing header so as not to include extra html formating

Now edit StructuredText/__init__.py
from: def HTML(src, level=0, type=type, StringType=type('')):

to: def HTML(src, level=0, type=type, StringType=type(''),**kw): # adding ability to grab extra keyword arguements

from: return ClassicHTML(src, level)

To: return ClassicHTML(src, level,**kw) # passing extra keyword arguements on

restart Zope and your pages should no longer have extra html and body tags in your documents.


SimonMichael, 2002/03/10 14:11 GMT (via web):
This needs to be pushed into stx via the zope collector. If for some reason that takes a while, maybe we should include patches for this kind of thing.


natesain, 2002/03/10 19:14 GMT (via web):
I've posted a ZWiki only fix for the extra HTML on the general discussion page


Simon Michael <simon@joyful.com>, 2002/03/10 19:43 GMT (via mail):
cc-ing here for reference

zwiki@zwiki.org (natesain) writes:

 > Looking further into the subject of extra HTML added by STXNG I've
 > found a solution that only needs changes to ZWiki.  ZWiki imports the
 > StructuredText module which defines several ways of rendering a stx
 > document: DocBook,HTML,HTMLNG,HTMLWithImages... the module also
 > provieds several parsers that generate a DOM like structure from the
 > stx source. If I understand corectly the HTML renderer is a backwards
 > compatable function for those who want ClassicSTX redering. I don't
 > think the guys at Zope consider its inserting extra HTML to be a
 > bug. The solution is to use the newer renderers in the StrucutredText
 > module.  To use the newer renderers (like HTMLNG), use the Document
 > parser to create a STX DOM structure and then pass that strucutre to
 > HTMLNG.  Doing this we can also pass the header arguement. So: text =
 > str(StructuredText.HTML(text,level=3)) becomes text =
 > str(StructuredText.HTMLNG(StructuredText.Document(text),level=3,header
 > =0)) It would also be easy to experment with HTMLWithImages which has
 > syntax for adding images in STX: text =
 > str(StructuredText.HTMLWithImages(
 > StructuredText.DocumentWithImages(text),level=3,header=0))


Simon Michael <simon@joyful.com>, 2002/03/10 20:40 GMT (via mail):
cc from GeneralDiscussion:
 > Great! This makes the test pass so without thinking any more about it
 > BOOM! In it goes.  Everybody watch out for related breakages in the next
 > while.


Simon Michael <simon@joyful.com>, 2002/03/10 20:41 GMT (via mail):
cc from GeneralDiscussion::


> !PS HTMLWithImages? has the old problem and I don't see a
> HTMLNGWithImages?.


> PPS by "the test" I meant the unit test I added earlier,
> testIssueNo0012StxDoubleHtmlTag.


Simon, 2002/03/13 21:42 GMT (via web):
So the first part of this issue is fixed in 0.9.9 (double html & body tags). Are structured text pages still not valid html/xhtml ? Can we close this ?


Simon, 2002/04/16 02:06 GMT (via web):
fixed in 0.9.9