pythontinymcepdf-generationreportlabrml

Reportlab Unordered List not showing bullets


Whenever users input unordered lists using TinyMCE and it will look like this under source code

<ul>
 <li>item 1</li>
 <li>item 2</li>
 <li>item 3</li></ul>

When it renders to PDF using reportlab, it shows up without bullets all on the same line like this:

item 1 item 2 item 3

Below is the reportlab code:

<paraStyle name="long_td_contents_right_notes"
    alignment="right"
    fontName="ACaslon-SemiBold"
    fontSize="8"/>



<blockTable style="blocktablestyle1" colWidths="145,{{if wide}}328{{else}}250{{endif}}">
        {{ for note in notes }}
            <tr><td align="left"><para style="long_td_contents_left">{{ rml(note.title) }}</para></td><td align="left"><para style="long_td_contents_left_notes"> {{ rml(note.body) }}</para></td></tr>
        {{endfor}}

Any help with this would be massively appreciated.

Thanks


Solution

  • This worked.

    {{ for note in notes }}
            {{script}}
                    notesWithBullets =  rml( note.body.replace('<li>', '&bull; ').replace('</p>','<br>').replace('</ul>','<br>').replace('</li>', '<br>'))
            {{endscript}}
                 <tr><td align="left"><para style="long_td_contents_left">{{ rml(note.title) }}</para></td><td align="left"><para style="long_td_contents_left">{{ rml(notesWithBullets) }}</para></td></tr>
    {{endfor}}