shithub: werc

Download patch

ref: 53c303ffd1d3acfae2d9199106b5a6cedc76a398
parent: a2754a9e221c4370450be8ee05e9e5a67e622203
author: uriel <uriel@engel.se.cat-v.org>
date: Sat Jan 3 22:59:52 EST 2009

Simplify .txt handler, and remove double spacing, if lines are too close we should use css to space them.

--- a/bin/werc.rc
+++ b/bin/werc.rc
@@ -83,11 +83,8 @@
 }
 
 fn txt_handler {
-    echo '<pre>'
-    # XXX Insering a blank line between lines in input is good for fortunes.txt, but maybe not for other .txt files
-    # XXX Words are not broken, even if they are way beyond 82 chars long
-    cat $1 | sed 's/$/\n/g; s/</\&lt;/g; s/>/\&gt;/g' | fmt -l 82 -j
-    echo '</pre>'
+    # Note: Words are not broken, even if they are way beyond 82 chars long
+    echo '<pre>' `{ sed 's/</\&lt;/g; s/>/\&gt;/g' < $1 | fmt -l 82 -j } '</pre>'
 }
 
 fn dir_listing_handler {