You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you want to limit your search to working code examples, include the keyword "codex" (mnemonic for code example) in your search, e.g., "codex ellipse"; see search examples.
The nearly 300 code Gallery included with the Matplotlib source distribution are full-text searchable from the Search Page page, but sometimes when you search, you get a lot of results from the The Matplotlib API or other documentation that you may not be interested in if you just want to find a complete, free-standing, working piece of example code. To facilitate example searches, we have tagged every code example page with the keyword codex for code example which shouldn’t appear anywhere else on this site except in the FAQ. So if you want to search for an example that uses an ellipse, Search Page for codex ellipse.
The problem
Yet, the codex has disappeared from the gallery - probably due to the migration to sphinx-gallery.
As I see it, the gallery example html pages are generated by sphinx from .rst files. Those .rst files are generated by sphinx-gallery from the .py files in the examples folder. The generation of those files happens internally by sphinx-gallery, based on formatted strings.
Options:
Changing the indivudial example .py files. Cumbersome. ❌
Siingle sidedly manipulating the source of spinx-gallery. Out of question. ❌
Monkey-patching the format strings of sphinx-gallery. Would work. ✔️
Injecting the keyword via css. Would produce the desired html output, but not affect seach. ❌
Solve this in the most general way by negotiating and doing PR to Sphinx-Gallery. ❔
Advising the user to search for "Sphinx-Gallery <search text>", instead of "codex <search text>" Works. ✔️
Or did I miss anything? Which options would be worth pursuing here?
Activity
tacaswell commentedon May 1, 2018
This seems like something we should be able to inject via sphinx gallery...
ImportanceOfBeingErnest commentedon May 2, 2018
As I see it, the gallery example html pages are generated by sphinx from
.rstfiles. Those.rstfiles are generated by sphinx-gallery from the.pyfiles in theexamplesfolder. The generation of those files happens internally by sphinx-gallery, based on formatted strings.Options:
.pyfiles. Cumbersome. ❌"Sphinx-Gallery <search text>", instead of"codex <search text>"Works. ✔️Or did I miss anything? Which options would be worth pursuing here?
ImportanceOfBeingErnest commentedon May 2, 2018
Monkey patching would look as follows. Inside of
conf.pyyou'd add something like this:Is this the way to go here?
ImportanceOfBeingErnest commentedon May 4, 2018
Since I didn't get any answer here I implemented the monkey-patching solution in #11169.