Updated wiki.php to use parsedown

This commit is contained in:
Ubergeek 2019-07-04 16:27:10 +00:00
parent 261791daec
commit 8a3e498b22
1 changed files with 17 additions and 5 deletions

View File

@ -1,10 +1,15 @@
<?php
/*
This code is Copyright(c) 2019 by ubergeek under the GPL 3 or later.
Parsedown is licensed under the MIT license.
*/
include('config.php');
include('parrsedown-1.7.3/Parsedown.php');
include('parsedown-1.7.3/Parsedown.php');
$page = $_GET['page'];
$style = $_GET['style'];
$Parsedown = new Parsedown();
if ( $page == "") {
$page = "main";
@ -18,6 +23,11 @@ if ( $style == "") {
else {
$site_style=$style;
}
$header = file_get_contents("$doc_root/includes/header.md");
$sidebar = file_get_contents("$doc_root/includes/sidebar.md");
$content = file_get_contents("$doc_root/articles/$page.md");
$footer = file_get_contents("$doc_root/includes/footer.md");
print "<!DOCTYPE html>
<html lang='en'>
@ -30,7 +40,8 @@ print "<!DOCTYPE html>
<div id='header'>";
echo ( shell_exec("/usr/bin/pandoc $doc_root/includes/header.md") );
print $Parsedown->text($header);
print "
</div>
<!-- End Header -->
@ -42,7 +53,8 @@ print "<hr>
<!-- Begin Sidebar -->
<div id='sidebar'>
";
echo ( shell_exec("/usr/bin/pandoc $doc_root/includes/sidebar.md") );
echo $Parsedown->text($sidebar);
print " </div>
<!-- End Sidebar -->
@ -50,7 +62,7 @@ print " </div>
<!-- Begin Body -->
<div id='content'>";
echo ( shell_exec("/usr/bin/pandoc $doc_root/articles/$page.md") );
echo $Parsedown->text($content);
print " </div>
<!-- End Body -->
@ -62,7 +74,7 @@ print " </div>
<hr>
";
echo ( shell_exec("/usr/bin/pandoc $doc_root/includes/footer.md") );
echo $Parsedown->text($footer);
print " </div>
<!-- End Footer -->