Re: check-po a lynx



Ahoj.

Po prečítaní problému, ktorý mal s týmto programom Miroslav Biňas mám
pocit, že by sa DUMP_COMMAND mal ešte trochu upraviť - pre elinks
treba asi pridať -dump-charset utf-8, le lynx som našiel len voľbu
-display_charset a neviem, či to je to pravé (čítal som len manuálovú
stránku).
Ale s tým kódovaním znakov to môže byť asi vo všeobecnosti celkom
sranda (bolo to už dávno, čo som pracoval s nastavením locale na
ISO-8859-2).

Paľo
--- check-po.orig	2009-05-15 23:06:06.000000000 +0200
+++ check-po	2009-05-19 14:31:06.000000000 +0200
@@ -51,6 +51,30 @@
 		exit 1
 		;;
 esac
+
+DUMP_COMMAND=
+DUMP_COMMAND_WIDTH=
+for agent in lynx elinks ; do
+	which $agent > /dev/null 2>&1
+	if test $? -eq 0 ; then
+		DUMP_COMMAND="$agent -dump"
+		break
+	fi
+done
+case $DUMP_COMMAND in
+	elinks*)
+		DUMP_COMMAND="$DUMP_COMMAND -dump-charset UTF-8"
+		USER_FULLNAME_IDX=15
+		USER_EMAIL_IDX=16
+		DUMP_COMMAND_WIDTH=-dump-width=200
+		;;
+	*)
+		DUMP_COMMAND="$DUMP_COMMAND -display-charset UTF-8"
+		USER_FULLNAME_IDX=14
+		USER_EMAIL_IDX=15
+		DUMP_COMMAND_WIDTH=-width=200
+		;;
+esac
 	
 #---------------------------------------------------------
 
@@ -107,7 +131,9 @@
 	echo "Vertimus"
 	echo "========"
 
-	lynx $URL -dump -width=200 > $TMPDIR/vertimus
+	test -z "$DUMP_COMMAND" && fatal "Cannot get Vertimus page - missing \$DUMP_COMMAND. Please install one of the supported text-mode browsers: lynx, elinks"
+
+	$DUMP_COMMAND $URL $DUMP_COMMAND_WIDTH > $TMPDIR/vertimus
 	UPLOAD=`cat $TMPDIR/vertimus | $GEGREP -B 2 -A 1 "^ *\[[0-9]*\]\[download.png\].*merged\.po$" | tail -4`
 	printf "Check for PO file availability... "
 	test `echo "$UPLOAD" | wc -l` -ne 4 && fatal "PO file is not available on Vertimus page"
@@ -194,17 +220,21 @@
 	WIKI_FULLNAME=`echo $TRANS | sed -e 's,\[\[http://l10n\.gnome\.org/users/[^/]*/|\([^]]*\)\]\]$,\1,'`
 	echo "Full name: $WIKI_FULLNAME"
 
-	lynx http://l10n.gnome.org/users/$WIKI_USER -dump > $TMPDIR/wiki-user
-	USER_FULLNAME=`cat $TMPDIR/wiki-user | egrep "^ *\[14\]" | sed -e 's/^ *\[14\]//'`
-	USER_EMAIL=`cat $TMPDIR/wiki-user | egrep "^ *\[15\]" | sed -e 's/^ *\[15\]//' | sed -e 's/ dot /./g' -e 's/ at /@/g'`
-	echo "User full name: $USER_FULLNAME"
-	echo "User e-mail: $USER_EMAIL"
-
-	printf "Check for translator full name... "
-	if test "$WIKI_FULLNAME" != "$USER_FULLNAME" ; then
-		warning "Assigned translator full name differs from user's registration"
+	if test -z "$DUMP_COMMAND" ; then
+		warning "Cannot get WIKI page - missing \$DUMP_COMMAND. Please install one of the supported text-mode browsers: lynx, elinks"
 	else
-		echo "ok"
+		$DUMP_COMMAND http://l10n.gnome.org/users/$WIKI_USER > $TMPDIR/wiki-user
+		USER_FULLNAME=`cat $TMPDIR/wiki-user | egrep "^ *\[$USER_FULLNAME_IDX\]" | sed -e "s/^ *\[$USER_FULLNAME_IDX\]//"` 
+		USER_EMAIL=`cat $TMPDIR/wiki-user | egrep "^ *\[$USER_EMAIL_IDX\]" | sed -e "s/^ *\[$USER_EMAIL_IDX\]//" | sed -e 's/ dot /./g' -e 's/ at /@/g'`
+		echo "User full name: $USER_FULLNAME"
+		echo "User e-mail: $USER_EMAIL"
+
+		printf "Check for translator full name... "
+		if test "$WIKI_FULLNAME" != "$USER_FULLNAME" ; then
+			warning "Assigned translator full name differs from user's registration"
+		else
+			echo "ok"
+		fi
 	fi
 
 	if test -n "$DL_USER" ; then


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]