bugGNU roff - Bugs: bug #62933, [man] produce hyperlinks in PDF...

 
 

bug #62933: [man] produce hyperlinks in PDF output

Submitter:  G. Branden Robinson <gbranden>
Submitted:  Sun 21 Aug 2022 01:41:37 PM UTC
   
 
Category:  Macro man Severity:  3 - Normal
Item Group:  Feature change Status:  Fixed
Privacy:  Public Assigned to:  gbranden
Open/Closed:  Closed Planned Release:  1.24.0
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Wed 31 Jan 2024 04:31:55 AM UTC, comment #7: 


commit 594937c50e0d9fed0c815ac4e3e0c560c6d66c32
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
Date:   Tue Jan 30 21:02:03 2024 -0600

    [man]: Fix Savannah #62933 (`MR` PDF hyperlinks).

    * tmac/an.tmac (MR): Support hyperlinked man page cross references in
      PDF.

    Fixes <https://savannah.gnu.org/bugs/?62933>.


G. Branden Robinson <gbranden>
Group administrator
Wed 31 Jan 2024 02:58:56 AM UTC, comment #6: 

Got the last third.


diff --git a/tmac/an.tmac b/tmac/an.tmac
index 81ad61118..b8160e8aa 100644
--- a/tmac/an.tmac
+++ b/tmac/an.tmac
@@ -1270,6 +1270,11 @@ .de1 MR
 .  if \\n[an*do-hyperlink] \{\
 .    if '\*[.T]'html' \
 .      nop \X^html:<a href="\\*[an*url]">^\c
+.    if '\*[.T]'pdf' \{\
+.      ds an*saved-stroke-color \\n[.m]\"
+.      nop \&\m[\\*[PDFHREF.TEXT.COLOUR]]\c
+.      pdfhref W -D \\*[an*url] -- "|"
+.    \}
 .    if \\n[an*is-output-terminal] \
 .      nop \X^tty: link \\*[an*url]^\c
 .  \}
@@ -1277,6 +1282,10 @@ .de1 MR
 .  if \\n[an*do-hyperlink] \{\
 .    if '\*[.T]'html' \
 .      nop \X^html:</a>^\c
+.    if '\*[.T]'pdf' \{\
+.      nop \X'pdf: markend'\\m[\\*[an*saved-stroke-color]]\c
+.      rm an*saved-stroke-color
+.    \}
 .    if \\n[an*is-output-terminal] \
 .      nop \X^tty: link^\c
 .  \}


G. Branden Robinson <gbranden>
Group administrator
Wed 31 Jan 2024 01:04:38 AM UTC, comment #5: 

Deri did 2/3rds of this in bug #65215.  Adding dependency.

G. Branden Robinson <gbranden>
Group administrator
Thu 17 Aug 2023 07:18:49 AM UTC, comment #4: 

This actually hurts now (post-1.23.0 Git) with man's `U` register  defaulting to 1.

A `UR` URL with no link text now gets rendered as nothing at all.

Kicking up to normal.

G. Branden Robinson <gbranden>
Group administrator
Tue 27 Dec 2022 09:30:01 AM UTC, comment #3: 

De-scheduling for 1.23.0 because of the difficulties with general hyperlink support in man(7) for PDF.  Also, Deri gave me permission to postpone it.

https://lists.gnu.org/archive/html/groff/2022-12/msg00134.html

G. Branden Robinson <gbranden>
Group administrator
Tue 23 Aug 2022 09:52:38 PM UTC, comment #2: 

Thanks, Deri.

Kicking up to blocker severity because IMO this is a killer feature for groff 1.23.0.

G. Branden Robinson <gbranden>
Group administrator
Sun 21 Aug 2022 04:02:19 PM UTC, comment #1: 

.MR only makes sense in pdf output when dealing with a man page collection in a single volume, a-la Branden's new groff-man-pages. The reason is because the link to a separate man page requires a protocol handler which fires of a call to mandb to produce the man page in pdf format which then triggers your default pdf viewer.

Now this all "do-able", there is even a man:// protocol, but under kde5 this is hard coded to run man2html (which is horrible), under kde4 it was possible to alter this. Under desktops which fully support the xdg commands it is possible to use this protocol to present all man pages as pdfs.

Before .MR was added to man I wrote a script which detects references to external man pages and inserts the appropriate .pdfhref commands, should be easy to add the appropriate .MR command instead. An example of this in action can be seen at:-

http://chuzzlewit.co.uk

When .MR is used in a volume of man pages I have shared a patch with Branden which links the pages. The result is attached.

Deri James <deri>
Group Member
Sun 21 Aug 2022 01:41:37 PM UTC, original submission:  

Originally reported by Alejandro Colomar, although already a known issue at the time.  :)

See https://lists.gnu.org/archive/html/groff/2022-01/msg00015.html and follow-ups.

G. Branden Robinson <gbranden>
Group administrator

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #53597:  groff-man-pages.pdf added by deri (2MiB - application/pdf)

 

Carbon-Copy List
  • -email is unavailable- added by deri (Posted a comment)
  • -email is unavailable- added by gbranden (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 13 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2024-01-31 gbranden StatusIn Progress Fixed
        Open/ClosedOpen Closed
    2024-01-31 gbranden Dependencies- bugs #65099 is dependent
    2024-01-31 gbranden StatusNone In Progress
        Assigned toNone gbranden
        Planned ReleaseNone 1.24.0
    2024-01-31 gbranden Dependencies- Depends on bugs #65215
    2023-08-17 gbranden Severity1 - Wish 3 - Normal
    2022-12-27 gbranden Planned Release1.23.0 None
    2022-09-26 gbranden Severity5 - Blocker 1 - Wish
        Planned ReleaseNone 1.23.0
    2022-08-23 gbranden Severity1 - Wish 5 - Blocker
    2022-08-21 deri Attached File- Added groff-man-pages.pdf, #53597

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code