[Surfraw-commits] [SCM] surfraw - a fast unix command line interface to WWW branch, master, updated. surfraw_2-2-5_1-118-g2c376d1

Ian Beckwith ianb at erislabs.net
Thu Jul 1 23:36:04 UTC 2010


The following commit has been merged in the master branch:
commit 2c376d1afd78080332ecf0ae8987f87b8d551d14
Author: Ian Beckwith <ianb at erislabs.net>
Date:   Fri Jul 2 00:35:59 2010 +0100

    * new elvi: yandex. Thanks to Uspenskiy Andrey.

diff --git a/AUTHORS b/AUTHORS
index 0f6e808..de58ae1 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -102,6 +102,9 @@ James TD Smith <ahktenzero at dsl.pipex.com>
 Charles Twardy <ctwardy at iet.com>
         fixed cia
 
+Uspenskiy Andrey <duspen at yandex.ua>
+        elvi: yandex
+
 THANKS TO
 
 Brian Nelson           <bnelson at bloodclot.net>
diff --git a/ChangeLog b/ChangeLog
index 8b7fc05..99163d1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2010-07-02  Ian Beckwith  <ianb at erislabs.net>
+
+	* new elvi: yandex. Thanks to Uspenskiy Andrey.
+
 2010-05-06  Ian Beckwith  <ianb at erislabs.net>
 
 	* uzbl_load_url_from_surfraw: fix menu.
diff --git a/elvi/Makefile.am b/elvi/Makefile.am
index 4d57a6e..d39343f 100644
--- a/elvi/Makefile.am
+++ b/elvi/Makefile.am
@@ -103,6 +103,7 @@ dist_elvi_SCRIPTS	= \
 		  wikipedia \
 		  woffle \
 		  yahoo \
+		  yandex \
 		  youtube \
 		  yubnub
 
diff --git a/elvi/yandex b/elvi/yandex
new file mode 100755
index 0000000..9d5ba3c
--- /dev/null
+++ b/elvi/yandex
@@ -0,0 +1,49 @@
+#!/bin/sh
+# $Id$
+# elvis: yandex		-- Search the web using Yandex (yandex.ru)
+. surfraw || exit 1
+
+w3_config_hook () {
+    def   SURFRAW_yandex_search "${search:-yandsearch?}text"
+}
+
+w3_usage_hook () {
+    cat <<EOF
+Usage: $w3_argv0 [options] [search words]...
+Description:
+  Surfraw search the web using Yandex (yandex.ru)
+Local options:		Specialized search on topic
+  -dict		|	Slovari
+  -news		|	News
+  -images	|	Images
+  -market	|	Market
+  -maps		|	Maps (not implemented)
+EOF
+    w3_global_usage
+}
+
+w3_parse_option_hook () {
+    opt="$1"
+    optarg="$2"
+    case "$opt" in
+      -dict)   search="search.xml?" opt=slovari ;;
+      -news)   search="yandsearch?rpt=nnews2\&" ;;
+      -market) search="search.xml?" ;;
+      -images|-maps) : ;;
+       *)      return 1
+    esac
+    setopt SURFRAW_yandex_domain "${opt:+${opt#-}.}"
+    [[ -n $search ]] && setopt SURFRAW_yandex_search "${search}text"
+    return 0
+}
+
+w3_config
+w3_parse_args "$@"
+# w3_args now contains a list of arguments
+
+if test -z "$w3_args"; then
+    w3_browse_url "http://${SURFRAW_yandex_domain}yandex.ru/"
+else
+    escaped_args=`w3_url_of_arg $w3_args`
+    w3_browse_url "http://${SURFRAW_yandex_domain}yandex.ru/${SURFRAW_yandex_search}=${escaped_args}"
+fi
diff --git a/links.IN b/links.IN
index 341e312..5702444 100644
--- a/links.IN
+++ b/links.IN
@@ -99,5 +99,6 @@ elvi.1sr.gz @mandir@/man1/wetandwild.1sr.gz
 elvi.1sr.gz @mandir@/man1/wikipedia.1sr.gz
 elvi.1sr.gz @mandir@/man1/woffle.1sr.gz
 elvi.1sr.gz @mandir@/man1/yahoo.1sr.gz
+elvi.1sr.gz @mandir@/man1/yandex.1sr.gz
 elvi.1sr.gz @mandir@/man1/youtube.1sr.gz
 elvi.1sr.gz @mandir@/man1/yubnub.1sr.gz
diff --git a/test/Makefile.am b/test/Makefile.am
index 0076d90..3ac6054 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -21,7 +21,8 @@ EXTRA_DIST = runtests elviwithouttests README COOKIES W.test		\
 	springer.test stockquote.test sunonesearch.test thesaurus.test	\
 	translate.test urban.test w3css.test w3html.test w3link.test	\
 	w3rdf.test wayback.test webster.test wetandwild.test		\
-	wikipedia.test woffle.test yahoo.test youtube.test yubnub.test
+	wikipedia.test woffle.test yahoo.test yandex.test youtube.test	\
+	yubnub.test
 
 test:
 	./runtests
diff --git a/test/yandex.ru b/test/yandex.ru
new file mode 100644
index 0000000..62a6311
--- /dev/null
+++ b/test/yandex.ru
@@ -0,0 +1,2 @@
+yandex putin
+ru.wikipedia.org

-- 
surfraw -  a fast unix command line interface to WWW



More information about the Surfraw-commits mailing list