2022-06-30 13:23:14 +02:00
|
|
|
#ifndef PAGED_ARTICLES_H
|
|
|
|
#define PAGED_ARTICLES_H
|
|
|
|
|
2022-07-03 16:28:57 +02:00
|
|
|
#include "core/ustring.h"
|
|
|
|
#include "core/vector.h"
|
2022-06-30 13:23:14 +02:00
|
|
|
|
2022-07-03 16:28:57 +02:00
|
|
|
#include "../../http/web_node.h"
|
2022-06-30 13:23:14 +02:00
|
|
|
|
|
|
|
// This class will load and process all md files from the folder set to it's folder property,
|
|
|
|
// and generate one page from them. TThe files are processed in alphabetical order.
|
|
|
|
|
|
|
|
// The generated HTML looks like:
|
|
|
|
|
|
|
|
// render_menu()
|
|
|
|
// <div class="article_list_entry">
|
|
|
|
// Contents of the first md file.
|
|
|
|
// </div>
|
|
|
|
// <div class="article_list_entry">
|
|
|
|
// Contents of the second md file.
|
|
|
|
// </div>
|
|
|
|
// ...
|
|
|
|
// </div>
|
|
|
|
|
2022-07-03 16:28:57 +02:00
|
|
|
class WebServerRequest;
|
|
|
|
|
2022-06-30 13:23:14 +02:00
|
|
|
class PagedArticles : public WebNode {
|
2022-07-03 16:28:57 +02:00
|
|
|
GDCLASS(PagedArticles, WebNode);
|
2022-06-30 13:23:14 +02:00
|
|
|
|
|
|
|
public:
|
2022-07-03 16:28:57 +02:00
|
|
|
String get_folder();
|
|
|
|
void set_folder(const String &val);
|
2022-06-30 13:23:14 +02:00
|
|
|
|
2022-07-03 16:28:57 +02:00
|
|
|
void _handle_request(Ref<WebServerRequest> request);
|
|
|
|
|
|
|
|
void _render_index(Ref<WebServerRequest> request);
|
|
|
|
void _render_preview(Ref<WebServerRequest> request);
|
2022-06-30 13:23:14 +02:00
|
|
|
|
|
|
|
void load();
|
|
|
|
void generate_index_page();
|
|
|
|
|
|
|
|
PagedArticles();
|
|
|
|
~PagedArticles();
|
|
|
|
|
|
|
|
protected:
|
2022-07-03 16:28:57 +02:00
|
|
|
void _notification(int what);
|
|
|
|
|
|
|
|
static void _bind_methods();
|
|
|
|
|
|
|
|
String _folder;
|
|
|
|
|
|
|
|
String _index_page;
|
2022-06-30 13:23:14 +02:00
|
|
|
};
|
|
|
|
|
2022-07-03 16:28:57 +02:00
|
|
|
#endif
|