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 custom target in manpage role #11825
Conversation
sphinx/addnodes.py
Outdated
@@ -549,7 +549,7 @@ class literal_strong(nodes.strong, not_smartquotable): | |||
""" | |||
|
|||
|
|||
class manpage(nodes.Inline, nodes.FixedTextElement): | |||
class manpage(nodes.reference, nodes.FixedTextElement): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure if this change is really needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think changing the base class of
manpage
is not the way to go. Concerning the formatting, I think we shouldn't change it for now.
@picnixz: I tried reverting this change but I get the same formatting results in HTML. It must come from something else.
We can also wait for another opinion on the formatting changes, and if it is OK I can modify the expected results in the tests, and add a changelog entry etc.
Otherwise I don't really know where to look for this formatting change in the code. I will continue to try some things but I don't know if I will manage to keep the existing HTML formatting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be ok for you to postpone it for a few weeks/months? because I won't have time for in-depth review before march/april.
If anyone else has time to dig or wants to discuss feel free to ignore my opinion as I don't mind both formats actually (just that I want to keep changes minimal if possible, especially if it concerns base classes)
I think changing the base class of You should also check with the However, I agree that the feature is relevant. |
I was not sure if it was required, but it seemed to make sense as the rest of the "reference" nodes are based on this class.
I will try when I have some time. From what I saw there are tests that cover this usage.
I already checked this, as it is my main use case. It is working the same way as before. |
Just for the record, here is the test that checks this role in sphinx/tests/test_build_manpage.py Line 17 in 68295a5
Which has been added in #2224 |
# Conflicts: # sphinx/transforms/__init__.py
Thanks Nicolas! A |
Thank you @AA-Turner, but it is still missing the changelog entry that I didn't add. |
Subject: Allow custom target inside
<>
inmanpage
role, like in hyperlinks.Feature or Bugfix
Purpose
mailx.1
manpage has 3 conflicting versions. I would like to specify which version to link to (for instancebsd-mailx/mailx.1
) without changing the displayed text (so keeping onlymailx.1
displayed). By making the manpage node extend node.reference and by applying the XRefRole treatment, we can now specify the target of a manpage role inside<>
like in an hyperlink.Detail
For now I only tested the rendering in LaTeX PDF and HTML builders I didn't find any issue. Except that in HTML, the FixedTextElement style is now respected (which IMO is a good thing) so the link appears like this (with RTD theme):
Before:
After:
Relates