Support numbering custom nodes (Refactor numfig feature)#2317
Closed
tk0miya wants to merge 5 commits intosphinx-doc:masterfrom
Closed
Support numbering custom nodes (Refactor numfig feature)#2317tk0miya wants to merge 5 commits intosphinx-doc:masterfrom
tk0miya wants to merge 5 commits intosphinx-doc:masterfrom
Conversation
Member
|
OK, I'll take a look. (and please fix test failure) |
doc/extdev/appapi.rst
Outdated
|
|
||
| Register a Docutils node class as a numfig target. Sphinx numbers the node | ||
| automatically. And then the users can refer it using :rst:role:`numref`. | ||
| figure, table or code-block. And then the node is numbered automatically. |
Member
There was a problem hiding this comment.
It seems that the last line is not needed.
03d6b55 to
281ec9a
Compare
| return type.lname | ||
|
|
||
| def is_enumerable_node(self, node): | ||
| return node.__class__ in self.enumerable_nodes |
Member
There was a problem hiding this comment.
Do you want to avoid derived enumerable nodes?
If we accept derived nodes, isinstance is good solution.
return isinstance(node, self.enumerable_nodes.keys())
Member
There was a problem hiding this comment.
OK, I understand. It must be intended.
281ec9a to
6330657
Compare
Member
Author
|
@shimizukawa Thanks, I updated the docs :-) |
Member
Member
Author
|
Thank you for reviewing, I merged manually now. |
Contributor
|
That's great, thank you. Any change in usage with respect to #1858? |
Member
Author
|
This does not refer |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

I refactored numfig feature and improved it as a enumeration framework.
I introduced a new Sphinx API:
Sphinx.add_enumerable_node. It is able to add new node which behaves as enumerable elements like figures.This is instead of #1858. The differences between the PRs are:
I'm going to merge this in a few days. But I need reviews from anybody (because the change is little large).
Thanks,