1
0

blogview_markdown

This commit is contained in:
Mike Schwörer 2017-12-30 23:46:27 +01:00
parent c4aa27a708
commit bb28fd3b6d
Signed by: Mikescher
GPG Key ID: D3C7172E0A70F8CF
13 changed files with 1673 additions and 23 deletions

View File

@ -208,7 +208,7 @@ html, body {
color: #333;
border: 1px solid black;
background-color: #E0E0E0;
width: 80%;
width: 90%;
margin-left: auto;
margin-right: auto; }
@ -219,6 +219,41 @@ html, body {
.bc_data {
padding: 8px; }
.bc_markdown code {
font-family: Consolas, Monaco, 'Andale Mono', monospace;
direction: ltr;
text-align: left;
white-space: pre;
word-spacing: normal;
word-break: normal;
-moz-tab-size: 4;
tab-size: 4;
-webkit-hyphens: none;
-moz-hyphens: none;
-ms-hyphens: none;
hyphens: none; }
.bc_markdown pre {
font-size: 14px;
display: block;
padding: 9.5px;
margin: 0 0 10px;
line-height: 20px;
word-break: break-all;
word-wrap: break-word;
white-space: pre-wrap;
background-color: #F8F8F8;
color: black;
border: 1px solid rgba(0, 0, 0, 0.15);
-webkit-border-radius: 2px;
-moz-border-radius: 2px;
border-radius: 2px; }
.bc_markdown blockquote {
padding: 0 0 0 15px;
margin: 0 0 20px;
border-left: 5px solid #CCC; }
.euler_pnl_base {
display: inline-flex;
flex-direction: column;

View File

@ -4,7 +4,7 @@
color: $COL_TEXT_DARK;
border: 1px solid black;
background-color: $COL_BACKGROUND_2;
width: 80%;
width: 90%;
margin-left: auto;
margin-right: auto;
}
@ -17,3 +17,42 @@
.bc_data {
padding: 8px;
}
.bc_markdown code {
font-family: Consolas, Monaco, 'Andale Mono', monospace;
direction: ltr;
text-align: left;
white-space: pre;
word-spacing: normal;
word-break: normal;
-moz-tab-size: 4;
tab-size: 4;
-webkit-hyphens: none;
-moz-hyphens: none;
-ms-hyphens: none;
hyphens: none;
}
.bc_markdown pre {
font-size: 14px;
display: block;
padding: 9.5px;
margin: 0 0 10px;
line-height: 20px;
word-break: break-all;
word-wrap: break-word;
white-space: pre-wrap;
background-color: #F8F8F8;
color: black;
border: 1px solid rgba(0,0,0,.15);
-webkit-border-radius: 2px;
-moz-border-radius: 2px;
border-radius: 2px;
}
.bc_markdown blockquote {
padding: 0 0 0 15px;
margin: 0 0 20px;
border-left: 5px solid #CCC;
}

1548
www/extern/Parsedown.php vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,20 @@
<?php
require_once (__DIR__ . '/../internals/base.php');
require_once (__DIR__ . '/../internals/blog.php');
require_once (__DIR__ . '/../extern/Parsedown.php');
?>
<div class="blogcontent bc_markdown">
<div class="bc_header">
<?php echo $post['date']; ?>
</div>
<div class="bc_data">
<?php
$pd = new Parsedown();
echo $pd->text(Blog::getPostFragment($post));
?>
</div>
</div>

View File

@ -19,3 +19,10 @@ function httpError($errorcode, $message)
{
die($message);//TODO errorcode
}
function destructiveUrlEncode($str) {
$str = str_replace(' ', '_', $str);
$str = str_replace('+', '_', $str);
$str = str_replace('.', '', $str);
return urlencode($str);
}

View File

@ -4,7 +4,7 @@ class Blog
{
public static function listAll()
{
return
$all =
[
[ 'id' => 5, 'date' => '2009-04-08', 'visible' => true, 'title' => 'Beginning the log', 'fragment' => 'initial.md', 'type' => 'markdown', 'cat' => 'log' ],
[ 'id' => 6, 'date' => '2009-05-01', 'visible' => false, 'title' => 'Mess with the best ...', 'fragment' => 'hack.md', 'type' => 'markdown', 'cat' => 'log' ],
@ -27,9 +27,24 @@ class Blog
[ 'id' => 20, 'date' => '2015-01-09', 'visible' => true, 'title' => 'More Befunge with Project Euler', 'fragment' => 'more_euler.md', 'type' => 'markdown', 'cat' => 'log' ],
[ 'id' => 9, 'date' => '2016-10-22', 'visible' => true, 'title' => 'A complete sudoku solver in Befunge-93', 'fragment' => 'sudoku_befunge.md', 'type' => 'markdown', 'cat' => 'blog' ],
];
return array_map('self::completeSingle', $all);
}
public static function listAllOrderedDescending() {
private static function completeSingle($d)
{
if ($d['cat']==='blog')
$d['url'] = "/blog/" . $d['id'] . "/" . destructiveUrlEncode($d['title']);
else if ($d['cat']==='log')
$d['url'] = "/log/" . $d['id'] . "/" . destructiveUrlEncode($d['title']);
$d['canonical'] = "https://www.mikescher.com" . $d['url'];
return $d;
}
public static function listAllOrderedDescending()
{
$data = self::listAll();
usort($data, function($a, $b) { return strcasecmp($b['date'], $a['date']); });
return $data;

View File

@ -32,8 +32,8 @@ $allposts = Blog::listAllOrderedDescending();
{
if (!$post['visible']) continue;
if ($post['cat']=='blog') echo "<a class='bloglistelem ble_blog' href='/blog/" . $post['id'] . "/" . urlencode($post['title']) . "'>";
else if ($post['cat']=='log') echo "<a class='bloglistelem ble_log' href='/log/" . $post['id'] . "'>";
if ($post['cat']=='blog') echo "<a class='bloglistelem ble_blog' href='" . $post['url'] . "'>";
else if ($post['cat']=='log') echo "<a class='bloglistelem ble_log' href='" . $post['url'] . "'>";
echo "<div class='ble_date'>" . $post['date'] . "</div>";
echo "<div class='ble_title'>" . $post['title'] . "</div>";
echo "</a>";

View File

@ -18,7 +18,8 @@ if ($post === NULL) httpError(404, 'blogpost not found');
<title>Mikescher.com - Blog</title>
<meta name="google-site-verification" content="pZOhmjeJcQbRMNa8xRLam4dwJ2oYwMwISY1lRKreSSs"/>
<link rel="icon" type="image/png" href="/data/images/favicon.png"/>
<link rel="stylesheet" href="/data/css/styles.css"/>
<link rel="stylesheet" href="/data/css/styles.css"/>
<link rel="canonical" href="<?php echo $post['canonical']; ?>"/>
</head>
<body>
<div id="mastercontainer">

View File

@ -1,6 +1,3 @@
Let's do Befunge-93
=====================
Hello, this is my try to teach *you* a little bit of Befunge-93.
Preamble

View File

@ -1,6 +1,3 @@
My BFJoust bot
---------------------
[Brainfuck Joust](http://esolangs.org/wiki/BF_Joust) is a tournament for Bots written in [brainfuck](http://esolangs.org/wiki/Brainfuck) *(or at least in a brainfuck-like language)*.
The board consist of 10 to 30 fields, one player starts left and one player right. The value of every field goes from `-127` to `128` and then wraps around, every field has a value of zero, except the two starting fields (the "flags"), they have a value of `128`.

View File

@ -1,6 +1,3 @@
.Net format specifier Cheat Sheet
============================
Here my (growing) collection of C# format specifier, this is not a complete list but rather a collection of specifier I needed in the past:
###Short syntax summary

View File

@ -1,6 +1,3 @@
Rapla Enhancement Script
=====================
![rapla_logo](/data/blog/Rapscript/logo.png)
I don't think many of you know [rapla](https://code.google.com/p/rapla/). And you should probably be thankful about that. But if you happen to study at the DHBW-KA, or any other place that uses rapla you could be interested in my enhancement-script.

View File

@ -1,6 +1,3 @@
A sudoku solver in Befunge-93
=======================
![sudoku debug](/data/blog/SudokuSolver/sudoku.png)
Because of [this project euler puzzle](https://www.mikescher.com/blog/1/Project_Euler_with_Befunge/problem-096) I spend the last few days implementing a sudoku solver in befunge-93 (as always I ignored the 80x25 size restriction because otherwise befunge-93 would be not turing-complete and I'm pretty sure this problem impossible).