ó
öÀ„\c           @   s¨   d  Z  d d l m Z d d l m Z d d l m Z e r… d d l m	 Z	 m
 Z
 d d l m Z d d l m Z d d l m Z n  d e f d	 „  ƒ  YZ d
 „  Z d S(   sÿ   
    sphinx.environment.collectors.title
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    The title collector components for sphinx.environment.

    :copyright: Copyright 2007-2019 by the Sphinx team, see AUTHORS.
    :license: BSD, see LICENSE for details.
iÿÿÿÿ(   t   nodes(   t   EnvironmentCollector(   t   SphinxContentsFilter(   t   Dictt   Set(   t   Sphinx(   t   BuildEnvironmentt   TitleCollectorc           B   s)   e  Z d  Z d „  Z d „  Z d „  Z RS(   s'   title collector for sphinx.environment.c         C   s*   | j  j | d  ƒ | j j | d  ƒ d  S(   N(   t   titlest   popt   Nonet
   longtitles(   t   selft   appt   envt   docname(    (    sB   lib/python2.7/site-packages/sphinx/environment/collectors/title.pyt	   clear_doc   s    c         C   s=   x6 | D]. } | j  | | j  | <| j | | j | <q Wd  S(   N(   R   R   (   R   R   R   t   docnamest   otherR   (    (    sB   lib/python2.7/site-packages/sphinx/environment/collectors/title.pyt   merge_other!   s    c         C   sÒ   t  j ƒ  } | } d | k rD t  j ƒ  } | t  j | d ƒ 7} n  x[ | j t  j ƒ D]4 } t | ƒ } | d j | ƒ | | j ƒ  7} PqW W| t  j d ƒ 7} | | j j	 | j j
 <| | j j | j j
 <d S(   s   Add a title node to the document (just copy the first section title),
        and store that title in the environment.
        t   titlei    s
   <no title>N(   R    R   t   Textt   traverset   sectionR   t	   walkaboutt   get_entry_textR   R   R   R   (   R   R   t   doctreet	   titlenodet   longtitlenodet   nodet   visitor(    (    sB   lib/python2.7/site-packages/sphinx/environment/collectors/title.pyt   process_doc'   s    (   t   __name__t
   __module__t   __doc__R   R   R   (    (    (    sB   lib/python2.7/site-packages/sphinx/environment/collectors/title.pyR      s   		c         C   s&   |  j  t ƒ i d d 6t d 6t d 6S(   Nt   builtint   versiont   parallel_read_safet   parallel_write_safe(   t   add_env_collectorR   t   True(   R   (    (    sB   lib/python2.7/site-packages/sphinx/environment/collectors/title.pyt   setup@   s
    N(   R"   t   docutilsR    t   sphinx.environment.collectorsR   t   sphinx.transformsR   t   Falset   typingR   R   t   sphinx.sphinxR   t   sphinx.environmentR   R   R)   (    (    (    sB   lib/python2.7/site-packages/sphinx/environment/collectors/title.pyt   <module>
   s   '