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
+13
-13
@@ -1,6 +1,6 @@
|
||||
## To build:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
make
|
||||
```
|
||||
|
||||
@@ -8,7 +8,7 @@ NOTE: there is an alternate version for vi(m) like movements. See [alternate
|
||||
version](#alternate-code) below. If your terminal has problems with the
|
||||
`stty(1)` commands try:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
make anon-no_stty
|
||||
```
|
||||
|
||||
@@ -28,14 +28,14 @@ For more detailed information see [2005 anon bugs](../../bugs.html#2005_anon).
|
||||
|
||||
## To use:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
./anon x y [z]
|
||||
```
|
||||
|
||||
|
||||
## Try:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
./anon 4 4
|
||||
|
||||
./anon 3 3 3
|
||||
@@ -48,13 +48,13 @@ hook you) and spending too much time playing. :-)
|
||||
|
||||
If you want to see this in action you can easily do this:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
yes 'please crash on me :-)' | ./anon 4 4
|
||||
```
|
||||
|
||||
What happens if you specify a larger board? For instance:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
yes 'please crash on me :-)' | ./anon 10 10 10
|
||||
```
|
||||
|
||||
@@ -70,13 +70,13 @@ The alternate version uses `vi(m)` like movement keys.
|
||||
|
||||
### Alternate build:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
make alt
|
||||
```
|
||||
|
||||
To compile the version without `stty(1)`:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
make alt-no_stty
|
||||
```
|
||||
|
||||
@@ -121,13 +121,13 @@ sorted in the order they appear on the screen.
|
||||
The program takes 2 or 3 arguments, specifying the dimensions of the board.
|
||||
For example, to play the original version of the Fifteen Puzzle:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
./anon 4 4
|
||||
```
|
||||
|
||||
To play with a 3D board, do something like this:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
./anon 3 3 3
|
||||
```
|
||||
|
||||
@@ -377,7 +377,7 @@ stored in a well-known location in the `MASS`.
|
||||
|
||||
`if(p,q,r,s)` is, in fact, an `if` statement. :-) It is equivalent to:
|
||||
|
||||
```c
|
||||
```<!---c-->
|
||||
if (p) { q; r } else {s}
|
||||
```
|
||||
|
||||
@@ -404,7 +404,7 @@ closes the current state and opens a new one behind the programmer's back.
|
||||
variable); `x` and `y-1` define the starting and ending values of `i`, and `z`
|
||||
is the loop body. `Z` is the post-loop code in the current state. For example:
|
||||
|
||||
```c
|
||||
```<!---c-->
|
||||
for(s,i, 0, 10,
|
||||
some_code ,
|
||||
other_code)
|
||||
@@ -412,7 +412,7 @@ is the loop body. `Z` is the post-loop code in the current state. For example:
|
||||
|
||||
is equivalent to:
|
||||
|
||||
```c
|
||||
```<!---c-->
|
||||
for (i=0; i<10; i++) {
|
||||
some_code;
|
||||
}
|
||||
|
||||
+20
-20
@@ -141,39 +141,39 @@ Location: <a href="../../location.html#ZZ">ZZ</a> - <em>Unknown location</em></l
|
||||
<!-- 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>NOTE: there is an alternate version for vi(m) like movements. See <a href="#alternate-code">alternate
|
||||
version</a> below. If your terminal has problems with the
|
||||
<code>stty(1)</code> commands try:</p>
|
||||
<div class="sourceCode" id="cb2"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a> <span class="fu">make</span> anon-no_stty</span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> make anon-no_stty</code></pre>
|
||||
<p>This will compile <a href="anon.c">anon.c</a> as <code>anon</code> to not use <code>stty(1)</code>.</p>
|
||||
<h3 id="bugs-and-misfeatures">Bugs and (Mis)features:</h3>
|
||||
<p>The current status of this entry is:</p>
|
||||
<pre><code> STATUS: INABIAF - please **DO NOT** fix</code></pre>
|
||||
<p>For more detailed information see <a href="../../bugs.html#2005_anon">2005 anon bugs</a>.</p>
|
||||
<h2 id="to-use">To use:</h2>
|
||||
<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">./anon</span> x y <span class="pp">[</span><span class="ss">z</span><span class="pp">]</span></span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> ./anon x y [z]</code></pre>
|
||||
<h2 id="try">Try:</h2>
|
||||
<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">./anon</span> 4 4</span>
|
||||
<span id="cb5-2"><a href="#cb5-2" aria-hidden="true" tabindex="-1"></a></span>
|
||||
<span id="cb5-3"><a href="#cb5-3" aria-hidden="true" tabindex="-1"></a> <span class="ex">./anon</span> 3 3 3</span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> ./anon 4 4
|
||||
|
||||
./anon 3 3 3</code></pre>
|
||||
<p>After a very large number of moves this program will deliberately force itself
|
||||
to destroy its runtime stack. This is the author’s way to prevent you from being
|
||||
frustrated (which might happen as it likes to create unsolvable puzzles just to
|
||||
hook you) and spending too much time playing. :-)</p>
|
||||
<p>If you want to see this in action you can easily do this:</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="fu">yes</span> <span class="st">'please crash on me :-)'</span> <span class="kw">|</span> <span class="ex">./anon</span> 4 4</span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> yes 'please crash on me :-)' | ./anon 4 4</code></pre>
|
||||
<p>What happens if you specify a larger board? For instance:</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="fu">yes</span> <span class="st">'please crash on me :-)'</span> <span class="kw">|</span> <span class="ex">./anon</span> 10 10 10</span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> yes 'please crash on me :-)' | ./anon 10 10 10</code></pre>
|
||||
<p>If you specify more than three args the program might also crash or do
|
||||
something strange. This might also happen if you specify excessively large board
|
||||
dimensions. Try <code>100 100 100</code> for instance and see what happens!</p>
|
||||
<h2 id="alternate-version">Alternate version:</h2>
|
||||
<p>The alternate version uses <code>vi(m)</code> like movement keys.</p>
|
||||
<h3 id="alternate-build">Alternate build:</h3>
|
||||
<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="fu">make</span> alt</span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> make alt</code></pre>
|
||||
<p>To compile the version without <code>stty(1)</code>:</p>
|
||||
<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-no_stty</span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> make alt-no_stty</code></pre>
|
||||
<h3 id="alternate-use">Alternate use:</h3>
|
||||
<p>Use <code>anon.alt</code> as you would <code>anon</code> with the change in movements:</p>
|
||||
<pre><code> k | Move empty spot up
|
||||
@@ -200,9 +200,9 @@ spaces on the board, and the goal is to rearrange them so that they appear
|
||||
sorted in the order they appear on the screen.</p>
|
||||
<p>The program takes 2 or 3 arguments, specifying the dimensions of the board.
|
||||
For example, to play the original version of the Fifteen Puzzle:</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">./anon</span> 4 4</span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> ./anon 4 4</code></pre>
|
||||
<p>To play with a 3D board, do something like this:</p>
|
||||
<div class="sourceCode" id="cb12"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb12-1"><a href="#cb12-1" aria-hidden="true" tabindex="-1"></a> <span class="ex">./anon</span> 3 3 3</span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> ./anon 3 3 3</code></pre>
|
||||
<p><strong>WARNING: do NOT run the program with more than 3 command-line arguments.
|
||||
This will trigger a bug that will cause it to crash or do something strange.
|
||||
:-)</strong></p>
|
||||
@@ -394,7 +394,7 @@ allocation. It’s the only state that needs to return a value from the boolean
|
||||
expression, since once the <code>MASS</code> is initialized any return value can simply be
|
||||
stored in a well-known location in the <code>MASS</code>.</p>
|
||||
<p><code>if(p,q,r,s)</code> is, in fact, an <code>if</code> statement. :-) It is equivalent to:</p>
|
||||
<div class="sourceCode" id="cb16"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb16-1"><a href="#cb16-1" aria-hidden="true" tabindex="-1"></a> <span class="cf">if</span> <span class="op">(</span>p<span class="op">)</span> <span class="op">{</span> q<span class="op">;</span> r <span class="op">}</span> <span class="cf">else</span> <span class="op">{</span>s<span class="op">}</span></span></code></pre></div>
|
||||
<pre class="<!---c-->"><code> if (p) { q; r } else {s}</code></pre>
|
||||
<p>Why are <code>q</code> and <code>r</code> split up? Because it’s cleaner (in whatever twisted sense of
|
||||
the word that can be applied to an IOCCC entry) to implement using boolean
|
||||
expressions. Keep in mind that all statements are assumed to evaluate to
|
||||
@@ -415,14 +415,14 @@ closes the current state and opens a new one behind the programmer’s back.
|
||||
<code>i</code> is the index variable (well, the index into the <code>MASS</code> of the index
|
||||
variable); <code>x</code> and <code>y-1</code> define the starting and ending values of <code>i</code>, and <code>z</code>
|
||||
is the loop body. <code>Z</code> is the post-loop code in the current state. For example:</p>
|
||||
<div class="sourceCode" id="cb17"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb17-1"><a href="#cb17-1" aria-hidden="true" tabindex="-1"></a> <span class="cf">for</span><span class="op">(</span>s<span class="op">,</span>i<span class="op">,</span> <span class="dv">0</span><span class="op">,</span> <span class="dv">10</span><span class="op">,</span></span>
|
||||
<span id="cb17-2"><a href="#cb17-2" aria-hidden="true" tabindex="-1"></a> some_code <span class="op">,</span></span>
|
||||
<span id="cb17-3"><a href="#cb17-3" aria-hidden="true" tabindex="-1"></a> other_code<span class="op">)</span></span></code></pre></div>
|
||||
<pre class="<!---c-->"><code> for(s,i, 0, 10,
|
||||
some_code ,
|
||||
other_code)</code></pre>
|
||||
<p>is equivalent to:</p>
|
||||
<div class="sourceCode" id="cb18"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb18-1"><a href="#cb18-1" aria-hidden="true" tabindex="-1"></a> <span class="cf">for</span> <span class="op">(</span>i<span class="op">=</span><span class="dv">0</span><span class="op">;</span> i<span class="op">&</span>lt<span class="op">;</span><span class="dv">10</span><span class="op">;</span> i<span class="op">++)</span> <span class="op">{</span></span>
|
||||
<span id="cb18-2"><a href="#cb18-2" aria-hidden="true" tabindex="-1"></a> some_code<span class="op">;</span></span>
|
||||
<span id="cb18-3"><a href="#cb18-3" aria-hidden="true" tabindex="-1"></a> <span class="op">}</span></span>
|
||||
<span id="cb18-4"><a href="#cb18-4" aria-hidden="true" tabindex="-1"></a> other_code<span class="op">;</span></span></code></pre></div>
|
||||
<pre class="<!---c-->"><code> for (i=0; i&lt;10; i++) {
|
||||
some_code;
|
||||
}
|
||||
other_code;</code></pre>
|
||||
<p>Note the “wrong” indentation in the former: the author prefers to write it
|
||||
that way, since the analogy to the usual <code>for</code> loop is clearer. This is why it’s
|
||||
easier to understand the pre-CPP code, since after CPP, the macro reshuffles
|
||||
|
||||
Reference in new issue
Block a user