summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorMarie-Helene Burle <msb2@sfu.ca>2019-05-30 17:16:33 -0700
committertoonn <toonn@toonn.io>2019-12-30 21:16:38 +0100
commit6e91ecb14fdbb35b3659fe3ad8deb60d96b28e76 (patch)
treeb84ba8f0ea6eea7765a2bf91c08a6e0191b362e5
parent1300d2f3491739538e2b52478cfdcb0660c9b913 (diff)
downloadranger-6e91ecb14fdbb35b3659fe3ad8deb60d96b28e76.tar.gz
Add preview support to .rtf, .doc, .docx, .xlsx, .xls
-rwxr-xr-xranger/data/scope.sh26
1 files changed, 25 insertions, 1 deletions
diff --git a/ranger/data/scope.sh b/ranger/data/scope.sh
index ae09fe39..da467efa 100755
--- a/ranger/data/scope.sh
+++ b/ranger/data/scope.sh
@@ -85,6 +85,31 @@ handle_extension() {
             odt2txt "${FILE_PATH}" && exit 5
             exit 1;;
 
+	## RTF and DOC
+	rtf|doc)
+	    ## Preview as markdown conversion
+	    ## note: catdoc does not always work for .doc files
+	    catdoc "${FILE_PATH}" && exit 5
+	    exit 1;;
+
+	## DOCX
+	docx)
+	    ## Preview as markdown conversion
+	    pandoc -t markdown "${FILE_PATH}" && exit 5
+	    exit 1;;
+
+	## XLSX
+	xlsx)
+	    ## Preview as csv conversion
+	    xlsx2csv "${FILE_PATH}" && exit 5
+	    exit 1;;
+
+	## XLS
+	xls)
+	    ## Preview as csv conversion
+	    xls2csv "${FILE_PATH}" && exit 5
+	    exit 1;;
+
         ## HTML
         htm|html|xhtml)
             ## Preview as text conversion
@@ -304,7 +329,6 @@ handle_fallback() {
     exit 1
 }
 
-
 MIMETYPE="$( file --dereference --brief --mime-type -- "${FILE_PATH}" )"
 if [[ "${PV_IMAGE_ENABLED}" == 'True' ]]; then
     handle_image "${MIMETYPE}"