Following Sphinx TODO directive
tutorial, I have made a Sphinx custom directive (let's call it A) that takes a file path as input, extracts information from this file, and produce nodes accordingly.
I want to create a new custom directive (let's call it B) that takes a directory as input, calls directive A on all files inside the directory (the search for files is actually a bit more involved than that, but it has no relevance to my issue) and appends the produced nodes.
I cannot find how to do that. I have started to write the Python file for this directive B, but I do not know how to get a hold of a node class corresponding to directive A. I'd like to write something like this:
def run(self):
nodes = []
directory = self.arguments[0]
for filepath in directory:
nodes += nodes.mydirectiveA("path/to/file") #not proper code
return nodes
What am I missing here?
Note: I have found this question whose title was promissing, but I do not have this inheritance relationship in my case.