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

scoped \href arguments to avoid leaking color #2433

Merged
merged 3 commits into from
Dec 18, 2024

Conversation

dginev
Copy link
Collaborator

@dginev dginev commented Oct 24, 2024

I stumbled onto a simple color leakage arxiv report yesterday and found a quick fix.

But I am also a little unsatisfied by how specific the fix is - it only contains one macro, rather than all possible cases where this containment may be needed. But I am not sure which cases those are.

So for now I'm offering the quick fix for consideration. And adding a test.

Minimal example reproducing the issue:

\documentclass{article}
\usepackage{hyperref}
\usepackage{xcolor}
\begin{document}
A link: \href{https://example.com}{\color{blue}here}.

\section{Color should not leak into this heading}
This text should be black.

\end{document}

@dginev dginev marked this pull request as draft October 24, 2024 14:45
@dginev dginev marked this pull request as ready for review October 24, 2024 14:48
@dginev dginev requested a review from brucemiller October 24, 2024 15:14
@brucemiller
Copy link
Owner

Doesn't the DefConstructor(... bounded=>1) do what you need? And wouldn't it be convenient to just add the test to hypertest?

@dginev
Copy link
Collaborator Author

dginev commented Oct 31, 2024

Good point, done.

I am still wondering if refactoring the sub { $_[0]->bgroup; } to the sub reference \&LaTeXML::Core::Stomach::bgroup wouldn't add a nice speedup, but at least in make test it isn't that visible, so I'll leave it out for now.

@brucemiller brucemiller merged commit 1301850 into brucemiller:master Dec 18, 2024
13 checks passed
@brucemiller brucemiller deleted the href-scoped-args branch December 18, 2024 20:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants