I am wondering if there is anyway to customize the sphinx documentation makefile?
What I want to achieve is that each time I do make html
, sphinx will go to certain directory and copy the specific file to my source
directory.
For example:
Suppose I have a script called name foo.py
under ~/bar
directory. I want foo.py
to be copied to ~/docs/source/
directory, which will be referenced by my project.rst
.
The reason I want to do this is that I want to keep the script I referenced in the doc to be the latest version and I hate to do copy-paste each time I do make html
.
I know I can achieve this purpose with a simple shell script. But, I am wondering if I can do it directly through sphinx make file?
Thanks much!
An easy solution is to create a symbolic/hard link ( ln -s path/to/destination path/to/link
, remove the -s
for a hard link).
In your case, ln -s ~/bar/foo.py ~/docs/source/foo.py
will create a link in the ~/docs/source/
directory (always up-to-date because it is just a link to your original file).
For fancier or more complete Makefile rule, have a look this customized sphinx Makefile . There is plenty of rules that send files over the web or from one directory to another (in my case ~/web-sphinx/.build/html/*
to ~/Public/
).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.