2022-02-05 02:45:53 +01:00
|
|
|
#ifndef PAGED_ARTICLES_H
|
|
|
|
#define PAGED_ARTICLES_H
|
|
|
|
|
|
|
|
#include "core/containers/vector.h"
|
|
|
|
#include "core/string.h"
|
|
|
|
|
2022-02-05 16:55:07 +01:00
|
|
|
#include "web/file_cache.h"
|
2022-02-05 15:30:48 +01:00
|
|
|
#include "web/http/web_node.h"
|
2022-02-05 02:45:53 +01:00
|
|
|
|
2022-02-05 15:30:48 +01:00
|
|
|
#include "web/http/request.h"
|
2022-02-05 02:45:53 +01:00
|
|
|
|
2022-02-15 00:00:50 +01: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-02-05 02:45:53 +01:00
|
|
|
|
|
|
|
class PagedArticles : public WebNode {
|
|
|
|
RCPP_OBJECT(PagedArticles, WebNode);
|
|
|
|
|
|
|
|
public:
|
|
|
|
void _handle_request_main(Request *request);
|
|
|
|
|
2022-02-14 23:27:26 +01:00
|
|
|
void render_index(Request *request);
|
2022-02-14 23:20:47 +01:00
|
|
|
void render_preview(Request *request);
|
|
|
|
|
2022-02-05 02:45:53 +01:00
|
|
|
void load();
|
2022-02-05 13:27:33 +01:00
|
|
|
void generate_index_page();
|
2022-02-05 02:45:53 +01:00
|
|
|
|
|
|
|
void _notification(const int what);
|
|
|
|
|
|
|
|
PagedArticles();
|
|
|
|
~PagedArticles();
|
|
|
|
|
|
|
|
String folder;
|
|
|
|
|
|
|
|
protected:
|
2022-02-05 13:27:33 +01:00
|
|
|
String index_page;
|
2022-02-05 02:45:53 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|