;ò
³0sDc           @   sµ  d  Z  d k Z d k l Z l Z d k l Z d k l Z l	 Z	 l
 Z
 l Z l Z l Z l Z d k l Z d „  Z d „  Z d „  Z d	 „  Z d
 e f d „  ƒ  YZ d e f d „  ƒ  YZ e d j oç d „  Z d „  Z d „  Z d k l Z l Z e ƒ  Z e d Z e d d e ƒZ  d e  _! xˆ d d e  d d d f d d e  d d d f d d e d d d d  f g D]9 \ Z" Z# Z$ Z% Z& Z' e' o e e" e$ e# e% e& ƒ qpqpWn d S(!   s<    $Id: xpreformatted.py 2426 2004-09-02 11:52:56Z rgbecker $ N(   s
   StringTypes   ListType(   s	   PyFontify(   s	   Paragraphs   cleanBlockQuotedTexts   _handleBulletWidths	   ParaLiness   _getFragWordss   stringWidths	   _sameFrag(   s	   _dedenterc         C   s  g  } g  } |  } xÇ | g  j o¹ | d } | i } | d =t i | d ƒ } | d j oo | | d } | i | i d | |  ƒ ƒ | i | ƒ g  } | d j o  | i d | i d | ƒ ƒ qØ q | i | ƒ q W| g  j o | i | ƒ n | Sd  S(   Ni    s   
i   s   texts    (   s   liness   clines   fragss   Ws   ws   texts   ts   strings   finds   is   tlefts   appends   clones   insert(   s   fragss   Ws   is   liness   clines   ts   ws   tleft(    (    sJ   /home/packages/reportlab/reportlab_2_0/reportlab/platypus/xpreformatted.pys   _getFragLines   s(     
	$c         C   sb   |  i ƒ  } x5 d d f D]' } t | | ƒ o t | | ƒ q q W|  i | | !| _ | g Sd  S(   Ns   liness   text(	   s   blParas   clones   fs   as   hasattrs   delattrs   liness   starts   stop(   s   blParas   starts   stops   as   f(    (    sJ   /home/packages/reportlab/reportlab_2_0/reportlab/platypus/xpreformatted.pys   _split_blPara%   s      c         C   s   t  i |  d ƒ Sd  S(   Ns    (   s   strings   counts   text(   s   text(    (    sJ   /home/packages/reportlab/reportlab_2_0/reportlab/platypus/xpreformatted.pys   _countSpaces-   s    c         C   sƒ   g  } d } d } x] |  D]U } | i } | i | | f ƒ | t | | i | i	 ƒ } | t
 i | d ƒ } q W| | | f Sd S(   s    given a fragment list return a list of lists
        [size, spaces, (f00,w00), ..., (f0n,w0n)]
        each pair f,w represents a style and some string
    i    s    N(   s   Ws   ns   ss   fragss   fs   texts   appends   stringWidths   fontNames   fontSizes   strings   count(   s   fragss   fs   texts   ns   ss   W(    (    sJ   /home/packages/reportlab/reportlab_2_0/reportlab/platypus/xpreformatted.pys   _getFragWord7   s      
s   XPreformattedc           B   s/   t  Z e e d d d „ Z d „  Z d „  Z RS(   Ni   i    c         C   s2   | |  _  | d „ } |  i | | | | | ƒ d  S(   Nc         C   s    t  i t |  p d | ƒ d ƒ S(   Ns    s   
(   s   strings   joins	   _dedenters   texts   dedent(   s   texts   dedent(    (    sJ   /home/packages/reportlab/reportlab_2_0/reportlab/platypus/xpreformatted.pys   <lambda>O   s    (	   s   caseSensitives   selfs   dedents   cleaners   _setups   texts   styles
   bulletTexts   frags(   s   selfs   texts   styles
   bulletTexts   fragss   caseSensitives   dedents   cleaner(    (    sJ   /home/packages/reportlab/reportlab_2_0/reportlab/platypus/xpreformatted.pys   __init__M   s    	c         C   s§  t  | ƒ t j o | g } n | } g  } d }	 | |	 } |  i } t	 | i
 ƒ } d } t |  i | | ƒ d |  _ |  i }
 t |
 ƒ } | d j o`|
 d } t | d ƒ oÁ | i
 } | i } d } t i | i d ƒ } xç | D]… } t | | | ƒ } t | | ƒ } | | } | i  | t i | d ƒ | f ƒ |	 d }	 |	 t | ƒ j  o | |	 p | d } qæ WnW | i } | i } xA | D]9 } | d j o | d } n
 | i } t | | ƒ } qŒWt |  i | ƒ |  _ | i! d | d	 | ƒ Sn¨| d j o2 t" d d d
 | i
 d | i d | i# d	 g  ƒ Snix=t$ |
 ƒ D]/} d } t& | ƒ \ } } } | d d } t | | i
 ƒ } | i! ƒ  g } | d d | d _ xN | d D]B } | d i! ƒ  } | d | _ | i  | ƒ t | | i
 ƒ } q´W|	 d }	 |	 t | ƒ j  o | |	 p | d } t | | ƒ } | | } | i  t" d | d | d | d
 | d | ƒ ƒ qDWt |  i | ƒ |  _ t" d d d	 | ƒ S| Sd S(   s  
        Returns a broken line structure. There are two cases

        A) For the simple case of a single formatting input fragment the output is
            A fragment specifier with
                kind = 0
                fontName, fontSize, leading, textColor
                lines=  A list of lines
                        Each line has two items.
                        1) unused width in points
                        2) a list of words

        B) When there is more than one input formatting fragment the out put is
            A fragment specifier with
                kind = 1
                lines=  A list of fragments each having fields
                            extraspace (needed for justified)
                            fontSize
                            words=word list
                                each word is itself a fragment with
                                various settings

        This structure can be used to easily draw paragraphs with the various alignments.
        You can supply either a single width or a list of widths; the latter will have its
        last item repeated until necessary. A 2-element list is useful when there is a
        different first line indent; a longer list could be created to facilitate custom wraps
        around irregular objects.i    i   s   texts   
s    iÿÿÿÿi   s   kinds   liness   fontSizes   fontNames	   textColors
   extraSpaces	   wordCounts   wordss   currentWidthN(+   s   types   widths   ListTypes	   maxWidthss   liness   linenos   maxWidths   selfs   styles   floats   fontSizes	   fFontSizes   requiredWidths   _handleBulletWidths
   bulletTexts   heights   fragss   lens   nFragss   fs   hasattrs   fontNames   kinds   strings   splits   texts   Ls   ls   stringWidths   currentWidths   maxs
   extraSpaces   appends   clones	   ParaLiness	   textColors   _getFragLiness   maxSizes   _getFragWords   ns   ws   wordss   i(   s   selfs   widths   fontNames   wordss   maxWidths   maxSizes   currentWidths   styles   fontSizes   linenos   fragss   requiredWidths   Ls	   fFontSizes	   maxWidthss
   extraSpaces   nFragss   kinds   fs   is   liness   ls   ns   w(    (    sJ   /home/packages/reportlab/reportlab_2_0/reportlab/platypus/xpreformatted.pys
   breakLinesR   s€      
			
		 
"
0		 	  
(
2c         C   s   t  Sd  S(   N(   s   _split_blPara(   s   self(    (    sJ   /home/packages/reportlab/reportlab_2_0/reportlab/platypus/xpreformatted.pys   _get_split_blParaFuncµ   s    (   s   __name__s
   __module__s   Nones   __init__s
   breakLiness   _get_split_blParaFunc(    (    (    sJ   /home/packages/reportlab/reportlab_2_0/reportlab/platypus/xpreformatted.pys   XPreformattedL   s   	cs   PythonPreformattedc           B   s’   t  Z d  Z h  d d d f <d d d f <d d d f <d	 d
 d f <d d d f <d d d f <Z e d e d „ Z d „  Z d „  Z RS(   sG   Used for syntax-colored Python code, otherwise like XPreformatted.
    s   rests    s   comments   <font color="green">s   </font>s   keywords   <font color="blue"><b>s   </b></font>s	   parameters   <font color="black">s
   identifiers   <font color="red">s   strings   <font color="gray">i    c         C   s^   | o |  i |  i | ƒ ƒ } n t t i |  | | f h  d | <d | <d | <ƒ d  S(   Ns
   bulletTexts   dedents   frags(   s   texts   selfs   fontifys
   escapeHtmls   applys   XPreformatteds   __init__s   styles
   bulletTexts   dedents   frags(   s   selfs   texts   styles
   bulletTexts   dedents   frags(    (    sJ   /home/packages/reportlab/reportlab_2_0/reportlab/platypus/xpreformatted.pys   __init__Å   s
    	c         C   sG   t  i | d d ƒ } t  i | d d ƒ } t  i | d d ƒ } | Sd  S(   Ns   &s   &amp;s   <s   &lt;s   >s   &gt;(   s   strings   replaces   texts   s(   s   selfs   texts   s(    (    sJ   /home/packages/reportlab/reportlab_2_0/reportlab/platypus/xpreformatted.pys
   escapeHtmlÌ   s    c         C   s°   | d d j o | d } n t i | ƒ } d }
 d } x] | D]U \ }	 } } } |
 | | | !}
 |  i |	 \ } } |
 | | | | !| }
 | } qA W|
 | | }
 |
 Sd S(   s/   Return a fontified version of some Python code.i    s   
i   s    N(   s   codes	   PyFontifys   fontifys   tagss   fontifiedCodes   poss   ks   is   js   dummys   selfs   formatss   ss   e(   s   selfs   codes   dummys   es   tagss   is   js   poss   ss   ks   fontifiedCode(    (    sJ   /home/packages/reportlab/reportlab_2_0/reportlab/platypus/xpreformatted.pys   fontifyÒ   s      
(   s   __name__s
   __module__s   __doc__s   formatss   Nones   __init__s
   escapeHtmls   fontify(    (    (    sJ   /home/packages/reportlab/reportlab_2_0/reportlab/platypus/xpreformatted.pys   PythonPreformatted¹   s
    `	s   __main__c         C   s¢   d t  |  ƒ GH|  i i } t | ƒ } xt t | ƒ D]f } | | } | i	 } t | ƒ } d | | | i f Gx) t | ƒ D] } d | | | i f Gqz WHq4 Wd  S(   Ns(   
############dumpXPreforemattedLines(%s)s   line%d: %d(%d)
  s   %d:'%s'(   s   strs   Ps   blParas   liness   lens   ns   ranges   ls   lines   wordss   nwordss	   wordCounts   ws   text(   s   Ps   wordss   nwordss   liness   ls   ns   ws   line(    (    sJ   /home/packages/reportlab/reportlab_2_0/reportlab/platypus/xpreformatted.pys   dumpXPreformattedLinesç   s     
	 c         C   sÚ   d t  |  ƒ GH|  i } t | ƒ } x* t | ƒ D] } d | | | i f GHq1 Wd } x| t | ƒ D]n } d } xU t
 | ƒ D]G } d | | | d f G| d } x | d D] } d | d Gq­ WHq} W| d } qd Wd  S(   Ns(   
############dumpXPreforemattedFrags(%s)s   frag%d: '%s'i    s   frag%d.%d: size=%di   s   '%s'(   s   strs   Ps   fragss   lens   ns   ranges   ls   texts   _getFragLiness   Ls   _getFragWordss   Ws   w(   s   Ps   Ws   ls   ns   ws   fragss   L(    (    sJ   /home/packages/reportlab/reportlab_2_0/reportlab/platypus/xpreformatted.pys   dumpXPreformattedFragsô   s&    	   
 c   
      C   s’   t  |  | d | ƒ} t | ƒ | i | | ƒ \ } }	 t | ƒ | i | | ƒ } t | ƒ x. | D]& } | i | | ƒ t | ƒ d } qd Wd  S(   Ns   dedentiô  (   s   XPreformatteds   texts   styles   dedents   Ps   dumpXPreformattedFragss   wraps   aWs   aHs   ws   hs   dumpXPreformattedLiness   splits   Ss   s(
   s   texts   styles   dedents   aWs   aHs   ws   ss   Ps   Ss   h(    (    sJ   /home/packages/reportlab/reportlab_2_0/reportlab/platypus/xpreformatted.pys   try_it  s    


 
(   s   getSampleStyleSheets   ParagraphStyles   BodyTexts   discussiontexts   parents	   Helveticas?  


The <font name=courier color=green>CMYK</font> or subtractive

method follows the way a printer
mixes three pigments (cyan, magenta, and yellow) to form colors.
Because mixing chemicals is more difficult than combining light there
is a fourth parameter for darkness.  For example a chemical
combination of the <font name=courier color=green>CMY</font> pigments generally never makes a perfect

black -- instead producing a muddy color -- so, to get black printers
don't use the <font name=courier color=green>CMY</font> pigments but use a direct black ink.  Because
<font name=courier color=green>CMYK</font> maps more directly to the way printer hardware works it may
be the case that &amp;| &amp; | colors specified in <font name=courier color=green>CMYK</font> will provide better fidelity
and better control when printed.


i    f456.0f42.799999999999997sv  

   This is a non rearranging form of the <b>Paragraph</b> class;
   <b><font color=red>XML</font></b> tags are allowed in <i>text</i> and have the same

      meanings as for the <b>Paragraph</b> class.
   As for <b>Preformatted</b>, if dedent is non zero <font color=red size=+1>dedent</font>
       common leading spaces will be removed from the
   front of each line.

i   s›       <font color=blue>class </font><font color=red>FastXMLParser</font>:
        # Nonsense method
        def nonsense(self):
            self.foo = 'bar'
s   Codef4.7999999999999998i   ((   s   __version__s   strings   typess
   StringTypes   ListTypes   reportlab.libs	   PyFontifys	   paragraphs	   Paragraphs   cleanBlockQuotedTexts   _handleBulletWidths	   ParaLiness   _getFragWordss   stringWidths	   _sameFrags	   flowabless	   _dedenters   _getFragLiness   _split_blParas   _countSpacess   _getFragWords   XPreformatteds   PythonPreformatteds   __name__s   dumpXPreformattedLiness   dumpXPreformattedFragss   try_its   reportlab.lib.styless   getSampleStyleSheets   ParagraphStyles
   styleSheets   Bs   DTstyles   fontNames   texts   dedents   styles   aWs   aHs   active(!   s   PythonPreformatteds   try_its	   ParaLiness   DTstyles   texts	   _sameFrags   ListTypes	   PyFontifys
   StringTypes   styles   aHs   aWs   __version__s   dumpXPreformattedFragss   _getFragLiness   dedents   Bs   strings   _split_blParas	   _dedenters
   styleSheets	   Paragraphs   dumpXPreformattedLiness   getSampleStyleSheets   XPreformatteds   actives   _countSpacess   _getFragWords   cleanBlockQuotedTexts   stringWidths   _getFragWordss   ParagraphStyles   _handleBulletWidth(    (    sJ   /home/packages/reportlab/reportlab_2_0/reportlab/platypus/xpreformatted.pys   ?   s0   	1			
	m-				
	J % 