Comments (4)
Hahahaha LOL oh how much I agree with you! So I'm open to suggestions, but I have learned that function objects can actually be pickled. It's just that a detail about how Sphinx parses conf.py
means that you cannot pickle a function defined in conf.py
itself. Meaning in the future with the planned writer interface sometime with 1.x, I should be able to let users take very fine-grained control over how things are generated.
What exactly do you want to change? It will help me understand how / where Exhale can let you hook into things.
That said, there is this "secret" saving of the ExhaleRoot
object that the testing framework actually relies on to make comparisons.
Lines 428 to 429 in ab69386
So I think you can do something like this in conf.py
def my_postprocessing(app):
exhale_root = app.exhale_root
the_function = None
for node in exhale_root.all_nodes:
if node.kind == "function" and node.name == "function::you::wanna::change":
the_function = node
break
if not the_function:
raise RuntimeError("couldn't find it...")
file_path = os.path.join(exhale_root.root_directory, the_function.file_name)
# open / edit etc
I didn't test that but that should be close, but the order matters -- exhale has to go first, so I think what you do is below that
# in conf.py, it makes your `conf.py` an "extension"
def setup(app):
app.setup_extension("exhale")
app.connect("builder-inited", my_postprocessing)
What that should do is say "hey I need exhale to run first", then in the same event (builder-inited
) run my_postprocessing
.
Some small notes:
-
app.exhale_root
will disappear in v1.0.0, it's undocumented because it was a temporary hack. -
Note that you have to do
os.path.join(exhale_root.root_directory, something)
. By the time you get access toexhale_root
the regrettable function has been called (also going away in 1.0.0, this was a dumb thing for me to do...)Lines 3027 to 3038 in ab69386
-
You only have to do that join for leaf documents (the ones the breathe directives are actually on). The top-level documents for library root etc should be safe to just access these fields directly from
exhale_root
:Lines 908 to 911 in ab69386
-
Don't get trapped by my extremely confused bookeeping variables. By the time you get access,
exhale_root.class_like
does not contain all classes and structs! This is a detail specific to making the tree view easier to generate. It only contains top-level things by the time you get it. So if you want to change all class / struct pages:all_class_like = [node for node in exhale_root.all_nodes if node.kind in ["class", "struct"]] for node in all_class_like: file_path = os.path.join(exhale_root.root_directory, node.file_name) # do stuffs
Hope that makes sense. Does this enable you to bypass what you want?
from exhale.
Ooops I didn't mean to finish that. What I do not know: if you are guaranteed that your custom my_postprocessing
will execute after exhale does (I don't think this is what setup_extension
actually does, it probably only calls setup(app)
and you may be relying on Sphinx registering 'builter-inited'
handlers sequentially).
But there is a different Sphinx event that may actually be much easier for you to post-process anything with, it depends on what you need to do I guess. It might be best to connect to the 'source-read'
event instead. You should also be guaranteed that app.exhale_root
(until v1.0.0) will exist by that point.
from exhale.
I must confess that I'm not using exhale anymore. At some point, I realized that I wanted to have the full control of how things are displayed, and thus, exhale was not adapted to my needs. Thanks for this great project anyway. That's still a great application for the ones less control-freak than me...
from exhale.
Sorry to see you go, but I fully understand and that's a completely valid complaint about exhale. If you're willing to enumerate the things you would like control over I'd be grateful. I've got a prototype for how to pass controls to users for writing their own class, but right now most of my efforts are focused on fixing breathe which has some big updates needed if it is to remain viable.
I'm leaving this open as a reminder that while exhale provides some reasonable defaults, it's almost 100% inflexible with respect to people wanting to change things. Particularly on a per-compound basis. Users need control over this!
from exhale.
Related Issues (20)
- ignore file extensions in directory? HOT 6
- "createTreeView":True with RTD theme does not show Class Hierarchy HOT 1
- Operator>>, <<, -> overloading bug HOT 4
- Unable to resolve function HOT 1
- Warnings caused by missing newlines in exhale output HOT 3
- LaTeX in \f$ swallows \n newlines HOT 2
- Allow root file to be excluded and set filename of hierarchy files HOT 1
- Replace collapsible list JavaScript with details/summary HOT 1
- Does it work for C projects? HOT 1
- Module Index Error 404 page HOT 1
- Exhale seems to eat asterisk-chars '*' HOT 1
- Exhale does not find functions with weird data types
- Hard-coded 'Class' and 'Classes' even for C
- Allow fully qualified enum, class, structs titles
- Fixup packaging requirements HOT 8
- Windows path length issues HOT 4
- no coverage uploaded for master HOT 1
- KeyError: 'concept' when listing nodes to console HOT 1
- Problem with Sphinx 7
- Github action fails HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from exhale.