Hi Takeshi, thanks for the quick answer!
On Wed, Jan 17, 2018 at 3:15 AM, Komiya Takeshi wrote:
> Hi Matthias,
>
> Hmm, your code seems good. What event did you modify metadata?
> Sphinx refers it on consistency-checking phase. So it should be
> changed on reading phase.
I guess I modified it too early, I was trying to do it while I was
still parsing the source file.
It's there:
https://github.com/spatialaudio/nbsphinx/blob/91c4eae1ce7b2fd23117302913ca2f5e6e5167b3/src/nbsphinx.py#L686
I'm really not surprised that this doesn't work, I was rather
surprised that it *did* work in several Sphinx versions, including the
current one.
But I just found a much better way than manipulating the document
nodes manually: I'm just using the RST parser!
Before parsing my actual source file, I'm just doing something like this:
rstparser.parse(':orphan:', document)
And that does the trick!
That's the change if you are interested:
https://github.com/spatialaudio/nbsphinx/commit/1a2001c9b5a49816af4660d831bc99ab10147324
> BTW, I think new API is needed to add metadata. To modify internal
> data directly is a bit ugly and fragile.
Yeah, I guess it is. But I don't know how many people really need this.
I don't need it anymore since I found a simpler way.
cheers,
Matthias