improve markdown to HTML tools, build location.html, authors.html, years.html

Renamed `.winner.json` to `.entry.json` as per recent decisions made for issue #2156.

JSON element _winner_JSON_format_version_ renamed to _entry_JSON_format_version_
in `.winner.json`.

Changed _entry_JSON_format_version_ from "1.0 2024-01-14" to "1.1 2024-02-11".

JSON element _winner_id_ renamed to _entry_id_ in `.entry.json`
JSON element _winner_text renamed to _entry_text_ in `.entry.json`
JSON element _winner_id_ renamed to _entry_id_ in `author/author_handle.json` files.

Changed _author_JSON_format_version_ from "1.0 2023-06-10" to "1.1 2024-02-11".

Renamed `tmp/gen_winner_json.sh` to `tmp/gen_entry_json.sh`.

Renamed `tmp/example.dot_winner.json` to `tmp/example.dot_entry.json`.

Renamed `tmp/winner_id.txt` to `tmp/entry_id.txt`.

Renamed `tmp/winner_dir.txt` to `tmp/entry_dir.txt`.

Moved outdated `tmp/awards_check.sh` into `tmp/OLD_manifest/awards_check.sh`.
Moved outdated `tmp/awards_check.sh` into `tmp/OLD_manifest/awards_check.sh`.
Moved outdated `tmp/src/winner_name` into `tmp/OLD_manifest/winner_name`.
Moved outdated `tmp/sql` into `tmp/OLD_manifest/sql`.
Moved outdated `tmp/template-footer.html` into `tmp/OLD_manifest/template-footer.html`.
Moved outdated `tmp/template-header.html` into `tmp/OLD_manifest/template-header.html`.
Moved outdated `tmp/template-top.html` into `tmp/OLD_manifest/template-top.html`.
Moved outdated `tmp/test.html` into `tmp/OLD_manifest/test.html`.
Moved outdated `tmp/fake.gen_index.sh` into `tmp/OLD_manifest/fake.gen_index.sh`.
Moved outdated `tmp/old-ioccc.css` into `tmp/OLD_manifest/old-ioccc.css`.

Removed winner_name from `tmp/src/Makefile`.

Updated `tmp/example.dot_entry.json` to reflect the above JSON changes.

Updated `tmp/manifest.numbers` to reflect the above JSON changes.

Updated `tmp/README.md` to reflect the above JSON changes.
Sorted `tmp/README.md` by existing `tmp` filenames.

Updated all `.entry.json` files to reflect the above JSON changes.

Updated all `author/author_handle.json` files to reflect the above JSON changes.

Added new tool `bin/gen-location.sh` to form the top level file `location.html`
from `author/author_handle.json` files!

Added new tool `bin/gen-years.sh` to form the top level file `years.html`
using `.top`, `.year` and `.entry.json' files!

Added new tool `bin/gen-authors.sh` to form a new top level file
`/authors.html` from `author/author_handle.json` and related
`.entry.json' files!

The old `winners.html` file now redirects to the new `authors.html` file.

Renamed `bin/gen-author.sh` to `bin/output-index-author.sh`.
Renamed `bin/subst.winner-index.sh` to `subst.entry-index.sh`.
Renamed `bin/subst.winner-index.awk` to `subst.entry-index.awk`.
Renamed `bin/manifest.entry.json.awk` to `bin/manifest.entry.json.awk`.
Renamed `bin/gen-inventory.sh` to `bin/output-index-inventory.sh`.
Renamed `bin/sort.gitignore` to `bin/sort.gitignore.sh`.
Renamed `bin/sgi` to `bin/sgi.sh`.

The core logic of converting markdown to HTML has been
generalized into a new `bin/md2html.sh` tool.

The `bin/readme2index.sh` tool now calls the
new `bin/md2html.sh` tool to form entry's `index.html` files.

The `bin/quick-readme2index.sh` tool now calls the new `bin/md2html.sh`
tool, unless the `index.html` is newer than both `.entry.json` and
`README.md`, to form entry `index.html` files.

Increased, slightly, the speed of the `bin/quick-readme2index.sh` tool
with the entry's `index.html` file does not need to be updated.

The `bin/quick-readme2index.sh` tool will touch the `index.html` file,
even if the `bin/md2html.sh` tool determines that the `index.html` file
did not change, so that the `index.html` file will not appear
out of date with respect to `.entry.json`.

Slightly improved the look and feel of `index.html` files for entries.

The logic of `bin/all-run.sh` has been improved.  The initial
processing, from first bash version check, thru the -N test, serves
as the model for the `bin/readme2index.sh` tool and the
`bin/quick-readme2index.sh` tool.  There tools now share
a common set of command line options.

Changed the format of `inc/md2html.cfg` so that for a given "_file_glob_"
match, options follow, one per line.  The "_file_glob_" is on a line
by itself.  The option lines that follow must be intended:

```
[12][0-9][0-9][0-9]/README.md
	-H
	topnav=year
	-o
	bin/subst.default.sh
	-o
	bin/subst.year.sh
```

Added "-D ./" to top level markdown files in `inc/md2html.cfg`.

The above intending is performed with 1 or more whitespace
characters, although we use a leading tab "convention"
out of deference to Makefile formats. :-)

Once a new "_file_glob_" is found, the set of any previous
option lines is said to have ended.

The general argument processing logic now makes used of shell arrays.

Added checks in the `bin/md2html.sh` tool to disallow a "_file_glob_"
of . (dot) as this is used internally to help the shell process the
new `inc/md2html.cfg` format.

Changed `bin/all-run.sh` VERSION from "1.1.2 2024-01-20"
to "1.3 2024-02-11".

Changed `bin/output-index-author.sh` VERSION from "1.3.1 2024-01-16"
to "1.4 2024-02-11".

Changed `bin/pandoc-wrapper.sh` VERSION from "1.3.2 2024-01-19"
to "1.4 2024-02-05".

Changed `bin/quick-readme2index.sh` VERSION from "1.0 2024-01-20"
to "1.1 2024-02-11".

Changed `bin/readme2index.sh` VERSION from "1.1.1 2024-01-20"
to "1.2 2024-02-11".

Changed `bin/subst.default.sh` VERSION from "1.1.1 2024-01-16"
to "1.2 2024-02-05".

Changed `bin/subst.entry-index.sh` VERSION from "1.1.1 2024-01-16
to "1.2 2024-02-11".

