1
0

ParsedownCustom

This commit is contained in:
2018-01-01 23:03:05 +01:00
parent 32f1e8437b
commit e56ca264a3
36 changed files with 939 additions and 277 deletions

View File

@@ -0,0 +1,31 @@
<?php
require_once (__DIR__ . '/../internals/base.php');
global $PARAM_CODE;
global $PARAM_URL;
global $PARAM_INTERACTIVE;
$result = '';
$result .= '<div class="bce_code">' . "\n";
$result .= ' <div class="bce_code_data">' .htmlspecialchars($PARAM_CODE) . '</div>' . "\n";
$result .= ' <div class="bce_code_ctrl">' . "\n";
if ($PARAM_INTERACTIVE) {
$result .= ' <div class="ctrl_btn_left">' . "\n";
$result .= ' <div class="ctrl_btn">Start</div>' . "\n";
$result .= ' <div class="ctrl_btn">Stop</div>' . "\n";
$result .= ' <div class="ctrl_btn">Reset</div>' . "\n";
$result .= ' </div>' . "\n";
}
if ($PARAM_URL !== '') {
$result .= ' <div class="ctrl_btn_right">' . "\n";
$result .= ' <a class="ctrl_btn" href="' .$PARAM_URL . '" download target="_blank">Download</a>' . "\n";
$result .= ' </div>' . "\n";
}
$result .= ' </div>' . "\n";
$result .= '</div>' . "\n";
$result .= includeScriptOnce("/data/javascript/blogpost_bef93runner.js", false) . "\n";
return $result;

View File

@@ -4,44 +4,37 @@ require_once (__DIR__ . '/../internals/base.php');
global $PARAM_CODE_LEFT;
global $PARAM_CODE_RIGHT;
?>
$result = '';
<div class="bfjoust_runner_owner" >
<div class="hsplit">
<textarea class="hsplit_1 source" id="source_1"><?php echo htmlspecialchars($PARAM_CODE_LEFT); ?></textarea>
<textarea class="hsplit_2 source" id="source_2"><?php echo htmlspecialchars($PARAM_CODE_RIGHT); ?></textarea>
</div>
$result .= '<div class="bfjoust_runner_owner">' . "\n";
$result .= ' <div class="hsplit">' . "\n";
$result .= ' <textarea class="hsplit_1 source" id="source_1">' . htmlspecialchars($PARAM_CODE_LEFT) . '</textarea>' . "\n";
$result .= ' <textarea class="hsplit_2 source" id="source_2">' . htmlspecialchars($PARAM_CODE_RIGHT) . '</textarea>' . "\n";
$result .= ' </div>' . "\n";
<div id="commandpanel">
<div>
<div>
<a href="#" id="a_expand">expand</a>
|
<a href="#" id="a_collapse">collapse</a>
|
<a href="#" id="a_run">run</a>
(size:
<input type="number" id="run_size" min="10" max="30" value="30" width="30">
speed:
<input type="number" id="run_speed" min="0" max="10000" value="10">
)
|
<a href="#" id="a_stop">stop</a>
|
<a href="#" id="a_arena">arena</a>
</div>
</div>
</div>
$result .= ' <div id="commandpanel">' . "\n";
$result .= ' <div>' . "\n";
$result .= ' <div>' . "\n";
$result .= ' <a href="#" id="a_expand">expand</a>|<a href="#" id="a_collapse">collapse</a>|<a href="#" id="a_run">run</a>' . "\n";
$result .= ' (size:<input type="number" id="run_size" min="10" max="30" value="30" width="30"> speed:<input type="number" id="run_speed" min="0" max="10000" value="10">)' . "\n";
$result .= ' | <a href="#" id="a_stop">stop</a> | <a href="#" id="a_arena">arena</a>' . "\n";
$result .= ' </div>' . "\n";
$result .= ' </div>' . "\n";
$result .= ' </div>' . "\n";
<div class="hsplit">
<textarea class="hsplit_1 sink" id="sink_1"></textarea>
<textarea class="hsplit_2 sink" id="sink_2"></textarea>
</div>
$result .= ' <div class="hsplit">' . "\n";
$result .= ' <textarea class="hsplit_1 sink" id="sink_1"></textarea>' . "\n";
$result .= ' <textarea class="hsplit_2 sink" id="sink_2"></textarea>' . "\n";
$result .= ' </div>' . "\n";
<div class="hsplit">
<canvas class="hsplit_1 bottomelem" id="board"></canvas>
<textarea class="hsplit_2 bottomelem" id="log" wrap="off"> </textarea>
</div>
</div>
$result .= ' <div class="hsplit">' . "\n";
$result .= ' <canvas class="hsplit_1 bottomelem" id="board"></canvas>' . "\n";
$result .= ' <textarea class="hsplit_2 bottomelem" id="log" wrap="off"> </textarea>' . "\n";
$result .= ' </div>' . "\n";
$result .= '</div>' . "\n";
<script src="/data/javascript/blogpost_BFJoustBot_script.js"></script>
$result .= '' . "\n";
$result .= includeScriptOnce("/data/javascript/blogpost_BFJoustBot_script.js", false) . "\n";
return $result;

