From ed866b45e84415b4004dbcb83fb8d51fe5cbfc1d Mon Sep 17 00:00:00 2001
From: Landon Curt Noll
Date: Fri, 19 Jul 2024 00:18:41 -0700
Subject: [PATCH] format headers
We move `tmp/format-headers.sh` into `bin/format-headers.sh`.
We also add a few missing empty lines to `README.md`.
We add `bin/format-headers.sh` to the `bin/README.md`.
We run `bin/format-headers.sh` to perform the above.
Performed `make www` to accomplish the above and to test under macOS.
---
1984/laman/README.md | 1 -
1985/sicherman/README.md | 1 -
1986/wall/README.md | 1 +
1989/jar.2/README.md | 1 +
1990/jaw/README.md | 1 +
1990/westley/README.md | 1 -
1991/fine/README.md | 2 --
1992/ant/README.md | 4 ++--
1992/ant/index.html | 4 ++--
1993/ant/README.md | 6 +++---
1993/ant/index.html | 6 +++---
1994/tvr/README.md | 1 -
2001/cheong/README.md | 2 --
2001/ollinger/README.md | 1 -
2004/hibachi/README.md | 1 -
2006/hamre/README.md | 2 --
2006/stewart/README.md | 1 -
2011/konno/README.md | 1 -
2011/toledo/README.md | 2 +-
2011/toledo/index.html | 2 +-
2013/hou/README.md | 2 --
2015/howe/README.md | 1 -
2020/otterness/README.md | 2 +-
2020/otterness/index.html | 2 +-
README.md | 3 +++
bin/README.md | 34 +++++++++++++++++++++++++++++++++-
{tmp => bin}/format-headers.sh | 30 +++++++++++++++++++++++++++---
bin/index.html | 10 ++++++++++
28 files changed, 90 insertions(+), 35 deletions(-)
rename {tmp => bin}/format-headers.sh (60%)
diff --git a/1984/laman/README.md b/1984/laman/README.md
index df225277a..5c782e1f7 100644
--- a/1984/laman/README.md
+++ b/1984/laman/README.md
@@ -14,7 +14,6 @@ The current status of this entry is:
For more detailed information see [1984/laman in bugs.html](../../bugs.html#1984_laman).
-
## To use:
```
diff --git a/1985/sicherman/README.md b/1985/sicherman/README.md
index 7787dc88e..b7182a8b9 100644
--- a/1985/sicherman/README.md
+++ b/1985/sicherman/README.md
@@ -36,7 +36,6 @@ The [sicherman.alt.c](%%REPO_URL%%/1985/sicherman/sicherman.alt.c) is a slight c
### Alternate build:
-
```
make alt
```
diff --git a/1986/wall/README.md b/1986/wall/README.md
index 02a75c60f..998b2dc8a 100644
--- a/1986/wall/README.md
+++ b/1986/wall/README.md
@@ -27,6 +27,7 @@ supports the `-traditional-cpp` option.
make alt
```
+
### Alternate use:
Use `wall.alt` as you would `wall` above.
diff --git a/1989/jar.2/README.md b/1989/jar.2/README.md
index 757a53f58..f52543b04 100644
--- a/1989/jar.2/README.md
+++ b/1989/jar.2/README.md
@@ -37,6 +37,7 @@ It has no error recovery, and performs rather poorly in a number of cases. Even
so, placing all this functionality in such a small, densely packed program, is
impressive enough to win the `Best of Show` award.
+
## Author's remarks:
This program implements a Lisp interpreter in 1465 bytes of source.
diff --git a/1990/jaw/README.md b/1990/jaw/README.md
index 37b79b40b..26ef5e762 100644
--- a/1990/jaw/README.md
+++ b/1990/jaw/README.md
@@ -4,6 +4,7 @@
make all
```
+
### Bugs and (Mis)features:
The current status of this entry is:
diff --git a/1990/westley/README.md b/1990/westley/README.md
index b9248fa68..a60bab6c0 100644
--- a/1990/westley/README.md
+++ b/1990/westley/README.md
@@ -18,7 +18,6 @@ The current status of this entry is:
For more detailed information see [1990/westley in bugs.html](../../bugs.html#1990_westley).
-
## To use:
```
diff --git a/1991/fine/README.md b/1991/fine/README.md
index b74bf76ca..e45e088b5 100644
--- a/1991/fine/README.md
+++ b/1991/fine/README.md
@@ -53,10 +53,8 @@ If you get stuck, come back and read the author's remarks for additional hints
and information.
-
## Author's remarks:
-
The author wishes to thank J Greely for the last 6 bytes.
Here's about how it does it:
diff --git a/1992/ant/README.md b/1992/ant/README.md
index fb56f8bef..d280366dc 100644
--- a/1992/ant/README.md
+++ b/1992/ant/README.md
@@ -33,14 +33,14 @@ This version, [ant.alt.c](%%REPO_URL%%/1992/ant/ant.alt.c), was provided by the
author in 2024, and is an unobfuscated version.
-## Alternate build:
+### Alternate build:
```
make alt
```
-## Alternate use:
+### Alternate use:
Use `ant.alt` as you would `ant` above.
diff --git a/1992/ant/index.html b/1992/ant/index.html
index 42c104046..b8e1880c9 100644
--- a/1992/ant/index.html
+++ b/1992/ant/index.html
@@ -421,9 +421,9 @@ code below.
Alternate code:
This version, ant.alt.c, was provided by the
author in 2024, and is an unobfuscated version.
-Alternate build:
+Alternate build:
make alt
-Alternate use:
+Alternate use:
Use ant.alt as you would ant above.
Try:
./try.alt.sh
diff --git a/1993/ant/README.md b/1993/ant/README.md
index f3af494a7..78b82d128 100644
--- a/1993/ant/README.md
+++ b/1993/ant/README.md
@@ -39,7 +39,7 @@ unobfuscated version provided by the author. You can look at this code if you
want some clues in how it works.
-## Alternate build:
+### Alternate build:
If you wish to build this deobfuscated version, you can do so like:
@@ -49,12 +49,12 @@ If you wish to build this deobfuscated version, you can do so like:
```
-## Alternate use:
+### Alternate use:
Use `ant.alt` like you would `ant` above.
-## Alternate try:
+### Alternate try:
```
./try.alt.sh
diff --git a/1993/ant/index.html b/1993/ant/index.html
index a061ff7fd..c78c3ee96 100644
--- a/1993/ant/index.html
+++ b/1993/ant/index.html
@@ -426,12 +426,12 @@ code below.
The ant.alt.c is an
unobfuscated version provided by the author. You can look at this code if you
want some clues in how it works.
-Alternate build:
+Alternate build:
If you wish to build this deobfuscated version, you can do so like:
make alt
-Alternate use:
+Alternate use:
Use ant.alt like you would ant above.
-Alternate try:
+Alternate try:
./try.alt.sh
See the author’s POSIX P1003.2-like documentation file ant.txt for
diff --git a/1994/tvr/README.md b/1994/tvr/README.md
index 2b3ca7d57..c950d6ba1 100644
--- a/1994/tvr/README.md
+++ b/1994/tvr/README.md
@@ -37,7 +37,6 @@ Mode may be a value from 0 to 12.
## Alternate code:
-
### NOTICE to those who wish for a greater challenge:
**If you want a greater challenge, don't read any further**:
diff --git a/2001/cheong/README.md b/2001/cheong/README.md
index c54a8f052..42c62a570 100644
--- a/2001/cheong/README.md
+++ b/2001/cheong/README.md
@@ -14,8 +14,6 @@ The current status of this entry is:
For more detailed information see [2001/cheong in bugs.html](../../bugs.html#2001_cheong).
-
-
## To use:
```
diff --git a/2001/ollinger/README.md b/2001/ollinger/README.md
index 42ab18819..855dcd6cf 100644
--- a/2001/ollinger/README.md
+++ b/2001/ollinger/README.md
@@ -14,7 +14,6 @@ The current status of this entry is:
For more detailed information see [2001/ollinger in bugs.html](../../bugs.html#2001_ollinger).
-
## To use:
```
diff --git a/2004/hibachi/README.md b/2004/hibachi/README.md
index 5882a6a64..bb10d1a05 100644
--- a/2004/hibachi/README.md
+++ b/2004/hibachi/README.md
@@ -46,7 +46,6 @@ This will run the `configure` script and then compile and link in (in
Then with your browser do the same as for the original source.
-
## Judges' remarks:
This entry violates the [guidelines](../../2004/guidelines.txt) in so many ways! We
diff --git a/2006/hamre/README.md b/2006/hamre/README.md
index 4f95a9eb2..fd454d47d 100644
--- a/2006/hamre/README.md
+++ b/2006/hamre/README.md
@@ -14,8 +14,6 @@ The current status of this entry is:
For more detailed information see [2006/hamre in bugs.html](../../bugs.html#2006_hamre).
-
-
## To use:
```
diff --git a/2006/stewart/README.md b/2006/stewart/README.md
index 1934a2022..a29c64104 100644
--- a/2006/stewart/README.md
+++ b/2006/stewart/README.md
@@ -14,7 +14,6 @@ The current status of this entry is:
For more detailed information see [2006/stewart in bugs.html](../../bugs.html#2006_stewart).
-
## To use:
```
diff --git a/2011/konno/README.md b/2011/konno/README.md
index 4b296fd33..e1bbe02ae 100644
--- a/2011/konno/README.md
+++ b/2011/konno/README.md
@@ -14,7 +14,6 @@ The current status of this entry is:
For more detailed information see [2011/konno in bugs.html](../../bugs.html#2011_konno).
-
## To use:
```
diff --git a/2011/toledo/README.md b/2011/toledo/README.md
index 2e7b4831e..8a1383c78 100644
--- a/2011/toledo/README.md
+++ b/2011/toledo/README.md
@@ -18,7 +18,7 @@ Windows](%%REPO_URL%%/2011/toledo/toledo.alt2.c). See [Alternate code](#alternat
```
-## Alternate code
+## Alternate code:
The first alt version, [toledo.alt.c](%%REPO_URL%%/2011/toledo/toledo.alt.c), allows you to reconfigure
the controls and the dimensions more easily.
diff --git a/2011/toledo/index.html b/2011/toledo/index.html
index 63cbffb96..a91bf51b3 100644
--- a/2011/toledo/index.html
+++ b/2011/toledo/index.html
@@ -415,7 +415,7 @@ controls and size and Alternate code below.
To use:
./toledo
-Alternate code
+Alternate code:
The first alt version, toledo.alt.c, allows you to reconfigure
the controls and the dimensions more easily.
The second version, toledo.alt2.c, should work for Windows but
diff --git a/2013/hou/README.md b/2013/hou/README.md
index ce43ffeb3..5232fb20c 100644
--- a/2013/hou/README.md
+++ b/2013/hou/README.md
@@ -75,8 +75,6 @@ even needing to create a temporary file but as the author refers to it and its
uses it can still be generated to follow along.
-
-
## Author's remarks:
### Using hou
diff --git a/2015/howe/README.md b/2015/howe/README.md
index 73c14d2d3..a3c55c802 100644
--- a/2015/howe/README.md
+++ b/2015/howe/README.md
@@ -17,7 +17,6 @@ The current status of this entry is:
For more detailed information see [2015/howe in bugs.html](../../bugs.html#2015_howe).
-
## To use:
```
diff --git a/2020/otterness/README.md b/2020/otterness/README.md
index 6dd357de3..c73b1486f 100644
--- a/2020/otterness/README.md
+++ b/2020/otterness/README.md
@@ -53,7 +53,7 @@ with the MIDI "SMF" file format.
entry](https://www.nathanotterness.com/2021/04/obfuscated_c_2020.html).
-## Alternate use:
+### Alternate use:
Use `prog.alt` as you would `prog`.
diff --git a/2020/otterness/index.html b/2020/otterness/index.html
index 1767012ad..3182583be 100644
--- a/2020/otterness/index.html
+++ b/2020/otterness/index.html
@@ -437,7 +437,7 @@ with the MIDI “SMF” file format.
… at their web page about the
entry.
-Alternate use:
+Alternate use:
Use prog.alt as you would prog.
Alternate try:
./try.alt.sh
diff --git a/README.md b/README.md
index ac3a6bb69..28f979fe6 100644
--- a/README.md
+++ b/README.md
@@ -22,6 +22,7 @@ temp-test-ioccc GitHub repo.
# The International Obfuscated C Code Contest
+
## **Obfuscate** | *verb* [with object]
- render obscure, unclear, or unintelligible: the spelling changes will deform
@@ -33,6 +34,7 @@ obfuscatory | adjective
late Middle English (as adjective): from late Latin **obfuscat-**
'darkened', from the verb **obfuscare**, based on Latin **fuscus** 'dark'.
+
## **Obfuscation** | *noun*
- the action of making something obscure, unclear, or unintelligible: when
@@ -44,6 +46,7 @@ mealy-mouthed denials and obfuscations.
The official IOCCC website is [www.ioccc.org](https://www.ioccc.org).
+
## How it was started:
The original inspiration of the International Obfuscated C Code Contest came
diff --git a/bin/README.md b/bin/README.md
index cfe3ecde8..9287d64f4 100644
--- a/bin/README.md
+++ b/bin/README.md
@@ -49,6 +49,7 @@ to set the verbosity level to `3`. The default for verbosity is `0`, no
verbosity, though using the [top level Makefile](%%REPO_URL%%/Makefile) will,
for some tools, set a verbosity level.
+
### Get version string of a tool
If you just want to know what version the tool is, you can use the `-V` option.
@@ -111,6 +112,7 @@ Or for example:
bin/all-years.sh -v 1 bin/chk-entry.sh
```
+
### [chk-entry.sh](%%REPO_URL%%/bin/chk-entry.sh)
@@ -131,6 +133,7 @@ the top level `Makefile` by:
make verify_entry_files
```
+
### [filelist.entry.json.awk](%%REPO_URL%%/bin/filelist.entry.json.awk)
@@ -186,6 +189,20 @@ We recommend that this tool be invoked via the top level `Makefile` by:
make find_missing_links
```
+
+
+
+Format select headers and preceding empty lines in entry README.md files.
+
+Usage:
+
+```
+ bin/format-headers.sh
+```
+
+
### [gen-authors.sh](%%REPO_URL%%/bin/gen-authors.sh)
@@ -223,6 +240,7 @@ We recommend that this tool be invoked via the top level `Makefile` by:
make gen_location
```
+
### [gen-other-html.sh](%%REPO_URL%%/bin/gen-other-html.sh)
@@ -242,6 +260,7 @@ We recommend that this tool be invoked via the top level `Makefile` by:
make gen_other_html
```
+
### [gen-sitemap.sh](%%REPO_URL%%/bin/gen-sitemap.sh)
@@ -309,6 +328,7 @@ We recommend that this tool be invoked via the top level `Makefile` by:
unless the `contest_status` is to be changed, but since only the judges should
do that, that is not a problem.
+
### [gen-top-html.sh](%%REPO_URL%%/bin/gen-top-html.sh)
@@ -365,6 +385,7 @@ We recommend that this tool be invoked via the top level `Makefile` by:
which will create the `index.html` for every IOCCC year (`1984/index.html`,
`1985/index.html` etc.).
+
### [gen-years.sh](%%REPO_URL%%/bin/gen-years.sh)
@@ -447,7 +468,9 @@ This tool is used in the [bin/md2html.cfg](%%REPO_URL%%/bin/md2html.cfg) file as
the [md2html tool](index.html#md2html).
+
### [output-year-index.sh](%%REPO_URL%%/bin/output-year-index.sh)
+
Output the inventory for a given year's winning entries in HTML form. In other
words in [1984](../1984/index.html) it would list, as links, the four winning
@@ -458,7 +481,9 @@ This tool is used in the [bin/md2html.cfg](%%REPO_URL%%/bin/md2html.cfg) file as
the [md2html tool](index.html#md2html).
+
### [pandoc-wrapper.sh](%%REPO_URL%%/bin/pandoc-wrapper.sh)
+
Wrapper tool to run `pandoc(1)`.
@@ -595,6 +620,7 @@ Print substitutions for an entry's `index.html`.
This tool is used in the [bin/md2html.cfg](%%REPO_URL%%/bin/md2html.cfg) file.
+
### [subst.entry-navbar.awk](%%REPO_URL%%/bin/subst.entry-navbar.awk)
@@ -612,6 +638,7 @@ Print substitutions for a year level `index.html`.
This tool is used in the [bin/md2html.cfg](%%REPO_URL%%/bin/md2html.cfg) file.
+
### [subst.year-navbar.awk](%%REPO_URL%%/bin/subst.year-navbar.awk)
@@ -620,6 +647,7 @@ Output substitutions for `navbar` on behalf of a year level `index.html`.
This tool is used in [subst.year-index.sh](index.html#subst-year-index).
+
## [tar-entry.sh](%%REPO_URL%%/bin/tar-entry.sh)
@@ -766,7 +794,6 @@ For example:
will cause no HTML content to be produced during the `footer` HTML phase.
-
## HTML phases
@@ -831,6 +858,7 @@ it is a file under topdir.
`getopt` phase 0 is the only `getopt` phase where `-d topdir` and `-c
md2html.cfg` may be used.
+
### `getopt` phase 1
@@ -845,6 +873,7 @@ The `-o "output tool"` is not allowed to output another `"-o tool"` or a `"-O
tool=optstr"`. Instead a `-o "output tool"` may execute another `-o "output
tool"` and merge the output into its own.
+
### `getopt` phase 2
@@ -854,6 +883,7 @@ matched by a saved argument.
The match is made with the (possibly modified) phase 0 argument.
+
### `getopt` phase 3
@@ -868,6 +898,7 @@ The `-o "output tool"` is not allowed to output another `"-o tool"` or a `"-O
tool=optstr"`. Instead a `-o "output tool"` may execute another `-o "output
tool"` and merge the output into its own.
+
### Command line option order
@@ -931,6 +962,7 @@ When `-E exitcode` is evaluated, the application will exit with the `exitcode`
value. If one wishes to also output a message to `stderr`, the `-e string` must
come **BEFORE** any `-E exitcode` in the command line.
+
### Substitution tokens
diff --git a/tmp/format-headers.sh b/bin/format-headers.sh
similarity index 60%
rename from tmp/format-headers.sh
rename to bin/format-headers.sh
index 5b7ec7d35..bde03e468 100755
--- a/tmp/format-headers.sh
+++ b/bin/format-headers.sh
@@ -1,13 +1,37 @@
#!/usr/bin/env bash
#
-# format-headers.sh - script that formats headers in README.md files so that
-# before a line that starts with '##' (as in '^##') that have specific names
-# there are two blank lines (\n\n).
+# format-headers.sh - format select headers and preceding empty lines in entry README.md files
+#
+# We formats headers in README.md files so that before a line that starts with
+# '##' (as in '^##') that have specific names there are two blank lines (\n\n).
#
# Script written by Landon with minor improvements by Cody Boone Ferguson where
# now it only acts on files under git control rather than any README.md file in
# the [0-9]{4} directories.
#
+# Copyright (c) 2023-2024 by Landon Curt Noll. All Rights Reserved.
+#
+# Permission to use, copy, modify, and distribute this software and
+# its documentation for any purpose and without fee is hereby granted,
+# provided that the above copyright, this permission notice and text
+# this comment, and the disclaimer below appear in all of the following:
+#
+# supporting documentation
+# source copies
+# source works derived from this source
+# binaries derived from this source or from derived source
+#
+# LANDON CURT NOLL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO
+# EVENT SHALL LANDON CURT NOLL BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+# CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
+# USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+# OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+# PERFORMANCE OF THIS SOFTWARE.
+#
+# chongo (Landon Curt Noll, http://www.isthe.com/chongo/index.html) /\oo/\
+#
+# Share and enjoy! :-)
for i in $(git ls-files '[0-9][0-9][0-9][0-9]/*README.md'); do
perl -0777 -p -i -e 's/([^\n]\n)\n*##*[[:space:]]*(To build):?\n\n*([^\n])?/$1\n\n## $2:\n\n$3/' "$i"
diff --git a/bin/index.html b/bin/index.html
index 344f18d4b..81dcc2f3c 100644
--- a/bin/index.html
+++ b/bin/index.html
@@ -490,6 +490,12 @@ that is NOT an IOCCC markdown best practice.
details.
We recommend that this tool be invoked via the top level Makefile by:
make find_missing_links
+
+Format select headers and preceding empty lines in entry README.md files.
+Usage:
+ bin/format-headers.sh
@@ -628,14 +634,18 @@ inventory, see the inventory in
1984/anonymous.
This tool is used in the bin/md2html.cfg file as part of
the md2html tool.
+
Output the inventory for a given year’s winning entries in HTML form. In other
words in 1984 it would list, as links, the four winning
entries, which you can see directly at 1984
inventory.
This tool is used in the bin/md2html.cfg file as part of
the md2html tool.
+
Wrapper tool to run pandoc(1).