commit a832461316c9bb938e4ce64f4261a6f8e0a826d0 Author: nsturtz Date: Wed Jan 20 16:46:23 2021 -0500 First Push diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8a12399 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +posts +image diff --git a/index.html b/index.html new file mode 100644 index 0000000..ed0225b --- /dev/null +++ b/index.html @@ -0,0 +1,57 @@ + +Loading BLOG + + + + diff --git a/index.php b/index.php new file mode 100644 index 0000000..d455df7 --- /dev/null +++ b/index.php @@ -0,0 +1,55 @@ + + + + + MIF's Blog + + + +
+

My Blog

+

Cool things go here.

+
+ = 1; $post--) { + makePost($post, FALSE); + } + } else { + makePost($specificPost, TRUE); + } + + function makePost($post, $showRest) { + $text = file_get_contents("posts/" . strval($post)); + $text = parse($text, $showRest, $post); + + echo("
" . $text . "
"); + } + ?> + + diff --git a/markdown.php b/markdown.php new file mode 100644 index 0000000..a9a79b2 --- /dev/null +++ b/markdown.php @@ -0,0 +1,38 @@ +$1", $asHtml); + + # Replace [text](link) with HTML links. Prevent ][ and )( in them + $findBetween = "([^\n|\[\]]+)"; + + # Parse images first, since they require a ! in front of them + $imageRegex = "/\!\[" . $findBetween . "\]\(" . $findBetween . "\)/i"; + $asHtml = preg_replace($imageRegex, "", $asHtml); + + # Parse links, Prevent ! at beginning + $linkRegex = "/(?!\!)\[" . $findBetween . "\]\(" . $findBetween . "\)/i"; + $asHtml = preg_replace($linkRegex, "$1", $asHtml); + + # + $asHtml = preg_replace("/```([^```]+)```/s", "$1", $asHtml); + $asHtml = preg_replace("/\`([^\n]+)\`/i", "$1", $asHtml); + + # Replace --- and after with read more if needed + if ($showRest == TRUE) { + $asHtml = preg_replace("/---/s", "", $asHtml); + $asHtml .= "Back"; + } else { + $asHtml = preg_replace("/---(.+)/s", "

Read more

", $asHtml); + } + + # Replace two newlines with a paragraph element + //$asHtml = preg_replace("/[\n][\n](.*)/i", "

$1

", $asHtml); + + return $asHtml; +} +?> diff --git a/matrix.css b/matrix.css new file mode 100644 index 0000000..9b89e41 --- /dev/null +++ b/matrix.css @@ -0,0 +1,7 @@ +/* Credit https://codepen.io/P3R0/pen/MwgoKv */ + +/*basic reset*/ +* {margin: 0; padding: 0;} +/*adding a black bg to the body to make things clearer*/ +body {background: black;} +canvas {display: block;} diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..dc24cbf --- /dev/null +++ b/readme.md @@ -0,0 +1,8 @@ +# TinyBlog +See it in action: http://petabyte.heb12.com/blog/ + +## Setup +Make a folder called "posts", and touch files 1 - however many posts you want. +Edit them with markdown, and bam. + +(You have to change index.php $postCount to how many posts you have. This will be fixed soon.) \ No newline at end of file