Skip to main content

path2doc

Function path2doc 

Source
pub fn path2doc(path: &Path, srcdir: &Path) -> Option<String>
Expand description

Project.path2doc (sphinx/project.py:114-128) against Sphinx’s default source_suffix — {'.rst': 'restructuredtext'} (config.py:243): the docname a source file under srcdir maps to, or None for anything else.

Deliberately narrower than this crate’s discovery (which also admits .md/.txt): the consumers — env.included bookkeeping and the orphan check behind it — must match what Sphinx records, and Sphinx’s default project never maps a .txt include target to a document.

One knowing simplification: for a .rst OUTSIDE srcdir sphinx’s relative_to fails and the absolute path itself becomes the “docname” ('/base/ext/part', probed) — a name no document can have, so the orphan check ignores it. None here has the same effect, and keeps env.included free of environment-specific absolute paths.