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 all
|
||||
```
|
||||
|
||||
@@ -20,26 +20,26 @@ For more detailed information see [1989 westley bugs](../../bugs.html#1989_westl
|
||||
|
||||
Try compiling and running the 4 resulting programs like:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
./compile.sh
|
||||
```
|
||||
|
||||
If you need to specify an alternate compiler path, say because your default
|
||||
compiler is clang (or in the case of macOS gcc is clang) you can do so like:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
CC=/opt/local/bin/gcc-mp-12 ./compile.sh
|
||||
```
|
||||
|
||||
If you wish to delay the script or remove the delay you can do so like:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
DELAY=2 ./compile.sh
|
||||
```
|
||||
|
||||
Finally try:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
./westley
|
||||
# input some lines of text, sending EOF (usually ctrl-d) to end
|
||||
|
||||
@@ -70,7 +70,7 @@ different algorithm for each version (hereafter referred to as
|
||||
When compiling these versions, one needs to define `trgpune`
|
||||
in the compile line (which the Makefile now has). Example:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
cc -Dtrgpune=putchar ver3.c -o ver3
|
||||
```
|
||||
|
||||
@@ -109,13 +109,13 @@ function `vs()` to define in the ROT13 version. But a function
|
||||
called `vs()` turns into a function called `if()` in the original,
|
||||
so it can't be done. Therefore, I do:
|
||||
|
||||
```c
|
||||
```<!---c-->
|
||||
expr1 && expr2 && (expr3=etc);
|
||||
```
|
||||
|
||||
which is the same as:
|
||||
|
||||
```c
|
||||
```<!---c-->
|
||||
if (expr1 && expr2) expr3=etc;
|
||||
```
|
||||
|
||||
@@ -124,7 +124,7 @@ expressions if they aren't in an assignment or conditional
|
||||
statement. This might warrant a warning, since other compilers
|
||||
may do this. I found MANY compilers botched:
|
||||
|
||||
```c
|
||||
```<!---c-->
|
||||
expr1 && (expr2,expr3);
|
||||
```
|
||||
|
||||
@@ -146,7 +146,7 @@ such statements to make it more portable.
|
||||
|
||||
Normally (!), a reversible C program is done thus:
|
||||
|
||||
```c
|
||||
```<!---c-->
|
||||
/**/ forward code /*/ edoc drawkcab /**/
|
||||
```
|
||||
|
||||
@@ -154,7 +154,7 @@ If your compiler nests comments, it will get this wrong.
|
||||
However, I have made some bits of the code palindromic,
|
||||
(or different, but reversible) so it is more like:
|
||||
|
||||
```c
|
||||
```<!---c-->
|
||||
/**/forward/*//**/ palindromic /**//*/drawkcab/**/
|
||||
```
|
||||
|
||||
|
||||
+14
-14
@@ -141,24 +141,24 @@ 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> all</span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> make all</code></pre>
|
||||
<h3 id="bugs-and-misfeatures">Bugs and (Mis)features:</h3>
|
||||
<p>The current status of this entry is:</p>
|
||||
<pre><code> STATUS: known bug - please help us fix</code></pre>
|
||||
<p>For more detailed information see <a href="../../bugs.html#1989_westley">1989 westley bugs</a>.</p>
|
||||
<h2 id="try">Try:</h2>
|
||||
<p>Try compiling and running the 4 resulting programs like:</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">./compile.sh</span></span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> ./compile.sh</code></pre>
|
||||
<p>If you need to specify an alternate compiler path, say because your default
|
||||
compiler is clang (or in the case of macOS gcc is clang) you can do so like:</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="va">CC</span><span class="op">=</span>/opt/local/bin/gcc-mp-12 <span class="ex">./compile.sh</span></span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> CC=/opt/local/bin/gcc-mp-12 ./compile.sh</code></pre>
|
||||
<p>If you wish to delay the script or remove the delay you can do so like:</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="va">DELAY</span><span class="op">=</span>2 <span class="ex">./compile.sh</span></span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> DELAY=2 ./compile.sh</code></pre>
|
||||
<p>Finally try:</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">./westley</span></span>
|
||||
<span id="cb6-2"><a href="#cb6-2" aria-hidden="true" tabindex="-1"></a> <span class="co"># input some lines of text, sending EOF (usually ctrl-d) to end</span></span>
|
||||
<span id="cb6-3"><a href="#cb6-3" aria-hidden="true" tabindex="-1"></a></span>
|
||||
<span id="cb6-4"><a href="#cb6-4" aria-hidden="true" tabindex="-1"></a> <span class="ex">./try.sh</span> <span class="co"># demo of some input</span></span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> ./westley
|
||||
# input some lines of text, sending EOF (usually ctrl-d) to end
|
||||
|
||||
./try.sh # demo of some input</code></pre>
|
||||
<h2 id="judges-remarks">Judges’ remarks:</h2>
|
||||
<p>There is a secret way to get ONE of the versions to print out
|
||||
“<code>Hello, world!\n</code>”. Can you find how to do it?</p>
|
||||
@@ -175,7 +175,7 @@ different algorithm for each version (hereafter referred to as
|
||||
(ROT13 and reversed)).</p>
|
||||
<p>When compiling these versions, one needs to define <code>trgpune</code>
|
||||
in the compile line (which the Makefile now has). Example:</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">cc</span> <span class="at">-Dtrgpune</span><span class="op">=</span>putchar ver3.c <span class="at">-o</span> ver3</span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> cc -Dtrgpune=putchar ver3.c -o ver3</code></pre>
|
||||
<p><code>trgpune</code> is the ROT13 of <code>getchar()</code>, so <code>getchar()</code> and <code>putchar()</code>
|
||||
are exchanged in the ROT13 counterpart. It is easy to see that
|
||||
this is unavoidable. I must have a <code>#define</code> for a library
|
||||
@@ -207,14 +207,14 @@ first argument (argc) must be at least one).</p>
|
||||
function <code>vs()</code> to define in the ROT13 version. But a function
|
||||
called <code>vs()</code> turns into a function called <code>if()</code> in the original,
|
||||
so it can’t be done. Therefore, I do:</p>
|
||||
<div class="sourceCode" id="cb8"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb8-1"><a href="#cb8-1" aria-hidden="true" tabindex="-1"></a> expr1 <span class="op">&&</span> expr2 <span class="op">&&</span> <span class="op">(</span>expr3<span class="op">=</span>etc<span class="op">);</span></span></code></pre></div>
|
||||
<pre class="<!---c-->"><code> expr1 && expr2 && (expr3=etc);</code></pre>
|
||||
<p>which is the same as:</p>
|
||||
<div class="sourceCode" id="cb9"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb9-1"><a href="#cb9-1" aria-hidden="true" tabindex="-1"></a> <span class="cf">if</span> <span class="op">(</span>expr1 <span class="op">&&</span> expr2<span class="op">)</span> expr3<span class="op">=</span>etc<span class="op">;</span></span></code></pre></div>
|
||||
<pre class="<!---c-->"><code> if (expr1 && expr2) expr3=etc;</code></pre>
|
||||
<p>A/UX on the Macintosh doesn’t get this right; it evaluates ALL
|
||||
expressions if they aren’t in an assignment or conditional
|
||||
statement. This might warrant a warning, since other compilers
|
||||
may do this. I found MANY compilers botched:</p>
|
||||
<div class="sourceCode" id="cb10"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb10-1"><a href="#cb10-1" aria-hidden="true" tabindex="-1"></a> expr1 <span class="op">&&</span> <span class="op">(</span>expr2<span class="op">,</span>expr3<span class="op">);</span></span></code></pre></div>
|
||||
<pre class="<!---c-->"><code> expr1 && (expr2,expr3);</code></pre>
|
||||
<p><code>expr2</code> was OFTEN evaluated even if <code>expr1</code> was false. I removed
|
||||
such statements to make it more portable.</p>
|
||||
<h3 id="variable-names-worth-noting">Variable names worth noting</h3>
|
||||
@@ -224,11 +224,11 @@ such statements to make it more portable.</p>
|
||||
<p><code>tang</code> and <code>gnat</code> are both ROT13 and palindrome pairs!</p>
|
||||
<p>–</p>
|
||||
<p>Normally (!), a reversible C program is done thus:</p>
|
||||
<div class="sourceCode" id="cb11"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb11-1"><a href="#cb11-1" aria-hidden="true" tabindex="-1"></a> <span class="co">/**/</span> forward code <span class="co">/*/ edoc drawkcab /**/</span></span></code></pre></div>
|
||||
<pre class="<!---c-->"><code> /**/ forward code /*/ edoc drawkcab /**/</code></pre>
|
||||
<p>If your compiler nests comments, it will get this wrong.
|
||||
However, I have made some bits of the code palindromic,
|
||||
(or different, but reversible) so it is more like:</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> <span class="co">/**/</span>forward<span class="co">/*//**/</span> palindromic <span class="co">/**//*/drawkcab/**/</span></span></code></pre></div>
|
||||
<pre class="<!---c-->"><code> /**/forward/*//**/ palindromic /**//*/drawkcab/**/</code></pre>
|
||||
<p>The code can therefore be interlaced. There are eight
|
||||
such palindromic bits. You can find them within the
|
||||
<code>/*//**/ /**//*/</code> pairs.</p>
|
||||
|
||||
Reference in new issue
Block a user