From 107b72e74cf740489c8eae7464b9ee24dcaeed6e Mon Sep 17 00:00:00 2001 From: toonn Date: Mon, 16 Apr 2018 12:38:01 +0200 Subject: Add support for mutool pdf previews in scope.sh --- README.md | 2 +- doc/ranger.1 | 10 +++++----- doc/ranger.pod | 2 +- ranger/data/scope.sh | 1 + 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index ef644ae6..df17f731 100644 --- a/README.md +++ b/README.md @@ -75,7 +75,7 @@ Optional, for enhanced file previews (with `scope.sh`): * `highlight` or `pygmentize` for syntax highlighting of code * `atool`, `bsdtar` and/or `unrar` for previews of archives * `lynx`, `w3m` or `elinks` for previews of html pages -* `pdftotext` for pdf previews +* `pdftotext` or `mutool` for pdf previews * `transmission-show` for viewing bit-torrent information * `mediainfo` or `exiftool` for viewing information about media files * `odt2txt` for OpenDocument text files (`odt`, `ods`, `odp` and `sxw`) diff --git a/doc/ranger.1 b/doc/ranger.1 index 745f1032..71310541 100644 --- a/doc/ranger.1 +++ b/doc/ranger.1 @@ -1,4 +1,4 @@ -.\" Automatically generated by Pod::Man 4.07 (Pod::Simple 3.32) +.\" Automatically generated by Pod::Man 4.09 (Pod::Simple 3.35) .\" .\" Standard preamble: .\" ======================================================================== @@ -129,7 +129,7 @@ .\" ======================================================================== .\" .IX Title "RANGER 1" -.TH RANGER 1 "ranger-1.9.1" "05.03.2018" "ranger manual" +.TH RANGER 1 "ranger-1.9.1" "2018-04-16" "ranger manual" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l @@ -270,7 +270,7 @@ scripts by setting the option \f(CW\*(C`use_preview_script\*(C'\fR and \f(CW\*(C This default script is \fI~/.config/ranger/scope.sh\fR. It contains more documentation and calls to the programs \fIlynx\fR and \fIelinks\fR for html, \&\fIhighlight\fR for text/code, \fIimg2txt\fR for images, \fIatool\fR for archives, -\&\fIpdftotext\fR for PDFs and \fImediainfo\fR for video and audio files. +\&\fIpdftotext\fR or \fImutool\fR for PDFs and \fImediainfo\fR for video and audio files. .PP Install these programs (just the ones you need) and scope.sh will automatically use them. @@ -599,7 +599,7 @@ Toggle the mark-status of all files .IP "V" 14 .IX Item "V" Starts the visual mode, which selects all files between the starting point and -the cursor until you press \s-1ESC. \s0 To unselect files in the same way, use \*(L"uV\*(R". +the cursor until you press \s-1ESC.\s0 To unselect files in the same way, use \*(L"uV\*(R". .IP "/" 14 Search for files in the current directory. .IP ":" 14 @@ -702,7 +702,7 @@ in ranger. .IP "automatically_count_files [bool]" 4 .IX Item "automatically_count_files [bool]" Should ranger count and display the number of files in each directory -as soon as it's visible? This gets slow with remote file systems. Turning it +as soon as it's visible? This gets slow with remote file sytems. Turning it off will still allow you to see the number of files after entering the directory. .IP "autosave_bookmarks [bool]" 4 diff --git a/doc/ranger.pod b/doc/ranger.pod index 8599a1a6..41bafdd3 100644 --- a/doc/ranger.pod +++ b/doc/ranger.pod @@ -177,7 +177,7 @@ scripts by setting the option C and C to true This default script is F<~/.config/ranger/scope.sh>. It contains more documentation and calls to the programs I and I for html, I for text/code, I for images, I for archives, -I for PDFs and I for video and audio files. +I or I for PDFs and I for video and audio files. Install these programs (just the ones you need) and scope.sh will automatically use them. diff --git a/ranger/data/scope.sh b/ranger/data/scope.sh index 540a910e..f7a0f589 100755 --- a/ranger/data/scope.sh +++ b/ranger/data/scope.sh @@ -61,6 +61,7 @@ handle_extension() { pdf) # Preview as text conversion pdftotext -l 10 -nopgbrk -q -- "${FILE_PATH}" - && exit 5 + mutool draw -F txt -i -- "${FILE_PATH}" 1-10 && exit 5 exiftool "${FILE_PATH}" && exit 5 exit 1;; -- cgit 1.4.1-2-gfad0 From 83d0e61abfb80c609c5686be5fcf0b7208571d82 Mon Sep 17 00:00:00 2001 From: toonn Date: Mon, 16 Apr 2018 12:39:38 +0200 Subject: Add a pass through fmt to pdf previews. This reformats the previews to fit the preview column width making previews more readable in most cases. --- ranger/data/scope.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ranger/data/scope.sh b/ranger/data/scope.sh index f7a0f589..25251533 100755 --- a/ranger/data/scope.sh +++ b/ranger/data/scope.sh @@ -60,8 +60,8 @@ handle_extension() { # PDF pdf) # Preview as text conversion - pdftotext -l 10 -nopgbrk -q -- "${FILE_PATH}" - && exit 5 - mutool draw -F txt -i -- "${FILE_PATH}" 1-10 && exit 5 + pdftotext -l 10 -nopgbrk -q -- "${FILE_PATH}" - | fmt -w ${PV_WIDTH} && exit 5 + mutool draw -F txt -i -- "${FILE_PATH}" 1-10 | fmt -w ${PV_WIDTH} && exit 5 exiftool "${FILE_PATH}" && exit 5 exit 1;; -- cgit 1.4.1-2-gfad0 From f6af1ebad94b902d61f73b00978272018e2ef438 Mon Sep 17 00:00:00 2001 From: toonn Date: Mon, 16 Apr 2018 14:13:49 +0200 Subject: Refix typo "sytem" --- doc/ranger.1 | 2 +- doc/ranger.pod | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/ranger.1 b/doc/ranger.1 index 71310541..238aafd5 100644 --- a/doc/ranger.1 +++ b/doc/ranger.1 @@ -702,7 +702,7 @@ in ranger. .IP "automatically_count_files [bool]" 4 .IX Item "automatically_count_files [bool]" Should ranger count and display the number of files in each directory -as soon as it's visible? This gets slow with remote file sytems. Turning it +as soon as it's visible? This gets slow with remote file systems. Turning it off will still allow you to see the number of files after entering the directory. .IP "autosave_bookmarks [bool]" 4 diff --git a/doc/ranger.pod b/doc/ranger.pod index 41bafdd3..0a34209a 100644 --- a/doc/ranger.pod +++ b/doc/ranger.pod @@ -678,7 +678,7 @@ in ranger. =item automatically_count_files [bool] Should ranger count and display the number of files in each directory -as soon as it's visible? This gets slow with remote file sytems. Turning it +as soon as it's visible? This gets slow with remote file systems. Turning it off will still allow you to see the number of files after entering the directory. -- cgit 1.4.1-2-gfad0