
    -e                        d Z ddlmZ ddlZ ej        e          ZddlZddlZddl	Z	ddl
mZ ddlmZ ddlmZ ddlmZ dd	lmZ d
Z G d de          Zd Z ej        dej        ej        z            ZdS )aF   Automatically document Bokeh Jinja2 templates.

This directive takes the module path to an attribute name that defines a Jinja2
template:

.. code-block:: rest

    .. bokeh-jinja:: bokeh.core.templates.FILE

Any template parameters will be displayed and the template source code will
be rendered in a collapsible code block. For example, the usage above will
generate the following output:

    .. bokeh-jinja:: bokeh.core.templates.FILE
        :noindex:

To enable this extension, add `"bokeh.sphinxext.bokeh_jinja"` to the
extensions list in your Sphinx configuration module.

    )annotationsN)basename)SphinxError   )PARALLEL_SAFE)BokehDirective)JINJA_DETAIL)BokehJinjaDirectivesetupc                  &    e Zd ZdZdZdd iZd ZdS )r
   Tr   noindexc                    dS )NT )xs    ;lib/python3.11/site-packages/bokeh/sphinxext/bokeh_jinja.py<lambda>zBokehJinjaDirective.<lambda>N   s    T     c                   | j         d         }|                    dd          \  }}	 t          j        |          }n"# t          $ r t          d|            Y nw xY wt          ||d           }|t          d|            t          |j                  	                                }t                              |          }|r|                    d          nd }t          |j                  }	t          j        ||t!          |          | j                            dd          |dnt'          j        |          |	t                              d|          	          }
|                     |
d
          S )Nr   .r   z(Unable to import Bokeh template module: zUnable to find Bokeh template: r   F )namemoduleobjreprr   docfilenametemplate_textz<bokeh-jinja>)	argumentsrsplit	importlibimport_moduleImportErrorr   getattropenr   read_DOCPATmatchgroupr   r	   renderreproptionsgettextwrapdedentsubparse)selftemplate_pathmodule_pathtemplate_namer   templater   mr   r   rst_texts              r   runzBokehJinjaDirective.runQ   s{   q)%2%9%9#q%A%A"]	R,[99FF 	R 	R 	RP;PPQQQQQ	R 6=$77I-IIJJJX.//4466MM-(('aggajjj4H-..&NNL$$Y66kxs';';!++b-88
 
 
 zz(O444s   = AAN)__name__
__module____qualname__has_contentrequired_argumentsoption_specr7   r   r   r   r
   r
   I   s<        K>>K5 5 5 5 5r   r
   c                H    |                      ddt                     t          S )z+ Required Sphinx extension setup function. pyzbokeh-jinja)add_directive_to_domainr
   r   )apps    r   r   r   p   s!    m5HIIIr   z\{\#(.+?)\#\})flags)__doc__
__future__r   logging	getLoggerr8   logr   rer,   os.pathr   sphinx.errorsr   r   r   bokeh_directiver   	templatesr	   __all__r
   r   compile	MULTILINEDOTALLr%   r   r   r   <module>rQ      s#   0 # " " " " " g!!     				        & % % % % %       + + + + + + # # # # # #$5 $5 $5 $5 $5. $5 $5 $5N   "*%R\BI-E
F
F
Fr   