add hack-a-round for language specified markdown code blocks
When language is specified in a markdown code block such as:
````
```c
printf("Hello, world!\n");
```
````
is used, the resulting HTML as produced by `pandoc(1)` combined
with our revised `ioccc.css` is not intent the code block well.
A temporary "_hack-a-round_" is to turn the "markdown code language
specifier" into an HTML comment. For example:
````
```<!---c-->
printf("Hello, world!\n");
```
````
This commits turns off existing markdown code language specifiers
for now, while preserving our ability to restore them in the future
when a better "_hack-a-round_" to the "markdown code language
specifier" problem is found.
The HTML impact if this "_hack-a-round_" is to produce HTML that
looks like this:
```
<pre class="<!---c-->"><code> .. </code></pre>
```
We might be able to create a complex set of classes for each markdown
code language (there won't be very many) in `ioccc.css`, or we might
find a more general CSS (or maybe `pandoc(1)`?) solution.
For now, this hack-a-round will have to do.
This commit is contained in:
1 parent
3919df50fb
commit
b66c79254a
700 files changed
+7052
-7056
No files matched your search
+11
-11
@@ -1,6 +1,6 @@
|
||||
## To build:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
make
|
||||
```
|
||||
|
||||
@@ -25,38 +25,38 @@ For more detailed information see [2012 vik bugs](../../bugs.html#2012_vik).
|
||||
|
||||
To embed text (from file or command line):
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
./vik e base.png filename > encodedimg.png
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
./vik e base.png SomeRandomText > encodedimg.png
|
||||
```
|
||||
|
||||
To extract the embedded text:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
./vik d encodedimg.png
|
||||
```
|
||||
|
||||
To embed a PNG into another:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
./vik e base.png source.png > encodedimg.png
|
||||
```
|
||||
|
||||
To extract the embedded PNG:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
./vik d encodedimg.png > restored.png
|
||||
```
|
||||
|
||||
|
||||
## Try:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
./try.sh
|
||||
```
|
||||
|
||||
@@ -68,7 +68,7 @@ For those few who might use Windows this alternate code might work.
|
||||
|
||||
### Alternate build:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
make alt
|
||||
```
|
||||
|
||||
@@ -116,7 +116,7 @@ possible to get the bitmap data from the extracted image, and run it through any
|
||||
of the previous winning brainfuck interpreters, but I thought it would be easier
|
||||
to include an interpreter in the program to avoid the hassle:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
./vik e ioccc.png chocolate.png > encodedimg.png
|
||||
./vik b encodedimg.png
|
||||
```
|
||||
@@ -125,7 +125,7 @@ It is of course also possible to embed a
|
||||
[brainfuck](https://en.wikipedia.org/wiki/Brainfuck) program as a text file
|
||||
(as explained above) and decode it, e.g.:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
./vik e ioccc.png .+[.+] > encodedimg.png
|
||||
./vik b encodedimg.png
|
||||
```
|
||||
@@ -154,7 +154,7 @@ compile the program on this platform, the following line can be added after
|
||||
the variable declarations in the main declaration in order to run
|
||||
correctly:
|
||||
|
||||
```c
|
||||
```<!---c-->
|
||||
_setmode(_fileno(stdout), 0x8000);
|
||||
```
|
||||
|
||||
|
||||
+13
-13
@@ -141,7 +141,7 @@ Location: <a href="../../location.html#US">US</a> - <em>United States of America
|
||||
<!-- START: this line starts content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
|
||||
|
||||
<h2 id="to-build">To build:</h2>
|
||||
<div class="sourceCode" id="cb1"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a> <span class="fu">make</span></span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> make</code></pre>
|
||||
<p>This entry requires <a href="https://www.zlib.net">Zlib</a>.</p>
|
||||
<p>There is an alternate version which might work for Windows. See <a href="#alternate-code">Alternate
|
||||
code</a> section below.</p>
|
||||
@@ -151,21 +151,21 @@ code</a> section below.</p>
|
||||
<p>For more detailed information see <a href="../../bugs.html#2012_vik">2012 vik bugs</a>.</p>
|
||||
<h2 id="to-use">To use:</h2>
|
||||
<p>To embed text (from file or command line):</p>
|
||||
<div class="sourceCode" id="cb3"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a> <span class="ex">./vik</span> e base.png filename <span class="op">></span> encodedimg.png</span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> ./vik e base.png filename > encodedimg.png</code></pre>
|
||||
<p>or</p>
|
||||
<div class="sourceCode" id="cb4"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a> <span class="ex">./vik</span> e base.png SomeRandomText <span class="op">></span> encodedimg.png</span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> ./vik e base.png SomeRandomText > encodedimg.png</code></pre>
|
||||
<p>To extract the embedded text:</p>
|
||||
<div class="sourceCode" id="cb5"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a> <span class="ex">./vik</span> d encodedimg.png</span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> ./vik d encodedimg.png</code></pre>
|
||||
<p>To embed a PNG into another:</p>
|
||||
<div class="sourceCode" id="cb6"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true" tabindex="-1"></a> <span class="ex">./vik</span> e base.png source.png <span class="op">></span> encodedimg.png</span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> ./vik e base.png source.png > encodedimg.png</code></pre>
|
||||
<p>To extract the embedded PNG:</p>
|
||||
<div class="sourceCode" id="cb7"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb7-1"><a href="#cb7-1" aria-hidden="true" tabindex="-1"></a> <span class="ex">./vik</span> d encodedimg.png <span class="op">></span> restored.png</span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> ./vik d encodedimg.png > restored.png</code></pre>
|
||||
<h2 id="try">Try:</h2>
|
||||
<div class="sourceCode" id="cb8"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb8-1"><a href="#cb8-1" aria-hidden="true" tabindex="-1"></a> <span class="ex">./try.sh</span></span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> ./try.sh</code></pre>
|
||||
<h2 id="alternate-code">Alternate code:</h2>
|
||||
<p>For those few who might use Windows this alternate code might work.</p>
|
||||
<h3 id="alternate-build">Alternate build:</h3>
|
||||
<div class="sourceCode" id="cb9"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb9-1"><a href="#cb9-1" aria-hidden="true" tabindex="-1"></a> <span class="fu">make</span> alt</span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> make alt</code></pre>
|
||||
<h3 id="alternate-use">Alternate use:</h3>
|
||||
<p>Use <code>vik.alt</code> as you would <code>vik</code> above.</p>
|
||||
<h2 id="judges-remarks">Judges’ remarks:</h2>
|
||||
@@ -196,13 +196,13 @@ into another image and extracted, the bitmap data is also a valid
|
||||
possible to get the bitmap data from the extracted image, and run it through any
|
||||
of the previous winning brainfuck interpreters, but I thought it would be easier
|
||||
to include an interpreter in the program to avoid the hassle:</p>
|
||||
<div class="sourceCode" id="cb10"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb10-1"><a href="#cb10-1" aria-hidden="true" tabindex="-1"></a> <span class="ex">./vik</span> e ioccc.png chocolate.png <span class="op">></span> encodedimg.png</span>
|
||||
<span id="cb10-2"><a href="#cb10-2" aria-hidden="true" tabindex="-1"></a> <span class="ex">./vik</span> b encodedimg.png</span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> ./vik e ioccc.png chocolate.png > encodedimg.png
|
||||
./vik b encodedimg.png</code></pre>
|
||||
<p>It is of course also possible to embed a
|
||||
<a href="https://en.wikipedia.org/wiki/Brainfuck">brainfuck</a> program as a text file
|
||||
(as explained above) and decode it, e.g.:</p>
|
||||
<div class="sourceCode" id="cb11"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb11-1"><a href="#cb11-1" aria-hidden="true" tabindex="-1"></a> <span class="ex">./vik</span> e ioccc.png .+<span class="pp">[</span><span class="ss">.+</span><span class="pp">]</span> <span class="op">></span> encodedimg.png</span>
|
||||
<span id="cb11-2"><a href="#cb11-2" aria-hidden="true" tabindex="-1"></a> <span class="ex">./vik</span> b encodedimg.png</span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> ./vik e ioccc.png .+[.+] > encodedimg.png
|
||||
./vik b encodedimg.png</code></pre>
|
||||
<h3 id="obfuscation">Obfuscation</h3>
|
||||
<p>I really wanted to keep the program simple, so instead of adding multiple macros
|
||||
or helper methods that can be confusing, I placed all functionality in the
|
||||
@@ -221,7 +221,7 @@ binary data to <code>stdout</code>.</p>
|
||||
compile the program on this platform, the following line can be added after
|
||||
the variable declarations in the main declaration in order to run
|
||||
correctly:</p>
|
||||
<div class="sourceCode" id="cb12"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb12-1"><a href="#cb12-1" aria-hidden="true" tabindex="-1"></a> _setmode<span class="op">(</span>_fileno<span class="op">(</span>stdout<span class="op">),</span> <span class="bn">0x8000</span><span class="op">);</span></span></code></pre></div>
|
||||
<pre class="<!---c-->"><code> _setmode(_fileno(stdout), 0x8000);</code></pre>
|
||||
<p>NOTE: this is what the <a href="#alternate-code">Alternate code</a> does.</p>
|
||||
<h3 id="limitations">Limitations</h3>
|
||||
<p>The program doesn’t have many error checks so passing in invalid arguments
|
||||
|
||||
Reference in new issue
Block a user