|
a/src/query/plaintorich.cpp |
|
b/src/query/plaintorich.cpp |
|
... |
|
... |
153 |
// Replace HTTP(s) urls in text/plain with proper HTML anchors so that
|
153 |
// Replace HTTP(s) urls in text/plain with proper HTML anchors so that
|
154 |
// they become clickable in the preview. We don't make a lot of effort
|
154 |
// they become clickable in the preview. We don't make a lot of effort
|
155 |
// for validating, or catching things which are probably urls but miss
|
155 |
// for validating, or catching things which are probably urls but miss
|
156 |
// a scheme (e.g. www.xxx.com/index.html), because complicated.
|
156 |
// a scheme (e.g. www.xxx.com/index.html), because complicated.
|
157 |
static const string urlRE = "(https?://[[:alnum:]~_/.%?&=,#@]+)[[:space:]|]";
|
157 |
static const string urlRE = "(https?://[[:alnum:]~_/.%?&=,#@]+)[[:space:]|]";
|
|
|
158 |
static const string urlRep{"<a href=\"$1\">$1</a>"};
|
158 |
static std::regex url_re(urlRE);
|
159 |
static std::regex url_re(urlRE);
|
159 |
static string activate_urls(const string& in)
|
160 |
static string activate_urls(const string& in)
|
160 |
{
|
161 |
{
|
161 |
return std::regex_replace(in, url_re, "<a href=\"$1\">$1</a>");
|
162 |
return std::regex_replace(in, url_re, urlRep);
|
162 |
}
|
163 |
}
|
163 |
|
164 |
|
164 |
// Fix result text for display inside the gui text window.
|
165 |
// Fix result text for display inside the gui text window.
|
165 |
//
|
166 |
//
|
166 |
// We call overridden functions to output header data, beginnings and ends of
|
167 |
// We call overridden functions to output header data, beginnings and ends of
|