Hello!
There are no event's for when a `make clean` is fired, are there? I'm writing an extension that generates a lot of reStructuredText documents after "builder-inited". I'd like to find a way to enable my users to simply `make clean` and I do the cleanup. I'm open to advice on any level, but I stuck with generating the documents automatically for a couple of reasons
1. Even if I could figure out how to hook directly into sphinx and start adding some nodes directly (instead of creating files)
a) A large number are made (I'm "recreating" doxygen hierarchies)
b) I'm concerned that (especially for RTD), the AST would no longer fit in RAM for large projects
2. Generated files allow users to actually see what was made (debug friendly).
Of course, generating files seems to be a very non-standard thing for an extension to do ;)
- - - -
Extra info if you're interested:
The setup is basically this: they must write in their index.rst (or elsewhere)
toctree directive to incorporate "contaimentFolder/rootFileName". So I require them to specify these explicitly to my extensions' arguments in conf.py.
# in conf.py (assuming it is in the extension list)
exhale_args = {
"containmentFolder": "./api",
"rootFileName": "library_root.rst"
}
then say their
index.rst.. toctree::
:maxdepth: 2
overview
other_stuff
api/library_root
Since they have to consciously add
api/library_root in their own docs, I force them to specify "containmentFolder" and "rootFileName" explicitly (as well as the title of the document since it's in a toctree).
Currently
I just emit a warning if they choose "." for the "containmentFolder". If it is ".", then I prepend the extension name to every file created to hopefully at least make it clear what was generated. It's obnoxious though, because now my extension name shows up in their urls.
Idea
At the very least, maybe I should make the sub-folder a hard requirement?
Ideally I'd still like to be able to hook into `make clean` directly. If they remove a class from their API for example, locally their "./api" folder will start inducing warnings because my extension won't link to it anymore.
Sorry for the long question, thanks for any insight / suggestions!
-Stephen