about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCase Duckworth2024-03-18 10:25:12 -0500
committerCase Duckworth2024-03-18 10:25:12 -0500
commit45db37efb5122ec7351fe0896d2c0261b472ea76 (patch)
tree254bee43722b49fcf302ed4cef0032853fa8b709
parentUpdate README (diff)
downloadschwa-45db37efb5122ec7351fe0896d2c0261b472ea76.tar.gz
schwa-45db37efb5122ec7351fe0896d2c0261b472ea76.zip
Change static copying/ update readme
-rw-r--r--README.md4
-rwxr-xr-xschwa.awk7
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 @@
1# Source Code Htmlizer Written in Awk 1# Source Code Htmlizer Written in Awk
2 2
3Here 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. 3Here 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.
4 4
5[stagit]: https://codemadness.org/stagit.html 5[stagit]: https://codemadness.org/stagit.html
6 6
@@ -13,7 +13,7 @@ I don't want to figure out how to process actual command-line arguments in awk,
13 -vreadmefilter='pandoc -thtml5' \ 13 -vreadmefilter='pandoc -thtml5' \
14 -vtemplate=template.html \ 14 -vtemplate=template.html \
15 -vstatic=style.css \ 15 -vstatic=style.css \
16 -vclone=https://foo.bar/schwa \ 16 -vclone='<a href="https://git.acdw.net/schwa">https://git.acdw.net/schwa</a>'
17 -vdesc="Source Code Htmlizer" \ 17 -vdesc="Source Code Htmlizer" \
18 * 18 *
19``` 19```
diff --git a/schwa.awk b/schwa.awk index 015b374..946a2cf 100755 --- a/schwa.awk +++ b/schwa.awk
@@ -16,7 +16,6 @@ BEGIN {
16 else TMPLV["DESCRIPTION"] = "" 16 else TMPLV["DESCRIPTION"] = ""
17 "pwd" | getline TMPLV["DIRECTORY"]; close("pwd") 17 "pwd" | getline TMPLV["DIRECTORY"]; close("pwd")
18 TMPLV["DIRECTORY"] = outfn(TMPLV["DIRECTORY"], 3) 18 TMPLV["DIRECTORY"] = outfn(TMPLV["DIRECTORY"], 3)
19 copy_statics()
20} 19}
21 20
22FNR == 1 { 21FNR == 1 {
@@ -27,7 +26,7 @@ FNR == 1 {
27 FILES[f++] = FILENAME 26 FILES[f++] = FILENAME
28 printf("%s -> %s\n", FILENAME, OUTFILE) 27 printf("%s -> %s\n", FILENAME, OUTFILE)
29 if (system("mkdir -p " OUTD outfn(FILENAME, 2))) 28 if (system("mkdir -p " OUTD outfn(FILENAME, 2)))
30 die(1, "Can't make directory " outfn(FILENAME, 2)) 29 die(1, "Can't make directory: " outfn(FILENAME, 2))
31 if (!system("cp " FILENAME " " outfn(FILENAME, 4))) 30 if (!system("cp " FILENAME " " outfn(FILENAME, 4)))
32 TMPLV["RAWFILE"] = outfn(FILENAME, 3) 31 TMPLV["RAWFILE"] = outfn(FILENAME, 3)
33 OUTSTR = "" 32 OUTSTR = ""
@@ -37,6 +36,7 @@ END {
37 if (dead) exit dead 36 if (dead) exit dead
38 finish() 37 finish()
39 doindex() 38 doindex()
39 copy_statics()
40} 40}
41 41
42{ 42{
@@ -129,7 +129,8 @@ function copy_statics () {
129 split(static, STATICS, ":") 129 split(static, STATICS, ":")
130 for (s in STATICS) { 130 for (s in STATICS) {
131 printf("Copying %s\n", STATICS[s]) 131 printf("Copying %s\n", STATICS[s])
132 if (system("cp " STATICS[s] " " outfn(STATICS[s], 4))) 132 print(OUTD outfn(STATICS[s], 3))
133 if (system("cp " STATICS[s] " " OUTD outfn(STATICS[s], 3)))
133 die(2, "Can't copy static file: " STATICS[s]) 134 die(2, "Can't copy static file: " STATICS[s])
134 } 135 }
135} 136}