pandocs
pandocs copied to clipboard
Update requirements.txt file for changes in #452
Supersedes and closes #452 Original OP follows:
It may seem a bit convoluted, but it works:
https://user-images.githubusercontent.com/14352721/201120995-a3bf61d5-e9f6-472f-ba4a-b150bfb8c9dd.mp4
Some more stuff is needed to merge this but we should be already at a pretty good point:
- [x] move from pygal to matplotlib #449
- [x] make the output SVG use the CSS variables instead of hardcoded colross
- [ ] update requirements.txt
- [ ] move the call to the plot generation from the
rendererto thepreprocstep of mdbook, otherwise the output SVG files cannot be inline injected- We should consider just calling a python script, instead of having the single calls for every plot like it is now here. @ISSOtm opinions?
- [ ] replace the two img tags with #import in the MBC5 article so the svg is actually injected in the HTML
Fixes #322
Alright, I have edited the OP to replicate the original PR's. That means what's left is only mdBook "wiring up", which falls under my responsibility... so I'll have to do that then. :P
Thank you @glinesbdev!
I finally found some time to hook up this PR's Python to a mdBook preproc.
It has to be a preproc, not a renderer/backend, because the files are {{#include}}d, and those are processed by the built-in links preproc. So they must be generated before then.
I used a separate script for the preproc, so that graph_render.py can still be invoked stand-alone. (For any reason.) I thus made the CLI logic only run if not imported. I also modified the "core" logic to make matplotlib write to an in-memory buffer rather than to a temporary file, to avoid any problems with the file already existing or whatnot.
Also, the generated files cannot go under src, otherwise they trigger mdBook's "did something change?", which re-builds... thus in a loop.