From 962840188681e1d6f4aec0ebf07e05a70609325d Mon Sep 17 00:00:00 2001
From: Karl Berry <karl@freefriends.org>
Date: Sun, 29 Apr 2018 23:01:08 +0000
Subject: lwarp (26apr18)

git-svn-id: svn://tug.org/texlive/trunk@47491 c570f23f-e606-0410-a88d-b1316a301751
---
 .../texmf-dist/tex/latex/lwarp/lwarp-hyperref.sty  | 102 +++++++++++----------
 1 file changed, 53 insertions(+), 49 deletions(-)

(limited to 'Master/texmf-dist/tex/latex/lwarp/lwarp-hyperref.sty')

diff --git a/Master/texmf-dist/tex/latex/lwarp/lwarp-hyperref.sty b/Master/texmf-dist/tex/latex/lwarp/lwarp-hyperref.sty
index 51da8aac561..471402b46fc 100644
--- a/Master/texmf-dist/tex/latex/lwarp/lwarp-hyperref.sty
+++ b/Master/texmf-dist/tex/latex/lwarp/lwarp-hyperref.sty
@@ -38,11 +38,11 @@
 
 \newrobustcmd*{\hyperimage}{%
 \begingroup%
-\catcode`\#=12
-\catcode`\%=12
-\catcode`\&=12
-\catcode`\~=12
-\catcode`\_=12
+\catcode`\#=12%
+\catcode`\%=12%
+\catcode`\&=12%
+\catcode`\~=12%
+\catcode`\_=12%
 \LWR@hyperimageb%
 }
 
@@ -55,53 +55,57 @@
 
 \newcommand*{\hyperdef}{%
 \begingroup%
-\catcode`\#=12
-\catcode`\%=12
-\catcode`\&=12
-\catcode`\~=12
-\catcode`\_=12
+\catcode`\#=12%
+\catcode`\%=12%
+\catcode`\&=12%
+\catcode`\~=12%
+\catcode`\_=12%
 \LWR@hyperdefb%
 }
 
-\NewDocumentCommand{\LWR@hyperrefbb}{m m m +m}{%
-\def\LWR@templink{#1}%
-\@onelevel@sanitize\LWR@templink%
-\def\LWR@templinktwo{#2}%
-\@onelevel@sanitize\LWR@templinktwo%
-\def\LWR@templinkthree{#3}%
-\@onelevel@sanitize\LWR@templinkthree%
-\LWR@htmltag{a href="\LWR@templink\LWR@hashmark%
-    \LWR@templinktwo.\LWR@templinkthree"%
-}%
-#4%
+\newcommand{\LWR@hyperreffinish}[1]{%
+\begingroup%
+\LetLtxMacro\ref\LWR@origref%{} syntax highlighting
+#1%
+\endgroup%
 \LWR@htmltag{/a}%
+}
+
+\newcommand*{\LWR@hyperrefbb}[3]{%
+\LWR@htmltag{%
+    a href="%
+        \detokenize\expandafter{#1}\LWR@hashmark%
+        \detokenize\expandafter{#2}.\detokenize\expandafter{#3}%
+    "%
+}%
 \endgroup%
+\LWR@hyperreffinish%
 }
 
 \newrobustcmd*{\LWR@hyperrefb}{%
 \begingroup%
-\catcode`\#=12
-\catcode`\%=12
-\catcode`\&=12
-\catcode`\~=12
-\catcode`\_=12
+\catcode`\#=12%
+\catcode`\%=12%
+\catcode`\&=12%
+\catcode`\~=12%
+\catcode`\_=12%
 \LWR@hyperrefbb%
 }
 
-\NewDocumentCommand{\LWR@hyperrefcb}{O{label} +m}{
+
+\NewDocumentCommand{\LWR@hyperrefcb}{O{label}}{%
 \LWR@startref{#1}%
-#2%
-\LWR@htmltag{/a}%
 \endgroup%
+\LWR@hyperreffinish%
 }
 
 \newcommand*{\LWR@hyperrefc}{%
 \begingroup%
-\catcode`\#=12
-\catcode`\%=12
-\catcode`\&=12
-\catcode`\~=12
-\catcode`\_=12
+\catcode`\#=12%
+\catcode`\%=12%
+\catcode`\&=12%
+\catcode`\~=12%
+\catcode`\_=12%
 \LWR@hyperrefcb%
 }
 
@@ -111,33 +115,33 @@
 }
 
 \NewDocumentCommand{\LWR@hypertargetb}{m +m}{%
-\label{#1}%
+\label{LWR-ht-#1}%
 #2%
 \endgroup%
 }
 
 \newcommand*{\hypertarget}{%
 \begingroup%
-\catcode`\#=12
-\catcode`\%=12
-\catcode`\&=12
-\catcode`\~=12
-\catcode`\_=12
+\catcode`\#=12%
+\catcode`\%=12%
+\catcode`\&=12%
+\catcode`\~=12%
+\catcode`\_=12%
 \LWR@hypertargetb%
 }
 
-\DeclareDocumentCommand{\LWR@hyperlinkb}{m +m}{%
-\hyperref[#1]{#2}%
-\endgroup%
+\DeclareDocumentCommand{\LWR@hyperlinkb}{m}{%
+\LWR@hyperrefcb[LWR-ht-#1]%
 }
 
-\newcommand*{\hyperlink}{%
+\DeclareDocumentCommand{\hyperlink}{}{%
+\LWR@ensuredoingapar%
 \begingroup%
-\catcode`\#=12
-\catcode`\%=12
-\catcode`\&=12
-\catcode`\~=12
-\catcode`\_=12
+\catcode`\#=12%
+\catcode`\%=12%
+\catcode`\&=12%
+\catcode`\~=12%
+\catcode`\_=12%
 \LWR@hyperlinkb%
 }
 
-- 
cgit v1.2.3

