Now paged article has a summary field again, if it finds a summary.md it will load it and store that, otherwise it will just use it's uri segment.

This commit is contained in:
Relintai 2022-02-05 13:27:05 +01:00
parent bb4aa4ebdd
commit ead57f1d6a
2 changed files with 22 additions and 0 deletions

View File

@ -88,6 +88,12 @@ void PagedArticle::load() {
Utils::markdown_to_html(&fd);
if (files[i] == "summary.md") {
summary = fd;
continue;
}
String pagination;
pagination = Utils::get_pagination_links(get_full_uri(), files, i);
@ -116,12 +122,24 @@ void PagedArticle::load() {
file_cache->wwwroot_refresh_cache();
}
if (summary == "") {
generate_summary();
}
}
String PagedArticle::get_index_page() {
return index_page;
}
String PagedArticle::get_summary() {
return summary;
}
void PagedArticle::generate_summary() {
summary = get_uri_segment();
}
void PagedArticle::_notification(const int what) {
switch (what) {
case NOTIFICATION_ENTER_TREE:

View File

@ -19,6 +19,9 @@ public:
void load();
void load_folder(const String &folder, const String &path);
String get_index_page();
String get_summary();
virtual void generate_summary();
void _notification(const int what);
@ -31,6 +34,7 @@ public:
protected:
String index_page;
String summary;
std::map<String, String *> pages;
FileCache *file_cache;
};