def serialize_footnote(ctx, document, el, root):
    "Serializes footnotes."

    footnote_num = el.rid

    if el.rid not in ctx.footnote_list:
        ctx.footnote_id += 1
        ctx.footnote_list[el.rid] = ctx.footnote_id

    footnote_num = ctx.footnote_list[el.rid]

    note = etree.SubElement(root, 'sup')
    link = etree.SubElement(note, 'a')
    link.set('href', '#')
    link.text = u'{}'.format(footnote_num)

    fire_hooks(ctx, document, el, note, ctx.get_hook('footnote'))

    return root
def serialize_footnote ( ctx , document , el , root ) : footnote_num = el . rid if el . rid not in ctx . footnote_list : ctx . footnote_id += 1 ctx . footnote_list [ el . rid ] = ctx . footnote_id footnote_num = ctx . footnote_list [ el . rid ] note = etree . SubElement ( root , 'sup' ) link = etree . SubElement ( note , 'a' ) link . set ( 'href' , '#' ) link . text = u'{}' . format ( footnote_num ) fire_hooks ( ctx , document , el , note , ctx . get_hook ( 'footnote' ) ) return root
Serializes footnotes.