-
Notifications
You must be signed in to change notification settings - Fork 487
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
respect #|hide
and #|include: false
for showdoc
#1079
Conversation
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
#|hide
for showdoc#|hide
and #|include: false
for showdoc
nbdev/processors.py
Outdated
@@ -59,8 +59,10 @@ def _show_docs(trees): | |||
return [t for t in trees if isinstance(t,ast.Expr) and nested_attr(t, 'value.func.id')=='show_doc'] | |||
|
|||
def cell_lang(cell): return nested_attr(cell, 'metadata.language', 'python') | |||
|
|||
def _want_hide(c): return 'hide' in c.directives_ or c.directives_.get('include:') == ['false'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found it odd that the colon is included in the key include:
vs include
. Looking at the code this seems deliberate and is even in the tests for processor.extract_directives
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure why it wouldn't include the :
? That's the thing that let's you know it's a key:value thing.
BTW why did you abstract out _want_hide
here? Seems like you could easily inline it since you're only using it in one place?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you mind taking a look at the new way I just pushed? Just want to check if that is more in line with what you would do
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feel free to merge when ready - just one question inline
closes #1076
I tested this extensively with both
#|hide
and#|include: false
to make sure the code is still exported but the show doc is not called#|include: false
is the same thing as#|hide
@jph00 @seeM