diff --git a/config.cpp b/config.cpp index 60a1682..46172ea 100644 --- a/config.cpp +++ b/config.cpp @@ -85,6 +85,7 @@ Config::Config(const std::map &map) this->urls.linkindex = required("linkindex"); this->urls.linklogout = required("linklogout"); this->urls.linkpage = required("linkpage"); + this->urls.linkpagebytitle = required("linkpagebytitle"); this->urls.linkrecent = required("linkrecent"); this->urls.linkrevision = required("linkrevision"); this->urls.linksettings = required("linksettings"); diff --git a/config.h b/config.h index 7f3b4cf..1558ae7 100644 --- a/config.h +++ b/config.h @@ -26,6 +26,7 @@ struct ConfigUrls std::string linkallcats; std::string linkshere; std::string linkpage; + std::string linkpagebytitle; std::string linkrevision; std::string linkhistory; std::string linkedit; diff --git a/urlprovider.cpp b/urlprovider.cpp index a515bff..dde1dcf 100644 --- a/urlprovider.cpp +++ b/urlprovider.cpp @@ -63,6 +63,11 @@ std::string UrlProvider::page(std::string pagename) return replaceOnlyPage(config->linkpage, pagename); } +std::string UrlProvider::pageByTitle(std::string title) +{ + return replaceSingleVar(config->linkpagebytitle, "title", utils::strreplace(title, " ", "-")); +} + std::string UrlProvider::linksHere(std::string pagename) { return replaceOnlyPage(config->linkshere, pagename); diff --git a/urlprovider.h b/urlprovider.h index 3c28c0e..49a6e9a 100644 --- a/urlprovider.h +++ b/urlprovider.h @@ -27,6 +27,8 @@ class UrlProvider std::string page(std::string pagename); + std::string pageByTitle(std::string title); + std::string linksHere(std::string pagename); std::string pageHistory(std::string pagename);