summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2010-06-22 11:27:21 +0200
committerhut <hut@lavabit.com>2010-06-22 11:27:21 +0200
commitbf14a7e72e7c03673949388365744f26e227ec83 (patch)
treee2a659ad39e963a1c6c372f6a55fb7be0dab241d
parent2e386864912dd028774ffcd997f5ea686e955d0b (diff)
downloadranger-bf14a7e72e7c03673949388365744f26e227ec83.tar.gz
data/scope.sh: added lynx
-rw-r--r--README1
-rwxr-xr-xranger/data/scope.sh22
2 files changed, 16 insertions, 7 deletions
diff --git a/README b/README
index 7a293b97..d92543f7 100644
--- a/README
+++ b/README
@@ -54,6 +54,7 @@ For scope.sh: (enhanced file previews)
 * img2txt (from caca-utils) for previewing images
 * highlight for syntax highlighting of code
 * atool for previews of archives
+* lynx or elinks for previews of html pages
 
 
 Getting Started
diff --git a/ranger/data/scope.sh b/ranger/data/scope.sh
index ad14f5e5..ef5f8ff4 100755
--- a/ranger/data/scope.sh
+++ b/ranger/data/scope.sh
@@ -13,19 +13,27 @@
 mimetype=$(file --mime-type -Lb "$1")
 extension=$(echo "$1" | grep '\.' | grep -o '[^.]\+$')
 
+case "$extension" in
+	# Archive extensions:
+	tar|gz|tgz|bz|tbz|bz2|tbz2|Z|tZ|lzo|tzo|lz|tlz|xz|txz|7z|t7z|\
+	zip|jar|war|rar|lha|lzh|alz|ace|a|arj|arc|rpm|cab|lzma|rz|cpio)
+		atool -l "$1" || exit 1
+		exit 0;;
+	# HTML Pages:
+	htm|html|xhtml)
+		lynx -dump "$1" || elinks -dump "$1" || exit 1
+		exit 0;;
+esac
+
 case "$mimetype" in
-	text/*)
+	# Syntax highlight for text files:
+	text/* | */xml)
 		highlight --ansi "$1" || cat "$1" || exit 1
 		exit 0;;
+	# Ascii-previews of images:
 	image/*)
 		img2txt "$1" || exit 1
 		exit 0;;
 esac
 
-case "$extension" in
-	zip|gz)
-		atool -l "$1" || exit 1
-		exit 0;;
-esac
-
 exit 1