unk/lht
2019-07-01 12:37:58 -05:00

6 lines
241 B
Awk
Executable File

#!/usr/bin/awk -f
function s(t,i){while(match($0,t)){if(I[ni]==i)ni-=sub(t,"</"i">")
else if(sub(t,"<"i">"))I[++ni]=i}}BEGIN{FS="\n"; RS="";ni=0}
{$0=(match($0,/^<.*>$/))?$0:"<p>"$0"</p>"
s("__","strong");s("\\*","em");s("`","code"); print}