Skip to content

[config] Allow Unicode en-dash as a year-range separator during copyright end-year substitution. - #12450

Closed
jayaddison wants to merge 5 commits into
sphinx-doc:masterfrom
jayaddison:issue-12449/copyright-substitution-unicode-en-dash
Closed

jayaddison wants to merge 5 commits into
sphinx-doc:masterfrom
jayaddison:issue-12449/copyright-substitution-unicode-en-dash

Conversation

@jayaddison

Copy link
Copy Markdown
Contributor

Feature or Bugfix

  • Feature

Purpose

  • During copyright end-year substitution (when SOURCE_DATE_EPOCH is configured in the environment), match against copyright years like 2000–2010 (unicode en-dash) the same way that we would for 2000-2010 (ASCII dash).

Detail

  • Update the (invalid / negative-case) copyright year-range line match patterns to add unicode en-dash.

Relates

Comment thread sphinx/config.py Outdated
* ``YYYY-YYYY,``
* ``YYYY-YYYY ``
* ``YYYY-YYYY``
* ``YYYY–YYYY``

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Even though it would be possible to disable RUF002 (ambiguous character) linting on a per-file basis, I think it's a useful and important enough lint that I'll rewrite this docstring to refer to EN-DASH by character name instead.

…ame instead of using it as a literal.

This resolves a RUF002 ambiguous-character lint error emitted by v0.4.7 of ruff.
@jayaddison jayaddison changed the title Issue 12449/copyright substitution unicode en dash [config] Allow Unicode en-dash as a year-range separator during copyright end-year substitution. Jun 20, 2024
@jayaddison

Copy link
Copy Markdown
Contributor Author

Hrm; by chance I've noticed that this would likely make the matplotlib documentation build with an incorrectly-substituted copyright notice when SOURCE_DATE_EPOCH is configured.

They're considering streamlining that copyright notice; even so, I'd like to raise awareness of this risk, and I don't think we should merge this change yet.

(this wasn't discovered by any systematic checks of existing copyright notices; it just so happens that I have a pending contribution to matplotlib and noticed it in their doc dir configuration)

@jayaddison jayaddison closed this Jun 22, 2024
@jayaddison
jayaddison deleted the issue-12449/copyright-substitution-unicode-en-dash branch June 22, 2024 11:43
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Jul 23, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Config: support unicode en-dash (codepoint 8211) during copyright year substitution.

1 participant