
    f                     <    d Z ddlmZ d	dZd Z ed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.

Revision information:
$Id: Document.py 40218 2005-11-18 14:39:19Z andreasjung $
    )	maketransc                    d| j                         z  g}|j                  }d}| j                         r, |t        t	        | j                               |      dz          | j                         r_ |d|z  dz          |dz   }| j                         D ]4  }d|j                         z  } |t        t	        |      ||      dz          6 |dz
  }t        | j                               }|j                           |t        d||      dz          |dz   }|D ]X  \  }}	t        |	d      r|	j                         d	|	j                         xs d
} |t        t	        |      ||      dz          Z |dz
  } |t        d||      dz          |dz   }|D ]h  \  }}	t        |	d      s|	j                         |	j                         d	|	j                         xs d
} |t        t	        |      ||      dz          j dj                  |      S )zi Output structured text format.  Note, this will wack any existing
    'structured' format of the text.  z%s

   z

 zThis interface extends:

zo %szAttributes:getSignatureStringz -- zno documentationzMethods: )getNameappendgetDoc_justify_and_indent_trim_doc_stringgetBaseslistnamesAndDescriptionssorthasattrr   join)
Imungeroutplevelbitemr   namedescs
             j/var/dept/share/cheung/public_html/OutSchool/python/env/lib/python3.12/site-packages/Interface/Document.pyasStructuredTextr      s   
 
AIIK	 A88DExxz !1!((*!=uEvMNzz|cEk::;	 	AAIIK'D$%5d%;UEJ 	
 	 6 6 89 		]E5	9&	@AAIE* 
dt12!%!%!D2D!DFD$%5d%;UEJ 	 AIE	Z	6v	=>AIE* 
d4-.#'<<>#'#:#:#<#';;=#F4F#FHD $%5d%;UEJ  771:    c                 `   | j                         j                  dd      } | j                  d      }|d   g}t        |      dkD  rYd}|dd D ]1  }t        |      t        |j	                               z
  }||k  s|0|}3 |dd D ]  }|j                  ||d         dj                  |      S )zR
    Trims a doc string to make it format
    correctly with structured text.
    

r   r   N)stripreplacesplitlenlstripr
   r   )textlinesnlines
min_indentlineindents         r   r   r   I   s    
 ::<-DJJtEAhZF
5zA~
!"I 	"Dt9s4;;=11F
"j&8!
	" !"I 	-DMM$z{+,	-99Vr   r!   z  c                    g }|rd|z  }| j                  | t              j                         j                         } | D ]:  }dj	                  ||g      }t        |      |kD  s%|j                  |       d|z  }< |j                  |       dj	                  |      S | j                  dd      j                  d      } | D ]  }|j                  d|z  |z           dj	                  |      S )z9 indent and justify text, rejustify (munge) if specified r   r"   r!   )	translate_transr#   r%   r   r&   r
   r$   )r(   r   r   widthr)   r,   words          r   r   r   ]   s     EU{~~dF+11399; 	D88T4L)D4y5 T"U{		 LLyy ||FD)//5 	0DLL3;$./	0 yyr   N)r   )r   H   )__doc__stringr   r   r   r0   r    r   r   <module>r7      s-    .`& 
64	  r   