summary refs log tree commit diff stats
path: root/ranger
diff options
context:
space:
mode:
authorMarie-Helene Burle <msb2@sfu.ca>2019-06-01 17:11:17 -0700
committertoonn <toonn@toonn.io>2019-12-30 21:16:38 +0100
commitb1e6eeeb602978c343a5c2a6284a2e26786099c8 (patch)
treec52e239395d57d69ddce07c6259d5946aa5ac433 /ranger
parente30459d31a61a1baf05b72880b743878dbdbe86c (diff)
downloadranger-b1e6eeeb602978c343a5c2a6284a2e26786099c8.tar.gz
Add '--', empty lines, and pandoc fallback support for html and json
Diffstat (limited to 'ranger')
-rwxr-xr-xranger/data/scope.sh16
1 files changed, 10 insertions, 6 deletions
diff --git a/ranger/data/scope.sh b/ranger/data/scope.sh
index ff7aa85e..94257d0a 100755
--- a/ranger/data/scope.sh
+++ b/ranger/data/scope.sh
@@ -47,6 +47,7 @@ PYGMENTIZE_STYLE=${PYGMENTIZE_STYLE:-autumn}
 OPENSCAD_IMGSIZE=${RNGR_OPENSCAD_IMGSIZE:-1000,1000}
 OPENSCAD_COLORSCHEME=${RNGR_OPENSCAD_COLORSCHEME:-Tomorrow Night}
 
+
 handle_extension() {
     case "${FILE_EXTENSION_LOWER}" in
         ## Archive
@@ -84,7 +85,7 @@ handle_extension() {
             ## Preview as text conversion
             odt2txt "${FILE_PATH}" && exit 5
 	    # Preview as markdown conversion
-	    pandoc -s -t markdown "${FILE_PATH}" && exit 5
+	    pandoc -s -t markdown -- "${FILE_PATH}" && exit 5
             exit 1;;
 
 	## ODT (using pandoc)
@@ -98,7 +99,7 @@ handle_extension() {
 	    ## 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
+	    catdoc -- "${FILE_PATH}" && exit 5
 	    exit 1;;
 
 	## DOCX, ePub, FB2 (using markdown)
@@ -106,14 +107,14 @@ handle_extension() {
         ## uncommented other methods to preview those formats
 	docx|epub|fb2)
 	    ## Preview as markdown conversion
-	    pandoc -s -t markdown "${FILE_PATH}" && exit 5
+	    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
+	    xlsx2csv -- "${FILE_PATH}" && exit 5
 	    exit 1;;
 
 	## XLS
@@ -121,7 +122,7 @@ handle_extension() {
 	    ## Preview as csv conversion
 	    ## xls2csv comes with catdoc:
             ##   http://www.wagner.pp.ru/~vitus/software/catdoc/
-	    xls2csv "${FILE_PATH}" && exit 5
+	    xls2csv -- "${FILE_PATH}" && exit 5
 	    exit 1;;
 
         ## HTML
@@ -130,12 +131,14 @@ 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
         json)
             jq --color-output . "${FILE_PATH}" && exit 5
             python -m json.tool -- "${FILE_PATH}" && exit 5
+	    pandoc -s -t markdown -- "${FILE_PATH}" && exit 5
             ;;
 
         ## Direct Stream Digital/Transfer (DSDIFF) and wavpack aren't detected
@@ -342,6 +345,7 @@ handle_fallback() {
     exit 1
 }
 
+
 MIMETYPE="$( file --dereference --brief --mime-type -- "${FILE_PATH}" )"
 if [[ "${PV_IMAGE_ENABLED}" == 'True' ]]; then
     handle_image "${MIMETYPE}"