
    [`a$                     T    d dl mZ d dlmZ d dlZd dlmZmZ d dl	m
Z
 d Zd Zd ZdS )	    )unicode_literals)urlparseN)
generatorssignals)strftimec                     | D ]y}t          |t          j                  r*|j        |j        z   |j        z   D ]}t          |           Ft          |t          j                  r|j        D ]}t          |           zdS )z-
    Process Article and Page generators
    T)	
isinstancer   ArticlesGeneratorarticlestranslationsdraftsopen_graph_tagPagesGeneratorpages)content_generators	generatorarticlepages       T/var/www/html/maison-a-villennes.fr/sources/pelican-plugins/pilosus_pelican_og/og.pyprocess_generatorsr      s     ( 	% 	%	i!=>> 	%&*+$%( ( w''''	(
 	:#<== 	%! % %t$$$$4    c                    d| j         fdg}| j                            d          }| j                            dd          }|rG|                    d| j                            dd                    }|                    d|f           ny|rwt          |          }|j        sJ| j                            dd          r/d	                    | j                            dd          |          }|                    d|f           t          j
                            | j                            dd          | j                  }|                    d
|f           | j        }| j                            d|          }|                    d|f           | j                            dg           }|r	|d         }nd}|                    d| j                            d|          f           |                    d| j                            dd          f           t          | d          r*|                    dt          | j        d          f           t          | d          r*|                    dt          | j        d          f           t          | d          r_| j        D ]W}	t          j
                            | j                            dd          |	j                  }|                    d|f           X| j                            di           }
t'          |
          dk    r5| j        D ]-}|j        |
v r"|                    d|
|j                 f           .|                    d| j        j        f           	 | j        D ]}|                    d|j        f           n# t0          $ r Y nw xY w|| _        dS )a3  
    Process single item (article or page)

    Access the following meta tags:
    og:title
    og:type
    og:image
    og:url
    og:description
    og:locale
    og:site_name
    og:see_also
    article:author
    article:published_time
    article:modified_time
    article:section
    article:tag
    zog:title)zog:typer   DEFAULT_OG_IMAGEog_image z{static}SITEURLzog:imagez{0}/{1}zog:urlog_descriptionzog:descriptionLOCALEr   z	og:locale	og_localezog:site_nameSITENAMEdatezarticle:published_timez%Y-%m-%dmodifiedzarticle:modified_timerelated_postszog:see_alsoAUTHOR_FB_IDzarticle:authorzarticle:sectionzarticle:tagN)titlesettingsgetmetadatareplaceappendr   schemeformatospathjoinurlsummaryhasattrr   r!   r"   r#   lenauthorsnamecategorytagsAttributeErrorog)itemog_tagsdefault_imageimage	image_urlr0   default_summarydescriptiondefault_localerelated_postauthor_fb_profilesauthortags                r   r   r      s   ( DJ'$&G M%%&899MMj"--E 8j$-*;*;Ir*J*JKK
E*++++ 	8 //I# '=$$Y33 '$-$4$4)))R88%%' %'M NNJ6777 ',,t}((B77
B
BCNNHc?### lO-##$4oFFKNN$k2333 ]&&x44N '*NN	dm''^DDEG G G NNNDM$5$5j"$E$EFGGG tV .0TY
++- 	. 	. 	. tZ   )/M:2' 2' ( 	) 	) 	) t_%% 1 . 	1 	1L',,t}00B??AQRRCNNM3/0000 **>2>>
""l 	I 	IF{000%'9&+'FGI I I NN%t}'9:;;;9 	6 	6CNNM3845555	6    DGGGs   &N( (
N54N5c                  N    t           j                            t                     dS )z#
    Pelican plugin entrypoint
    N)r   all_generators_finalizedconnectr    r   r   registerrJ      s"     $,,-?@@@@@r   )
__future__r   urllib.parser   os.pathr-   pelicanr   r   pelican.utilsr   r   r   rJ   rI   r   r   <module>rP      s    ' ' ' ' ' ' ! ! ! ! ! !  ' ' ' ' ' ' ' ' " " " " " "  $_ _ _DA A A A Ar   