U
    m/e	                     @   s8   d dl mZ d dlmZ d dlmZ G dd deZdS )    )nodes)admonitionlabels)HTML5Translatorc                       s8   e Zd ZdZdgZd
ddZdd Z fdd	Z  ZS )BotoHTML5TranslatorzEExtension of Sphinx's ``HTML5Translator`` for Botocore documentation.z
[REQUIRED] c                 C   s@   | j | j|dd| d |r<dt|  d}| j | dS )z;Uses the h3 tag for admonition titles instead of the p tag.divzadmonition )ZCLASSz<h3 class='admonition-title'> z</h3>N)bodyappendZstarttagr   )selfnodenametitle r   </tmp/pip-unpacked-wheel-3gylhwtm/botocore/docs/translator.pyvisit_admonition   s    z$BotoHTML5Translator.visit_admonitionc                 C   sV   t |dkoTt|d tjoTt |d dkoTt|d d tjoT|d d  | jkS )zDetermines if a node is an implicit heading.

        An implicit heading is represented by a paragraph node whose only
        child is a strong node with text that isnt in `IGNORE_IMPLICIT_HEADINGS`.
           r   )len
isinstancer   strongTextZastextIGNORE_IMPLICIT_HEADINGS)r
   r   r   r   r   is_implicit_heading$   s    z'BotoHTML5Translator.is_implicit_headingc                    sB   |  |r2|d d }| jd| d tjnt | dS )zVisit a paragraph HTML element.

        Replaces implicit headings with an h3 tag and defers to default
        behavior for normal paragraph elements.
        r   z<h3>z</h3>
N)r   r   r	   r   ZSkipNodesupervisit_paragraph)r
   r   text	__class__r   r   r   2   s
    
z#BotoHTML5Translator.visit_paragraph)r   )	__name__
__module____qualname____doc__r   r   r   r   __classcell__r   r   r   r   r      s   
r   N)Zdocutilsr   Zsphinx.localer   Zsphinx.writers.html5r   ZSphinxHTML5Translatorr   r   r   r   r   <module>   s   