mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2025-01-25 18:39:18 +01:00
Added back md parsing support for the rest of the WebNodes that used to support it.
This commit is contained in:
parent
0f39a8f6ac
commit
05fd41c5ac
@ -5,6 +5,7 @@
|
|||||||
#include "core/os/file_access.h"
|
#include "core/os/file_access.h"
|
||||||
|
|
||||||
#include "../../html/html_builder.h"
|
#include "../../html/html_builder.h"
|
||||||
|
#include "../../html/markdown_renderer.h"
|
||||||
#include "../../html/paginator.h"
|
#include "../../html/paginator.h"
|
||||||
#include "../../http/http_server_enums.h"
|
#include "../../http/http_server_enums.h"
|
||||||
#include "../../http/web_permission.h"
|
#include "../../http/web_permission.h"
|
||||||
@ -141,6 +142,9 @@ void ListWebPage::load() {
|
|||||||
|
|
||||||
files.sort();
|
files.sort();
|
||||||
|
|
||||||
|
Ref<MarkdownRenderer> r;
|
||||||
|
r.instance();
|
||||||
|
|
||||||
Vector<String> list_entries;
|
Vector<String> list_entries;
|
||||||
|
|
||||||
for (int i = 0; i < files.size(); ++i) {
|
for (int i = 0; i < files.size(); ++i) {
|
||||||
@ -151,7 +155,9 @@ void ListWebPage::load() {
|
|||||||
|
|
||||||
memdelete(f);
|
memdelete(f);
|
||||||
|
|
||||||
//Utils::markdown_to_html(&fd);
|
if (files[i].get_extension() == "md") {
|
||||||
|
fd = r->render_to_html(fd);
|
||||||
|
}
|
||||||
|
|
||||||
list_entries.push_back(fd);
|
list_entries.push_back(fd);
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#include "core/project_settings.h"
|
#include "core/project_settings.h"
|
||||||
|
|
||||||
#include "../../file_cache.h"
|
#include "../../file_cache.h"
|
||||||
|
#include "../../html/markdown_renderer.h"
|
||||||
#include "../../html/paginator.h"
|
#include "../../html/paginator.h"
|
||||||
#include "../../http/http_server_enums.h"
|
#include "../../http/http_server_enums.h"
|
||||||
#include "../../http/web_permission.h"
|
#include "../../http/web_permission.h"
|
||||||
@ -116,6 +117,9 @@ void PagedArticleWebPage::load() {
|
|||||||
|
|
||||||
files.sort();
|
files.sort();
|
||||||
|
|
||||||
|
Ref<MarkdownRenderer> r;
|
||||||
|
r.instance();
|
||||||
|
|
||||||
for (int i = 0; i < files.size(); ++i) {
|
for (int i = 0; i < files.size(); ++i) {
|
||||||
String file_path = _articles_folder_abs;
|
String file_path = _articles_folder_abs;
|
||||||
file_path += files[i];
|
file_path += files[i];
|
||||||
@ -130,7 +134,9 @@ void PagedArticleWebPage::load() {
|
|||||||
f->close();
|
f->close();
|
||||||
memdelete(f);
|
memdelete(f);
|
||||||
|
|
||||||
//Utils::markdown_to_html(&fd);
|
if (files[i].get_extension() == "md") {
|
||||||
|
fd = r->render_to_html(fd);
|
||||||
|
}
|
||||||
|
|
||||||
if (files[i].get_file().get_basename() == "summary") {
|
if (files[i].get_file().get_basename() == "summary") {
|
||||||
summary = fd;
|
summary = fd;
|
||||||
|
@ -65,9 +65,6 @@ void StaticWebPage::load_and_process_file(const String &path) {
|
|||||||
_data = "";
|
_data = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
//todo prcess
|
|
||||||
//could support bbcode easily
|
|
||||||
//should probably support md -> I should probably write a parser
|
|
||||||
if (path.get_extension() == "md") {
|
if (path.get_extension() == "md") {
|
||||||
Ref<MarkdownRenderer> r;
|
Ref<MarkdownRenderer> r;
|
||||||
r.instance();
|
r.instance();
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#include "static_web_page_folder_files.h"
|
#include "static_web_page_folder_files.h"
|
||||||
|
|
||||||
|
#include "../../html/markdown_renderer.h"
|
||||||
#include "core/os/dir_access.h"
|
#include "core/os/dir_access.h"
|
||||||
#include "core/os/file_access.h"
|
#include "core/os/file_access.h"
|
||||||
|
|
||||||
@ -27,6 +28,9 @@ void StaticWebPageFolderFiles::load() {
|
|||||||
ERR_FAIL_COND_MSG(!da, "Dir Path = " + _dir_path);
|
ERR_FAIL_COND_MSG(!da, "Dir Path = " + _dir_path);
|
||||||
|
|
||||||
if (da) {
|
if (da) {
|
||||||
|
Ref<MarkdownRenderer> r;
|
||||||
|
r.instance();
|
||||||
|
|
||||||
da->list_dir_begin();
|
da->list_dir_begin();
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
@ -47,9 +51,9 @@ void StaticWebPageFolderFiles::load() {
|
|||||||
f->close();
|
f->close();
|
||||||
memdelete(f);
|
memdelete(f);
|
||||||
|
|
||||||
//if (process_if_can && d->current_get_extension() == "md") {
|
if (_process_if_can && (fn.get_extension()) == "md") {
|
||||||
// Utils::markdown_to_html(&str);
|
str = r->render_to_html(str);
|
||||||
//}
|
}
|
||||||
|
|
||||||
append_data(str);
|
append_data(str);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user