Background
Would like to define a base URL that can be reused by other macros.
Problem
Using the \goto macro requires a fully expanded URL.
Minimum Working Example
Here's code that illustrates the problem:
\setupinteraction[state=start]
\def\WPhomepagebase{http://tex.stackexchange.com/questions/}
\def\WPpagequestion{\WPhomepagebase{}201545}
%\def\WPpagequestion{http://tex.stackexchange.com/questions/201545}
\def\href#1#2{%
\goto{#1}[url(#2)]%
}
\starttext
\href{TeX StackExchange}{\WPpagequestion}
\stoptext
If the code is changed as follows:
%\def\WPhomepagebase{http://tex.stackexchange.com/questions/}
%\def\WPpagequestion{\WPhomepagebase{}201545}
\def\WPpagequestion{http://tex.stackexchange.com/questions/201545}
Then the document produces the correct hyperlink.
Question
How do you use \goto within a custom macro, as shown in the example code, such that the URL can contain other macros?
\edef\WPpagequestion{...}. – Aditya Sep 17 '14 at 19:00