pp index.upphtml < twtxt.txt > index.html
awk
. @prologic feed is a special case 😋. Ok, optimized it some:\n\nhttps://clbin.com/MCzFb\n\n\nHow does it run on your side?
grep -v '^#'
it would still break everything.\nI'm trying out the newer version now. Will report back.
> I assumed all lines start with a date
So did I in my attempt, but even after a quick
grep -v '^#'
it would still break everything.I'm trying out the newer version now. Will report back.
smu
used for?
awk
to avoid the dumpster fire below.
timestamp=$(echo "$line" | grep -Eo '^[0-9]{4}-[01][0-9]-[0-3][0-9][Tt][0-2][0-9]:[0-5][0-9]:[0-5][0-9](\.[0-9]+)?([+-][0-2][0-9]:[0-5][0-9]|Zz)')
twt=$(echo "$line" | sed -e 's/"/\"/g; s/
/\ -)
hyperlinked=$(echo "$twt" | sed 's|http://[^ ]*[^ ,.;:)>}!]|<a href="&">&</a>|g; s|https://[^ ]*[^ ,.;:)>}!]|<a href="&">&</a>|g')
awk
to avoid the dumpster fire below. \n\ntimestamp=$(echo "$line" | grep -Eo '^[0-9]{4}-[01][0-9]-[0-3][0-9][Tt][0-2][0-9]:[0-5][0-9]:[0-5][0-9](\\.[0-9]+)?([+-][0-2][0-9]:[0-5][0-9]|Zz)')\ntwt=$(echo "$line" | sed -e 's/"/\\"/g; s/
/\\/g' | cut -f 2- -)\nhyperlinked=$(echo "$twt" | sed 's|http://[^ ]*[^ ,.;:)>}!]|<a href="&">&</a>|g; s|https://[^ ]*[^ ,.;:)>}!]|<a href="&">&</a>|g')\n
awk
noob myself (@adi wrote the script that parses my twtxt feed) but if I've learned anything, is that it is one little powerhouse of a language.
twt
, in pp
you are required to sanitized template strings not variable values. You can just output unsanitezed, it's safe.