---Reply to mail from Matsumoto, Masakazu about Japanese code converter kcc
> Alexander R. Pruss wrote:
>
>>I've been asking for a long time for a way to plug in a filter (e.g., a sed
>>filter or something). That would do the job.
>>
Sounds like you both want something like this:
Right before line 799 in Spider.py insert this:
filter = config.get_string ('filter')
if filter is not None:
try:
tempfile = tempfile.mktemp()
f = open(tempfile, "wb")
f.write(document)
f.close()
command = filter + " " + tempfile
pipe = os.popen(command)
document = pipe.read()
pipe.close()
finally:
try: os.unlink(infile)
except: pass
(line 799)
# OK, it's fair game, so we parse it
try:
pluckerdoc = self._parser (new_url,
header,
document,
self._config,
attributes.as_dict())
In .pluckerrc Matto would add:
filter = kcc [the opts he needs]
I coludn't understand the README or manual for kcc, but, from the code it
looks like it takes an inputfile (and write to stdout. Should work.
Matto:
You can test it by removing the first two lines and inserting the
commandline for kcc for the filter variable (command = "kcc [opts] " + tempfile)
---End reply
Christopher R. Hawks
HAWKSoft
-------------------------------------------------------------------------
Contrary to popular belief, Unix is user friendly. It just happens to be
very selective about who its friends are. And sometimes even best friends
have fights.
_______________________________________________
plucker-dev mailing list
[EMAIL PROTECTED]
http://lists.rubberchicken.org/mailman/listinfo/plucker-dev