🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #35240

Re: slrn: want post_body_filter_hook

#35240
From: Jan Hlavacek
Date: Thu, 17 Jul 1997 00:00
69 lines
2941 bytes
On 16 Jul 1997 17:36:36 GMT, Pardoz <pardoz@io.com> wrote:
>On 16 Jul 1997 07:49:09 GMT, Kikutani Makoto <kikutani@jdc.ericsson.se>
>wrote:
>
>>But I felt difficulty because I should trim both header and signature
>>from the file. If there is a hook for filtering only body part,
>>it'll be easy.
>
>	I'll second the request for a body-filtering hook (it would also
>make spell-checking much easier, since you wouldn't have ispell or
>whatever hiccupping on the Path: and References: lines).
>
This would not be easy to implement, because of the way slrn composes posts.
It first creates the headers,  appends eventual quoted text and signature and
saves it to a file.  Then it calls an editor to this file.  After that,  it
would have to strip the headers and signature from the text,  filter it
through something,  read it back,  and append the headers again.  

I solve this problem by feeding the file to ex and calling an ex script which
filters the body through ispell-filter.  My post_filter_hook looks roughly
like this:


define post_filter_hook (file)
{
   variable rsp;
   variable cmd;
   
   forever 
     {
	rsp = get_response ("NnIi",
			    "Select Filter? \001None, \001Ispell");
	
	if ((rsp == 'i') or (rsp == 'I'))
	  cmd = "/usr/bin/ex -s -c 'source ~/lib/slrn/ispell_script'";
	else return;
	
	() = system (Sprintf ("%s '%s'", cmd, file, 2));
     }
}

where ispell_script contains

       /^$/,?^-- ?!/home/lahvak/lib/vim/bin/ispell-filter
       wq

and, finally,  ispell-filter (from vim faq) is

       #!/bin/sh
       cat > /tmp/tmp.$$
       ispell $* /tmp/tmp.$$ </dev/tty >/dev/tty
       cat /tmp/tmp.$$
       rm -f /tmp/tmp.$$

This last thing is necessary because ispell doesn't accept input from stdout,
it needs a file to work with.  

You may want to change paths and commands to make it work for you the way you
want.  Also,  I don't know anything about non-unix systems.

lahvak
-- 
Jan Hlav\'{a}\v{c}ek <lahvak+n@math.ohio-state.edu>  (BCC's will bounce)
home page: http://www.math.ohio-state.edu/~lahvak/
slrn page: http://www.math.ohio-state.edu/~lahvak/software/slrn.html
slrn documentation: http://www.math.ohio-state.edu/~lahvak/software/slrn/

Technical Details
Message-ID: <slrn5sribp.rcu.lahvak+n@math.mps.ohio-state.edu>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.mbox.zip!not-for-mail
References: <5qhudl$n04@newstoo.ericsson.se> <slrn5spfbq.26.pardoz@io.com>

Show Full Headers
Complete Article Headers
Message-ID: <slrn5sribp.rcu.lahvak+n@math.mps.ohio-state.edu>
Subject: Re: slrn: want post_body_filter_hook
Date: Thu, 17 Jul 1997 00:00:00 +0000
From: lahvak+n@math.ohio-state.edu (Jan Hlavacek)
References: <5qhudl$n04@newstoo.ericsson.se> <slrn5spfbq.26.pardoz@io.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.mbox.zip!not-for-mail
X-Deja-AN: 257380946
Organization: Department of Mathematics, The Ohio State University
Reply-To: lahvak+n@math.ohio-state.edu
Newsgroups: news.software.readers