From 45db37efb5122ec7351fe0896d2c0261b472ea76 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Mon, 18 Mar 2024 10:25:12 -0500 Subject: Change static copying/ update readme --- README.md | 4 ++-- schwa.awk | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 1a55ef6..62fd4da 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Source Code Htmlizer Written in Awk -Here we have a tool that's in a similar vein to [stagit][] and others. It takes a number of files on the commandline and generates HTML for them in an output directory, then generates an index with a file listing and a readme. It's also written completely in awk(1p). I guess that's the gimmick. +Here we have a tool that's in a similar vein to [stagit][] and others. It takes a number of files on the commandline and generates HTML for them in an output directory, then generates an index with a file listing and a readme. It's also written completely in `awk(1p)`. I guess that's the gimmick. [stagit]: https://codemadness.org/stagit.html @@ -13,7 +13,7 @@ I don't want to figure out how to process actual command-line arguments in awk, -vreadmefilter='pandoc -thtml5' \ -vtemplate=template.html \ -vstatic=style.css \ - -vclone=https://foo.bar/schwa \ + -vclone='https://git.acdw.net/schwa' -vdesc="Source Code Htmlizer" \ * ``` diff --git a/schwa.awk b/schwa.awk index 015b374..946a2cf 100755 --- a/schwa.awk +++ b/schwa.awk @@ -16,7 +16,6 @@ BEGIN { else TMPLV["DESCRIPTION"] = "" "pwd" | getline TMPLV["DIRECTORY"]; close("pwd") TMPLV["DIRECTORY"] = outfn(TMPLV["DIRECTORY"], 3) - copy_statics() } FNR == 1 { @@ -27,7 +26,7 @@ FNR == 1 { FILES[f++] = FILENAME printf("%s -> %s\n", FILENAME, OUTFILE) if (system("mkdir -p " OUTD outfn(FILENAME, 2))) - die(1, "Can't make directory " outfn(FILENAME, 2)) + die(1, "Can't make directory: " outfn(FILENAME, 2)) if (!system("cp " FILENAME " " outfn(FILENAME, 4))) TMPLV["RAWFILE"] = outfn(FILENAME, 3) OUTSTR = "" @@ -37,6 +36,7 @@ END { if (dead) exit dead finish() doindex() + copy_statics() } { @@ -129,7 +129,8 @@ function copy_statics () { split(static, STATICS, ":") for (s in STATICS) { printf("Copying %s\n", STATICS[s]) - if (system("cp " STATICS[s] " " outfn(STATICS[s], 4))) + print(OUTD outfn(STATICS[s], 3)) + if (system("cp " STATICS[s] " " OUTD outfn(STATICS[s], 3))) die(2, "Can't copy static file: " STATICS[s]) } } -- cgit 1.4.1-21-gabe81