Testcase 6 : xhtml() causes renderer to hang

Asked by Luc Saffre

When I call ``do text from xhtml(HTML)`` with the following HTML code:

<div class="section" id="titel">
<h1>Title</h1>
<div class="system-message">
<p class="system-message-title">System Message: WARNING/2 (<tt class="docutils">&lt;string&gt;</tt>, line 2)</p>
<p>Title underline too short.</p>
<pre class="literal-block">
Title
====
</pre>
</div>
</div>

then appy.pod enters into an endless loop in xhtml2odt.py (HtmlElement.getConflictualElements()):

                    while visitParents:
                        try:
                            nextParent = env.currentElements[-i]
                            print nextParent # I added this line to make the endless loop visible
                            res.insert(0, nextParent.setConflictual())
                            if nextParent.elemType == 'para':
                                visitParents = False
                        except IndexError:
                            visitParents = False

I guess this is a bug...
You may use the files at
http://code.google.com/p/lino/source/browse/#hg%2Ftests%2Fappy%2F1
to reproduce this (though I didn't check whether the test.py works without Lino installed).

Luc

Question information

Language:
English Edit question
Status:
Solved
For:
Appy Edit question
Assignee:
No assignee Edit question
Solved by:
Gaëtan Delannay
Solved:
Last query:
Last reply:
Revision history for this message
Best Gaëtan Delannay (gaetan-delannay) said :
#1

Hi Luc,
Indeed, the counter (variable i) allowing to go upward from parent to parent in the list of currently walked tags is not incremented.
What happens if, after line

nextParent = env.currentElements[-i]

you insert this one:
i += 1

?
Cheers
Gaetan

Revision history for this message
Luc Saffre (luc-saffre) said :
#2

Ha! The most stupid bugs are the most difficult to find! Thanks for your answer.

Revision history for this message
Luc Saffre (luc-saffre) said :
#3

Thanks Gaëtan Delannay, that solved my question.