Changed `bin/output-index-inventory.sh` VERSION from "1.0.1 2024-01-16"
to "1.1 2024-02-11".

Changed `bin/manifest.entry.json.awk` from "1.0 2024-01-14"
to "1.1 2024-02-11".

Changed `bin/sort.gitignore.sh` from "1.0 2024-02-01"
to "1.1 2024-02-11".

Changed substitution symbol _%%DOCROOT_URL_SLASH%%_ to _%%DOCROOT_SLASH%%_
in various "inc/*.html" files.

Moved setting of symbol _%%DOCROOT_SLASH%%_ from `bin/subst.entry-index.sh`
to `bin/subst.default.sh`.

Changed the variable _$DOCROOT_URL_SLASH_ to _$DOCROOT_SLASH_, in
bin tools that use it, to be more descriptive.

Removed `-P pandoc_opts` from `bin/*.sh` command lines.
The PANDOC_WRAPPER_OPTSTR value is only used in `bin/pandoc-wrapper.sh`.

Removed `-B optstr` and `-A optstr` from the `bin/md2html.sh` command line.

Removed `[-O tool=optstr ..]` from the `bin/md2html.sh` command line.

Removed old use of `-U top_url` from command lines.
Add `-w site_url` as sort of a "replacement" for the old `-U top_url`.

Added a new `-U URL` to `bin/gen-author.sh`, `bin/output-index-inventory.sh`,
`bin/md2html.sh`, `bin/subst.default.sh`, and `bin/subst.entry-index.sh`
to allow for the Nu HTML check can use the encoded absolute URL of
the HTML page.

Added `-t tagline` to most command lines.

Added `-T md2html.sh` to most command lines.

Added `-D docroot/` to most command lines to set DOCROOT_SLASH.
The DOCROOT_SLASH value defaults to "../../" for most in tools,
suitable for HTML files under a `YYYY/dir` directory, except for
`bin/gen-location.sh` and `gen-entries-html.sh` (as this produces a
top level HTML file) and `bin/md2html.sh` (forms files at any level)
who use "./" instead.

In the case of `bin/output-index-inventory.sh`, `bin/quick-readme2index.sh`,
`bin/readme2index.sh`, and `bin/all-run.sh`

Helped make the use of exit code in bin tools a bit more consistent.

Fixed a number of typos in the bin tools.

Added comments for lower level tools such as
`manifest.entry.json.awk`, `bin/subst.default.sh`,
`bin/subst.entry-index.sh`, and bin/`manifest.entry.json.awk` to
indicate how they are usually invoked by other tools.

Changed the comments that a new `bin/md2html.sh` tool (that was the
`bin/readme2index.sh` tool) would add to a entry's `index.html` file.
No longer will it add the tool version number to the comment.  Thus,
a change in tool version will not force all entry `index.html`
files to be modified.  Now both the tool adds two comments, one
is the _tagline_ to indicate how the markdown content was generated,
and one for the new `bin/md2html.sh` tool.  For example:

```
<!-- The original markdown content was formed by the tool: bin/quick-readme2index.sh -->
<!-- The HTML was converted from markdown by the tool: bin/md2html.sh -->
```

Improve the debugging, especially in regards to changing important
exported shell variables, in `bin/md2html.sh`.  Other bin tools
have their exported shell variables improved somewhat as well.

The `bin/README.md` now describes the general _converting markdown
to HTML_ procedure including _getopt phases_ and _HTML phases_.
Content from `inc/md2html.cfg` and `bin/readme2index.sh` that related
to this topic has been centralized into the `bin/README.md` file.

Improved formatting of the `bin/README.md` file.  Updated it as needed
according to the above.

Sorted `2011/.year`, `2018/.year`, and `2019/.year` to be in dictionary order.
Adjusted ${WINNERS} in year Makefile to use dictionary order so
that `make genpath` will produce `.year` files in dictionary order.

FYI: We tested this massive set of changes as best as we could.
     Nevertheless we might have missing something in the JSON changes,
     `.entry.json` renames, manifest updates, code comments, etc.
This commit is contained in:
Landon Curt Noll committed 2024-02-11 16:00:31 -08:00
1 parent b23ab491ca
commit aedb017223
897 files changed
+29985 -27475

