
    mh                     t    d Z ddlZddlmZmZmZ ddlmZmZ ddlm	Z	  G d de	          Z
 ee
           dS )	a  
hCalendar: A microformat for serializing iCalendar data
          (http://microformats.org/wiki/hcalendar)

Here is a sample event in an iCalendar:

BEGIN:VCALENDAR
PRODID:-//XYZproduct//EN
VERSION:2.0
BEGIN:VEVENT
URL:http://www.web2con.com/
DTSTART:20051005
DTEND:20051008
SUMMARY:Web 2.0 Conference
LOCATION:Argent Hotel\, San Francisco\, CA
END:VEVENT
END:VCALENDAR

and an equivalent event in hCalendar format with various elements optimized appropriately.

<span class="vevent">
 <a class="url" href="http://www.web2con.com/">
  <span class="summary">Web 2.0 Conference</span>:
  <abbr class="dtstart" title="2005-10-05">October 5</abbr>-
  <abbr class="dtend" title="2005-10-08">7</abbr>,
 at the <span class="location">Argent Hotel, San Francisco, CA</span>
 </a>
</span>
    N)datedatetime	timedelta   )CRLFregisterBehavior)VCalendar2_0c                   *    e Zd ZdZedd            ZdS )	HCalendar	HCALENDARNTc           	      4   |pt          j                    ddfdfd}|j        }|D ]O} |dt          z              dz  |                    d          }|r |d|z   d	z   t          z              dz  |                    d
          }	|	r |d|	z   dz   t          z              |                    d          }
|
r%t          |
          t          k    rd}d}nt          |
          t          k    rd}d} |d                    |
	                    |          |
	                    |                               |                    d          }|s|                    d          }|r||
z   }|rr|}t          |          t          k    r|t          d          z
  } |d                    |	                    |          |	                    |                               |                    d          }|r |d|z   dz   t          z              |                    d          }|r |d|z   dz   t          z              |rdz   |dt          z              dz   |dt          z              Q|p                                S )zv
        Serialize iCalendar to HTML using the hCalendar microformat (http://microformats.org/wiki/hcalendar)
        r      c                      d z  z  S )N  )leveltabwidths   Q/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/vobject/hcalendar.pyindentz#HCalendar.serialize.<locals>.indent4   s    ;))    c                 l                                                                      |            d S )N)write)sr   outbufs    r   outz HCalendar.serialize.<locals>.out7   s.    LL"""LLOOOOOr   z<span class="vevent">r   urlz<a class="url" href="z">summaryz<span class="summary">z</span>:dtstartz	%A, %B %ez%Y%m%dz%A, %B %e, %H:%Mz%Y%m%dT%H%M%S%zz3<abbr class="dtstart", title="{0!s}">{1!s}</abbr>
dtendduration)daysz3- <abbr class="dtend", title="{0!s}">{1!s}</abbr>
locationzat <span class="location">z</span>descriptionz<div class="description">z</div>z</a>)sixStringIOvevent_listr   getChildValuetyper   r   formatstrftimer   getvalue)clsobjbuf
lineLengthvalidater   veventseventr   r   r   
timeformatmachiner   r    humanr"   r#   r   r   r   r   s                     @@@@r   	serializezHCalendar.serialize*   sD    &	* 	* 	* 	* 	* 	*	 	 	 	 	 	 / ?	" ?	"EC'$.///QJE %%e,,C +c1D84?@@@
)))44G L,w6CdJKKK )))44G ===D((!,J&GG']]h..!3J/G
 KVG,,W55#,,Z88: :; ; ;
 ++G44 3$22:>>H 3 (7 2  =!EE{{d** %	q(9(9(9 9COw 7 7 %z : :< <= = =
 **:66H P08;iG$NOOO--m<<K Q/+=H4OPPP #
FTM"""QJEC	D !!!!'foo'''r   )NNT)__name__
__module____qualname__nameclassmethodr6   r   r   r   r   r   '   s=        DU( U( U( [U( U( U(r   r   )__doc__r$   r   r   r   baser   r   	icalendarr	   r   r   r   r   <module>r?      s    < 


 . . . . . . . . . . ( ( ( ( ( ( ( ( # # # # # #Y( Y( Y( Y( Y( Y( Y( Y(v       r   