(self, root)
return div
Return div of footnotes as et Element.
Return div of footnotes as et Element.
Return div of footnotes as et Element .
def makeFootnotesDiv(self, root):
        """ Return div of footnotes as et Element. """

        if not self.footnotes.keys():
            return None

        div = etree.Element("div")
        div.set('class', 'footnote')
        hr = etree.SubElement(div, "hr")
        ol = etree.SubElement(div, "ol")

        for id in self.footnotes.keys():
            li = etree.SubElement(ol, "li")
            li.set("id", self.makeFootnoteId(id))
            self.parser.parseChunk(li, self.footnotes[id])
            backlink = etree.Element("a")
            backlink.set("href", "#" + self.makeFootnoteRefId(id))
            backlink.set("rev", "footnote")
            backlink.set("title", "Jump back to footnote %d in the text" % \
                            (self.footnotes.index(id)+1))
            backlink.text = FN_BACKLINK_TEXT

            if li.getchildren():
                node = li[-1]
                if node.tag == "p":
                    node.text = node.text + NBSP_PLACEHOLDER
                    node.append(backlink)
                else:
                    p = etree.SubElement(li, "p")
                    p.append(backlink)
        return div
def makeFootnotesDiv ( self , root ) : if not self . footnotes . keys ( ) : return None div = etree . Element ( "div" ) div . set ( 'class' , 'footnote' ) hr = etree . SubElement ( div , "hr" ) ol = etree . SubElement ( div , "ol" ) for id in self . footnotes . keys ( ) : li = etree . SubElement ( ol , "li" ) li . set ( "id" , self . makeFootnoteId ( id ) ) self . parser . parseChunk ( li , self . footnotes [ id ] ) backlink = etree . Element ( "a" ) backlink . set ( "href" , "#" + self . makeFootnoteRefId ( id ) ) backlink . set ( "rev" , "footnote" ) backlink . set ( "title" , "Jump back to footnote %d in the text" % ( self . footnotes . index ( id ) + 1 ) ) backlink . text = FN_BACKLINK_TEXT if li . getchildren ( ) : node = li [ - 1 ] if node . tag == "p" : node . text = node . text + NBSP_PLACEHOLDER node . append ( backlink ) else : p = etree . SubElement ( li , "p" ) p . append ( backlink ) return div