Structured text <img> html tag not working properly in Zope 2.61
I have a site with lots of structured text. There are many <img src='/some/image'> tags in the texts. But after upgrading from Zope 2.51 to Zope 2.61, I get broken images all over the place. Example:: <img src='images/kreativ.jpg' align='left'> This tag is turned into:: <img src="%3Ccode">images/kreativ.jpg align='left'> While:: <img src="images/kreativ.jpg" align="left"> is rendered correctly. It used to work. Does anybody know why it doesn't? What is the easiest way to get around this. It is not supposed to be illegal to put a tag like that into structured text, is it? I think that the most likely culprit is the stx parser seing some part of the <img> tag as inlined code. Unfortunately I have not been able to hunt it down myself. And it is a bit strange as there should be space around inline code. Does anybody here has a clue what it can be, or in what files I should look for the problem? The most likely files I found was:: \lib\python\StructuredText\ClassicStructuredText.py \lib\python\StructuredText\DocumentWithImages.py But the problem could easily be elsewhere. regards Max M
On Wed, 12 Nov 2003 20:43:51 +0100 Max M <maxm@mxm.dk> wrote:
I have a site with lots of structured text.
There are many <img src='/some/image'> tags in the texts. But after upgrading from Zope 2.51 to Zope 2.61, I get broken images all over the place.
Example::
<img src='images/kreativ.jpg' align='left'>
This tag is turned into::
<img src="%3Ccode">images/kreativ.jpg align='left'>
While::
<img src="images/kreativ.jpg" align="left">
I think this is because single quotes are used to designate inline preformatted code sections. This causes unintended markup to occur inside image tags containing single quotes. Maybe you can just mass replace the single quotes with double quotes. -Casey
It's not a good idea to mix HTML and STX.. STX (at least using the DocumentWithImages class for the document) has its own notation for including image, e.g. "DTML error message indicating that it cannot find a variable.":img:7-1:Figures/7-1.png It was only by accident that using HTML tags to place images into STX to work for you, unfortunately. On Wed, 2003-11-12 at 15:00, Casey Duncan wrote:
On Wed, 12 Nov 2003 20:43:51 +0100 Max M <maxm@mxm.dk> wrote:
I have a site with lots of structured text.
There are many <img src='/some/image'> tags in the texts. But after upgrading from Zope 2.51 to Zope 2.61, I get broken images all over the place.
Example::
<img src='images/kreativ.jpg' align='left'>
This tag is turned into::
<img src="%3Ccode">images/kreativ.jpg align='left'>
While::
<img src="images/kreativ.jpg" align="left">
I think this is because single quotes are used to designate inline preformatted code sections. This causes unintended markup to occur inside image tags containing single quotes.
Maybe you can just mass replace the single quotes with double quotes.
-Casey
_______________________________________________ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Chris McDonough wrote:
It's not a good idea to mix HTML and STX.. STX (at least using the DocumentWithImages class for the document) has its own notation for including image, e.g.
"DTML error message indicating that it cannot find a variable.":img:7-1:Figures/7-1.png
Yes. But I don't think that the image tag is the problem. I tried to change the HTML factory in StructuredText.py from: def HTML(aStructuredString, level=1, header=1): st = Basic(aStructuredString) doc = DocumentImages(st) return HTMLNGImages(doc,header=header,level=level) to: def HTML(aStructuredString, level=1, header=1): st = Basic(aStructuredString) doc = Document(st) return HTMLNG(doc,header=header,level=level) So that it would use the old class. But that changed nothing. It still rendered the html image tag as an error. Also in the DocumentWithImages.py there is the regex: def doc_img( self, s, expr1=re.compile('\"([ _a-zA-Z0-9*.:/;,\-\n\~]+)\":img:([a-zA-Z0-9\_\-.:/;,\n\~]+)').search, expr2=re.compile('\"([ _a-zA-Z0-9*.:/;,\-\n\~]+)\":img:([a-zA-Z0-9\_\-.:/;,\n\~]+):([a-zA-Z0-9_\-.:/;,\n\~]+)').search ): Suggesting at least that images should have the ":img:" to be recognised as an image tag. So my second guess was that it is the in the ctag() function at line 335 in ClassicStructuredText.py that the problem was. But I cannot find any problems with the regexs. Also a diff didn't show any significant changes in that file from 2.51 to 2.61 I don't understand it. Inline code should 'look like this'. If there is no space before, it should not render as code. ie. a tag='like this' should not render as code as there is no whitespace before it. To quote the source: - Text enclosed single quotes (with white-space to the left of the first quote and whitespace or punctuation to the right of the second quote) is treated as example code.
It was only by accident that using HTML tags to place images into STX to work for you, unfortunately.
Ay, that sucks. Customers have been using it for 2-3 years now. And they have many many documents. I could write a converter, for converting it into the new image tag, but that would suck too. regards Max M
On Wed, 12 Nov 2003 21:52:55 +0100 Max M <maxm@mxm.dk> wrote:
Ay, that sucks. Customers have been using it for 2-3 years now. And they have many many documents. I could write a converter, for converting it into the new image tag, but that would suck too.
You could maybe try installing the old structured text package in the new Zope. It might be worth a shot. -Casey
participants (3)
-
Casey Duncan -
Chris McDonough -
Max M