View File

@@ -1,34 +0,0 @@
<?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
$code_own = file_get_contents(__DIR__ . '/../statics/blog/bfjoust_MultiVAC.bfjoust');
$code_opp = file_get_contents(__DIR__ . '/../statics/blog/bfjoust_Patashu_lazy.bfjoust');
$pd = new Parsedown();
$dat = file_get_contents( __DIR__ . '/../statics/blog/bfjoust.md');
$dat = str_replace("{{CODE}}", $code_own, $dat);
echo $pd->text($dat);
global $PARAM_CODE_LEFT;
global $PARAM_CODE_RIGHT;
$PARAM_CODE_LEFT = $code_own;
$PARAM_CODE_RIGHT = $code_opp;
include (__DIR__ . '/../fragments/bfjoust_runner.php');
?>
</div>
</div>

View File

@@ -12,7 +12,7 @@ $problems = Euler::listAll();
<div style="position: relative;">
<a href="https://github.com/Mikescher/Project-Euler_Befunge" style="position: absolute; top: 0; right: 0; border: 0;">
<img src="/data/images/github_band.png" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png">
<img src="/data/images/blog/github_band.png" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png">
</a>
</div>

View File

@@ -2,7 +2,7 @@
require_once (__DIR__ . '/../internals/base.php');
require_once (__DIR__ . '/../internals/blog.php');
require_once (__DIR__ . '/../internals/euler.php');
require_once (__DIR__ . '/../extern/Parsedown.php');
require_once (__DIR__ . '/../internals/ParsedownCustom.php');
$subview = $OPTIONS['subview'];
@@ -11,7 +11,7 @@ $problem = Euler::getEulerProblem(intval(explode('-', $subview)[1]));
if ($post === NULL) httpError(404, 'problem not found');
$pd = new Parsedown();
$pd = new ParsedownCustom();
$arr = [];
@@ -29,7 +29,7 @@ $max = ceil($max / 20) * 20;
<div style="position: relative;">
<a href="https://github.com/Mikescher/Project-Euler_Befunge" style="position: absolute; top: 0; right: 0; border: 0;">
<img src="/data/images/github_band.png" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png">
<img src="/data/images/blog/github_band.png" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png">
</a>
</div>
@@ -45,44 +45,22 @@ $max = ceil($max / 20) * 20;
<div class="bce_description"><?php echo $pd->text(file_get_contents($problem['file_description'])); ?></div>
<br/>
<?php if ($problem['abbreviated']): ?>
<b>Solution:</b>
<div class="bce_code">
<div class="bce_code_data"><?php echo htmlspecialchars(file_get_contents($problem['file_code'])); ?></div>
<div class="bce_code_ctrl">
<div class="ctrl_btn_right">
<a class="ctrl_btn" href="<?php echo $problem['url_raw']; ?>" download target="_blank">Download</a>
</div>
</div>
</div>
<br/>
<?php else: ?>
<b>Solution:</b>
<div class="bce_code">
<div class="bce_code_data"><?php echo htmlspecialchars(file_get_contents($problem['file_code'])); ?></div>
<div class="bce_code_ctrl">
<div class="ctrl_btn_left">
<div class="ctrl_btn">Start</div>
<div class="ctrl_btn">Stop</div>
<div class="ctrl_btn">Reset</div>
</div>
<div class="ctrl_btn_right">
<a class="ctrl_btn" href="<?php echo $problem['url_raw']; ?>" download target="_blank">Download</a>
</div>
</div>
</div>
<br/>
<?php endif; ?>
<b>Solution:</b>
<?php
global $PARAM_CODE;
global $PARAM_URL;
$PARAM_CODE = file_get_contents($problem['file_code']);
$PARAM_URL = $problem['url_raw'];
$PARAM_INTERACTIVE = !$problem['abbreviated'];
echo require (__DIR__ . '/../fragments/befunge93_runner.php');
?>
<br/>
<b>Explanation:</b>
<div class="bce_explanation"><?php echo $pd->text(file_get_contents($problem['file_explanation'])); ?></div>
<br/>
<table>
<table class="notable">
<tr>
<td><b>Interpreter steps:</b></td>
<td><?php echo number_format($problem['steps'], 0, null, ' '); ?></td>

View File

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