I want to define a command, which separates a string an later adds a different \href to the first part, than to the second (e.g. \qname{foaf:Person}). But the code as I have it doesn't work, I get ! Argument of \reserved@a has an extra }., when I try to run it.
\RequirePackage{xstring}
\RequirePackage{hyperref}
\RequirePackage{url}
\newcommand{\prefix}{}%
\newcommand{\postfix}{}%
\newcommand{\qname}[1]{%
\IfSubStr{#1}{:}{%
\renewcommand{\prefix}{\StrBefore{#1}{:}}%
\renewcommand{\postfix}{\StrBehind{#1}{:}}%
\nolinkurl{\prefix}:\nolinkurl{\postfix}
}{%
\url{#1}%
}%
}
If I just output \prefix instead of \nolinkurl{\prefix}:\nolinkurl{\postfix} it works, but I want to have it as url.
I think there is something wrong with the variable handling, but I couldn't find information about this.
