implemented appendPage

This commit is contained in:
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 putPage(const std::string &pageName, const std::string &content);
void addPage(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: private:
class impl; class impl;
std::unique_ptr<impl> pimpl; 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); 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); 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 putPage(const std::string &pageName, const std::string &content);
void addPage(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> template <typename ReturnType>
ReturnType executeCommand(const std::string &command, ReturnType executeCommand(const std::string &command,
const std::list<std::string> &params = {}, const std::list<std::string> &params = {},