3
T'íc5 ã @ sì U d Z ddlZddlmZmZmZmZmZmZ ddl m
Z
mZ ddlm
Z
mZmZmZ ddlmZ ddlmZmZ ddlmZ dd lmZmZ dd
lmZ er¶ddlmZ ddlm Z ej!e
j"e
j#ej$ej!ej%ej$ej$ej!e
j#d
Z&G dd deZ'G dd de'Z(G dd deZ)G dd deZ*ej+dZ,G dd deZ-G dd de-Z.ej+dZ/ej+dZ0G dd deZ1ej+dej2Z3G d d! d!eZ4e'ej5d"e(d#d$e) e* e- e. e1 e1 e4 d% Z6ee7ef 6d&ee7ef d'd(d)Z8dS )*z#Handlers for additional ReST roles.é N)Ú
TYPE_CHECKINGÚAnyÚDictÚListÚTupleÚType)ÚnodesÚutils)ÚElementÚNodeÚTextElementÚsystem_message)Úaddnodes)Ú_Ú__)Úws_re)Ú
ReferenceRoleÚ
SphinxRole)ÚRoleFunction)ÚSphinx)ÚBuildEnvironment)
ÚcommandÚdfnZkbdZ
mailheaderZmakevarÚmanpageÚmimetypeZ newsgroupÚprogramÚregexpc s e Zd ZU dZejZee e j
Zee de
e
ee ee e
dd fdd
Zeeeeef ddd Zeee ee f d
ddZeee ee f d
d
dZeee ee f d
ddZdee
eeeeef dddZe jdee
eee ee f dddZ ZS )ÚXRefRoleaA
A generic cross-referencing role. To create a callable that can be used as
a role function, create an instance of this class.
The general features of this role are:
* Automatic creation of a reference and a content node.
* Optional separation of title and target with `title <target>`.
* The implementation is a class rather than a function to make
customization easier.
Customization can be done in two ways:
* Supplying constructor parameters:
* `fix_parens` to normalize parentheses (strip from target, and add to
title if configured)
* `lowercase` to lowercase the target
* `nodeclass` and `innernodeclass` select the node classes for
the reference and the content node
* Subclassing and overwriting `process_link()` and/or `result_nodes()`.
FN)Ú
fix_parensÚ lowercaseÚ nodeclassÚinnernodeclassÚ
warn_danglingÚreturnc s<