mò #á¸Ec@sJdZdklZdd„Zd„ZeddƒZddd„Zd S( sï Pretty-Print an Interface object as structured text (Yum) This module provides a function, asStructuredText, for rendering an interface as structured text. Revision information: $Id: Document.py 40218 2005-11-18 14:39:19Z andreasjung $ (s maketransic Cs4d|iƒg}|i}d}|iƒo'|tt|iƒƒ|ƒdƒn|i ƒoq|d|dƒ|d}xD|i ƒD]6}d|iƒ}|tt|ƒ||ƒdƒqŒW|d}nt |iƒƒ}|iƒ|td||ƒdƒ|d}xk|D]c\}} t| dƒpGd | iƒ| iƒpd f}|tt|ƒ||ƒdƒqqW|d}|td ||ƒdƒ|d}xt|D]l\}} t| dƒoPd | iƒ| iƒ| iƒpd f}|tt|ƒ||ƒdƒq·q·Wd i|ƒS(si Output structured text format. Note, this will wack any existing 'structured' format of the text. s%s is t sThis interface extends: so %ss Attributes:tgetSignatureStrings%s -- %ssno documentationsMethods:s %s%s -- %stN(tItgetNametrtappendtoutptleveltgetDoct_justify_and_indentt_trim_doc_stringtgetBasestbtitemtmungetlisttnamesAndDescriptionstsorttnametdescthasattrRtjoin( RRRRRRRRR R((t1/data/zmath/zope/lib/python/Interface/Document.pytasStructuredTexts@  '   $   #(   ,(cCsÙ|iƒiddƒ}|idƒ}|dg}t|ƒdjo…d}xR|dD]F}t|ƒt|i ƒƒ}||jp |djo |}qXqXWx'|dD]}|i ||ƒq­Wndi |ƒS(sR Trims a doc string to make it format correctly with structured text. s s iiN(ttexttstriptreplacetsplittlinestnlinestlentNonet min_indenttlinetlstriptindentRR(RR$R!RR"R((RR Is   s s iHcCsùg}|ošd|}|i|tƒiƒiƒ}x^|D]I}di ||gƒ}t |ƒ|jo|i |ƒd|}q<q<W|i |ƒdi |ƒSnO|iddƒidƒ}x#|D]}|i d||ƒqÉWdi |ƒSdS(s9 indent and justify text, rejustify (munge) if specified Rs s N(RRRR"Rt translatet_transRRtwordRRtwidthRR(RRRR(R'RR"((RR ]s$   N(t__doc__tstringt maketransRR R&R (R R RR+R&((Rt?s   0