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

LaTeX: fix mark-up when \DUrole is used with multiple classes #12745

Merged
merged 5 commits into from
Aug 17, 2024

Conversation

jfbu
Copy link
Contributor

@jfbu jfbu commented Aug 7, 2024

Fix #12744

Relates

This may be in all rigor breaking but I doubt very much people have customized LaTeX via \DUrole for simultaneous classes (the PR changes nothing when there is only one class) and anyhow it was never documented as possible so far.

EDIT: when I say "breaking" I only mean by that that if someone for example has defined via \@namedef a LaTeX command \DUrolestd,std-ref (where both comma and hyphen are part of the name) then this styling command will not be executed anymore as now only \DUrolestd and \DUrolestd-ref will be (if and only if they exist). The PDF build will not be broken in any way. And anyhow I would be very surprised someone has actually done that!.

I rebased on tip of master now that master passes tests.

@jfbu
Copy link
Contributor Author

jfbu commented Aug 8, 2024

For the record: I plunged into ancient Docutils history, and found out that the related changes happened in their projet at r5742 (Dec 1, 2008) with a syntax change such as

-\docutilsrolevery{\docutilsrolespecial{interpreted text}}
+\DUspan{very,special}{interpreted text}

and then r5862 (Jan 30, 2009) which removed \DUspan in favor of \DUrole with nested output (quite a few renamings inside this code chunk have happened since, keeping its same functionality):

-        self.body.append(r'\DUspan{%s}{' %','.join(classes))
+        for cls in classes:
+            self.body.append(r'\DUrole{%s}{' % cls)
+        self.context.append('}' * (len(classes)))

with an example syntax change such as

-  \DUspan{argA,argB,argC}{<content>}
+  \DUrole{argi}{\DUrole{argii}{\DUrole{arg-3}{<content>}}}

This all happened between their Release 0.5 (2008-06-25) and their Release 0.6 (2009-10-11).1

Sphinx seems to have inherited the short-lived (never released) \DUspan syntax at our commit 5f6c38f in March 2009 (but this may come from earlier, because it is posterior to the commit date introducing \DUrole into Docutils, perhaps this is not date when revision was merged). But \DUspan was not modified into \DUrole until much later: at 6b36b31 (see this Jan 15, 2016 comment) and the behavior of Sphinx LaTeX writer was not modified then to create nested macros as in Docutils.

Footnotes

  1. Due to a issue with git tags at Docutils, one gets only
    $ git tag --contains 472ada29b7
    0.14
    0.14rc1

CHANGES.rst Outdated Show resolved Hide resolved
CHANGES.rst Outdated Show resolved Hide resolved
@jfbu
Copy link
Contributor Author

jfbu commented Aug 17, 2024

I have rebased manually. Once tests complete and I have checked again the diff I will squash merge.

@jfbu jfbu merged commit 4c7fe10 into sphinx-doc:master Aug 17, 2024
20 checks passed
@jfbu jfbu deleted the latex_DUrole branch August 17, 2024 18:33
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 17, 2024
@AA-Turner AA-Turner modified the milestones: 8.x, 8.1.0 Oct 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
2 participants