Actually break page before a paragraph if the custom directive was used

authorOlivier CAYROL (Logilab) <Olivier.Cayrol@logilab.fr>
changesetd0c0f8c71552
branchdefault
phasepublic
hiddenno
parent revision#1950d4cded5d Remove empty line
child revision#ae3b3c35fed9 Correcting expected values in the tests
files modified by this revision
rest_docbook/visitor.py
# HG changeset patch
# User Olivier CAYROL (Logilab) <Olivier.Cayrol@logilab.fr>
# Date 1409740882 -7200
# Wed Sep 03 12:41:22 2014 +0200
# Node ID d0c0f8c715521eabbc68b2a6615cc918317b00c9
# Parent 1950d4cded5da85ebc7df4ace156422279390eeb
Actually break page before a paragraph if the custom directive was used

diff --git a/rest_docbook/visitor.py b/rest_docbook/visitor.py
@@ -1270,10 +1270,12 @@
1 
2      def visit_paragraph(self, node):
3          elt = SubElement(self.parents_stack[-1], u"para")
4          self.insert_ids(node, elt)
5          self.insert_classes(node, elt)
6 +        if node.get(u"pagebreak", u"false").lower() == u'true':
7 +            elt.set(u"{%s}break" % LDG_NS, u"page")
8          self.parents_stack.append(elt)
9 
10      def depart_paragraph(self, node):
11          self.parents_stack.pop()
12