Commit 91c0849e authored by jan.koester's avatar jan.koester
Browse files

test

parent c12bb9d9
Loading
Loading
Loading
Loading
+12 −0
Changes for src/plugin.cpp: 12 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -167,6 +167,18 @@ void blogi::PluginApi::Publish(const int tid, const std::string &html, json_obje
    json_object_object_add(response, "message", json_object_new_string("Plugin does not support publishing."));
}

void blogi::PluginApi::RenderPublished(const int /*tid*/, const std::string &html,
                                       json_object * /*params*/, libhtmlpp::HtmlElement &page){
    libhtmlpp::HtmlElement *main = page.getElementbyID("main");
    if (main) {
        libhtmlpp::HtmlString buf;
        buf << html;
        try {
            main->appendChild(buf.parse());
        } catch (...) {}
    }
}

void blogi::PluginApi::sharePost(const int /*tid*/, SharePostType /*type*/, const std::string &/*url*/,
                                 const std::string &/*title*/, const std::string &/*description*/){
}
+7 −0
Changes for src/plugin.h: 7 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -32,6 +32,8 @@
#include <httppp/exception.h>
#include <httppp/http.h>

#include <htmlpp/html.h>

#include <dbpp/database.h>

#include <json-c/json.h>
@@ -160,6 +162,11 @@ namespace blogi {
        /// Publish rendered HTML content; params contains plugin-specific metadata
        virtual void Publish(const int tid, const std::string &html, json_object *params, json_object *response);

        /// Render published content into a page element, wrapping it as it appears on the published page.
        /// Used by the editor preview so WYSIWYG matches the final output.
        virtual void RenderPublished(const int tid, const std::string &html,
                                     json_object *params, libhtmlpp::HtmlElement &page);

        /// Share a post to social networks; url is the public link, title/description for text
        virtual void sharePost(const int tid, SharePostType type, const std::string &url,
                               const std::string &title, const std::string &description);