Skip to content

docs: fix broken cross-references in documentation#1369

Open
wahajahmed010 wants to merge 2 commits into
collective:mainfrom
wahajahmed010:fix/1158-doc-links
Open

docs: fix broken cross-references in documentation#1369
wahajahmed010 wants to merge 2 commits into
collective:mainfrom
wahajahmed010:fix/1158-doc-links

Conversation

@wahajahmed010
Copy link
Copy Markdown

@wahajahmed010 wahajahmed010 commented May 7, 2026

See #1158

Changes

  • Remove :py: prefix from cross-references in docstrings:

    • :py:class::class:
    • :py:mod::mod:
    • :py:meth::meth:
  • Fix unqualified references to use fully qualified names:

    • :class:BUSYTYPE → `:class:`icalendar.enums.BUSYTYPE
    • :class:FBTYPE → `:class:`icalendar.enums.FBTYPE
    • :func:_escape_char → `:func:`~icalendar.parser.string._escape_char
    • ...and more
  • Use tilde-prefixed references (~) for cleaner displayed text while maintaining correct linking.

Files changed (13)

  • src/icalendar/cal/calendar.py
  • src/icalendar/cal/lazy.py
  • src/icalendar/cal/todo.py
  • src/icalendar/caselessdict.py
  • src/icalendar/enums.py
  • src/icalendar/parser/ical/lazy.py
  • src/icalendar/parser/parameter.py
  • src/icalendar/parser/property.py
  • src/icalendar/parser/string.py
  • src/icalendar/prop/dt/date.py
  • src/icalendar/prop/dt/datetime.py
  • src/icalendar/prop/dt/duration.py
  • src/icalendar/prop/dt/time.py

This PR was AI-assisted.


📚 Documentation preview 📚: https://icalendar--1369.org.readthedocs.build/

Fixes collective#1158

- Remove :py: prefix from cross-references in docstrings (:py:class: -> :class:, :py:mod: -> :mod:, :py:meth: -> :meth:)
- Fix unqualified references to use fully qualified names (e.g. :class:`BUSYTYPE` -> :class:`icalendar.enums.BUSYTYPE`)
- Use tilde-prefixed references for cleaner display (:class:`~icalendar.cal.todo.Todo`)
- Affected files: calendar.py, lazy.py, todo.py, caselessdict.py, enums.py,
  parser/ical/lazy.py, parser/parameter.py, parser/property.py, parser/string.py,
  prop/dt/date.py, prop/dt/datetime.py, prop/dt/duration.py, prop/dt/time.py
@read-the-docs-community
Copy link
Copy Markdown

read-the-docs-community Bot commented May 7, 2026

@stevepiercy
Copy link
Copy Markdown
Member

stevepiercy commented May 14, 2026

@wahajahmed010 would you please:

  • Replace "Fixes" with "See" in your PR description, as there may be other items that haven't been addressed and the issue should remain open
  • Update your branch against main
  • Fix code style with ruff
  • Resolve any change conflicts
  • Add a change log entry

For details, see https://icalendar.readthedocs.io/en/stable/contribute/index.html and https://icalendar.readthedocs.io/en/stable/contribute/development.html.

Once you perform those tasks, then I'll do a review. Thank you!

@wahajahmed010
Copy link
Copy Markdown
Author

@stevepiercy Thanks for the review! I've addressed all your feedback:

  1. ✅ Changed 'Fixes' → 'See' in the PR description
  2. ✅ Rebased on main
  3. ✅ Fixed ruff style errors (E501 line-length in docstrings)
  4. ✅ Resolved merge conflicts
  5. ✅ Added changelog entry

Ready for another review! 🙏

Comment thread CHANGES.rst
Minor changes
~~~~~~~~~~~~~

