ó
oUNc           @   s   d  Z  d d d !Z d d l m Z m Z d d l m Z d d l Z d d l Z d Z	 d	 Z
 d
 Z d Z d e j f d     YZ d   Z d S(   s,   HTML pretty-printing for Python source code.s   $Revision: 1.8 $i   iţ˙˙˙i˙˙˙˙(   t   htmlizert   usage(   t	   copyrightNs   <html><head>
<title>%(title)s</title>
<meta name="Generator" content="%(generator)s" />
%(alternate)s
%(stylesheet)s
</head>
<body>
s   </body>s3   <link rel="stylesheet" href="%s" type="text/css" />s?   <link rel="alternate" href="%(source)s" type="text/x-python" />t   Optionsc           B   s^   e  Z d  e j j e j d  f Z d g Z	 e
 j d e
 j d d d g  Z d	   Z RS(   s   %s [options] source.py
    i    t
   stylesheett   ss   URL of stylesheet to link to.t   extraActionss   *.pyt   descrs   source python filec         C   s   | |  d <d  S(   Nt   filename(    (   t   selfR   (    (    s<   /usr/lib/python2.7/dist-packages/twisted/scripts/htmlizer.pyt	   parseArgs)   s    N(   s
   stylesheetR   Ns   URL of stylesheet to link to.(   t   __name__t
   __module__t   ost   patht   basenamet   syst   argvt   synopsist   Nonet   optParametersR   t   Completionst   CompleteFilest   compDataR
   (    (    (    s<   /usr/lib/python2.7/dist-packages/twisted/scripts/htmlizer.pyR      s   		c          C   s  t    }  y |  j   Wn. t j k
 rG } t |  GHt j d  n X|  d } |  j d  d  k	 r{ t	 |  d f } n d } t
 | d d  } zo | j t i | d 6d t j f d	 6t i | d
 6d 6| d 6 t j t
 |  | t j  | j t  Wd  | j   Xd  S(   Ni   R   R   t    s   .htmlt   wt   titles   htmlizer/%st	   generatort   sourcet	   alternate(   R   t   parseOptionsR   t
   UsageErrort   strR   t   exitt   getR   t	   styleLinkt   opent   writet   headerR   t   longversiont   alternateLinkR    t   filtert   SmallerHTMLWritert   footert   close(   t   optionst   eR   R   t   output(    (    s<   /usr/lib/python2.7/dist-packages/twisted/scripts/htmlizer.pyt   run,   s*    	

(   t   __doc__t   __version__t   twisted.pythonR    R   t   twistedR   R   R   R&   R+   R#   R(   R   R0   (    (    (    s<   /usr/lib/python2.7/dist-packages/twisted/scripts/htmlizer.pyt   <module>   s   	