Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5461707

Browse files
committed
LaTeX: render in PDF hyperlinks located inside titles
Fix#12821
1 parent036db81 commit5461707

File tree

4 files changed

+15
-3
lines changed

4 files changed

+15
-3
lines changed

‎CHANGES.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ Features added
3131
Bugs fixed
3232
----------
3333

34+
* #12821: LaTeX: URLs/links in section titles should render in PDF.
35+
Patch by Jean-François B.
3436
* #13369: Correctly parse and cross-reference unpacked type annotations.
3537
Patch by Alicia Garcia-Raboso.
3638
* #13528: Add tilde ``~`` prefix support for:rst:role:`py:deco`.

‎sphinx/texinputs/sphinxlatexstyletext.sty

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
%% TEXT STYLING
22
%
33
% change this info string if making any custom modification
4-
\ProvidesPackage{sphinxlatexstyletext}[2024/07/28 v8.1.0 text styling]
4+
\ProvidesPackage{sphinxlatexstyletext}[2025/05/24 v8.3.0 text styling]
55

66
% 7.4.0 has moved all that is related to admonitions to sphinxlatexadmonitions.sty
77
% 8.1.0 has moved topic/contents/sidebar to sphinxlatexshadowbox.sty
@@ -57,7 +57,11 @@
5757
% reduce hyperref "Token not allowed in a PDF string" warnings on PDF builds
5858
\AtBeginDocument{\pdfstringdefDisableCommands{%
5959
% all "protected" macros possibly ending up in section titles should be here
60-
% TODO: examine if \sphinxhref, \sphinxurl, \sphinnolinkurl should be handled
60+
% next four were added so that URLs and internal links in titles can be allowed
61+
\let\sphinxurl\@firstofone
62+
\let\sphinxnolinkurl\@firstofone
63+
\let\sphinxhref\@secondoftwo
64+
\def\hyperref[#1]#2{#2}% for PDF bookmark to ignore #1
6165
\let\sphinxstyleemphasis\@firstofone
6266
\let\sphinxstyleliteralemphasis\@firstofone
6367
\let\sphinxstylestrong\@firstofone

‎sphinx/writers/latex.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1962,7 +1962,7 @@ def visit_reference(self, node: Element) -> None:
19621962
uri=node.get('refuri','')
19631963
ifnoturiandnode.get('refid'):
19641964
uri='%'+self.curfilestack[-1]+'#'+node['refid']
1965-
ifself.in_titleornoturi:
1965+
ifnoturi:
19661966
self.context.append('')
19671967
elifuri.startswith('#'):
19681968
# references to labels in the same document

‎tests/roots/test-root/markup.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -469,3 +469,9 @@ Smart quotes
469469

470470
.. [#] Like footnotes.
471471

472+
473+
Link in a title: `Field lists <https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html#field-lists>`_
474+
---------------------------------------------------------------------------------------------------------------------
475+
476+
Again: https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html#field-lists
477+
------------------------------------------------------------------------------------------

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp