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
@@ -1,20 +1,20 @@
|
||||
## To build:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
make
|
||||
```
|
||||
|
||||
|
||||
## To use:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
./prog > foo.c
|
||||
```
|
||||
|
||||
|
||||
## Try:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
./try.sh
|
||||
```
|
||||
|
||||
@@ -36,14 +36,14 @@ What is the difference between running `./prog` and `main`?
|
||||
Big terminals with tiny fonts have their uses in certain cases.
|
||||
One of them is:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
make treacl
|
||||
./treacl
|
||||
```
|
||||
|
||||
which is shorthand for:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
./prog < prog.c > treacle.c
|
||||
make treacle
|
||||
./treacle
|
||||
|
||||
@@ -141,11 +141,11 @@ Location: <a href="../../location.html#JP">JP</a> - <em>Japan</em></li>
|
||||
<!-- 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>
|
||||
<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 class="op">></span> foo.c</span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> ./prog > foo.c</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="ex">./try.sh</span></span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> ./try.sh</code></pre>
|
||||
<p>The script will ask you if you wish to run <code>make rake</code> but this is not necessary
|
||||
to fully enjoy the entry. <code>make rake</code> will run the <a href="rake.sh">rake.sh</a> script and
|
||||
then <code>prog</code> if all is built okay. If <code>rake</code> is not installed then it will check
|
||||
@@ -159,12 +159,12 @@ build <code>main.c</code>.</p>
|
||||
<h2 id="judges-remarks">Judges’ remarks:</h2>
|
||||
<p>Big terminals with tiny fonts have their uses in certain cases.
|
||||
One of them is:</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="fu">make</span> treacl</span>
|
||||
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a> <span class="ex">./treacl</span></span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> make treacl
|
||||
./treacl</code></pre>
|
||||
<p>which is shorthand for:</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">./prog</span> <span class="op"><</span> prog.c <span class="op">></span> treacle.c</span>
|
||||
<span id="cb5-2"><a href="#cb5-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">make</span> treacle</span>
|
||||
<span id="cb5-3"><a href="#cb5-3" aria-hidden="true" tabindex="-1"></a> <span class="ex">./treacle</span></span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> ./prog < prog.c > treacle.c
|
||||
make treacle
|
||||
./treacle</code></pre>
|
||||
<p>When using a smartphone to read the output, you may need to
|
||||
step back to see the bigger picture because that picture is worth
|
||||
more than 1000 words.</p>
|
||||
|
||||
+10
-10
@@ -134,7 +134,7 @@ the program!</p>
|
||||
<h2 id="how-did-i-achieve-that">How did I achieve that?</h2>
|
||||
<p>It is known that we can mitigate the quine restriction by <code>eval</code>.
|
||||
For example, this is a quine written in Ruby:</p>
|
||||
<div class="sourceCode" id="cb1"><pre class="sourceCode ruby"><code class="sourceCode ruby"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a> <span class="fu">eval</span> s<span class="kw">=</span><span class="st">"print 'eval s='; p s"</span></span></code></pre></div>
|
||||
<pre class="<!---ruby-->"><code> eval s="print 'eval s='; p s"</code></pre>
|
||||
<p>Note that <code>print</code> appears just once in the program.</p>
|
||||
<p>To emulate this approach in C, I adopted the following structure.</p>
|
||||
<pre><code> char s[]="<main code>int main() { <VM code> }";
|
||||
@@ -230,8 +230,8 @@ renaming and automatic register allocation only for this purpose.</p>
|
||||
<li><a href="gen-prog.c">gen-prog.c</a> generates <a href="prog.c">prog.c</a> based on <code>main.c</code>.</li>
|
||||
</ul>
|
||||
<p>You can run the process by <code>rake</code> command. <code>ruby-minisat</code> gem is needed.</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">$</span> gem install ruby-minisat</span>
|
||||
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a> <span class="ex">$</span> rake</span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> $ gem install ruby-minisat
|
||||
$ rake</code></pre>
|
||||
<h2 id="tools">Tools</h2>
|
||||
<p>I checked that the following QR code readers can read the output of my program.</p>
|
||||
<ul>
|
||||
@@ -243,13 +243,13 @@ found at
|
||||
<code>https://play.google.com/store/apps/details?id=com.google.zxing.client.android</code>
|
||||
but it appears to no longer exist.</p>
|
||||
<p>You can use <a href="tool.rb">tool.rb</a> to convert the output to a png file.</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">./main</span> Hello <span class="kw">|</span> <span class="ex">ruby</span> tool.rb <span class="op">></span> hello.png</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">$</span> zbarimg <span class="at">-q</span> hello.png</span>
|
||||
<span id="cb5-4"><a href="#cb5-4" aria-hidden="true" tabindex="-1"></a> <span class="ex">QR-Code:Hello</span></span>
|
||||
<span id="cb5-5"><a href="#cb5-5" aria-hidden="true" tabindex="-1"></a></span>
|
||||
<span id="cb5-6"><a href="#cb5-6" aria-hidden="true" tabindex="-1"></a> <span class="ex">$</span> ruby tool.rb prog.c</span>
|
||||
<span id="cb5-7"><a href="#cb5-7" aria-hidden="true" tabindex="-1"></a> <span class="ex">$</span> ruby tool.rb prog.c <span class="kw">|</span> <span class="ex">ruby</span> tool.rb</span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> ./main Hello | ruby tool.rb > hello.png
|
||||
|
||||
$ zbarimg -q hello.png
|
||||
QR-Code:Hello
|
||||
|
||||
$ ruby tool.rb prog.c
|
||||
$ ruby tool.rb prog.c | ruby tool.rb</code></pre>
|
||||
<h2 id="limitations">Limitations</h2>
|
||||
<ul>
|
||||
<li>QR code error correction level is fixed to L (Low).</li>
|
||||
|
||||
@@ -18,7 +18,7 @@ Do you think that it is possible to write QR code encoder in C within *1kB*?
|
||||
It is known that we can mitigate the quine restriction by `eval`.
|
||||
For example, this is a quine written in Ruby:
|
||||
|
||||
```ruby
|
||||
```<!---ruby-->
|
||||
eval s="print 'eval s='; p s"
|
||||
```
|
||||
|
||||
@@ -122,7 +122,7 @@ The compiler tool chain is the following.
|
||||
|
||||
You can run the process by `rake` command. `ruby-minisat` gem is needed.
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
$ gem install ruby-minisat
|
||||
$ rake
|
||||
```
|
||||
@@ -145,7 +145,7 @@ but it appears to no longer exist.
|
||||
|
||||
You can use [tool.rb](tool.rb) to convert the output to a png file.
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
./main Hello | ruby tool.rb > hello.png
|
||||
|
||||
$ zbarimg -q hello.png
|
||||
|
||||
Reference in new issue
Block a user