From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Thien-Thi Nguyen Newsgroups: gmane.lisp.guile.user,gmane.lisp.guile.sources Subject: biomail2ris 1.0 Date: Tue, 03 Dec 2002 21:23:26 -0800 Sender: guile-user-admin@gnu.org Message-ID: Reply-To: ttn@glug.org NNTP-Posting-Host: main.gmane.org X-Trace: main.gmane.org 1038979861 11433 80.91.224.249 (4 Dec 2002 05:31:01 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Wed, 4 Dec 2002 05:31:01 +0000 (UTC) Cc: guile-user@gnu.org, markus@mhoenicka.de Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18JS7d-0002y1-00 for ; Wed, 04 Dec 2002 06:30:58 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18JS8j-0004IP-00; Wed, 04 Dec 2002 00:32:05 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10.13) id 18JS8O-00040j-00 for guile-user@gnu.org; Wed, 04 Dec 2002 00:31:44 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10.13) id 18JS8M-0003vl-00 for guile-user@gnu.org; Wed, 04 Dec 2002 00:31:44 -0500 Original-Received: from ca-crlsca-cuda3-c6a-b-211.crlsca.adelphia.net ([68.71.15.211] helo=giblet) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18JS8I-0003vH-00; Wed, 04 Dec 2002 00:31:39 -0500 Original-Received: from ttn by giblet with local (Exim 3.35 #1 (Debian)) id 18JS0M-0003XQ-00; Tue, 03 Dec 2002 21:23:26 -0800 Original-To: guile-sources@gnu.org Errors-To: guile-user-admin@gnu.org X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.0.11 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.lisp.guile.user:1429 gmane.lisp.guile.sources:21 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.user:1429 writing this exposes a limitation of module (ttn edit): there is no way to specify the equivalent of emacs' case-fold-search. that's why there are ugly caps in the `find' regexp, ready to fail when/if the biomail folks change their html generation scheme. (for a more general solution to parsing html, see LAML.) biomail2ris has been tested with contemporary biomail option "html in attachment" and a slightly hacked refdb-0.9 installation. viva science and the scientific method! thi _____________________________________ #!/bin/sh # aside from this initial boilerplate, this is actually -*- scheme -*- code main='(module-ref (resolve-module '\''(biomail2ris)) '\'main')' exec ${GUILE-guile} -l $0 -c "(apply $main (cdr (command-line)))" "$@" !# ;;; ID: $Id: biomail2ris.scm,v 1.1 2002/12/04 04:58:41 ttn Exp $ ;;; ;;; Copyright (C) 2002 Thien-Thi Nguyen ;;; This program is part of ttn-do, released under GNU GPL v2 with ABSOLUTELY ;;; NO WARRANTY. See http://www.gnu.org/copyleft/gpl.txt for details. ;;; Commentary: ;; Usage: biomail2ris BIOMAIL-HTML-MAIL ;; ;; Parse file BIOMAIL-HTML-MAIL, retrieve in Medline format all the citations ;; therein, filter them through nmed2ris and display the output to stdout. ;;; Code: (define-module (biomail2ris) :use-module ((scripts PROGRAM) :select (script-MAIN)) :use-module (www http) :use-module (www url) :use-module (ttn gap-buffer) :use-module (ttn edit) :use-module (ttn make-buffered-caller) :export (biomail2ris)) (define *biomail2ris-version* "1.0") (define (biomail-get linear-url fields) (http:post-form (url:parse linear-url) (list (format #f "User-Agent: biomail2ris/~A" *biomail2ris-version*)) (cons '(submit . "Medline format") fields))) (use-modules (scripts slurp)) ; testing (define (biomail2ris . args) (let* ((sel '()) (user #f) (mail #f) (subj #f) (lang #f) (buf (make-gap-buffer (slurp (car args)))) (find (lambda (buf var) (let ((re (format #f "string buf)) ;; lastly, convert to ris format (let ((nmed2ris (make-buffered-caller "nmed2ris" #:inb buf))) (nmed2ris 'execute) (display (nmed2ris 'outbuf-string))))) #t) (define (main . args) (script-MAIN args "biomail2ris" biomail2ris '(usage . commentary))) ;;; biomail2ris ends here _______________________________________________ Guile-user mailing list Guile-user@gnu.org http://mail.gnu.org/mailman/listinfo/guile-user