def write_heading(self, text, bullet='', autoAnchor=None, anchor=None, level=1): # Store the line number of this heading with its unique anchor, # to later create paging info begin = len(self.buf) self.heading_marks[begin] = autoAnchor RawTextRfcWriter.write_heading(self, text, bullet=bullet, \ autoAnchor=autoAnchor, anchor=anchor, level=level) # Reserve room for a blankline and some lines of section content # text, in order to prevent orphan headings # orphanlines = self.get_numeric_pi('sectionorphan', default=self.orphan_limit + 2) end = len(self.buf) nr = len([ l for l in self.buf[begin:end] if l and l[0] in nroff_linestart_meta ]) needed = end - begin - nr + orphanlines self._set_break_hint(needed, "raw", begin)
def write_heading(self, text, bullet='', autoAnchor=None, anchor=None, \ level=1): # Store the line number of this heading with its unique anchor, # to later create paging info begin = len(self.buf) self.heading_marks[begin] = autoAnchor RawTextRfcWriter.write_heading(self, text, bullet=bullet, \ autoAnchor=autoAnchor, anchor=anchor, \ level=level) # Reserve room for a blankline and some lines of section content # text, in order to prevent orphan headings end = len(self.buf) + self.pis["sectionorphan"] self._set_break_hint(end-begin, 'raw', begin)
def write_heading(self, text, bullet='', autoAnchor=None, anchor=None, \ level=1): # Store the line number of this heading with its unique anchor, # to later create paging info begin = len(self.buf) self.heading_marks[begin] = autoAnchor RawTextRfcWriter.write_heading(self, text, bullet=bullet, \ autoAnchor=autoAnchor, anchor=anchor, \ level=level) # Reserve room for a blankline and some lines of section content # text, in order to prevent orphan headings end = len(self.buf) + self.pis["sectionorphan"] self._set_break_hint(end - begin, 'raw', begin)
def write_heading(self, text, bullet='', autoAnchor=None, anchor=None, level=1): # Store the line number of this heading with its unique anchor, # to later create paging info begin = len(self.buf) self.heading_marks[begin] = autoAnchor RawTextRfcWriter.write_heading(self, text, bullet=bullet, \ autoAnchor=autoAnchor, anchor=anchor, level=level) # Reserve room for a blankline and some lines of section content # text, in order to prevent orphan headings end = len(self.buf) nr = len([ l for l in self.buf[begin:end] if l and l[0] in nroff_linestart_meta]) self._set_break_hint(end - begin - nr + int(self.pis["sectionorphan"]), "raw", begin)
def write_heading(self, text, bullet='', autoAnchor=None, anchor=None, \ level=1): # Store the line number of this heading with its unique anchor, # to later create paging info begin = len(self.buf) self.heading_marks[begin] = autoAnchor RawTextRfcWriter.write_heading(self, text, bullet=bullet, \ autoAnchor=autoAnchor, anchor=anchor, \ level=level) # Reserve room for a blankline and some lines of section content # text, in order to prevent orphan headings # # We've now written a blank line before the heading, followed by # the heading. Next will be a blank line, followed by the section # content. We thus need (begin - end) + 1 + orphan_limit lines, but # if we ask for only that, we'll end up moving the text, to the next # page, without moving the section heading. So we ask for one more self.orphan_limit = self.get_numeric_pi('orphanlimit', default=self.orphan_limit) orphanlines = self.get_numeric_pi('sectionorphan', default=self.orphan_limit+2) end = len(self.buf) needed = end - begin + orphanlines self._set_break_hint(needed, 'raw', begin)