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="&lt;!---c--&gt;"><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:
Landon Curt Noll committed 2024-04-04 14:50:38 -07:00
1 parent 3919df50fb
commit b66c79254a
700 files changed
+7052 -7056

No files matched your search

+13 -13
View File
@@ -1,20 +1,20 @@
## To build:
```sh
```<!---sh-->
make
```
## To use:
```sh
```<!---sh-->
./prog
```
## Try:
```sh
```<!---sh-->
# Take a selfie
./prog 1000 selfie.jpg output.jpg
# Admire your portrait in cubist style
@@ -41,7 +41,7 @@ This program divides the image into a specified number of rectangles. This
process is content aware, so the algorithm tries to match most of the information.
However, it doesn't find the best theoretically possible layout.
```sh
```<!---sh-->
./prog 1000 input.jpg output.jpg
```
@@ -56,13 +56,13 @@ If you want to use `libjpeg` compiled from sources, then use the `LIBJPEG` defin
specify the path to includes and the library. For example using
[libjpeg source](https://mac-dev-env.patrickbougie.com/libjpeg/) version 9c:
```sh
```<!---sh-->
make prog LIBJPEG="-Ijpeg-9c jpeg-9c/libjpeg.a"
```
Use this command to build a PNG version (you need `libpng`):
```sh
```<!---sh-->
make prog_png LIBPNG="-lpng"
```
@@ -80,13 +80,13 @@ information!
First, make sure you have the compiler tools installed e.g. by:
```sh
```<!---sh-->
sudo xcode-select --install
```
Make sure you install [MacPorts](https://www.macports.org/install.php). Then do:
```sh
```<!---sh-->
sudo port install jpeg libpng ImageMagick
```
@@ -95,7 +95,7 @@ GIFs from the results using `makegif.sh`.
After that’s installed you need to run make with these options:
```sh
```<!---sh-->
make LDFLAGS="-I/opt/local/include -L/opt/local/lib"
```
@@ -103,7 +103,7 @@ After that’s installed you need to run make with these options:
First, make sure you have the compiler tools installed e.g. by:
```sh
```<!---sh-->
sudo xcode-select --install
```
@@ -111,14 +111,14 @@ Make sure you install [Homebrew](https://brew.sh).
Then:
```sh
```<!---sh-->
brew install libjpeg libpng
eval "$(brew shellenv)"
```
You are now ready to compile this entry:
```sh
```<!---sh-->
make clobber all
```
@@ -139,7 +139,7 @@ vertically to get the minimum difference.
You can use this command to make a GIF from output images (uses ImageMagick).
For instance after running the command suggested by the judges:
```sh
```<!---sh-->
convert -delay 10 -dither none -loop 0 $(find . -maxdepth 1 -type f -name '*jpg' | sort -V) $(find . -maxdepth 1 -type f -name '*jpg' | sort -rV) +map out.gif
```
+19 -19
View File
@@ -141,16 +141,16 @@ Location: <a href="../../location.html#RU">RU</a> - <em>Russian Federation</em>
<!-- 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="&lt;!---sh--&gt;"><code> make</code></pre>
<h2 id="to-use">To use:</h2>
<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="ex">./prog</span></span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> ./prog</code></pre>
<h2 id="try">Try:</h2>
<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="co"># Take a selfie</span></span>
<span id="cb3-2"><a href="#cb3-2" aria-hidden="true" tabindex="-1"></a> <span class="ex">./prog</span> 1000 selfie.jpg output.jpg</span>
<span id="cb3-3"><a href="#cb3-3" aria-hidden="true" tabindex="-1"></a> <span class="co"># Admire your portrait in cubist style</span></span>
<span id="cb3-4"><a href="#cb3-4" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb3-5"><a href="#cb3-5" aria-hidden="true" tabindex="-1"></a> <span class="co"># Also try:</span></span>
<span id="cb3-6"><a href="#cb3-6" aria-hidden="true" tabindex="-1"></a> <span class="ex">./try.sh</span></span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> # Take a selfie
./prog 1000 selfie.jpg output.jpg
# Admire your portrait in cubist style
# Also try:
./try.sh</code></pre>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>This entry has reminded us of a winning entry back in the early 90s. Can you
guess which one?</p>
@@ -161,7 +161,7 @@ rectangles. What is the complexity? Is it obvious from the source code?</p>
<p>This program divides the image into a specified number of rectangles. This
process is content aware, so the algorithm tries to match most of the information.
However, it doesn’t find the best theoretically possible layout.</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">./prog</span> 1000 input.jpg output.jpg</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> ./prog 1000 input.jpg output.jpg</code></pre>
<h3 id="building">Building</h3>
<p>You can build three versions, depending on the image format.</p>
<p>Default is JPEG version; if you have the <code>libjpeg</code> development package installed
@@ -169,9 +169,9 @@ in your system, then <code>make</code> without arguments should do the right thi
<p>If you want to use <code>libjpeg</code> compiled from sources, then use the <code>LIBJPEG</code> define to
specify the path to includes and the library. For example using
<a href="https://mac-dev-env.patrickbougie.com/libjpeg/">libjpeg source</a> version 9c:</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="fu">make</span> prog LIBJPEG=<span class="st">&quot;-Ijpeg-9c jpeg-9c/libjpeg.a&quot;</span></span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> make prog LIBJPEG=&quot;-Ijpeg-9c jpeg-9c/libjpeg.a&quot;</code></pre>
<p>Use this command to build a PNG version (you need <code>libpng</code>):</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">make</span> prog_png LIBPNG=<span class="st">&quot;-lpng&quot;</span></span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> make prog_png LIBPNG=&quot;-lpng&quot;</code></pre>
<p>And the PPM version (no additional dependencies, can read raw/ASCII PPM, writes
raw PPM):</p>
<pre><code> make prog_ppm</code></pre>
@@ -179,22 +179,22 @@ raw PPM):</p>
<p>Thanks to <a href="../../authors.html#Cody_Boone_Ferguson">Cody Boone Ferguson</a> for this
information!</p>
<p>First, make sure you have the compiler tools installed e.g. by:</p>
<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">sudo</span> xcode-select <span class="at">--install</span></span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> sudo xcode-select --install</code></pre>
<p>Make sure you install <a href="https://www.macports.org/install.php">MacPorts</a>. Then do:</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">sudo</span> port install jpeg libpng ImageMagick</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> sudo port install jpeg libpng ImageMagick</code></pre>
<p>The program itself doesn’t need ImageMagick, install it only if you plan to make
GIFs from the results using <code>makegif.sh</code>.</p>
<p>After that’s installed you need to run make with these options:</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="fu">make</span> LDFLAGS=<span class="st">&quot;-I/opt/local/include -L/opt/local/lib&quot;</span></span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> make LDFLAGS=&quot;-I/opt/local/include -L/opt/local/lib&quot;</code></pre>
<h3 id="building-on-macos-with-homebrew">Building on macOS with Homebrew</h3>
<p>First, make sure you have the compiler tools installed e.g. by:</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="fu">sudo</span> xcode-select <span class="at">--install</span></span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> sudo xcode-select --install</code></pre>
<p>Make sure you install <a href="https://brew.sh">Homebrew</a>.</p>
<p>Then:</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">brew</span> install libjpeg libpng</span>
<span id="cb12-2"><a href="#cb12-2" aria-hidden="true" tabindex="-1"></a> <span class="bu">eval</span> <span class="st">&quot;</span><span class="va">$(</span><span class="ex">brew</span> shellenv<span class="va">)</span><span class="st">&quot;</span></span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> brew install libjpeg libpng
eval &quot;$(brew shellenv)&quot;</code></pre>
<p>You are now ready to compile this entry:</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="fu">make</span> clobber all</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> make clobber all</code></pre>
<h3 id="notes">Notes</h3>
<p>Made this thing while experimenting with the idea of representing an image with
rectangles (lossy compression). It’s not very good in that sense, but the
@@ -206,7 +206,7 @@ the picture data is split (halves may have different size) horizontally or
vertically to get the minimum difference.</p>
<p>You can use this command to make a GIF from output images (uses ImageMagick).
For instance after running the command suggested by the judges:</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="ex">convert</span> <span class="at">-delay</span> 10 <span class="at">-dither</span> none <span class="at">-loop</span> 0 <span class="va">$(</span><span class="fu">find</span> . <span class="at">-maxdepth</span> 1 <span class="at">-type</span> f <span class="at">-name</span> <span class="st">&#39;*jpg&#39;</span> <span class="kw">|</span> <span class="fu">sort</span> <span class="at">-V</span><span class="va">)</span> <span class="va">$(</span><span class="fu">find</span> . <span class="at">-maxdepth</span> 1 <span class="at">-type</span> f <span class="at">-name</span> <span class="st">&#39;*jpg&#39;</span> <span class="kw">|</span> <span class="fu">sort</span> <span class="at">-rV</span><span class="va">)</span> +map out.gif</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> convert -delay 10 -dither none -loop 0 $(find . -maxdepth 1 -type f -name &#39;*jpg&#39; | sort -V) $(find . -maxdepth 1 -type f -name &#39;*jpg&#39; | sort -rV) +map out.gif</code></pre>
<p>NOTE: the above is done in the <a href="try.sh">try.sh</a> script.</p>
<p>Also provided <code>makegif.sh</code> to aid with GIF creation.</p>
<!--