
    e                     6    d Z ddlZddgZd	dZd
dZd ZddZy)z Pretty-Print an Interface object as structured text (Yum)

This module provides a function, asStructuredText, for rendering an
interface as structured text.
    NasReStructuredTextasStructuredTextc                    |rd }nd } || j                               g}|j                  }d}| j                         r) |t        t	        | j                               |             | j
                  D cg c]   }|t        j                  j                  ur|" }}|rY |t        d||             |dz  }|D ]7  }	d ||	j                               z  }
 |t        t	        |
      ||             9 |dz  }t        | j                               } |t        d||             |dz  }|D ]f  \  }}t        |d      rdj                   ||j                               |j                         xs d	      }
 |t        t	        |
      ||             h |dz  } |t        d
||             |dz  }|D ]  \  }}t        |d      sdj                  |j                         |j                               }dj                   ||      |j                         xs d	      }
 |t        t	        |
      ||              dj                  |      dz   S c c}w )z Output structured text format.  Note, this will whack any existing
    'structured' format of the text.

    If `rst=True`, then the output will quote all code as inline literals in
    accordance with 'reStructuredText' markup principles.
    c                 $    dj                  |       S )Nz``{}``)formatss    9/usr/lib/python3/dist-packages/zope/interface/document.py<lambda>z"asStructuredText.<locals>.<lambda>#   s    8??1#5     c                     | S )N r   s    r
   r   z"asStructuredText.<locals>.<lambda>%   s    1 r      zThis interface extends:zo %szAttributes:getSignatureStringz{} -- {}zno documentationzMethods:z{}{}z

)getNameappendgetDoc_justify_and_indent_trim_doc_string	__bases__zope	interface	InterfacesortednamesAndDescriptionshasattrr   r   join)Imungerstinline_literalroutplevelbasebasesbitemr   namedesc_calls                  r
   r   r      sI    5$				$%A88DExxz !1!((*!=uEF DNN444  E   !:E5IJ
 	LAN199;77D$%5d%;UEJK	L 	
!!"8"8":;	]E5	9:	QJE* L
dt12$$^DLLN%C!%!D2DFD$%5d%;UEJK	L
 
QJE	Z	67	QJE* L
d4-.MM$,,.$2I2I2KLE$$^E%:!%!D2DFD$%5d%;UEJKL ;;q>F""As   6%Ic                     t        | |d      S )zi Output reStructuredText format.  Note, this will whack any existing
    'structured' format of the text.T)r   r    )r   )r   r   s     r
   r   r   Q   s     AU55r   c           
      F   | j                  dd      j                  d      }|j                  d      g}|rWt        |D cg c]'  }t	        |      t	        |j                               z
  ) c}      }|D ]  }|j                  ||d         dj                  |      S c c}w )zJ Trims a doc string to make it format
    correctly with structured text. 

r   N)replacesplitpopminlenlstripr   r   )textlinesnlinesline
min_indents        r
   r   r   W   s     LL&,,T2Eiil^F&+-" d)c$++-&88 - .
 	-DMM$z{+,	- 99V-s   ,Bc                 `   d|z  }|rrg }|}| j                         } | D ]7  }dj                  ||g      }t        |      |kD  s%|j                  |       |}9 |j                  |       dj                  |      S || j	                         j                  dd      j                  dd|z         z   S )z9 indent and justify text, rejustify (munge) if specified  r/   r.   )r1   r   r4   r   stripr0   )r6   r$   r   widthindentr7   r9   words           r
   r   r   f   s     5[Fzz| 	D88T4L)D4y5 T"		 LLyy JJL  .77dVmLM 	Mr   )r   F)r   )r   H   )__doc__zope.interfacer   __all__r   r   r   r   r   r   r
   <module>rE      s4   
  
4#n6Mr   