o
    ç&•aM  ã                   @   s*   d Z ddlZddlmZ G dd„ dƒZdS )aÚ  
Python Markdown

A Python implementation of John Gruber's Markdown.

Documentation: https://python-markdown.github.io/
GitHub: https://github.com/Python-Markdown/markdown/
PyPI: https://pypi.org/project/Markdown/

Started by Manfred Stienstra (http://www.dwerg.net/).
Maintained for a few years by Yuri Takhteyev (http://www.freewisdom.org).
Currently maintained by Waylan Limberg (https://github.com/waylan),
Dmitry Shachnev (https://github.com/mitya57) and Isaac Muse (https://github.com/facelessuser).

Copyright 2007-2018 The Python Markdown Project (v. 1.7 and later)
Copyright 2004, 2005, 2006 Yuri Takhteyev (v. 0.2-1.6b)
Copyright 2004 Manfred Stienstra (the original version)

License: BSD (see LICENSE.md for details).
é    Né   )ÚparseBoolValuec                   @   sV   e Zd ZdZi Zdd„ Zddd„Zdd„ Zd	d
„ Zdd„ Z	dd„ Z
dd„ Zdd„ ZdS )Ú	Extensionz( Base class for extensions to subclass. c                 K   s   |   |¡ dS )z( Initiate Extension and set up configs. N)Ú
setConfigs)ÚselfÚkwargs© r   ú>/usr/lib/python3/dist-packages/markdown/extensions/__init__.pyÚ__init__&   s   zExtension.__init__Ú c                 C   s   || j v r| j | d S |S )z8 Return a setting for the given key or an empty string. r   ©Úconfig)r   ÚkeyÚdefaultr   r   r	   Ú	getConfig*   s   
zExtension.getConfigc                    ó   ‡ fdd„ˆ j  ¡ D ƒS )z( Return all configs settings as a dict. c                    s   i | ]}|ˆ   |¡“qS r   )r   ©Ú.0r   ©r   r   r	   Ú
<dictcomp>3   s    z(Extension.getConfigs.<locals>.<dictcomp>©r   Úkeysr   r   r   r	   Ú
getConfigs1   ó   zExtension.getConfigsc                    r   )z5 Return all config descriptions as a list of tuples. c                    s   g | ]}|ˆ j | d  f‘qS )é   r   r   r   r   r	   Ú
<listcomp>7   s    z+Extension.getConfigInfo.<locals>.<listcomp>r   r   r   r   r	   ÚgetConfigInfo5   r   zExtension.getConfigInfoc                 C   sL   t | j| d tƒrt|ƒ}| j| d du rt|dd�}|| j| d< dS )z8 Set a config setting for `key` with the given `value`. r   NT)Úpreserve_none)Ú
isinstancer   Úboolr   )r   r   Úvaluer   r   r	   Ú	setConfig9   s
   zExtension.setConfigc                 C   s0   t |dƒr	| ¡ }|D ]
\}}|  ||¡ qdS )z> Set multiple config settings given a dict or list of tuples. ÚitemsN)Úhasattrr"   r!   )r   r"   r   r    r   r   r	   r   A   s
   
ÿzExtension.setConfigsc              
   G   s|   |d }z|   |¡ W dS  ty= } z%dt|ƒv r1|   |i ¡ tjd | jj| jj¡t	dd� n‚ W Y d}~dS d}~ww )z( Private wrapper around extendMarkdown. r   z&missing 1 required positional argumentzCThe 'md_globals' parameter of '{}.{}.extendMarkdown' is deprecated.r   )ÚcategoryÚ
stacklevelN)
ÚextendMarkdownÚ	TypeErrorÚstrÚwarningsÚwarnÚformatÚ	__class__Ú
__module__Ú__name__ÚDeprecationWarning)r   ÚargsÚmdÚer   r   r	   Ú_extendMarkdownI   s    üù€üzExtension._extendMarkdownc                 C   s   t d| jj| jjf ƒ‚)a  
        Add the various proccesors and patterns to the Markdown Instance.

        This method must be overriden by every extension.

        Keyword arguments:

        * md: The Markdown instance.

        * md_globals: Global variables in the markdown module namespace.

        z8Extension "%s.%s" must define an "extendMarkdown"method.)ÚNotImplementedErrorr,   r-   r.   )r   r1   r   r   r	   r&   [   s
   ÿÿzExtension.extendMarkdownN)r   )r.   r-   Ú__qualname__Ú__doc__r   r
   r   r   r   r!   r   r3   r&   r   r   r   r	   r      s    	
r   )r6   r)   Úutilr   r   r   r   r   r	   Ú<module>   s    