Skip to content

Commit 3c5d4b1

Browse files
fix: escape URLs in TeX output rather than treating them as verbatim (#713)
This fixes issues with nesting in \emph{}
1 parent a1cb904 commit 3c5d4b1

File tree

6 files changed

+6
-6
lines changed

6 files changed

+6
-6
lines changed

src/tests/integration/code-content-doc/expected/tex/main.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
% hyperref and also makes the link useful on paper. If already in a footnote, the URL is
3232
% in parentheses instead.
3333
\let\oldhref\href
34-
\RenewDocumentCommand{\href}{vm}{%
34+
\RenewDocumentCommand{\href}{mm}{%
3535
\ifinfootnote%
3636
#2~(\url{#1})%
3737
\else%

src/tests/integration/extra-files-doc/expected/tex/main.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
% hyperref and also makes the link useful on paper. If already in a footnote, the URL is
3232
% in parentheses instead.
3333
\let\oldhref\href
34-
\RenewDocumentCommand{\href}{vm}{%
34+
\RenewDocumentCommand{\href}{mm}{%
3535
\ifinfootnote%
3636
#2~(\url{#1})%
3737
\else%

src/tests/integration/inheritance-doc/expected/tex/main.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
% hyperref and also makes the link useful on paper. If already in a footnote, the URL is
3232
% in parentheses instead.
3333
\let\oldhref\href
34-
\RenewDocumentCommand{\href}{vm}{%
34+
\RenewDocumentCommand{\href}{mm}{%
3535
\ifinfootnote%
3636
#2~(\url{#1})%
3737
\else%

src/tests/integration/sample-doc/expected/tex/main.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
% hyperref and also makes the link useful on paper. If already in a footnote, the URL is
3232
% in parentheses instead.
3333
\let\oldhref\href
34-
\RenewDocumentCommand{\href}{vm}{%
34+
\RenewDocumentCommand{\href}{mm}{%
3535
\ifinfootnote%
3636
#2~(\url{#1})%
3737
\else%

src/verso-manual/VersoManual/TeX.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ r##"
4040
% hyperref and also makes the link useful on paper. If already in a footnote, the URL is
4141
% in parentheses instead.
4242
\let\oldhref\href
43-
\RenewDocumentCommand{\href}{vm}{%
43+
\RenewDocumentCommand{\href}{mm}{%
4444
\ifinfootnote%
4545
#2~(\url{#1})%
4646
\else%

src/verso/Verso/Doc/TeX.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public class GenreTeX (genre : Genre) (m : Type → Type) where
7373
inline (inlineTeX : Inline genre → TeXT genre m TeX) (container : genre.Inline) (contents : Array (Inline genre)) : TeXT genre m TeX
7474

7575
def escapeForTexHref (s : String) : String :=
76-
s.replace "%" "\\%"
76+
s |>.replace "%" r#"\%"# |>.replace "#" r##"\#"##
7777

7878
/--
7979
Replaces characters with strings simultaneously.

0 commit comments

Comments
 (0)