Skip to content

Commit e431b90

Browse files
authored
Readthedocs support (#22)
* Update README * Add readthedocs builder * Add supported builders to info text
1 parent 5d6ae35 commit e431b90

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

sphinxext/rediraffe.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@
3939

4040
RE_OBJ = re.compile(r"(?:(\"|')(.*?)\1|(\S+))\s+(?:(\"|')(.*?)\4|(\S+))")
4141

42+
READTHEDOCS_BUILDERS = ["readthedocs", "readthedocsdirhtml"]
43+
4244

4345
def create_graph(path: Path) -> Dict[str, str]:
4446
"""
@@ -134,9 +136,12 @@ def build_redirects(app: Sphinx, exception: Union[Exception, None]) -> None:
134136
logger.info("rediraffe: Redirect generation skipped for linkcheck builders.")
135137
return
136138

137-
if type(app.builder) not in (StandaloneHTMLBuilder, DirectoryHTMLBuilder):
139+
if (
140+
type(app.builder) not in (StandaloneHTMLBuilder, DirectoryHTMLBuilder)
141+
and app.builder.name not in READTHEDOCS_BUILDERS
142+
):
138143
logger.info(
139-
"rediraffe: Redirect generation skipped for unsupported builders. Supported builders: html, dirhtml"
144+
"rediraffe: Redirect generation skipped for unsupported builders. Supported builders: html, dirhtml, readthedocs, readthedocsdirhtml."
140145
)
141146
return
142147

0 commit comments

Comments
 (0)