Skip to content
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

Allow production lists to refer to tokens from other production groups. #8247

Merged
merged 2 commits into from
Jan 23, 2021

Conversation

silene
Copy link
Contributor

@silene silene commented Sep 28, 2020

Feature or Bugfix

  • Feature

Purpose

Outside production lists, syntax `foo:bar` already makes it possible to refer to the production bar of group foo. This commit offers the same feature inside production lists. Similarly to the reference syntax, prefixing with a tilde prevents the group from being displayed.

This commit also makes it possible to use `:bar` to refer to production bar from a production list without a group name. This is especially useful when one has a main (unnamed) grammar and one or several named extensions that need to refer to it.

@tk0miya tk0miya added type:enhancement enhance or introduce a new feature markup labels Jan 20, 2021
@tk0miya tk0miya added this to the 4.0.0 milestone Jan 20, 2021
Copy link
Member

@tk0miya tk0miya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Could you add testcases for this new syntax?

@silene
Copy link
Contributor Author

silene commented Jan 20, 2021

I am a bit confused with the testing framework. I suppose I can add some testcases to tests/roots/test-productionlist/. But are there some reference files somewhere else that are used to assert that the output is correct? Or is it just a matter of getting the files to compile without errors/warnings?

Outside production lists, syntax "`foo:bar`" already makes it possible to
refer to the production "bar" of group "foo". This commit offers the same
feature inside production lists. Similarly to the reference syntax,
prefixing with a tilde prevents the group from being displayed.

This commit also makes it possible to use "`:bar`" to refer to production
"bar" from a production list without a group name. This is especially
useful when one has a main (unnamed) grammar and one or several named
extensions that need to refer to it.
@tk0miya
Copy link
Member

tk0miya commented Jan 23, 2021

This is a testcase that corresponds with tests/roots/test-productionlist/. It builds the document and inspect the result.
https://github.com/sphinx-doc/sphinx/blob/3.x/tests/test_domain_std.py#L352-L405

It's okay to modify them or to add new pair of project under tests/roots/ and testcase in test_domain_std.py.

@silene
Copy link
Contributor Author

silene commented Jan 23, 2021

Thanks for the help. It seemed a bit too frail and tedious to parse the HTML output. (Contrarily to the other tests for productionlist, it is the productions themselves that had to be parsed, and they have no structure.) So, I instead decided to check the doctree, as many other tests do.

@tk0miya
Copy link
Member

tk0miya commented Jan 23, 2021

Thank you for your work. LGTM!

@tk0miya tk0miya merged commit af0dfa2 into sphinx-doc:3.x Jan 23, 2021
@tk0miya tk0miya modified the milestones: 4.0.0, 3.5.0 Jan 23, 2021
@tk0miya
Copy link
Member

tk0miya commented Jan 23, 2021

Note: I was wrongly labeled this as "4.0.0". But it's unexpected.

tk0miya added a commit that referenced this pull request Jan 23, 2021
@silene silene deleted the inter_prodlist_refs branch January 23, 2021 08:24
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 17, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
markup type:enhancement enhance or introduce a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants