Skip to content

[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

Merged
merged 7 commits into from
Aug 12, 2023

Conversation

linawolf
Copy link
Contributor

Copy link
Member

@jaapio jaapio left a 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.

@linawolf
Copy link
Contributor Author

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

@linawolf linawolf marked this pull request as draft August 12, 2023 08:03
@linawolf linawolf force-pushed the feature-role-directive branch 4 times, most recently from 89de2c2 to 0ac728a Compare August 12, 2023 10:10
@linawolf linawolf marked this pull request as ready for review August 12, 2023 10:45
@linawolf linawolf requested a review from jaapio August 12, 2023 10:45
@linawolf
Copy link
Contributor Author

@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.

@linawolf linawolf force-pushed the feature-role-directive branch from cc2fc82 to 4d69875 Compare August 12, 2023 11:30
Copy link
Member

@jaapio jaapio left a 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!

@jaapio jaapio merged commit de05e4d into main Aug 12, 2023
@jaapio jaapio deleted the feature-role-directive branch August 12, 2023 12:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants