implemented appendPage

main
Michael Mandl 2018-03-29 21:20:25 +02:00
parent 36e73ecb0d
commit 12ce38327f
4 changed files with 18 additions and 0 deletions

View File

@ -29,6 +29,8 @@ class DokuWiki
void putPage(const std::string &pageName, const std::string &content);
void addPage(const std::string &pageName, const std::string &content);
void appendToPage(const std::string &pageName, const std::string &content);
private:
class impl;
std::unique_ptr<impl> pimpl;

View File

@ -52,3 +52,7 @@ void DokuWiki::addPage(const std::string &pageName, const std::string &content)
pimpl->addPage(pageName, content);
}
void DokuWiki::appendToPage(const std::string &pageName, const std::string &content)
{
pimpl->appendToPage(pageName, content);
}

View File

@ -180,3 +180,13 @@ void DokuWiki::impl::addPage(const std::string &pageName, const std::string &con
putPage(pageName, content);
}
void DokuWiki::impl::appendToPage(const std::string &pageName, const std::string &content)
{
if (!executeCommand<bool>("dokuwiki.appendPage", { pageName, content },
{{ "sum", xmlrpc_c::value_string("Added automatically") },
{"minor", xmlrpc_c::value_boolean(false) }}))
{
throw std::runtime_error("failed to append to page");
}
}

View File

@ -28,6 +28,8 @@ class DokuWiki::impl
void putPage(const std::string &pageName, const std::string &content);
void addPage(const std::string &pageName, const std::string &content);
void appendToPage(const std::string &pageName, const std::string &content);
template <typename ReturnType>
ReturnType executeCommand(const std::string &command,
const std::list<std::string> &params = {},