Introduction
Introduction Statistics Contact Development Disclaimer Help
New html_handler that replaces gnu/sed with awk by sqweek, sorry for taking so …
git clone git://git.suckless.org/swerc
Log
Files
Refs
README
---
commit d82b009b00c88a380c73ad5c67330bae3134b9da
parent 0caffac3988e627fabeebb005e7ad03dc97dd5c4
Author: [email protected] <unknown>
Date: Sat, 20 Dec 2008 22:56:49 +0100
New html_handler that replaces gnu/sed with awk by sqweek, sorry for taking so …
Diffstat:
M bin/werc.rc | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
---
diff --git a/bin/werc.rc b/bin/werc.rc
@@ -79,7 +79,12 @@ fn md_handler { cat $* | $formatter }
fn tpl_handler { template $1 }
fn html_handler {
- cat $1 | /bin/sed '0,/<[Bb][Oo][Dd][Yy][^>]*>/d; /<\/[Bb][Oo][Dd][Yy]>/,$d…
+ # body states: 0 = no <body> found, 2 = after <body>, 1 = after <body></bo…
+ awk 'gsub(".*<[Bb][Oo][Dd][Yy][^>]*>", "") > 0 {body=2}
+ gsub("</ *[Bb][Oo][Dd][Yy][^>]*>.*", "") > 0 {print; body=body-1}
+ body==2 {print}
+ body==0 {buf=buf "\n" $0}
+ END {if(body<=0) {print buf}}' < $1
}
fn txt_handler {
You are viewing proxied material from suckless.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.