summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rwxr-xr-xranger/data/scope.sh34
1 files changed, 34 insertions, 0 deletions
diff --git a/ranger/data/scope.sh b/ranger/data/scope.sh
index ae09fe39..f403ed83 100755
--- a/ranger/data/scope.sh
+++ b/ranger/data/scope.sh
@@ -83,6 +83,15 @@ handle_extension() {
         odt|ods|odp|sxw)
             ## Preview as text conversion
             odt2txt "${FILE_PATH}" && exit 5
+            ## Preview as markdown conversion
+            pandoc -s -t markdown -- "${FILE_PATH}" && exit 5
+            exit 1;;
+
+        ## XLSX
+        xlsx)
+            ## Preview as csv conversion
+            ## Uses: https://github.com/dilshod/xlsx2csv
+            xlsx2csv -- "${FILE_PATH}" && exit 5
             exit 1;;
 
         ## HTML
@@ -91,6 +100,7 @@ handle_extension() {
             w3m -dump "${FILE_PATH}" && exit 5
             lynx -dump -- "${FILE_PATH}" && exit 5
             elinks -dump "${FILE_PATH}" && exit 5
+            pandoc -s -t markdown -- "${FILE_PATH}" && exit 5
             ;;
 
         ## JSON
@@ -255,6 +265,30 @@ handle_image() {
 handle_mime() {
     local mimetype="${1}"
     case "${mimetype}" in
+        ## RTF and DOC
+        text/rtf|*msword)
+            ## Preview as text conversion
+            ## note: catdoc does not always work for .doc files
+            ## catdoc: http://www.wagner.pp.ru/~vitus/software/catdoc/
+            catdoc -- "${FILE_PATH}" && exit 5
+            exit 1;;
+
+        ## DOCX, ePub, FB2 (using markdown)
+        ## You might want to remove "|epub" and/or "|fb2" below if you have
+        ## uncommented other methods to preview those formats
+        *wordprocessingml.document|*/epub+zip|*/x-fictionbook+xml)
+            ## Preview as markdown conversion
+            pandoc -s -t markdown -- "${FILE_PATH}" && exit 5
+            exit 1;;
+
+        ## XLS
+        *ms-excel)
+            ## Preview as csv conversion
+            ## xls2csv comes with catdoc:
+            ##   http://www.wagner.pp.ru/~vitus/software/catdoc/
+            xls2csv -- "${FILE_PATH}" && exit 5
+            exit 1;;
+
         ## Text
         text/* | */xml)
             ## Syntax highlight