No files matched your search

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+175 -223
View File
@@ -31,9 +31,11 @@ later on, after the contents of this directory are removed.
The files in the [OLD_manifest](OLD_manifest) were in the top of
the tmp directory as of 2023 Oct 26. They represent the first
complete manifest that matched the winner file directories.
complete manifest that matched the _YYYY/dir_ entry directories.
These files in this directory are kept as a temporary snapshot for now.
These files in this directory are kept as a temporary snapshot.
Some obsolete files and tools were moved under [OLD_manifest](OLD_manifest).
### [README.md](README.md)
@@ -41,47 +43,26 @@ These files in this directory are kept as a temporary snapshot for now.
This file.
### [author_names.txt](author_names.txt)
### [author.csv](author.csv)
A text file of full names of each `author`: one full name per line.
The [author.csv](author.csv) is a CSV file that was exported from the
[author.numbers](author.numbers) file.
In the case of anonymous authors the form is:
In case of conflict, the data in [author.numbers](author.numbers) file is
considered authoritative over the [author.csv](author.csv) file.
```
Anonymous YYYY
```
### [author_wins.numbers](author_wins.numbers)
A [macOS](https://www.apple.com/macos) [Numbers](https://www.apple.com/numbers/)
spreadsheet: one line per `author`.
The first field is an `author_handle`.
The other fields are the `winner_id`'s of all `winner`s won by the `author`.
### [author_wins.csv](author_wins.csv)
The [author_wins.csv](author_wins.csv) is a CSV file that was exported from the
[author_wins.numbers](author_wins.numbers) file.
In case of conflict, the data in [author_wins.numbers](author_wins.numbers) file is
considered authoritative over the [author_wins.csv](author_wins.csv) file.
The [author_wins.csv.csv](author_wins.csv) is generated from the [author_wins.numbers](author_wins.numbers) file,
The [author.csv](author.csv) is generated from the [author.numbers](author.numbers) file,
via the [macOS](https://www.apple.com/macos/)
[Numbers](https://www.apple.com/numbers/) spreadsheet app, as follows:
0. open [author_wins.numbers](author_wins.numbers) in numbers: modify if/as needed
0. open [author.csv](author.csv) in numbers: modify if/as needed
1. File -> Export To -> CSV...
* 1a. `[ ]` Include table names (unset)
* 1b. Text Encoding: Unicode (UTF-8)
* 1c. Click ((Save..))
2. Save As: author_wins.csv
2. Save As: author.csv
* 2a. Select the `tmp` directory
3. Click ((Export))
@@ -123,26 +104,43 @@ following fields:
was given.
### [author.csv](author.csv)
### [author_handle.txt](author_handle.txt)
The [author.csv](author.csv) is a CSV file that was exported from the
[author.numbers](author.numbers) file.
A text file containing `author_handle`s for each `author`: one `author_handle`
per line.
In case of conflict, the data in [author.numbers](author.numbers) file is
considered authoritative over the [author.csv](author.csv) file.
The [author.csv](author.csv) is generated from the [author.numbers](author.numbers) file,
### [author_names.txt](author_names.txt)
A text file of full names of each `author`: one full name per line.
In the case of anonymous authors the form is:
```
Anonymous YYYY
```
### [author_wins.csv](author_wins.csv)
The [author_wins.csv](author_wins.csv) is a CSV file that was exported from the
[author_wins.numbers](author_wins.numbers) file.
In case of conflict, the data in [author_wins.numbers](author_wins.numbers) file is
considered authoritative over the [author_wins.csv](author_wins.csv) file.
The [author_wins.csv.csv](author_wins.csv) is generated from the [author_wins.numbers](author_wins.numbers) file,
via the [macOS](https://www.apple.com/macos/)
[Numbers](https://www.apple.com/numbers/) spreadsheet app, as follows:
0. open [author.csv](author.csv) in numbers: modify if/as needed
0. open [author_wins.numbers](author_wins.numbers) in numbers: modify if/as needed
1. File -> Export To -> CSV...
* 1a. `[ ]` Include table names (unset)
* 1b. Text Encoding: Unicode (UTF-8)
* 1c. Click ((Save..))
2. Save As: author.csv
2. Save As: author_wins.csv
* 2a. Select the `tmp` directory
3. Click ((Export))
@@ -151,29 +149,14 @@ via the [macOS](https://www.apple.com/macos/)
4. Execute ./[fix_csv.sh](fix_csv.sh)
### [author_handle.txt](author_handle.txt)
### [author_wins.numbers](author_wins.numbers)
A text file containing `author_handle`s for each `author`: one `author_handle`
per line.
A [macOS](https://www.apple.com/macos) [Numbers](https://www.apple.com/numbers/)
spreadsheet: one line per `author`.
The first field is an `author_handle`.
### [awards_check.sh](awards_check.sh)
Script to verify that the award name for each entry as found as a level 1
markdown header in each entry's `README.md` file.
Run the script from the top level directory. The output should end in ":1".
For example, this command should not produce any output.
```sh
tmp/awards_check.sh | grep -v ':1$'
```
Any output is an indication that either an award name is incorrect, or the
award is not formed at a level 1 markdown header, or that more than one
award line as at a level 1 markdown header we found, or the `README.md`
file is missing, etc.
The other fields are the `entry_id`'s of all _YYYY/dir_ entry's won by the `author`.
### [check_path_list.sh](check_path_list.sh)
@@ -194,6 +177,17 @@ print information about problems.
Tool that simply echos it arguments: used to test [run_all.sh](run_all.sh).
### [entry_dir.txt](entry_dir.txt)
A list of paths to _YYYY/dir_ entry directories that reside
under year directories.
### [entry_id.txt](entry_id.txt)
A text file containing `entry_id` strings: one `entry_id` per line.
### [example.author.json](example.author.json)
This is a JSON file containing an example `author/author_handle.json` for a
@@ -203,23 +197,18 @@ An `author/author_handle.json` file will be derived from the contents of the
[author.csv](author.csv) file and the [author_wins.csv](author_wins.csv) file.
### [example.dot_winner.json](example.dot_winner.json)
### [example.dot_entry.json](example.dot_entry.json)
This is a JSON file containing an example `year/dir/.winner.json` for a
fictitious `winner`.
This is a JSON file containing an example `year/dir/.entry.json` for a
fictitious winning _YYYY/dir_ entry.
A `year/dir/.winner.json` file will be derived from the contents the `year/dir/.id` file,
A `year/dir/.entry.json` file will be derived from the contents the `year/dir/.id` file,
the [author_wins.csv](author_wins.csv) file, the `year/dir/.year` file, and the
the [manifest.csv](manifest.csv) file.
The 11 field names in [manifest.numbers](manifest.numbers) match
the JSON member names found in
[example.dot_winner.json](example.dot_winner.json).
### [fake.gen_index.sh](fake.gen_index.sh)
Generate a fake index.html for a given winner.
[example.dot_entry.json](example.dot_entry.json).
### [fix_csv.sh](fix_csv.sh)
@@ -243,6 +232,11 @@ This tool also forms [path_list.built.txt](path_list.built.txt),
[manifest.csv](manifest.csv).
### [format-headers.sh](format-headers.sh)
This tool helped format the `README.md` files for _YYYY/dir_ winning entries.
### [gen_author_json.sh](gen_author_json.sh)
Temporary tool used to generate the `author/author_handle.json` files.
@@ -254,107 +248,19 @@ rm -rf ../author ; ./gen_author_json.sh author_handle.txt author.csv author_win
```
### [gen_winner_json.sh](gen_winner_json.sh)
### [gen_entry_json.sh](gen_entry_json.sh)
Generate a `.winner.json` for a given winner.
Generate a `.entry.json` for a given winning _YYYY/dir_ entry.
### [gen_path_list.found.sh](gen_path_list.found.sh)
The list of paths of files in winners.
The list of paths of files in all winning entries.
After doing a `make clobber` this tool updates, if needed,
form [path_list.found.txt](path_list.found.txt).
## [old-ioccc.css](old-ioccc.css)
The previous version of `/ioccc.css`, now `tmp/old-ioccc.css` to make
room for the new IOCCC css being developed.
### [manifest.numbers](manifest.numbers)
A [macOS](https://www.apple.com/macos) [Numbers](https://www.apple.com/numbers/)
spreadsheet contains information about files in winner directories under year directories.
This file as the following fields:
1. year:
IOCCC year as a 4-character string. Normally this would be a 4 digit year string,
however it may also be a string such as "mock".
NOTE: If year begins with "#", then dir is a comment, and the
rest of the row is to be ignored. Rows of this form do NOT
contain manifest information for a file.
2. dir:
Directory name number the IOCCC year.
3. path:
Path under the IOCCC/directory. In a few cases this is a path,
not just a simple filename under the IOCCC/directory.
4. inventory_order:
This number is the winners rank showing the order
that this file is to be listed for the given entry's in
[winners.html](winners.html).
If the number is 9 digits or less, then the given file
is considered a primary file when listed in the inventory
of files for a given winner.
If the number is 10 digits or more, then the given file
is considered a secondary file when listed in the inventory
of files for a given winner. We recommend using the
value **4294967295** (2^32-1) for secondary files.
5. OK_to_edit:
If the value is `true`, then the file is one that may be
edited directly.
If the value is `false`, then the file should **NOT** be
edited, because the given file is generated by a tool.
One should **NOT** modify such a file directly, but
instead modify source files (i.e., markdown files,
JSON files, etc.)
6. display_as:
The type of given file.
7. display_via_github
If `true`, then the contents of the file should be viewed
via the GitHub repo.
If `false`, then the contents of the file should be viewed
in the web browser directly. In some cases this may
result in the file being downloaded instead of being displayed.
8. winners_text:
Any text that should be displayed at the end of line in `winners.html`
(with a preceding " - "), or null is no such text is to be displayed.
The 8 field names in [manifest.numbers](manifest.numbers), must
match the JSON member names found in
[example.dot_winner.json](example.dot_winner.json).
NOTE: Cells containing true or false are JSON booleans.
NOTE: All other cells are JSON strings that need to be double quoted, including the year.
NOTE: Do not put commas, nor quotes, nor newlines in fields as these are bound to cause problems.
In case of conflict, the data in [manifest.numbers](manifest.numbers) file is
considered authoritative over the [manifest.csv](manifest.csv) file.
### [manifest.csv](manifest.csv)
The [manifest.csv](manifest.csv) is a CSV file that was exported from the
@@ -383,9 +289,91 @@ via the [macOS](https://www.apple.com/macos/)
4. Execute ./[fix_csv.sh](fix_csv.sh)
### [manifest.numbers](manifest.numbers)
A [macOS](https://www.apple.com/macos) [Numbers](https://www.apple.com/numbers/)
spreadsheet contains information about files in _YYYY/dir_ entry directories under year directories.
This file as the following fields:
1. year:
IOCCC year as a 4-character string. Normally this would be a 4 digit year string,
however it may also be a string such as "mock".
NOTE: If year begins with "#", then dir is a comment, and the
rest of the row is to be ignored. Rows of this form do NOT
contain manifest information for a file.
2. dir:
Directory name number the IOCCC year.
3. path:
Path under the IOCCC/directory. In a few cases this is a path,
not just a simple filename under the IOCCC/directory.
4. inventory_order:
This number is the rank showing the order
that this file is to be listed for the given entry's in
the winning entry's `index.html` file.
If the number is 9 digits or less, then the given file
is considered a primary file when listed in the inventory
of files for a given winning _YYYY/dir_ entry.
If the number is 10 digits or more, then the given file
is considered a secondary file when listed in the inventory
of files for a given winning _YYYY/dir_ entry We recommend using the
value **4294967295** (2^32-1) for secondary files.
5. OK_to_edit:
If the value is `true`, then the file is one that may be
edited directly.
If the value is `false`, then the file should **NOT** be
edited, because the given file is generated by a tool.
One should **NOT** modify such a file directly, but
instead modify source files (i.e., markdown files,
JSON files, etc.)
6. display_as:
The type of given file.
7. display_via_github
If `true`, then the contents of the file should be viewed
via the GitHub repo.
If `false`, then the contents of the file should be viewed
in the web browser directly. In some cases this may
result in the file being downloaded instead of being displayed.
8. entry_text:
Any text that should be displayed at the end of line in `index.html`
(with a preceding " - "), or null is no such text is to be displayed.
The 8 field names in [manifest.numbers](manifest.numbers), must
match the JSON member names found in
[example.dot_entry.json](example.dot_entry.json).
NOTE: Cells containing true or false are JSON booleans.
NOTE: All other cells are JSON strings that need to be double quoted, including the year.
NOTE: Do not put commas, nor quotes, nor newlines in fields as these are bound to cause problems.
In case of conflict, the data in [manifest.numbers](manifest.numbers) file is
considered authoritative over the [manifest.csv](manifest.csv) file.
### [path_list.built.txt](path_list.built.txt)
A list of file paths (from the top directory) of winner directories,
A list of file paths (from the top directory) of _YYYY/dir_ entry directories,
that are built from other primary content files.
These paths are formed from [manifest.numbers](manifest.numbers)
@@ -398,7 +386,7 @@ This file is formed by the [fix_csv.sh](fix_csv.sh) tool.
### [path_list.found.txt](path_list.found.txt)
A list of files that exist, or should exist once the tools to generate certain files,
such as the `index.html`, or the `.winner.json` files for each entry, are created.
such as the `index.html`, or the `.entry.json` files for each entry, are created.
This file is created by [gen_path_list.found.sh](gen_path_list.found.sh).
@@ -406,14 +394,14 @@ This file is created by [gen_path_list.found.sh](gen_path_list.found.sh).
### [path_list.manifest.txt](path_list.manifest.txt)
This is the list of file paths, both primary and constructed
files from winners.
files from _YYYY/dir_ entry directories.
This file is formed by the [fix_csv.sh](fix_csv.sh) tool.
### [path_list.required.txt](path_list.required.txt)
A list of file paths (from the top directory) of winner directories,
A list of file paths (from the top directory) of _YYYY/dir_ entry directories,
that are required to exist.
These paths are formed from [manifest.numbers](manifest.numbers)
@@ -423,10 +411,16 @@ entries where the "created_by" (5th) field is non-null. See
This file is formed by the [fix_csv.sh](fix_csv.sh) tool.
### [sql/winners.sql](sql/winners.sql)
### [run_all.sh](run_all.sh)
This is a SQL file, extracted from another SQL file that was used in the past
to generate data for the old winners directory tree.
A tool to run another tool over all _YYYY/dir_ entry directories.
Examples:
```sh
./run_all.sh -v 3 ./fake.gen_index.sh
./run_all.sh -v 1 ./gen_entry_json.sh
```
### [src](src)
@@ -438,66 +432,14 @@ Eventually a separate [build-ioccc repo](https://github.com/ioccc-src/build-iocc
will hold these tools.
### [run_all.sh](run_all.sh)
### [things-todo.md](things-todo.md)
A tool to run another tool over all winner directories.
Examples:
```sh
./run_all.sh -v 3 ./fake.gen_index.sh
./run_all.sh -v 1 ./gen_winner_json.sh
```
### templates
### [template-footer.html](template-footer.html)
### [template-header.html](template-header.html)
### [template-top.html](template-top.html)
An HTML template for what goes into the top of constructed HTML pages.
A todo list of known things to check and/or do.
Constructed HTML pages will be as follows:
### [update-manifest.sh](update-manifest.sh)
0. [template-top.html](template-top.html)
1. file: _path_ HTML comment
2. created by tool: _tool-name_ HTML comment
3. tool version: _tool-version_ HTML comment
4. content source: _path_ HTML comment
... possible multiple content source HTML comments ...
n. [template-header.html])(template-header.html)
n+1. _content generated by a tool such as pandoc_
n+2. [template-footer.html](template-footer.html)
### [test.html](test.html)
A test page for [ioccc.css](../ioccc.css).
This page was modeled after the above mentioned templates
with the "_content generated by a tool such as pandoc_"
replaced with some j-random test text.
### [winner_dir.txt](winner_dir.txt)
A list of paths to winner directories that reside
under year directories.
### [winner_id.txt](winner_id.txt)
A text file containing `winner_id` strings: one `winner_id` per line.
### [year_prize.numbers](year_prize.numbers)
A [macOS](https://www.apple.com/macos) [Numbers](https://www.apple.com/numbers/)
spreadsheet: one line per `winner`.
The first field is a `winner_id`.
The second field is the name of the award for given `winner`.
Interactive script to update the IOCCC manifest step by step post manifest.csv export.
### [year_prize.csv](year_prize.csv)
@@ -526,3 +468,13 @@ via the [macOS](https://www.apple.com/macos/)
* 3a. If needed click ((Replace))
4. Execute ./[fix_csv.sh](fix_csv.sh)
### [year_prize.numbers](year_prize.numbers)
A [macOS](https://www.apple.com/macos) [Numbers](https://www.apple.com/numbers/)
spreadsheet: one line per _YYYY/dir_ entry directory.
The first field is a `entry_id`.
The second field is the name of the award for given _YYYY/dir_ entry.
+1 -1
View File
@@ -1,4 +1,4 @@
# author_handle,winner_id,winner_id,winner_id,…,,,,,,,,,,,,,,,
# author_handle,entry_id,entry_id,entry_id,…,,,,,,,,,,,,,,,
Aaron_Grothe,2006_grothe,2012_grothe,,,,,,,,,,,,,,,,,
Adar_Zeitak,2012_zeitak,,,,,,,,,,,,,,,,,,
Adrian_Cable,2013_cable1,2013_cable2,2013_cable3,,,,,,,,,,,,,,,,
1 # author_handle winner_id entry_id winner_id entry_id winner_id entry_id …
2 Aaron_Grothe 2006_grothe 2012_grothe
3 Adar_Zeitak 2012_zeitak
4 Adrian_Cable 2013_cable1 2013_cable2 2013_cable3
Binary file not shown.
File renamed without changes.
File renamed without changes.
+4 -4
View File
@@ -1,6 +1,6 @@
{
"no_comment" : "mandatory comment: because comments were removed from the original JSON spec",
"author_JSON_format_version" : "1.0 2023-06-10",
"author_JSON_format_version" : "1.1 2024-02-11",
"author_handle" : "first0_last0",
"full_name" : "First Middle Last",
"sort_word" : "lowercaselast",
@@ -15,8 +15,8 @@
"github" : "@github0",
"affiliation" : "an affiliation group",
"winning_entry_set" : [
{ "winner_id" : "1987_somedir" },
{ "winner_id" : "2020_entrydir" },
{ "winner_id" : "2024_dirname" }
{ "entry_id" : "1987_somedir" },
{ "entry_id" : "2020_entrydir" },
{ "entry_id" : "2024_dirname" }
]
}
@@ -1,10 +1,10 @@
{
"no_comment" : "mandatory comment: because comments were removed from the original JSON spec",
"winner_JSON_format_version" : "1.0 2024-01-14",
"entry_JSON_format_version" : "1.1 2024-02-11",
"award" : "Award title",
"year" : "2024",
"dir" : "dirname",
"winner_id" : "2024_dirname",
"entry_id" : "2024_dirname",
"author_set" : [
{ "author_handle" : "first0_last0" },
{ "author_handle" : "first1_last1" },
@@ -17,7 +17,7 @@
"OK_to_edit" : false,
"display_as" : "html",
"display_via_github" : false,
"winners_text" : "winner home page"
"entry_text" : "winner home page"
},
{
"file_path" : "prog.c",
@@ -25,7 +25,7 @@
"OK_to_edit" : true,
"display_as" : "c",
"display_via_github" : true,
"winners_text" : "winning source"
"entry_text" : "winning source"
},
{
"file_path" : "Makefile",
@@ -33,7 +33,7 @@
"OK_to_edit" : true,
"display_as" : "makefile",
"display_via_github" : true,
"winners_text" : "how to compile"
"entry_text" : "how to compile"
},
{
"file_path" : "prog.alt.c",
@@ -41,7 +41,7 @@
"OK_to_edit" : true,
"display_as" : "c",
"display_via_github" : true,
"winners_text" : "alternative source"
"entry_text" : "alternative source"
},
{
"file_path" : "prog.orig.c",
@@ -49,7 +49,7 @@
"OK_to_edit" : false,
"display_as" : "c",
"display_via_github" : true,
"winners_text" : "original source"
"entry_text" : "original source"
},
{
"file_path" : "chocolate_cake.jpg",
@@ -57,7 +57,7 @@
"OK_to_edit" : true,
"display_as" : "image",
"display_via_github" : false,
"winners_text" : "required argument file"
"entry_text" : "required argument file"
},
{
"file_path" : "magic.txt",
@@ -65,7 +65,7 @@
"OK_to_edit" : true,
"display_as" : "text",
"display_via_github" : true,
"winners_text" : "data file"
"entry_text" : "data file"
},
{
"file_path" : "special.src",
@@ -73,7 +73,7 @@
"OK_to_edit" : true,
"display_as" : "text",
"display_via_github" : true,
"winners_text" : "special language source code"
"entry_text" : "special language source code"
},
{
"file_path" : "raw_data.file",
@@ -81,7 +81,7 @@
"OK_to_edit" : true,
"display_as" : "data",
"display_via_github" : false,
"winners_text" : "optional argument file"
"entry_text" : "optional argument file"
},
{
"file_path" : "spoiler.html",
@@ -89,7 +89,7 @@
"OK_to_edit" : true,
"display_as" : "html",
"display_via_github" : false,
"winners_text" : "SPOILER WARNING"
"entry_text" : "SPOILER WARNING"
},
{
"file_path" : "2024_dirname.tar.bz2",
@@ -97,7 +97,7 @@
"OK_to_edit" : false,
"display_as" : "tbz2",
"display_via_github" : false,
"winners_text" : "download winning source"
"entry_text" : "download winning source"
},
{
"file_path" : ".gitignore",
@@ -105,7 +105,7 @@
"OK_to_edit" : true,
"display_as" : "gitignore",
"display_via_github" : true,
"winners_text" : "list of files that should not be committed under git"
"entry_text" : "list of files that should not be committed under git"
},
{
"file_path" : ".winner.json",
@@ -113,7 +113,7 @@
"OK_to_edit" : true,
"display_as" : "json",
"display_via_github" : true,
"winners_text" : "description of winner in JSON"
"entry_text" : "description of winner in JSON"
},
{
"file_path" : "README.md",
@@ -121,7 +121,7 @@
"OK_to_edit" : true,
"display_as" : "markdown",
"display_via_github" : true,
"winners_text" : "markdown source for index.html"
"entry_text" : "markdown source for index.html"
}
]
}
+4 -4
View File
@@ -478,7 +478,7 @@ grep -v '^#' "$AUTHOR_HANDLE_TXT" | while read -r AUTHOR_HANDLE; do
#
echo '{'
echo ' "no_comment" : "mandatory comment: because comments were removed from the original JSON spec",'
echo ' "author_JSON_format_version" : "1.0 2023-06-10",'
echo ' "author_JSON_format_version" : "1.1 2024-02-11",'
# print author handle related JSON members from AUTHOR_CSV
#
@@ -534,12 +534,12 @@ grep -v '^#' "$AUTHOR_HANDLE_TXT" | while read -r AUTHOR_HANDLE; do
WIN_COUNT=$(echo "$WINS" | sed -e 's/,/\n/g' | wc -l)
export WIN_COUNT
export WIN_NUMBER=0
echo "$WINS" | sed -e 's/,/\n/g' | while read -r WINNER_ID; do
echo "$WINS" | sed -e 's/,/\n/g' | while read -r ENTRY_ID; do
((++WIN_NUMBER))
if [[ $WIN_NUMBER -lt $WIN_COUNT ]]; then
echo ' { "winner_id" : "'"$WINNER_ID"'" },'
echo ' { "entry_id" : "'"$ENTRY_ID"'" },'
else
echo ' { "winner_id" : "'"$WINNER_ID"'" }'
echo ' { "entry_id" : "'"$ENTRY_ID"'" }'
fi
done
echo ' ]'
@@ -1,9 +1,9 @@
#!/usr/bin/env bash
#
# gen_winner_json.sh - generate .winner.json for a winner
# gen_entry_json.sh - generate .entry.json for a winner
#
# XXX - This is a temporary utility that will be replaced when
# the .winner.json files are built.
# the .entry.json files are built.
#
# Copyright (c) 2023,2024 by Landon Curt Noll. All Rights Reserved.
#
@@ -33,8 +33,8 @@
#
export VERSION="1.1 2024-01-14"
NAME=$(basename "$0"); export NAME
export DOT_WINNER_JSON_BASENAME=".winner.json"
export WINNER_JSON_FORMAT_VERSION="1.0 2024-01-14"
export DOT_ENTRY_JSON_BASENAME=".entry.json"
export ENTRY_JSON_FORMAT_VERSION="1.1 2024-02-11"
export NO_COMMENT="mandatory comment: because comments were removed from the original JSON spec"
export AUTHOR_WINS_CSV="author_wins.csv"
export YEAR_PRIZE_CSV="year_prize.csv"
@@ -141,15 +141,15 @@ case "$#" in
;;
esac
export FULL_WINNER_PATH="$TOPDIR/$WINNER_PATH"
export WINNER_ID="${YEAR}_${WINNER}"
export ENTRY_ID="${YEAR}_${WINNER}"
export URL_PATH="https://$DOMAIN$DOCPATH/$YEAR/$WINNER"
# setup temporary files
#
export WINNER_JSON_PATH="$FULL_WINNER_PATH/$DOT_WINNER_JSON_BASENAME"
export TMP_DOT_WINNER_JSON="$FULL_WINNER_PATH/tmp.$$.$DOT_WINNER_JSON_BASENAME"
trap 'rm -f $TMP_DOT_WINNER_JSON' 0 1 2 3 15
export ENTRY_JSON_PATH="$FULL_WINNER_PATH/$DOT_ENTRY_JSON_BASENAME"
export TMP_DOT_ENTRY_JSON="$FULL_WINNER_PATH/tmp.$$.$DOT_ENTRY_JSON_BASENAME"
trap 'rm -f $TMP_DOT_ENTRY_JSON' 0 1 2 3 15
# print running info if verbose
#
@@ -157,7 +157,7 @@ if [[ $V_FLAG -ge 5 ]]; then
echo "$0: debug[5]: V_FLAG=$V_FLAG" 1>&2
echo "$0: debug[5]: NAME=$NAME" 1>&2
echo "$0: debug[5]: VERSION=$VERSION" 1>&2
echo "$0: debug[5]: WINNER_JSON_FORMAT_VERSION=$WINNER_JSON_FORMAT_VERSION" 1>&2
echo "$0: debug[5]: ENTRY_JSON_FORMAT_VERSION=$ENTRY_JSON_FORMAT_VERSION" 1>&2
echo "$0: debug[5]: NO_COMMENT=$NO_COMMENT" 1>&2
echo "$0: debug[5]: AUTHOR_WINS_CSV=$AUTHOR_WINS_CSV" 1>&2
echo "$0: debug[5]: YEAR_PRIZE_CSV=$YEAR_PRIZE_CSV" 1>&2
@@ -168,14 +168,14 @@ if [[ $V_FLAG -ge 5 ]]; then
echo "$0: debug[5]: TOPDIR=$TOPDIR" 1>&2
echo "$0: debug[5]: PANDOC=$PANDOC" 1>&2
echo "$0: debug[5]: FULL_WINNER_PATH=$FULL_WINNER_PATH" 1>&2
echo "$0: debug[5]: WINNER_ID=$WINNER_ID" 1>&2
echo "$0: debug[5]: ENTRY_ID=$ENTRY_ID" 1>&2
echo "$0: debug[5]: YEAR=$YEAR" 1>&2
echo "$0: debug[5]: WINNER=$WINNER" 1>&2
echo "$0: debug[5]: WINNER_PATH=$WINNER_PATH" 1>&2
echo "$0: debug[5]: URL_PATH=$URL_PATH" 1>&2
echo "$0: debug[5]: DOT_WINNER_JSON_BASENAME=$DOT_WINNER_JSON_BASENAME" 1>&2
echo "$0: debug[5]: WINNER_JSON_PATH=$WINNER_JSON_PATH" 1>&2
echo "$0: debug[5]: TMP_DOT_WINNER_JSON=$TMP_DOT_WINNER_JSON" 1>&2
echo "$0: debug[5]: DOT_ENTRY_JSON_BASENAME=$DOT_ENTRY_JSON_BASENAME" 1>&2
echo "$0: debug[5]: ENTRY_JSON_PATH=$ENTRY_JSON_PATH" 1>&2
echo "$0: debug[5]: TMP_DOT_ENTRY_JSON=$TMP_DOT_ENTRY_JSON" 1>&2
fi
# make is easier to process CSV files
@@ -251,40 +251,40 @@ fi
# determine award
#
AWARD=$(grep -E "^$WINNER_ID," "$YEAR_PRIZE_CSV" | sed -e "s/^$WINNER_ID,//")
AWARD=$(grep -E "^$ENTRY_ID," "$YEAR_PRIZE_CSV" | sed -e "s/^$ENTRY_ID,//")
export AWARD
if [[ -z $AWARD ]]; then
echo "$0: ERROR: cannot find award for $WINNER_ID in $YEAR_PRIZE_CSV" 1>&2
echo "$0: ERROR: cannot find award for $ENTRY_ID in $YEAR_PRIZE_CSV" 1>&2
exit 9
fi
if [[ $V_FLAG -ge 3 ]]; then
echo "$0: debug[3]: AWARD for $WINNER_ID: $AWARD" 1>&2
echo "$0: debug[3]: AWARD for $ENTRY_ID: $AWARD" 1>&2
fi
# determine author set
#
AUTHOR_SET=$(grep -E ",$WINNER_ID," "$AUTHOR_WINS_CSV")
AUTHOR_SET=$(grep -E ",$ENTRY_ID," "$AUTHOR_WINS_CSV")
declare -a AUTHOR
while read -r author extra; do
if [[ $V_FLAG -ge 5 ]]; then
echo "$0: debug[5]: $WINNER_ID extra: $extra"
echo "$0: debug[5]: $ENTRY_ID extra: $extra"
fi
if [[ $V_FLAG -ge 3 ]]; then
echo "$0: debug[3]: $WINNER_ID author: $author"
echo "$0: debug[3]: $ENTRY_ID author: $author"
fi
if [[ -z $author ]]; then
echo "$0: ERROR: $WINNER_ID empty author found in $AUTHOR_WINS_CSV with extra: $extra" 1>&2
echo "$0: ERROR: $ENTRY_ID empty author found in $AUTHOR_WINS_CSV with extra: $extra" 1>&2
exit 10
fi
AUTHOR+=( "$author" )
done <<< "$AUTHOR_SET"
export AUTHOR_COUNT=${#AUTHOR[@]}
if [[ $AUTHOR_COUNT -le 0 ]]; then
echo "$0: ERROR: cannot find any authors for $WINNER_ID" 1>&2
echo "$0: ERROR: cannot find any authors for $ENTRY_ID" 1>&2
exit 10
fi
if [[ $V_FLAG -ge 3 ]]; then
echo "$0: debug[3]: author count for $WINNER_ID: $AUTHOR_COUNT"
echo "$0: debug[3]: author count for $ENTRY_ID: $AUTHOR_COUNT"
fi
# collect inventory
@@ -350,65 +350,65 @@ while IFS=, read -r year dir file_path inventory_order OK_to_edit display_as dis
done <<< "$NUMBER_RANKED_MANIFEST_SET"
export FILE_COUNT=${#FILE_PATH[@]}
if [[ $FILE_COUNT -le 0 ]]; then
echo "$0: ERROR: cannot find files in manifest $MANIFEST_CSV for $WINNER_ID" 1>&2
echo "$0: ERROR: cannot find files in manifest $MANIFEST_CSV for $ENTRY_ID" 1>&2
exit 50
fi
if [[ $V_FLAG -ge 3 ]]; then
echo "$0: debug[3]: manifest file count for $WINNER_ID: $FILE_COUNT"
echo "$0: debug[3]: manifest file count for $ENTRY_ID: $FILE_COUNT"
fi
# write .winners.json
# write .entry.json
#
# write leading part of .winners.json
# write leading part of .entry.json
#
cat > "$TMP_DOT_WINNER_JSON" << EOF
cat > "$TMP_DOT_ENTRY_JSON" << EOF
{
"no_comment" : "$NO_COMMENT",
"winner_JSON_format_version" : "$WINNER_JSON_FORMAT_VERSION",
"entry_JSON_format_version" : "$ENTRY_JSON_FORMAT_VERSION",
"award" : "$AWARD",
"year" : $YEAR,
"dir" : "$WINNER",
"winner_id" : "$WINNER_ID",
"entry_id" : "$ENTRY_ID",
"author_set" : [
EOF
#
# write author_handle part of .winners.json
# write author_handle part of .entry.json
#
((AUTHOR_COUNT_LESS_1=AUTHOR_COUNT-1))
for i in "${!AUTHOR[@]}"; do
# stupid JSON syntax does not allow a trailing comma
if [[ $i -lt "$AUTHOR_COUNT_LESS_1" ]]; then
cat >> "$TMP_DOT_WINNER_JSON" << EOF
cat >> "$TMP_DOT_ENTRY_JSON" << EOF
{ "author_handle" : "${AUTHOR[$i]}" },
EOF
else
cat >> "$TMP_DOT_WINNER_JSON" << EOF
cat >> "$TMP_DOT_ENTRY_JSON" << EOF
{ "author_handle" : "${AUTHOR[$i]}" }
EOF
fi
done
#
# write start of manifest of .winners.json
# write start of manifest of .entry.json
#
cat >> "$TMP_DOT_WINNER_JSON" << EOF
cat >> "$TMP_DOT_ENTRY_JSON" << EOF
],
"manifest" : [
EOF
((FILE_COUNT_LESS_1=FILE_COUNT-1))
#
# write each file in the manifest of .winners.json
# write each file in the manifest of .entry.json
#
for i in "${!INVENTORY_ORDER[@]}"; do
#
# write start and file_path of a given file in manifest of .winners.json
# write inventory_order of a given file in manifest of .winners.json
# write OK_to_edit of a given file in manifest of .winners.json
# write display_as of a given file in manifest of .winners.json
# write display_via_github of a given file in manifest of .winners.json
# write winners_text of a given file in manifest of .winners.json
# write start and file_path of a given file in manifest of .entry.json
# write inventory_order of a given file in manifest of .entry.json
# write OK_to_edit of a given file in manifest of .entry.json
# write display_as of a given file in manifest of .entry.json
# write display_via_github of a given file in manifest of .entry.json
# write winners_text of a given file in manifest of .entry.json
#
cat >> "$TMP_DOT_WINNER_JSON" << EOF
cat >> "$TMP_DOT_ENTRY_JSON" << EOF
{
"file_path" : "${FILE_PATH[$i]}",
"inventory_order" : ${INVENTORY_ORDER[$i]},
@@ -420,47 +420,47 @@ EOF
# stupid JSON syntax does not allow a trailing comma
if [[ $i -lt "$FILE_COUNT_LESS_1" ]]; then
cat >> "$TMP_DOT_WINNER_JSON" << EOF
cat >> "$TMP_DOT_ENTRY_JSON" << EOF
},
EOF
else
cat >> "$TMP_DOT_WINNER_JSON" << EOF
cat >> "$TMP_DOT_ENTRY_JSON" << EOF
}
EOF
fi
done
#
# write trailing part of .winners.json
# write trailing part of .entry.json
#
cat >> "$TMP_DOT_WINNER_JSON" << EOF
cat >> "$TMP_DOT_ENTRY_JSON" << EOF
]
}
EOF
if [[ $V_FLAG -ge 7 ]]; then
echo "$0: debug[7]: start of TMP_DOT_WINNER_JSON below: $TMP_DOT_WINNER_JSON" 1>&2
cat "$TMP_DOT_WINNER_JSON" 1>&2
echo "$0: debug[7]: end of TMP_DOT_WINNER_JSON above: $TMP_DOT_WINNER_JSON" 1>&2
echo "$0: debug[7]: start of TMP_DOT_ENTRY_JSON below: $TMP_DOT_ENTRY_JSON" 1>&2
cat "$TMP_DOT_ENTRY_JSON" 1>&2
echo "$0: debug[7]: end of TMP_DOT_ENTRY_JSON above: $TMP_DOT_ENTRY_JSON" 1>&2
fi
# update .winner.json if needed
# update .entry.json if needed
#
if ! cmp -s "$TMP_DOT_WINNER_JSON" "$WINNER_JSON_PATH"; then
if ! cmp -s "$TMP_DOT_ENTRY_JSON" "$ENTRY_JSON_PATH"; then
# replace index.html file
#
if [[ $V_FLAG -ge 1 ]]; then
echo "$0: debug[1]: updating $WINNER_JSON_PATH"
echo "$0: debug[1]: updating $ENTRY_JSON_PATH"
fi
if [[ $V_FLAG -ge 3 ]]; then
mv -f -v "$TMP_DOT_WINNER_JSON" "$WINNER_JSON_PATH"
mv -f -v "$TMP_DOT_ENTRY_JSON" "$ENTRY_JSON_PATH"
status="$?"
else
mv -f "$TMP_DOT_WINNER_JSON" "$WINNER_JSON_PATH"
mv -f "$TMP_DOT_ENTRY_JSON" "$ENTRY_JSON_PATH"
status="$?"
fi
if [[ $status -ne 0 ]]; then
echo "$0: ERROR: mv -f -v $TMP_DOT_WINNER_JSON $WINNER_JSON_PATH failed, error: $status" 1>&2
echo "$0: ERROR: mv -f -v $TMP_DOT_ENTRY_JSON $ENTRY_JSON_PATH failed, error: $status" 1>&2
exit 100
fi
@@ -468,9 +468,9 @@ else
# index.html is OK, remove the tmp file
#
rm -f "$TMP_DOT_WINNER_JSON"
if [[ -e $TMP_DOT_WINNER_JSON ]]; then
echo "$0: ERROR: TMP_DOT_WINNER_JSON cannot be removed for cleanup: $TMP_DOT_WINNER_JSON" 1>&2
rm -f "$TMP_DOT_ENTRY_JSON"
if [[ -e $TMP_DOT_ENTRY_JSON ]]; then
echo "$0: ERROR: TMP_DOT_ENTRY_JSON cannot be removed for cleanup: $TMP_DOT_ENTRY_JSON" 1>&2
exit 101
fi
fi
+1611 -1611
View File
File diff suppressed because it is too large. Load diff
Binary file not shown.
+321 -321
View File
File diff suppressed because it is too large. Load diff
+321 -321
View File
File diff suppressed because it is too large. Load diff
+321 -321
View File
File diff suppressed because it is too large. Load diff
+1 -1
View File
@@ -44,7 +44,7 @@ CFLAGS= -O3 -g3 --pedantic -Wall
# target information #
######################
TARGETS= winner_name ioccc_status
TARGETS= ioccc_status
######################################
# all - default rule - must be first #