Remove comments

This commit is contained in:
Bruno Rybársky 2024-02-29 09:47:03 +01:00
parent 5cf3198356
commit 0baef8a140

@ -6,6 +6,10 @@ function renderDynamicPage($page_file): array
return require $page_file; return require $page_file;
} }
function removeHtmlComments($content = '') :string {
return preg_replace('/<!--(.|\s)*?-->/', '', $content);
}
function parsePageTag($input): array function parsePageTag($input): array
{ {
// Define the pattern for the tag // Define the pattern for the tag
@ -124,6 +128,8 @@ function renderPage($page_name = null, $site_name = null): array
$page = str_replace("__TEMPLATE_PAGE_TITLE__", $page_title, $page); $page = str_replace("__TEMPLATE_PAGE_TITLE__", $page_title, $page);
$page = removeHtmlComments($page);
return [ return [
"PageContent" => $page, "PageContent" => $page,
"PageName" => $page_name, "PageName" => $page_name,