mirror of
https://github.com/RGBCube/GitHubWrapper
synced 2025-05-16 14:15:00 +00:00
Black format
This commit is contained in:
parent
3d49dd9246
commit
6c3fe56acf
8 changed files with 119 additions and 118 deletions
|
@ -16,13 +16,7 @@ from sphinx.util.typing import RoleFunction
|
|||
|
||||
def make_link_role(resource_links: Dict[str, str]) -> RoleFunction:
|
||||
def role(
|
||||
typ: str,
|
||||
rawtext: str,
|
||||
text: str,
|
||||
lineno: int,
|
||||
inliner: Inliner,
|
||||
options: Dict = {},
|
||||
content: List[str] = []
|
||||
typ: str, rawtext: str, text: str, lineno: int, inliner: Inliner, options: Dict = {}, content: List[str] = []
|
||||
) -> Tuple[List[Node], List[system_message]]:
|
||||
|
||||
text = utils.unescape(text)
|
||||
|
@ -32,12 +26,14 @@ def make_link_role(resource_links: Dict[str, str]) -> RoleFunction:
|
|||
title = full_url
|
||||
pnode = nodes.reference(title, title, internal=False, refuri=full_url)
|
||||
return [pnode], []
|
||||
|
||||
return role
|
||||
|
||||
|
||||
def add_link_role(app: Sphinx) -> None:
|
||||
app.add_role('resource', make_link_role(app.config.resource_links))
|
||||
|
||||
|
||||
def setup(app: Sphinx) -> Dict[str, Any]:
|
||||
app.add_config_value('resource_links', {}, 'env')
|
||||
app.connect('builder-inited', add_link_role)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue