Variable containing relative path to source file

19 views
Skip to first unread message

BJ

unread,
Aug 11, 2020, 3:02:45 AM8/11/20
to sphinx-users
Hello Ladies and Gents,

image I have got this project layout

/
/doc_root
/doc_root/index.rst
/doc_root/_static
/doc_root/_static/header.rst
/doc_root/content
/doc_root/content/file1.rst
/doc_root/content/file2.rst
/doc_root/content/subfolder/file3.rst
/doc_root/content/subfolder/file4.rst

The sphinx build command will run in /doc_root , the _static/header.rst will be included in every content/**/file*.rst

What I am looking for is a kind of internal variable to be included to _static/header.rst (my desired use-case) or if not possible to all content/**/file*.rst, which would provide the relative path to the source file (the portion after /doc_root/

So best-case the content of content/file1.rst could look like:
..include:: /_static/header.rst

Lorem...


The _static/header.rst file could look like:
The source file is located in |the_awesome_variable|


The renderer content/file1.rst should look like:
The source file is located in content/file1.rst

Lorem...

How could I achieve this.

Best regards
BJ

Daniel Scott

unread,
Nov 25, 2020, 10:35:14 PM11/25/20
to sphinx...@googlegroups.com
--
You received this message because you are subscribed to the Google Groups "sphinx-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sphinx-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sphinx-users/26305b0a-e576-4fa8-adee-4388a8057a52n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages