Fix links enclosed in parenthesis
https://pixwhile.zangetsu.kaizoku.cyou/artworks/107901929
This commit is contained in:
parent
8de4af2972
commit
9259f7c198
|
@ -125,17 +125,25 @@ static inline std::vector<blankie::html::Node> parse_description_line(const http
|
|||
std::smatch sm;
|
||||
|
||||
while (std::regex_search(str, sm, blankie::murl::full_url_regex)) {
|
||||
if (sm.prefix().length()) {
|
||||
nodes.push_back(sm.prefix());
|
||||
std::string prefix = sm.prefix();
|
||||
std::string url_str = sm.str(0);
|
||||
std::string suffix = sm.suffix();
|
||||
|
||||
if (prefix.ends_with('(') && url_str.ends_with(')')) {
|
||||
url_str.pop_back();
|
||||
suffix.insert(0, 1, ')');
|
||||
}
|
||||
if (!prefix.empty()) {
|
||||
nodes.push_back(std::move(prefix));
|
||||
}
|
||||
|
||||
blankie::murl::Url url(sm.str(0));
|
||||
std::string url_str = url.is_host_equal("pixiv.net") || url.is_host_equal("www.pixiv.net")
|
||||
blankie::murl::Url url(std::move(url_str));
|
||||
url_str = url.is_host_equal("pixiv.net") || url.is_host_equal("www.pixiv.net")
|
||||
? proxy_pixiv_url(req, config, std::move(url))
|
||||
: url.to_string();
|
||||
nodes.push_back(Element("a", {{"href", url_str}}, {url_str}));
|
||||
|
||||
str = sm.suffix();
|
||||
str = std::move(suffix);
|
||||
}
|
||||
if (!str.empty()) {
|
||||
nodes.push_back(std::move(str));
|
||||
|
|
Loading…
Reference in New Issue