Closed adamtheturtle closed 1 month ago
Hmm, not sure how I feel about this... it introduces quite a lot of documentation complexity for what's quite a niche use case.
How about this for an idea: Sybils now have names, can you think of any reason the Sybil shouldn't be added to the namespace of the document, which would then show up in the example's namespace, and I think that means you should be able to use the existing "skip if" functionality, right?
Thank you for looking at this.
I can't think of a reason why your suggestion wouldn't be suitable but I don't feel I have a lot of knowledge.
The use case for me is already covered by CustomDirectiveSkipParser
in my sybil-extras
library which covers the extensions to Sybil which don't belong here. I thought it best to propose this upstream, but no requirement from me if you don't want it here.
Here's where I'd add self
, which is a Sybil, to document.namespace
:
https://github.com/simplistix/sybil/blob/fd98b3bed8fa6a53078a8945c19b22d37aebd810/sybil/sybil.py#L153
I'd add a test similar to this one, below it, which had two named sybils and a skip-if based on sybil.name == 'something'
:
https://github.com/simplistix/sybil/blob/fd98b3bed8fa6a53078a8945c19b22d37aebd810/tests/test_functional.py#L383
I'll close this for now as it sounds like you have a working solution, and I don't think I want this complexity around the skip parser.
I want to have two
Sybil
s, and for a code block to be skipped only for one of thoseSybil
s. This is my attempt to get that working.