-
-
Notifications
You must be signed in to change notification settings - Fork 15
[FEATURE] Enable configurable custom and default text roles #514
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
Conversation
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 could not find this in your changes to that's why I ask it, default text roles set by a document are document bases, aren't they? Otherwise the order of parsing matters and I don't thing we have that order currently. It would also disallow caching of the full documents between runs as the parser would be in a different state. Therefor I think it would make sense to add these textroles somehow in the DocumentParserContext?
Same applies for document defined or replaced roles, those should only apply to the current document from the point where the role was defined.
packages/guides-restructured-text/src/RestructuredText/Directives/DefaultRoleDirective.php
Outdated
Show resolved
Hide resolved
packages/guides-restructured-text/src/RestructuredText/TextRoles/DefaultTextRoleFactory.php
Show resolved
Hide resolved
We usually define textroles in the includes.rst.txt which is included at the beginning of each document. So I supose it is probably defined on document level. will have a look at it |
89de2c2
to
0ac728a
Compare
@jaapio Each DocumentParserContext now manages a clone of the TextRoleFactory such that changes made to it by one directive do not apply to another document. Also added a test for this. |
An Action Directive does not return a node but does an action on the context
…e directive of other files
cc2fc82
to
4d69875
Compare
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.
Thanks this looks good!
See https://docutils.sourceforge.io/docs/ref/rst/directives.html#role