2

每当用户使用 TinyMCE 输入无序列表时,它在源代码下将如下所示

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

当它使用reportlab 呈现为PDF 时,它会在同一行显示没有项目符号,如下所示:

项目 1 项目 2 项目 3

以下是reportlab代码:

<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}}

对此的任何帮助将不胜感激。

谢谢

4

1 回答 1

0

这行得通。

{{ 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}}
于 2015-05-05T19:57:13.540 回答