관리-도구
편집 파일: parseentities.pyc
� �fc @ s� d Z d d l Z d d l Z d d l Z e j d � Z d d d � Z d � Z e d k r� e e j � d k r� e e j d � Z n e j Z e e j � d k r� e e j d d � Z n e j Z e j � Z e e � Z e e e � n d S( s� Utility for parsing HTML entity definitions available from: http://www.w3.org/ as e.g. http://www.w3.org/TR/REC-html40/HTMLlat1.ent Input is read from stdin, output is written to stdout in form of a Python snippet defining a dictionary "entitydefs" mapping literal entity name to character or numeric entity. Marc-Andre Lemburg, mal@lemburg.com, 1999. Use as you like. NO WARRANTIES. i����Ns7 <!ENTITY +(\w+) +CDATA +"([^"]+)" +-- +((?:.| )+?) *-->i c C s� d } | d k r! t | � } n i } xT t j | | | � } | sI Pn | j � \ } } } | | f | | <| j � } q* W| S( Ni ( t Nonet lent entityREt searcht groupst end( t textt post endpost dt mt namet charcodet comment( ( s3 /usr/lib64/python2.7/Tools/scripts/parseentities.pyt parse s c C s� | j d � | j � } | j � x� | D]� \ } \ } } | d d k r� t | d d !� } | d k rx d | } q� t | � } n t | � } t j | � } | j d | | | f � q* W| j d � d S( Ns entitydefs = { i s &#i����i s '\%o's '%s': %s, # %s s } ( t writet itemst sortt intt reprt TextToolst collapse( t ft defsR R R R t code( ( s3 /usr/lib64/python2.7/Tools/scripts/parseentities.pyt writefile# s t __main__i i t w( t __doc__t ret sysR t compileR R R R t __name__R t argvt opent infilet stdint outfilet stdoutt readR R ( ( ( s3 /usr/lib64/python2.7/Tools/scripts/parseentities.pyt <module> s