[Surfraw-devel] [Fwd: Bug#223953: surfraw: Additional elvi for wikipedia encyclopedia]

Christian Surchi csurchi@debian.org
Sun, 14 Dec 2003 15:50:31 +0100


--=-QVYIwyHjtTq7sS+VXRIz
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

Another elvi, sent by Moritz in BTS.

Moritz: are you interested to join the work on surfraw in this mailing
list and in Alioth too?

thanks
Christian


-----Messaggio Inoltrato-----
From: Moritz Muehlenhoff <jmm@informatik.uni-bremen.de>
To: Debian Bug Tracking System <submit@bugs.debian.org>
Subject: Bug#223953: surfraw: Additional elvi for wikipedia encyclopedia
Date: Sun, 14 Dec 2003 12:38:49 +0100

Package: surfraw
Version: 1.0.7-3.1
Severity: wishlist


I wrote a new elvi for the wikipedia encyclopedia.

Cheers,
        Moritz

-- System Information:
Debian Release: testing/unstable
Architecture: i386
Kernel: Linux legolas 2.6.0-test9-bk24 #26 Thu Nov 20 13:00:30 CET 2003 i686
Locale: LANG=C, LC_CTYPE=de_DE.ISO-8859-15@euro

Versions of packages surfraw depends on:
ii  emacs21 [www-browser]         21.3+1-4   The GNU Emacs editor
ii  links [www-browser]           0.98-3     Character mode WWW browser
ii  lynx [www-browser]            2.8.4.1b-5 Text-mode WWW Browser

-- no debconf information


--=-QVYIwyHjtTq7sS+VXRIz
Content-Type: application/x-shellscript
MIME-Version: 1.0
Content-Disposition: attachment; filename="/home/jmm/wikipedia"
Content-Transfer-Encoding: 7bit

#!/bin/sh
# elvis: wikipedia -- Search the free dictionary wikipedia
# Author: Moritz Muehlenhoff <jmm@informatik.uni-bremen.de>
. surfraw || exit 1

w3_config_hook () {
def   SURFRAW_wikipedia_language	en
}

w3_usage_hook () {
    cat <<EOF
Usage: $w3_argv0 [options] [search-string]
Description:
  Search the Wikipedia online dictionary
Local options:
  -language=ISOCODE | -l=ISOCODE  Two letter language code (resembles ISO country codes)
				  Default: $SURFRAW_wikipedia_language
				  Environment: SURFRAW_wikipedia_language

Examples:
  $w3_argv0 -language=de Richard Stallman
EOF
    w3_global_usage
}

w3_parse_option_hook () {
    opt="$1"
    optarg="$2"
    case "$opt" in
	-language=*)	setopt	SURFRAW_wikipedia_language		$optarg	;;
	-l=*)	setopt	SURFRAW_wikipedia_language		$optarg	;;
	*) return 1 ;;
    esac
    return 0
}

w3_config
w3_parse_args "$@"

prefix="http://$SURFRAW_wikipedia_language.wikipedia.org/w/wiki.phtml?search="

if null $w3_args; then
    w3_browse_url "http://www.wikipedia.org"
else
    escaped_args=`w3_url_of_arg $w3_args`
    w3_browse_url "${prefix}${escaped_args}"
fi

--=-QVYIwyHjtTq7sS+VXRIz--