groff-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[groff] 03/05: [man]: Tweak computation in URI breaking.


From: G. Branden Robinson
Subject: [groff] 03/05: [man]: Tweak computation in URI breaking.
Date: Tue, 2 Nov 2021 11:29:57 -0400 (EDT)

gbranden pushed a commit to branch master
in repository groff.

commit 0610ed464415c624f1022294764b86c6ffd51376
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Tue Nov 2 21:04:24 2021 +1100

    [man]: Tweak computation in URI breaking.
    
    * tmac/an-ext.tmac (UE, ME): Stop adding the page offset `.o` when
      performing the available horizontal space computation for the typeset
      URI string.  This made no difference on nroff devices (grotty; even
      with `.po 15n`), but it caused the breaking decision to be too
      conservative on troff devices {grops}, forcing some URIs that would
      fit on the current line to the next one.
    
    * tmac/tests/an-ext_UE-breaks-before-long-URIs.sh: Add test of URI with
      no link text, which also has break points after every character, so
      that we detect even slight alterations.
---
 ChangeLog                                       | 16 ++++++++++++++++
 tmac/an-ext.tmac                                |  4 ++--
 tmac/tests/an-ext_UE-breaks-before-long-URIs.sh | 11 ++++++++++-
 3 files changed, 28 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index c53e2c1..67ab45b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,21 @@
 2021-11-02  G. Branden Robinson <g.branden.robinson@gmail.com>
 
+       [man]: Tweak computation in URI breaking.
+
+       * tmac/an-ext.tmac (UE, ME): Stop adding the page offset `.o`
+       when performing the available horizontal space computation for
+       the typeset URI string.  This made no difference on nroff
+       devices (grotty; even with `.po 15n`), but it caused the
+       breaking decision to be too conservative on troff devices
+       {grops}, forcing some URIs that would fit on the current line to
+       the next one.
+
+       * tmac/tests/an-ext_UE-breaks-before-long-URIs.sh: Add test of
+       URI with no link text, which also has break points after every
+       character, so that we detect even slight alterations.
+
+2021-11-02  G. Branden Robinson <g.branden.robinson@gmail.com>
+
        [libgroff]: Do more device and font description file validation,
        resolve an assertion failure arising from a negative declared
        device resolution, and correct a documentation error.
diff --git a/tmac/an-ext.tmac b/tmac/an-ext.tmac
index fb1b6e4..44b347b 100644
--- a/tmac/an-ext.tmac
+++ b/tmac/an-ext.tmac
@@ -145,7 +145,7 @@
 .    nr mW \\w'\\*(m2'
 .    \" If the URI won't fit on the rest of the line, break early and
 .    \" turn off adjustment.
-.    if \\n(.o+\\n(.i+\\n(.ku+\\n(mWu>\\n(.lu \{\
+.    if \\n(.i+\\n(.ku+\\n(mWu>\\n(.lu \{\
 .      nr mL 1
 .      nr mJ \\n(.j
 .      br
@@ -215,7 +215,7 @@
 .    nr mW \\w'\\*(m2'
 .    \" If the URI won't fit on the rest of the line, break early and
 .    \" turn off adjustment.
-.    if \\n(.o+\\n(.i+\\n(.ku+\\n(mWu>\\n(.lu \{\
+.    if \\n(.i+\\n(.ku+\\n(mWu>\\n(.lu \{\
 .      nr mL 1
 .      nr mJ \\n(.j
 .      br
diff --git a/tmac/tests/an-ext_UE-breaks-before-long-URIs.sh 
b/tmac/tests/an-ext_UE-breaks-before-long-URIs.sh
index dab26cb..af2e264 100755
--- a/tmac/tests/an-ext_UE-breaks-before-long-URIs.sh
+++ b/tmac/tests/an-ext_UE-breaks-before-long-URIs.sh
@@ -22,7 +22,7 @@ groff="${abs_top_builddir:-.}/test-groff"
 input=$(cat <<EOF
 .TH ridonk 1 2021-10-31 "groff test suite"
 .SH Name
-ridonk \- check the typesetting of an absurdly long URI
+ridonk \- check the typesetting of absurdly long URIs
 .SH Description
 .UR https://\:www\:.adobe\:.com/\:content/\:dam/\:acom/\:en/\:devnet/\:\
 actionscript/\:articles/\:5001\:.DSC_Spec\:.pdf
@@ -31,6 +31,13 @@ Commerce
 n.:
 A kind of transaction in which A plunders from B the goods of C,
 and for compensation B picks the pocket of D of money belonging to E.
+.P
+.UR https://1\:2\:3\:4\:5\:6\:7\:8\:9\:1\:1\:2\:3\:4\:5\:6\:7\:8\:9\:\
+2\:1\:2\:3\:4\:5\:6\:7\:8\:9\:3\:1\:2\:3\:4\:5\:6\:7\:8\:9\:4\:1\:2\:\
+3\:4\:5\:6\:7\:8\:9\:5\:1\:2\:3\:4\:5\:6\:7\:8\:9\:6\:1\:2\:3\:4\:5\:\
+6\:7\:8\:9\:7\:1\:2\:3\:4\:5\:6\:7\:8\:9\:8\:1\:2\:3\:4\:5\:6\:7\:8\:\
+9\:9\:1\:2\:3\:4\:5\:6\:7\:8\:9\:0
+.UE
 EOF
 )
 
@@ -50,8 +57,10 @@ echo "testing that lines break where expected" >&2
 output=$(printf "%s" "$input" | "$groff" -Tascii -P-cbou -man)
 break1=$(echo "$output" | grep -x "  *Commerce")
 break2=$(echo "$output" | grep -x "  *<https.*actionscript/")
+break3=$(echo "$output" | grep -x "  *<https.*612")
 test -n "$break1" || wail "first break"
 test -n "$break2" || wail "second break"
+test -n "$break3" || wail "third break"
 
 test -z "$fail"
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]