Module ImportFrom alias Import alias ImportFrom alias Import alias identifier Assign NameStore AttributeLoad NameLoad attr Assign NameStore AttributeLoad NameLoad attr Expr Str ClassDef bases AttributeLoad NameLoad attr body Assign NameStore ListLoad Num FunctionDef arguments args NameParam NameParam NameParam defaults body Expr Str If CompareEq Call NameLoad AttributeLoad NameLoad attr Num body If CompareLtE AttributeLoad NameLoad attr Str body Assign NameStore ListLoad TupleLoad Num Str Num orelse Assign NameStore ListLoad TupleLoad Num Str Num NameLoad orelse Assign NameStore AttributeLoad NameLoad attr If NameLoad body Assign NameStore SubscriptLoad SubscriptLoad NameLoad Index Num Index Num orelse Assign NameStore Num FunctionDef arguments args NameParam NameParam NameParam defaults body Expr Str Assign TupleStore NameStore NameStore NameStore NameStore SubscriptLoad NameLoad Index Call NameLoad NameLoad Expr Call NameLoad NameLoad NameLoad ListLoad TupleLoad NameLoad NameLoad NameLoad NameLoad NameLoad decorator_list Assign NameStore AttributeLoad NameLoad attr AugAssignAdd SubscriptStore NameLoad Index Num Num Assign NameStore BinOpMod Str SubscriptLoad NameLoad Index Num Expr Call NameLoad AttributeLoad NameLoad attr NameLoad NameLoad Assign NameStore ListLoad Assign NameStore ListLoad For NameStore NameLoad body Assign TupleStore NameStore NameStore NameStore SubscriptLoad NameLoad Slice Num Assign NameStore BinOpSub NameLoad NameLoad If CompareGt AttributeLoad NameLoad attr Str body Assign NameStore Call AttributeLoad NameLoad attr NameLoad orelse Assign NameStore SubscriptLoad AttributeLoad NameLoad attr Index NameLoad If BoolOpAnd CompareGtE AttributeLoad NameLoad attr Num CompareGtE NameLoad AttributeLoad NameLoad attr body Assign NameStore Str orelse Assign NameStore Str Assign NameStore Call NameLoad NameLoad Assign AttributeStore NameLoad attr AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr TupleLoad NameLoad NameLoad NameLoad NameLoad If NameLoad body If UnaryOpNot Call NameLoad NameLoad NameLoad body Assign NameStore Call NameLoad NameLoad Str Assign NameStore BinOpMod Str TupleLoad NameLoad NameLoad Assign NameStore Call NameLoad BinOpMod Str TupleLoad NameLoad NameLoad Call NameLoad NameLoad NameLoad Expr Call AttributeLoad NameLoad attr TupleLoad NameLoad NameLoad NameLoad NameLoad If AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr ListLoad Call NameLoad Num AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr ListLoad NameLoad Assign AttributeStore NameLoad attr Call NameLoad NameLoad keyword TupleLoad NameLoad keyword AttributeLoad NameLoad attr Assign TupleStore AttributeStore NameLoad attr AttributeStore NameLoad attr Call AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr NameLoad NameLoad Return TupleLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr decorator_list decorator_list Assign AttributeStore NameLoad attr NameLoad
N/A copy copy N/A reportlab reportlab.platypus.tableofcontents drawPageNumbers N/A rst2pdf.genelements genelements N/A Table N/A genelements Table N/A Paragraph N/A genelements Paragraph N/A 

.. NOTE:  

    THIS IS A HUGE HACK HACK HACK

All I did was take the wrap() method from the stock reportlab TOC generator,
and make the minimal changes to make it work on MY documents in rst2pdf.

History:
~~~~~~~~

The reportlab TOC generator adds nice dots between the text and the page number.
The rst2pdf one does not.

A closer examination reveals that the rst2pdf one probably deliberately stripped
this code, because the reportlab implementation only allowed a single TOC, and
this is unacceptable for at least some rst2pdf users.

There are other differences in the rst2pdf one I don't understand.  This module
is a hack to add back dots between the lines. Maybe at some point we can figure
out if this is right, or how to support dots in the TOC in the main code.

Mind you, the original RL implementation is a complete hack in any case:

- It uses a callback to a nested function which doesn't even bother to
    assume the original enclosing scope is available at callback time.
    This leads it to do crazy things like eval()

- It uses a single name in the canvas for the callback function
    (this is what kills multiple TOC capability) when it would be
    extremely easy to generate a unique name.
 DottedTableOfContents N/A N/A genelements MyTableOfContents N/A N/A toc_counter N/A 0 wrap N/A N/A self availWidth availHeight N/A N/A N/A All table properties should be known by now. N/A N/A N/A len N/A self _lastEntries 0 N/A N/A N/A N/A reportlab Version 2.3 N/A N/A _tempEntries N/A N/A 0 Placeholder for table of contents 0 N/A N/A _tempEntries N/A N/A 0 Placeholder for table of contents 0 None N/A N/A _tempEntries N/A self _lastEntries N/A _tempEntries N/A N/A base_level N/A N/A _tempEntries N/A 0 N/A 0 N/A N/A base_level 0 drawTOCEntryEnd N/A N/A canvas kind label N/A N/A N/A Callback to draw dots and page numbers after each entry. N/A N/A style page key dot N/A end_info N/A N/A int label N/A N/A drawPageNumbers canvas style N/A N/A page key availWidth availHeight dot N/A N/A toc_counter N/A self toc_counter N/A N/A toc_counter N/A 0 1 N/A funcname N/A drawTOCEntryEnd%s N/A toc_counter N/A 0 N/A N/A setattr N/A self canv funcname drawTOCEntryEnd N/A end_info N/A N/A tableData N/A N/A entry _tempEntries N/A N/A N/A level text pageNum N/A entry N/A 3 N/A left_col_level N/A level base_level N/A N/A N/A reportlab Version 2.3 N/A N/A style N/A N/A self getLevelStyle left_col_level N/A N/A style N/A N/A self levelStyles N/A left_col_level N/A N/A N/A N/A self dotsMinLevel 0 N/A left_col_level N/A self dotsMinLevel N/A N/A dot  .  N/A N/A dot N/A style N/A copy style N/A N/A style textColor N/A self linkColor N/A key N/A N/A N/A self refid_lut get N/A level text pageNum None N/A key N/A N/A N/A N/A isinstance text unicode N/A N/A text N/A unicode text utf-8 N/A text N/A <a href="#%s">%s</a> N/A key text N/A para N/A Paragraph N/A %s<onDraw name="%s" label="%s"/> N/A text funcname N/A len end_info style N/A N/A N/A end_info append N/A style pageNum key dot N/A N/A style spaceBefore N/A N/A N/A N/A tableData append N/A N/A Spacer 1 N/A style spaceBefore N/A N/A N/A tableData append N/A para N/A N/A self _table N/A Table tableData colWidths N/A availWidth style N/A self tableStyle N/A N/A N/A self width N/A self height N/A N/A N/A self _table wrapOn N/A self canv availWidth availHeight N/A N/A N/A self width N/A self height N/A N/A N/A N/A genelements MyTableOfContents DottedTableOfContents