self._saved_page_states = []
def showPage(self):
- self._saved_page_states.append(dict(self.__dict__))
self._startPage()
def save(self):
class PageReset(platypus.Flowable):
def draw(self):
+ """Flag to close current story page numbering and prepare for the next
+ should be executed after the rendering of the full story"""
self.canv._doPageReset = True
class _rml_styles(object,):
if extra_style:
style.__dict__.update(extra_style)
result = []
- for i in self._textual(node).split('\n'):
- result.append(platypus.Paragraph(i, style, **(utils.attr_get(node, [], {'bulletText':'str'}))))
+ textuals = self._textual(node).split('\n')
+ keep_empty_lines = (len(textuals) > 1) and len(node.text.strip())
+ for i in textuals:
+ if keep_empty_lines and len(i.strip()) == 0:
+ i = '<font color="white"> </font>'
+ result.append(
+ platypus.Paragraph(
+ i, style, **(
+ utils.attr_get(node, [], {'bulletText':'str'}))
+ )
+ )
return result
elif node.tag=='barCode':
try:
self.handle_frameBegin()
def afterPage(self):
+ if isinstance(self.canv, NumberedCanvas):
+ # save current page states before eventual reset
+ self.canv._saved_page_states.append(dict(self.canv.__dict__))
if self.canv._doPageReset:
# Following a <pageReset/> tag:
# - we reset page number to 0
story_cnt = 0
for node_story in node_stories:
if story_cnt > 0:
- # Reset Page Number with new story tag
- fis.append(PageReset())
fis.append(platypus.PageBreak())
fis += r.render(node_story)
+ # end of story numbering computation
+ fis.append(PageReset())
story_cnt += 1
try:
if self.localcontext and self.localcontext.get('internal_header',False):