config

OpenBSD system configuration
git clone git://jacobedwards.org/config
Log | Files | Refs | README

commit 4e95d760693efb119292eaa5495e1671a3538cb1
parent b7ed8dfc758faba7d49e37d48089baf3d51401f2
Author: Jacob R. Edwards <jacobouno@protonmail.com>
Date:   Mon, 28 Sep 2020 15:08:22 -0700

Remove plain-text support from sfeed awk script

Diffstat:
Mscripts/.local/bin/sfeed.awk | 23+++--------------------
1 file changed, 3 insertions(+), 20 deletions(-)

diff --git a/scripts/.local/bin/sfeed.awk b/scripts/.local/bin/sfeed.awk @@ -1,21 +1,10 @@ #!/usr/bin/awk -f -# display sfeed(1) formatted text as either html or plain-text. +# display sfeed(1) formatted text as html. BEGIN { FS = "\t" } -function basename(path) { - n = split(path, a, "/"); - return a[n]; -} - -function plain(title, author, content) { - gsub(/\\n/, "\n", content); - gsub(/\\t/, " ", content); - printf "%s\nby %s\n\n%s\n", title, author, content -} - function html(title, link, author, content) { gsub(/\\[nt]/, " ", content); if (link == "") { @@ -24,13 +13,7 @@ function html(title, link, author, content) { printf "<article><header><h1><a href=\"%s\">%s</a></h1><h2><address>by %s</address></h2></header>%s</article>\n", link, title, author, content } + { - # TODO: calculate filename only once when it's opened. - if ($7 == "") { author = basename(FILENAME); } else { author = $7; } - if ($5 == "plain") { - plain($2, author, $4); - print "\n"; - } else { - html($2, $3, author, $4); - } + html($2, $3, $7, $4); }