
    h!              	       h   S SK r S SKrS SKrS SKrSSKJr  Sr\ R                  " S\S9r\R                  SSS	S
SSS9  \R                  SSSSSS9  SS jr
S r\R                  " S\R                  \R                  -  5      r\R                  " S\R                  \R                  -  5      rS rS rg)    N   )htmldiff zR%prog [OPTIONS] FILE1 FILE2
%prog --annotate [OPTIONS] INFO1 FILE1 INFO2 FILE2 ...)usagedescriptionz-oz--outputFILEoutput-zFile to write the difference to)metavardestdefaulthelpz-az--annotation
store_true
annotationzDo an annotation)actionr   r   c                    U c  [         R                  SS  n [        R                  U 5      u  pUR                  (       a  [        X5      $ [        U 5      S:w  a5  [        S5        [        R                  5         [         R                  " S5        U u  p#[        U5      n[        U5      n[        U5      S   n[        U5      u  pxn	[        Xh5      n
Xz-   U	-   n
UR                  S:X  a;  U
R                  S5      (       d  U
S-  n
[         R                  R!                  U
5        g [#        UR                  S5       nUR!                  U
5        S S S 5        g ! , (       d  f       g = f)Nr      zError: you must give two filesr
   
wb)sysargvparser
parse_argsr   annotatelenprint
print_helpexit	read_file
split_bodyr   r	   endswithstdoutwriteopen)argsoptionsfile1file2input1input2body1prebody2postresultfs               H/var/www/html/env/lib/python3.13/site-packages/lxml/html/_diffcommand.pymainr2      s   |xx|%%d+MG&&
4yA~./LEuFuFvq!E!&)Ce#F\D F~~t$$dNF

 '..$'1GGFO (''s   7E
E c                 $   U S:X  a   [         R                  R                  5       nU$ [        R                  R                  U 5      (       d  [        SU -  5      e[        U S5       nUR                  5       nS S S 5        U$ ! , (       d  f       W$ = f)Nr
   zInput file %s does not existrb)r   stdinreadospathexistsOSErrorr$   )filenamecr0   s      r1   r   r   7   s{    3IINN H WW^^H%%*X57 	7 (D!QA "H "!Hs   %B  
Bz	<body.*?>z
</body.*?>c                    S=p[         R                  U 5      nU(       a%  U S UR                  5        nXR                  5       S  n [        R                  U 5      nU(       a%  XR	                  5       S  nU S UR	                  5        n XU4$ )Nr   )body_start_researchendbody_end_restart)htmlr,   r.   matchs       r1   r    r    G   s}    OC  &E<EIIK IIKL!t$EKKMN#NU[[]#d?    c                 F    [        S5        [        R                  " S5        g )NzNot yet implementedr   )r   r   r   )r&   r%   s     r1   r   r   S   s    	
 HHQKrE   )N)optparser   rer7   diffr   r   OptionParserr   
add_optionr2   r   compileISr>   rA   r    r    rE   r1   <module>rP      s     
 	 	  
		=
   *		*     .			  2	 

"$$rtt)jj2449
rE   