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
@@ -372,7 +372,7 @@ hit a key every time to move because it is blocking.</p></li>
|
||||
</ul>
|
||||
<h2 id="on-environmental-variables-more-generally-and-string-to-int-conversions"><a name="envvars" href="#toc">On environmental variables more generally and string to int conversions</a></h2>
|
||||
<p>What happens if you do:</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="va">WALLS</span><span class="op">=</span> <span class="ex">./prog</span></span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> WALLS= ./prog</code></pre>
|
||||
<p>Can you run into the wall since you didn’t specify a value and the default is 1?
|
||||
No. That’s not the way it works. By saying WALLS= you have told the system that
|
||||
there is that environmental variable. However the way the <code>strtoul()</code> functions
|
||||
@@ -381,12 +381,12 @@ it’s wasteful (iocccsize wise) and I have never felt that having invalid input
|
||||
for a number could have a better value than 0.</p>
|
||||
<p>If however you were to give valid input followed by invalid input the valid
|
||||
input would be parsed. For example:</p>
|
||||
<div class="sourceCode" id="cb13"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb13-1"><a href="#cb13-1" aria-hidden="true" tabindex="-1"></a> <span class="va">WALLS</span><span class="op">=</span>1test <span class="ex">./prog</span></span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> WALLS=1test ./prog</code></pre>
|
||||
<p>would let you go through the walls. On the other hand</p>
|
||||
<div class="sourceCode" id="cb14"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb14-1"><a href="#cb14-1" aria-hidden="true" tabindex="-1"></a> <span class="va">WALLS</span><span class="op">=</span>test1 <span class="ex">./prog</span></span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> WALLS=test1 ./prog</code></pre>
|
||||
<p>would not. Furthermore if you specify the same variable more than once it’s the
|
||||
last one that counts. For example:</p>
|
||||
<div class="sourceCode" id="cb15"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb15-1"><a href="#cb15-1" aria-hidden="true" tabindex="-1"></a> <span class="va">WALLS</span><span class="op">=</span>0 <span class="va">WALLS</span><span class="op">=</span>1 <span class="va">CANNIBAL</span><span class="op">=</span>1 <span class="va">CANNIBAL</span><span class="op">=</span>0 <span class="ex">./prog</span></span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> WALLS=0 WALLS=1 CANNIBAL=1 CANNIBAL=0 ./prog</code></pre>
|
||||
<p>would allow you to go through walls but you could not cannibalise.</p>
|
||||
<p>Also note that I specify base 0 which means that you can also have it in hex and
|
||||
octal. These are all the same:</p>
|
||||
@@ -421,17 +421,17 @@ will end (yes things that haven’t begun can be ended).</p>
|
||||
<p>If <code>calloc()</code> fails to obtain the needed memory you’ll see something like (here it
|
||||
was before I added proper - to make the perfect and obvious pun - capsizing
|
||||
so that by setting the size to -1 it went to the max unsigned value):</p>
|
||||
<div class="sourceCode" id="cb19"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb19-1"><a href="#cb19-1" aria-hidden="true" tabindex="-1"></a> <span class="ex">$</span> MAXSIZE=-1 ./prog</span>
|
||||
<span id="cb19-2"><a href="#cb19-2" aria-hidden="true" tabindex="-1"></a> <span class="ex">memory</span> error</span>
|
||||
<span id="cb19-3"><a href="#cb19-3" aria-hidden="true" tabindex="-1"></a> <span class="ex">X:0/157</span> Y:0/42 S:3/18446744073709551614 B:0</span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> $ MAXSIZE=-1 ./prog
|
||||
memory error
|
||||
X:0/157 Y:0/42 S:3/18446744073709551614 B:0</code></pre>
|
||||
<p>BTW: There are two arrays that have to be <strong>MAXSIZE</strong> (technically + 1).</p>
|
||||
<p>Is it possible that some value specified by the user could mess this up? I do
|
||||
not know but what I do know is that because it’s unsigned it can’t be negative;
|
||||
if the max size is 0 then the array size will be 1 but it won’t matter because
|
||||
the snake size will be >= that max anyway. But here’s a curious output:</p>
|
||||
<div class="sourceCode" id="cb20"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb20-1"><a href="#cb20-1" aria-hidden="true" tabindex="-1"></a> <span class="va">SIZE</span><span class="op">=</span>1 <span class="va">MAXSIZE</span><span class="op">=</span>0 <span class="ex">./prog</span></span>
|
||||
<span id="cb20-2"><a href="#cb20-2" aria-hidden="true" tabindex="-1"></a> <span class="ex">YOU</span> WIN!</span>
|
||||
<span id="cb20-3"><a href="#cb20-3" aria-hidden="true" tabindex="-1"></a> <span class="ex">X:78/156</span> Y:20/41 S:0/0 B:0</span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> SIZE=1 MAXSIZE=0 ./prog
|
||||
YOU WIN!
|
||||
X:78/156 Y:20/41 S:0/0 B:0</code></pre>
|
||||
<p>Why does it show snake size as 0 when I specified 1? It’s because the max size
|
||||
is 0 and I limit the size to be no bigger than the max size.</p>
|
||||
<!--
|
||||
|
||||
Reference in new issue
Block a user