gbranden pushed a commit to branch master
in repository groff.
commit 6f78dac68c01e05f58103a2d1dc4d8b7f42292bd
Author: G. Branden Robinson <[email protected]>
AuthorDate: Sat Aug 2 06:26:06 2025 -0500
[{eqn,grap,pic}2graph]: Revise comment style.
* contrib/eqn2graph/eqn2graph.sh:
* contrib/grap2graph/grap2graph.sh:
* contrib/pic2graph/pic2graph.sh:
- Wrap at 72 columns.
- Fill paragraphs.
- Make enumerators in lists hang.
- Remove trailing whitespace.
- Drop empty comment stump at end of comment block.
---
contrib/eqn2graph/eqn2graph.sh | 25 ++++++++++---------
contrib/grap2graph/grap2graph.sh | 33 ++++++++++++------------
contrib/pic2graph/pic2graph.sh | 54 ++++++++++++++++++++++------------------
3 files changed, 60 insertions(+), 52 deletions(-)
diff --git a/contrib/eqn2graph/eqn2graph.sh b/contrib/eqn2graph/eqn2graph.sh
index 00fad61ca..d4c2827b1 100644
--- a/contrib/eqn2graph/eqn2graph.sh
+++ b/contrib/eqn2graph/eqn2graph.sh
@@ -6,29 +6,28 @@
#
# In Unixland, the magic is in knowing what to string together...
#
-# Take an eqn equation on stdin, emit cropped bitmap on stdout.
-# The eqn markup should *not* be wrapped in .EQ/.EN, this script will do that.
+# Take an eqn equation on stdin, emit cropped bitmap on stdout. The eqn
+# markup should *not* be wrapped in .EQ/.EN, this script will do that.
# A -format FOO option changes the image output format to any format
# supported by convert(1). All other options are passed to convert(1).
# The default format is PNG.
#
# This is separate from pic2graph because pic processing has some weird
-# clipping effect on the output, mangling equations that are very wide
+# clipping effect on the output, mangling equations that are very wide
# or deep. Besides, this tool can supply its own delimiters.
#
-
-# Requires the groff suite and the ImageMagick tools. Both are open source.
-# This code is released to the public domain.
+# Requires the groff suite and the ImageMagick tools. Both are open
+# source. This code is released to the public domain.
#
# Here are the assumptions behind the option processing:
#
# 1. None of the options of eqn(1) are relevant.
#
# 2. Many options of convert(1) are potentially relevant, (especially
-# -density, -interlace, -transparency, -border, and -comment).
+# -density, -interlace, -transparency, -border, and -comment).
#
# Thus, we pass everything except -format to convert(1).
-#
+
convert_opts=""
convert_trim_arg="-trim"
format="png"
@@ -67,11 +66,13 @@ fi
if ! tmp=`(umask 077 && mktemp -d -q "$d/eqn2graph-XXXXXX") 2> /dev/null`
then
- # mktemp failed--not installed or is a version that doesn't support those
- # flags? Fall back to older method which uses more predictable naming.
+ # mktemp failed--not installed or is a version that doesn't support
+ # those flags? Fall back to older method which uses more
+ # predictable naming.
#
- # $RANDOM is a Bashism. The fallback of $PPID is not good
pseudorandomness,
- # but is supported by the stripped-down dash shell, for instance.
+ # $RANDOM is a Bashism. The fallback of $PPID is not good
+ # pseudorandomness, but is supported by the stripped-down dash
+ # shell, for instance.
tmp="$d/eqn2graph$$-${RANDOM:-$PPID}"
(umask 077 && mkdir "$tmp") 2> /dev/null
fi
diff --git a/contrib/grap2graph/grap2graph.sh b/contrib/grap2graph/grap2graph.sh
index 59359bf59..5e4578fe6 100644
--- a/contrib/grap2graph/grap2graph.sh
+++ b/contrib/grap2graph/grap2graph.sh
@@ -6,16 +6,15 @@
#
# In Unixland, the magic is in knowing what to string together...
#
-# Take grap description on stdin, emit cropped bitmap on stdout.
-# The grap markup should *not* be wrapped in .G1/.G2, this script will do that.
-# A -U option on the command line enables gpic/groff "unsafe" mode.
-# A -format FOO option changes the image output format to any format
-# supported by convert(1). All other options are passed to convert(1).
-# The default format is PNG.
+# Take grap description on stdin, emit cropped bitmap on stdout. The
+# grap markup should *not* be wrapped in .G1/.G2, this script will do
+# that. A -U option on the command line enables gpic/groff "unsafe"
+# mode. A -format FOO option changes the image output format to any
+# format supported by convert(1). All other options are passed to
+# convert(1). The default format is PNG.
#
-
-# Requires the groff suite and the ImageMagick tools. Both are open source.
-# This code is released to the public domain.
+# Requires the groff suite and the ImageMagick tools. Both are open
+# source. This code is released to the public domain.
#
# Here are the assumptions behind the option processing:
#
@@ -23,11 +22,11 @@
#
# 2. Only the -U option of groff(1) is relevant.
#
-# 3. Many options of convert(1) are potentially relevant, (especially
-# -density, -interlace, -transparency, -border, and -comment).
+# 3. Many options of convert(1) are potentially relevant, (especially
+# -density, -interlace, -transparency, -border, and -comment).
#
# Thus, we pass -U to groff(1), and everything else to convert(1).
-#
+
groff_opts=""
convert_opts=""
convert_trim_arg="-trim"
@@ -69,11 +68,13 @@ fi
if ! tmp=`(umask 077 && mktemp -d -q "$d/grap2graph-XXXXXX") 2> /dev/null`
then
- # mktemp failed--not installed or is a version that doesn't support those
- # flags? Fall back to older method which uses more predictable naming.
+ # mktemp failed--not installed or is a version that doesn't support
+ # those flags? Fall back to older method which uses more
+ # predictable naming.
#
- # $RANDOM is a Bashism. The fallback of $PPID is not good
pseudorandomness,
- # but is supported by the stripped-down dash shell, for instance.
+ # $RANDOM is a Bashism. The fallback of $PPID is not good
+ # pseudorandomness, but is supported by the stripped-down dash
+ # shell, for instance.
tmp="$d/grap2graph$$-${RANDOM:-$PPID}"
(umask 077 && mkdir "$tmp") 2> /dev/null
fi
diff --git a/contrib/pic2graph/pic2graph.sh b/contrib/pic2graph/pic2graph.sh
index 09c47904a..c70267ea9 100644
--- a/contrib/pic2graph/pic2graph.sh
+++ b/contrib/pic2graph/pic2graph.sh
@@ -3,35 +3,37 @@
# pic2graph -- compile PIC image descriptions to bitmap images
#
# by Eric S. Raymond <[email protected]>, July 2002
-
+#
# In Unixland, the magic is in knowing what to string together...
#
-# Take a pic/eqn diagram on stdin, emit cropped bitmap on stdout.
-# The pic markup should *not* be wrapped in .PS/.PE, this script will do that.
-# An -unsafe option on the command line enables gpic/groff "unsafe" mode.
-# A -format FOO option changes the image output format to any format
-# supported by convert(1). An -eqn option changes the eqn delimiters.
-# All other options are passed to convert(1). The default format in PNG.
+# Take a pic/eqn diagram on stdin, emit cropped bitmap on stdout. The
+# pic markup should *not* be wrapped in .PS/.PE, this script will do
+# that. An -unsafe option on the command line enables gpic/groff
+# "unsafe" mode. A -format FOO option changes the image output format
+# to any format supported by convert(1). An -eqn option changes the eqn
+# delimiters. All other options are passed to convert(1). The default
+# format in PNG.
#
-# Requires the groff suite and the ImageMagick tools. Both are open source.
-# This code is released to the public domain.
+# Requires the groff suite and the ImageMagick tools. Both are open
+# source. This code is released to the public domain.
#
# Here are the assumptions behind the option processing:
#
-# 1. Only the -U option of gpic(1) is relevant. -C doesn't matter because
-# we're generating our own .PS/.PE, -[ntcz] are irrelevant because we're
-# generating Postscript.
+# 1. Only the -U option of gpic(1) is relevant. -C doesn't matter
+# because we're generating our own .PS/.PE, -[ntcz] are irrelevant
+# because we're generating Postscript.
#
-# 2. Ditto for groff(1), though it's a longer and more tedious demonstration.
+# 2. Ditto for groff(1), though it's a longer and more tedious
+# demonstration.
#
-# 3. Many options of convert(1) are potentially relevant (especially
+# 3. Many options of convert(1) are potentially relevant (especially
# -density, -interlace, -transparency, -border, and -comment).
#
# Thus, we pass -U to gpic and groff, and everything else to convert(1).
#
-# We don't have complete option coverage on eqn because this is primarily
-# intended as a pic translator; we can live with eqn defaults.
-#
+# We don't have complete option coverage on eqn because this is
+# primarily intended as a pic translator; we can live with eqn defaults.
+
groffpic_opts=""
convert_opts=""
convert_trim_arg="-trim"
@@ -82,11 +84,13 @@ fi
if ! tmp=`(umask 077 && mktemp -d -q "$d/pic2graph-XXXXXX") 2> /dev/null`
then
- # mktemp failed--not installed or is a version that doesn't support those
- # flags? Fall back to older method which uses more predictable naming.
+ # mktemp failed--not installed or is a version that doesn't support
+ # those flags? Fall back to older method which uses more
+ # predictable naming.
#
- # $RANDOM is a Bashism. The fallback of $PPID is not good
pseudorandomness,
- # but is supported by the stripped-down dash shell, for instance.
+ # $RANDOM is a Bashism. The fallback of $PPID is not good
+ # pseudorandomness, but is supported by the stripped-down dash
+ # shell, for instance.
tmp="$d/pic2graph$$-${RANDOM:-$PPID}"
(umask 077 && mkdir "$tmp") 2> /dev/null
fi
@@ -97,8 +101,9 @@ then
exit 1
fi
-# See if the installed version of convert(1) is new enough to support the -trim
-# option. Versions that didn't were described as "old" as early as 2008.
+# See if the installed version of convert(1) is new enough to support
+# the -trim option. Versions that didn't were described as "old" as
+# early as 2008.
is_convert_recent=`convert -help | grep -e -trim`
if test -z "$is_convert_recent"
then
@@ -109,7 +114,8 @@ fi
trap 'exit_status=$?; rm -rf "$tmp" && exit $exit_status' EXIT INT TERM
# Here goes:
-# 1. Wrap the input in dummy .PS/PE macros (and add possibly null .EQ/.EN)
+# 1. Wrap the input in dummy .PS/PE macros (and add possibly null
+# .EQ/.EN)
# 2. Process through eqn and pic to emit troff markup.
# 3. Process through groff to emit Postscript.
# 4. Use convert(1) to crop the PostScript and turn it into a bitmap.
_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit