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

Add debug logging to autosectionlabel #10881

Merged
merged 7 commits into from Oct 4, 2022
Merged

Conversation

patzm
Copy link
Contributor

@patzm patzm commented Sep 28, 2022

Subject: I started using emoji and other non-plain-text content in section headings. I other wonder what the auto-generated section label will be.

  • Feature

Purpose

See the subject. For instance, the following heading

|:page_facing_up:| Formatting
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

gets rendered (using sphinxemoji) as
image

Trying to reference it with

:ref:`|:page_facing_up:| Formatting`

fails worked. I guess I did something else wrong. I had no clue then whether it was due to the | or : characters, whether the emoji had already been inserted and the correct reference would have been :ref:`📄 Formatting` , or something else altogether. I also couldn't find anything in the docs 😕. Because the code internally relies on docutils, I didn't want to rabbit hole and think about what the code would actually do.

Output would be for instance:

/some/dir/docs/shared/contribution/code_authoring.rst:40: section "|:page_facing_up:| Formatting" gets labeled as "|:page_facing_up:| formatting"
/some/dir/docs/shared/contribution/code_authoring.rst:50: section "|:pencil2:| Writing new code" gets labeled as "|:pencil2:| writing new code"
/some/dir/docs/shared/contribution/documentation.rst:2: section "Documentation" gets labeled as "documentation"
wrong conclusion What worked eventually: ```rst :ref:`|:page_facing_up:| formatting` ``` ~note the _lower-case_ `formatting`, not _upper-case_.~

Questions

Soooo: debug logging. Is this the best way to do this? I could configure the verbosity then with -vv(docs).

Should we also add something to the docs? Somehow help other lost souls like myself?

@AA-Turner
Copy link
Member

Please target against 5.x and add a CHANGES entry and tests.

A

@AA-Turner AA-Turner added this to the 5.3.0 milestone Sep 28, 2022
@patzm
Copy link
Contributor Author

patzm commented Sep 29, 2022

Done. I also added documentation in 4b31161. Renders as
image

Changes added ✅.

Can you help me with the tests? I only see tests that look at the generated html or xml output. But this is actually for testing whether the debug logging works. Does that even need a test?

@AA-Turner AA-Turner changed the base branch from master to 5.x September 30, 2022 15:01
@AA-Turner
Copy link
Member

Please target against 5.x

I changed the base but you'll need to rebase to remove all the extra commits.

A

@patzm
Copy link
Contributor Author

patzm commented Oct 4, 2022

ok I hope that this was the right rebase. Also I hope you do squash merging 😆.

CHANGES Outdated Show resolved Hide resolved
@AA-Turner AA-Turner changed the title add debug logging to autosectionlabel Add debug logging to autosectionlabel Oct 4, 2022
@AA-Turner AA-Turner merged commit 3e29abf into sphinx-doc:5.x Oct 4, 2022
@patzm patzm deleted the patch-1 branch October 4, 2022 14:28
@AA-Turner
Copy link
Member

Thanks Martin!

A

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 4, 2022
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.

None yet

2 participants