gbranden pushed a commit to branch master
in repository groff.
commit 1cfbd820e4dd3ee5a716b574f835ff07f798461d
Author: Sven Schober <[email protected]>
AuthorDate: Mon Sep 2 20:11:53 2024 +0200
[man]: Handle discrepant `pdf{images,totext}`.
There are at least two different implementation variants for pdfimages
and pdftotext out there: poppler's and xpdfreader.com's.
* tmac/tests/an_UR-works.sh: Cope with minute syntax differences between
these implementations in test case.
Fixes <https://savannah.gnu.org/bugs/?66155> (1/2).
[I tweaked the shell style. --GBR]
---
ChangeLog | 13 +++++++++++++
tmac/tests/an_UR-works.sh | 28 ++++++++++++++++++++++++++--
2 files changed, 39 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index f99e99ab8..dddffd3c9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2024-09-02 Sven Schober <[email protected]>
+
+ [man]: Handle discrepant `pdf{images,totext}`.
+
+ There are at least two different implementation variants for
+ pdfimages and pdftotext out there: poppler's and
+ xpdfreader.com's.
+
+ * tmac/tests/an_UR-works.sh: Cope with minute syntax differences
+ between these implementations in test case.
+
+ Fixes <https://savannah.gnu.org/bugs/?66155> (1/2).
+
2024-09-05 G. Branden Robinson <[email protected]>
* src/roff/troff/input.cpp (token::next)
diff --git a/tmac/tests/an_UR-works.sh b/tmac/tests/an_UR-works.sh
index ea87a768d..5d126bdc2 100755
--- a/tmac/tests/an_UR-works.sh
+++ b/tmac/tests/an_UR-works.sh
@@ -95,8 +95,24 @@ then
exit 77 # skip
fi
-output=$(printf "%s\n" "$input" | "$groff" -Tpdf -P-d -man -rU0 \
+# At least two different implementations of pdftotext exist; if we don't
+# have the poppler version, assume it's xpdfreader.com's.
+have_poppler_pdftotext=yes
+if pdftotext -v 2>&1 | grep -q xpdfreader
+then
+ have_poppler_pdftotext=
+fi
+
+if [ -n "$have_poppler_pdftotext" ]
+then
+ output=$(printf "%s\n" "$input" | "$groff" -Tpdf -P-d -man -rU0 \
| pdftotext - -)
+else
+ tmp_file=$(mktemp)
+ printf "%s\n" "$input" | "$groff" -Tpdf -P-d -man -rU0 > "$tmp_file"
+ output=$(pdftotext "$tmp_file" -)
+ rm "$tmp_file"
+fi
echo "$output"
echo "checking formatting of web URI with link text" \
@@ -110,8 +126,16 @@ echo "checking formatting of web URI with no link text" \
# expected: Or 〈http://bar.example.com〉.
echo "$output" | grep -q 'Or .*http://bar.example.com.*\.' || wail
-output=$(printf "%s\n" "$input" | "$groff" -Tpdf -P-d -man -rU1 \
+if [ -n "$have_poppler_pdftotext" ]
+then
+ output=$(printf "%s\n" "$input" | "$groff" -Tpdf -P-d -man -rU1 \
| pdftotext - -)
+else
+ tmp_file=$(mktemp)
+ printf "%s\n" "$input" | "$groff" -Tpdf -P-d -man -rU1 > "$tmp_file"
+ output=$(pdftotext "$tmp_file" -)
+ rm "$tmp_file"
+fi
echo "$output"
echo "checking formatting of web URI with link text" \
_______________________________________________
Groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit