Submit
Path:
~
/
/
lib
/
python3
/
dist-packages
/
sphinx
/
ext
/
__pycache__
/
File Content:
extlinks.cpython-310.pyc
o �$�a� � @ s� d Z ddlZddlmZmZmZmZ ddlmZm Z ddl mZmZ ddl mZ ddlZddlmZ ddlmZ dd lmZ dd lmZ deded edefdd�Zdeddfdd�Zdedeeef fdd�ZdS )a� sphinx.ext.extlinks ~~~~~~~~~~~~~~~~~~~ Extension to save typing and prevent hard-coding of base URLs in the reST files. This adds a new config value called ``extlinks`` that is created like this:: extlinks = {'exmpl': ('https://example.invalid/%s.html', caption), ...} Now you can use e.g. :exmpl:`foo` in your documents. This will create a link to ``https://example.invalid/foo.html``. The link caption depends on the *caption* value given: - If it is ``None``, the caption will be the full URL. - If it is a string, it must contain ``%s`` exactly once. In this case the caption will be *caption* with the role content substituted for ``%s``. You can also give an explicit caption, e.g. :exmpl:`Foo <foo>`. Both, the url string and the caption string must escape ``%`` as ``%%``. :copyright: Copyright 2007-2021 by the Sphinx team, see AUTHORS. :license: BSD, see LICENSE for details. � N)�Any�Dict�List�Tuple)�nodes�utils)�Node�system_message)�Inliner)�Sphinx)�RemovedInSphinx60Warning)�split_explicit_title)�RoleFunction�name�base_url�caption�returnc s� z� d W n t tfy t�dt� � �dd�d � Y nw �d urDz�d W n t tfyC t�dt� ��dd�d �Y nw i g fdtdtd td tdtdt d t t dtt t t t f f� �fdd� }|S )N�dummyztextlinks: Sphinx-6.0 will require base URL to contain exactly one '%s' and all other '%' need to be escaped as '%%'.�%z%%z%sz|extlinks: Sphinx-6.0 will require a caption string to contain exactly one '%s' and all other '%' need to be escaped as '%%'.�typ�rawtext�text�lineno�inliner�options�contentr c sV t �|�}t|�\}}} � | } |s�d u r| }n�| }tj||d| d�}|gg fS )NF)�internal�refuri)r �unescaper r � reference)r r r r r r r �has_explicit_title�title�part�full_url�pnode�r r � �5/usr/lib/python3/dist-packages/sphinx/ext/extlinks.py�role@ s zmake_link_role.<locals>.role)� TypeError� ValueError�warnings�warnr �replace�str�intr r r r r r )r r r r( r&