Support applying options to multiple examples as suggested in #640
Motivation for this change
The conversation at https://github.com/pgf-tikz/pgf/issues/640 on the possibility of supporting the specification of options that can be applied to multiple examples.
To demonstrate the usage of this feature, I've modified ControlElectric.lua, while simplifying the code by removing unnecessary double quotes at the same time.
Checklist
This PR is also related to https://github.com/pgf-tikz/pgf/issues/971
~~I found bugs in this version of pull request. It doesn't work in all cases. Please do not merge this PR for now. The fix is coming along in due course.~~
I am not sure if I understand your message right, but also the actual version (without your PR) doesn't work in all cases so far. (I think I listed some/all of them in some comment ...)
Oops, never mind my last comment. My bad checking out the wrong source from the wrong branch locally.
For the record: Here are other examples that could make use of this PR:
- [ ] https://github.com/pgf-tikz/pgf/blob/12f17834c849a659b8829bbc9122bc459f585917/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/doc.lua#L101-L140
- [ ] https://github.com/pgf-tikz/pgf/blob/12f17834c849a659b8829bbc9122bc459f585917/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/doc.lua#L170-L191
For the record: Here are other examples that could make use of this PR:
* [ ] https://github.com/pgf-tikz/pgf/blob/12f17834c849a659b8829bbc9122bc459f585917/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/doc.lua#L101-L140 * [ ] https://github.com/pgf-tikz/pgf/blob/12f17834c849a659b8829bbc9122bc459f585917/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/doc.lua#L170-L191
Indeed. I am working on my forked branch (specifically main) fixing most, if not all of the missing preambles. And there are lots of them. The two you pointed out are indeed covered.
After fixing all the missing preambles and extending the existing extractor.lua (in my forked main branch), it extracted 2,503 tex documents. I managed to compile them all successfully. The generated pgfmanual.pdf is also looking good. (You should be able to download the updated pdf from https://github.com/hansonchar/pgf/actions/runs/9750355245 once the workflow has completed. See here and scroll to the bottom if you want to replicate the extract-compile process from my main branch.)
I plan to submit two pull requests - one for fixing the preamble, etc. so that readers of the manual can copy-and-paste any of the examples in the pdf and have them successfully compiled, and another for the extended extractors and scripts.
(I've got other miscellaneous things fixed as well, but I'll delay those to future pull requests.)
However, these changes presume the fixes in this pull request #1339 have been merged. Any chance that can be done any time soon?
That sounds awesome.
Unfortunately I am a Windows child with almost no knowledge about bash scripts. After modifying it a bit so I could run it in Git Bash it extracted 2391 files. I assume it is my fault that I couldn't replicate 2503 extractions as you. I didn't run the compilations until the end, because in series this takes "forever" :sleeping:.
Merging usually is done by the master chief @hmenke, but I haven't seem him for a while (at least I can't remember ...). Have you (@muzimuzhi) seen him?
2391 sounds significantly on the low side. Did you specify both the pgf/tex and pgf/doc (of the forked main branch) as the source directories during the extraction ? For example,
texlua ~/github.com/pgf/doc/generic/pgf/extract.lua ~/github.com/pgf/tex ~/github.com/pgf/doc ~/tmp/mwe
(Running in parallel is an optimization that can be done later on.)
Sorry, forgot that the main branch is called "master" so I didn't run the script on your "main" branch. Now I also extracted 2305 TEX files.
I think you meant 2503, but yeah.
Of course. It seems I really need holidays :)