On 10/12/2023 3:14 PM, Pablo Rodriguez wrote:
Hi Hans,

I have the following source, which tries to resemble three kinds of links:

     \setupinteraction[state=start, style=, focus=standard]

     \def\inone#1{%
       \start\setupinteraction[color=darkgreen]%
       \enabledirectives[references.border=darkgreen]%
       \goto{#1}[url(#1)]\stop}
     \def\intwo#1{%
       \start\setupinteraction[color=darkred]%
       \enabledirectives[references.border=darkred]%
       \goto{#1}[url(#1)]\stop}
     \def\inthree#1{%
       \start\setupinteraction[color=darkblue]%
       \enabledirectives[references.border=darkblue]%
       \goto{#1}[url(#1)]\stop}

     \starttext
     \startTEXpage[offset=1dk, align=middle]
     \inone{one}\blank
     \intwo{two}\blank
     \inthree{three}\blank
     \stopTEXpage
     \chapter[one]{First chapter}
     \chapter[two]{Second chapter}
     \chapter[three]{Second chapter}
     \stoptext

I see that the directive for link borders only allows one color for
links per document.

In my real-world documents, I need to make three different border links:
for destinations inside the document (/GoTo), for destinations in other
documents (/GoToR or /GoToE) and for external destinations (/URI).

With the current document I write now, I have over a hundred links in
twenty pages. Being able to visually distinguish each link helps
interaction with the document (reading or even writing it).

Would it be possible that \setupinteraction could have a bordercolor
key, such as the color one?
All is possible but not all should be done, especially not features that mostly serve a few viewers (like acrobat) and don't really relate to typesetting.

That said, we can add some styling. First of all, you can use a bit of abstraction

\defineinteraction[one]  [color=darkgreen,style=\underbar]
\defineinteraction[two]  [color=darkred,  style=\underbar]
\defineinteraction[three][color=darkblue, style=\underbar]

\def\inone#1{%
  \start\setinteraction[one]%
  \goto{#1}[url(#1)]\stop}
\def\intwo#1{%
  \start\setinteraction[two]%
  \goto{#1}[url(#1)]\stop}
\def\inthree#1{%
  \start\setinteraction[three]%
  \goto{#1}[url(#1)]\stop}

which already might help you. To make it easier I'll add \namedgoto do that one can say:

\def\inone  #1{\namedgoto[#1]{#1}[url(#1)]}
\def\intwo  #1{\namedgoto[#1]{#1}[url(#1)]}
\def\inthree#1{\namedgoto[#1]{#1}[url(#1)]}

I'll also add \outline and \outlined

\defineinteraction[one]  [color=darkgreen,style=\outlined]%
\defineinteraction[two]  [color=darkred,  style=\outline]%
\defineinteraction[three][color=darkblue, style=\outlined]%

which of course you then will wikify ...

I attached an example but there is no upload (will happen when the build is running again because I can't make osx bins here).

hans


-----------------------------------------------------------------
                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
       tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------

Attachment: oeps.pdf
Description: Adobe PDF document

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

Reply via email to