
\c           @   s@   d  Z  d d l m Z d d l m Z d e f d     YZ d S(   s  
    sphinxcontrib.websupport.writer
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    sphinxcontrib.websupport writer that adds comment-related annotations.

    :copyright: Copyright 2007-2016 by the Sphinx team, see AUTHORS.
    :license: BSD, see LICENSE for details.
i(   t   HTMLTranslatori   (   t   is_commentablet   WebSupportTranslatorc           B   s2   e  Z d  Z d   Z d   Z d   Z d   Z RS(   s%   
    Our custom HTML translator.
    c         O   s#   t  j |  | | |  d |  _ d  S(   Ns   sphinx-has-comment(   R    t   __init__t   comment_class(   t   selft   buildert   argst   kwargs(    (    s>   lib/python2.7/site-packages/sphinxcontrib/websupport/writer.pyR      s    c         C   s?   t  |  r+ t | d  r+ |  j |  n  t j |  |  d  S(   Nt   uid(   R   t   hasattrt   handle_visit_commentableR    t   dispatch_visit(   R   t   node(    (    s>   lib/python2.7/site-packages/sphinxcontrib/websupport/writer.pyR      s    c         C   sn   |  j  |  | j d r< |  j j d | j d d  n  d | j g | j d <| j d j |  j  d  S(   Nt   idss   <span id="%s"></span>i    s   s%st   classes(   t   add_db_nodet
   attributest   bodyt   appendR	   R   (   R   R   (    (    s>   lib/python2.7/site-packages/sphinxcontrib/websupport/writer.pyR      s    c         C   sY   |  j  j } | j | j  sU | j d | j d |  j  j d | j pN | j    n  d  S(   Nt   idt   documentt   source(   R   t   storaget   has_nodeR	   t   add_nodet   current_docnamet	   rawsourcet   astext(   R   R   R   (    (    s>   lib/python2.7/site-packages/sphinxcontrib/websupport/writer.pyR   *   s
    (   t   __name__t
   __module__t   __doc__R   R   R   R   (    (    (    s>   lib/python2.7/site-packages/sphinxcontrib/websupport/writer.pyR      s
   			N(   R   t   sphinx.writers.htmlR    t   utilsR   R   (    (    (    s>   lib/python2.7/site-packages/sphinxcontrib/websupport/writer.pyt   <module>
   s   