diff options
author | Johannes Löthberg <johannes@kyriasis.com> | 2014-10-10 01:27:51 +0200 |
---|---|---|
committer | Johannes Löthberg <johannes@kyriasis.com> | 2014-10-10 01:33:13 +0200 |
commit | ced51aa57c06445dfac130ae975a612dff820b8b (patch) | |
tree | 87a485e3885d8c0304da4af70f4e2def6040ead2 | |
parent | db560a8f1398915fb8ea90ca349ccb4b91310b03 (diff) | |
download | website-ced51aa57c06445dfac130ae975a612dff820b8b.tar.xz |
awink: clean up a bit, funcitonalize
-rwxr-xr-x | scripts/awink | 39 | ||||
-rw-r--r-- | src/journal.html | 1 |
2 files changed, 25 insertions, 15 deletions
diff --git a/scripts/awink b/scripts/awink index d0ad890..1456c8b 100755 --- a/scripts/awink +++ b/scripts/awink @@ -1,17 +1,28 @@ #!/usr/bin/env bash -if ! [[ -n "$1" || -n "$2" ]]; then - printf "%s\n" "awink <infile> <outfile>" - exit 2 -fi +## +# arguments: +# $1 In file +# $2 Out file +build() { + gawk '{ + if (NF == 2 && $1 == "%include") { + while ((getline line < $2) > 0) { + print line; + } + close($2); + } else { + print; + } + }' "$1" > "$2" +} -gawk '{ - if (NF == 2 && $1 == "%include") { - while ((getline line < $2) > 0) { - print line; - } - close($2); - } else { - print; - } -}' "$1" > "$2" +main() { + if [[ "$#" != 2 ]]; then + printf "%s\n" "awink <in file> <out file>" + exit 2 + fi + + build "$1" "$2" +} +main "$@" diff --git a/src/journal.html b/src/journal.html index 5e85fde..e3a403d 100644 --- a/src/journal.html +++ b/src/journal.html @@ -16,7 +16,6 @@ <h2 class="title" >Blogpost</h2> <div class="info"> <time datetime="2014-08-22T09:50:23Z">2014-08-22 09:50 UTC</time> - <a rel="author" href="./about">Johannes Löthberg</a> </div> <p>Developers developers developers developers developers developers |