pombreda / xhtml2pdf

Automatically exported from code.google.com/p/xhtml2pdf
GNU General Public License v2.0
0 stars 0 forks source link

Ordered lists with paragraphs do not format properly #32

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Write a valid template and include a basic ordered list somewhere in the
html, such as: 
<ol>
    <li>Item 1
          <p>Comments on Item 1</p>
    </li>
    <li>Item 2
          <p>Comments on Item 2</p>
    </li>
</ol> 
2. Take the html and render it as an html string and then convert it to a
pdf document.
3. When you view the pdf document it will appear as described below.
4. An example of how I did this is in the demo\djangoproject\views.py
render_to_pdf function.

What is the expected output? 
When I view the html in my browser the comment lines are indented and
correctly shown as follows:
1. Item 1
      Comments on Item 1
2. Item 2
      Comments on Item 2

What do you see instead?
Instead of just indenting the paragraphs, it re-adds a number in front of
each paragraph.
1. Item 1
      1. Comments on Item 1
2. Item 2
      2. Comments on Item 2

What version of the product are you using? 
Pisa 3.0.29

On what operating system?
Vista

Please provide any additional information below.
We changed our source code and made a patch to get this to work, however,
it is an ugly fix and just temporary.  I am hoping this solution is
acceptable to the client as the paragraphs are not indented anymore, but at
least the numbers are no longer showing.

Original issue reported on code.google.com by seanb1...@gmail.com on 5 Mar 2009 at 3:39

GoogleCodeExporter commented 9 years ago
Here is the code that was modified in the pisa_tags.py file:

class pisaTagP(pisaTag):
    def start(self, c):
        # save the type of tag; it's used in PmlBaseDoc.afterFlowable()
        # to check if we need to add an outline-entry
        # c.frag.tag = self.tag
        if c.node.parentNode and c.node.parentNode.tagName == 'li' and
c.node.previousSibling:
            c.frag.bulletText = u'   '
        if self.attr.align is not None:
            #print self.attr.align, getAlign(self.attr.align)
            c.frag.alignment = getAlign(self.attr.align)

Original comment by seanb1...@gmail.com on 5 Mar 2009 at 7:27

GoogleCodeExporter commented 9 years ago
Thanks for the fix. I used a more general approach in pisa_context.py. Will be 
available in 3.0.30

Original comment by dirk.holtwick on 26 Mar 2009 at 6:22