wpilibsuite / sphinxext-opengraph

Sphinx extension to generate unique OpenGraph metadata
https://sphinxext-opengraph.readthedocs.io
Other
74 stars 27 forks source link

Add READTHEDOCS defaults #21

Closed Daltz333 closed 3 years ago

TheTripleV commented 4 years ago
from urllib.parse import urlparse, urlunparse
from pathlib import PosixPath

parse_result = urlparse("https://docs.wpilib.org/en/stable/")

print(
    urlunparse((
        parse_result.scheme,
        parse_result.netloc,
        PosixPath(parse_result.path).parent.parent.as_posix(),
        "",
        "",
        "",
    ))
)

gets the RTD url with the language and version stripped.

TheTripleV commented 4 years ago

Also, there should be a check for RTD.