+ // The characters in chars_url[] need to be escaped in the url
+ // field because otherwise LaTeX will fail when the hyperlink is
+ // within an argument of another command, e.g. in a \footnote. It
+ // is important that they are escaped as "\#" and not as "\#{}".
+ for (int k = 0; k < 2; k++)
+ for (size_t i = 0, pos;
+ (pos = url.find(chars_url[k], i)) != string::npos;
+ i = pos + 2)
+ url.replace(pos, 1, backslash + chars_url[k]);
+
+ // add "http://" when the type is web (type = empty)
+ // and no "://" or "run:" is given
+ docstring type = getParam("type");
+ if (url.find(from_ascii("://")) == string::npos
+ && url.find(from_ascii("run:")) == string::npos
+ && type.empty())
+ url = from_ascii("http://") + url;
+
+ } // end if (!url.empty())