feat: reworked the template structure

This commit is contained in:
David Bailey 2024-08-29 20:40:36 +02:00
parent c607d57221
commit c9808f90f8
24 changed files with 216 additions and 80 deletions

View file

@ -29,14 +29,27 @@ $sql_adapter = new MySQLHandler($db_connection, $SERVER_HOST);
$adapter = new PostHandler($sql_adapter);
require_once 'dergdown.php';
require_once 'setup/derg_insert.php';
function dergdown_to_html($text) {
function dergdown_to_html($post) {
$DergInsert = new DergInsertRenderer($post);
$Parsedown = new Dergdown();
$Parsedown->setDergRenderer($DergInsert);
return $Parsedown->text($text);
$markdown = $post->markdown;
if($markdown == '') {
$markdown = '
{{
template: fragments/directory/inline.html
}}
';
}
return $Parsedown->text($markdown);
}
function post_to_html($post) {
return dergdown_to_html($post->markdown);
return dergdown_to_html($post);
}
$adapter->markdown_engine = "post_to_html";