a
    e	g]                     @   s6   d dl mZ d dlmZ d dlmZ G dd dZdS )    )compat)TemplateLookup)Templatec                   @   s.   e Zd ZdZdddZdddZdd
dZdS )TGPluginz&TurboGears compatible Template Plugin.Nmakc                 C   s   || _ || _|si }i }| D ]4\}}|drD|||dd  < q |dv r |||< q tf i || _i | _tt	j
d D ]}||v r||| | j|< q|d S )Nzmako.   )directoriesZfilesystem_checksZmodule_directoryr   )extra_vars_func	extensionitems
startswithr   lookuptmpl_optionsr   Zinspect_getargspecr   __init__)selfr	   optionsr
   Zlookup_optionskvkw r   V/var/www/html/llm_bihealth/app/venv/lib/python3.9/site-packages/mako/ext/turbogears.pyr      s    

zTGPlugin.__init__c                 C   sH   |durt |fi | jS d|vr<d|dd d | j }| j|S )z(Loads a template from a file or a stringN/.)r   r   replacer
   r   Zget_template)r   ZtemplatenameZtemplate_stringr   r   r   load_template&   s    zTGPlugin.load_templatehtmlFc                 C   s8   t |tr| |}| jr(||   |jf i |S )N)
isinstancestrr   r	   updaterender)r   infoformatfragmenttemplater   r   r   r   3   s
    

zTGPlugin.render)NNr   )N)r   FN)__name__
__module____qualname____doc__r   r   r   r   r   r   r   r      s
   

 r   N)Zmakor   Zmako.lookupr   Zmako.templater   r   r   r   r   r   <module>   s   