Skip to content

Conversation

ianw
Copy link
Contributor

@ianw ianw commented Aug 5, 2024

Sphinx chooses to lower() all :ref: values, which means that we can not link to a program that has an upper-case value in it's program name, nor differentiate between upper and lower-case single character flags in references (e.g. -A/-a).

While we could simply lower() the program name, it's not quite so simple for mixed-case arguments because they can then make duplicate refs. A alternative simple approach that fits nicely into the existing code is to simply prefix capitals in references with "_" and lower them.

Unfortunately since this changes the refs, this would be a backwards incompatible change if made unconditionally. You may also decide that mixed case references are more clear in your output HTML URL's if you are not worried about ever making internal references in your documentation.

Thus this adds a :force_refs_lower: flag to optionally enable the prefix/lower behaviour.

A test-case and documentation is added as well.

@ianw ianw force-pushed the force-refs-lower branch 2 times, most recently from 75e26c5 to 32a974a Compare August 5, 2024 21:46
@ianw ianw requested a review from gaborbernat August 5, 2024 22:02
Copy link
Member

@gaborbernat gaborbernat left a comment

Choose a reason for hiding this comment

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

Sphinx chooses to lower() all :ref: values, which means that we can
not link to a program that has an upper-case value in it's program
name, nor differentiate between upper and lower-case single character
flags in references (e.g. -A/-a).

While we could simply lower() the program name, it's not quite so
simple for mixed-case arguments because they can then make duplicate
refs.  A alternative simple approach that fits nicely into the
existing code is to simply prefix capitals in references with "_" and
lower them.

Unfortunately since this changes the refs, this would be a backwards
incompatible change if made unconditionally.  You may also decide that
mixed case references are more clear in your output HTML URL's if you
are not worried about ever making internal references in your
documentation.

Thus this adds a :force_refs_lower: flag to optionally enable the
prefix/lower behaviour.

A test-case and documentation is added as well.
@ianw ianw force-pushed the force-refs-lower branch from 32a974a to 220578a Compare August 5, 2024 22:08
Copy link
Member

@gaborbernat gaborbernat left a comment

Choose a reason for hiding this comment

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

@gaborbernat gaborbernat enabled auto-merge (squash) August 5, 2024 22:10
@gaborbernat gaborbernat merged commit 84122c0 into tox-dev:main Aug 5, 2024
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