- Fix broken cross-references in documentation by replacing ``:py:`` prefixed roles with standard Sphinx roles and qualifying ambiguous references. See `#1158 <https://github.com/collective/icalendar/issues/1158>`_
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please edit and move this to a new file at /news/1158.documentation. In v7.1.1, we migrated to an automated procedure to update CHANGES.rst, per https://icalendar.readthedocs.io/en/latest/contribute/index.html#change-log-entry-format. This also avoids merge conflicts and updating your PR repeatedly while waiting for it to get merged.

Suggested change
- Fix broken cross-references in documentation by replacing ``:py:`` prefixed roles with standard Sphinx roles and qualifying ambiguous references. See `#1158 <https://github.com/collective/icalendar/issues/1158>`_
- Fix broken cross-references in documentation by removing ``:py`` prefixed roles and qualifying ambiguous references. @wahajahmed010

I'll perform a full review later.

Copy link
Copy Markdown
Member

@stevepiercy stevepiercy left a comment

Choose a reason for hiding this comment

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

Thank you for your contribution! This is an improvement, but some things need to be reverted. I'll explain.

Python objects without a fully qualified path are in the context of the module, whether that's in docstrings or code, and it's not ambiguous. Adding a fully qualified path adds visual noise to readers of the source code, and it doesn't change how the link functions. Such links weren't broken and didn't need to be changed.

You did catch one incorrect and ambiguous reference, though, and that was well-spotted.

Would you please take care? Thank you!

Comment thread src/icalendar/cal/lazy.py
True

When you access all :attr:`subcomponents` of the calendar,
When you access all :attr:`~icalendar.cal.component.Component.subcomponents` of the calendar,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Good catch! It previously linked to https://icalendar.readthedocs.io/en/latest/reference/api/icalendar.cal.lazy.html#icalendar.cal.lazy.LazyCalendar.subcomponents, which is not the greater context of all components.

r"""Unescape backslash sequences in iCalendar text.

Unlike :py:meth:`unescape_string`, this only handles actual backslash escapes
Unlike :meth:`unescape_string`, this only handles actual backslash escapes
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This doesn't fix the link as is. See https://icalendar--1369.org.readthedocs.build/en/1369/reference/api/icalendar.parser.property.html#icalendar.parser.property.unescape_backslash. This should fix it.

Suggested change
Unlike :meth:`unescape_string`, this only handles actual backslash escapes
Unlike :meth:`~icalendar.parser.string.unescape_string`, this only handles actual backslash escapes

Comment thread src/icalendar/cal/todo.py

Returns:
:class:`Todo`
:class:`~icalendar.cal.todo.Todo`
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Unnecessary. Please revert.

Suggested change
:class:`~icalendar.cal.todo.Todo`
:class:`Todo`

Comment on lines +131 to +132
Call :meth:`~icalendar.parser.ical.lazy.LazySubcomponent.parse` to get the fully
parsed component.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Unnecessary. Please revert.

Suggested change
Call :meth:`~icalendar.parser.ical.lazy.LazySubcomponent.parse` to get the fully
parsed component.
Call :meth:`parse` to get the fully parsed component.

Comment on lines +168 to +169
Joins list items with the separator, applying
:func:`~icalendar.parser.parameter.dquote` to each item
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Unnecessary. Please revert.

Suggested change
Joins list items with the separator, applying
:func:`~icalendar.parser.parameter.dquote` to each item
Joins list items with the separator, applying :func:`dquote` to each item

Comment on lines +11 to +12
Applies :func:`~icalendar.parser.string._unescape_string` to the value. If the value
is a list,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Unnecessary. Please revert.

Suggested change
Applies :func:`~icalendar.parser.string._unescape_string` to the value. If the value
is a list,
Applies :func:`_unescape_string` to the value. If the value is a list,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please revert all changes to this file. They aren't necessary. Private functions don't render as links. The one public function is not ambiguous and its link works as is.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Pleasse revert all changes to this file. They aren't necessary.

Comment thread src/icalendar/enums.py
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Pleasse revert all changes to this file. They aren't necessary.

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