From 83d607a94fd3c8ae10278ea3329d41a2463c6d6b Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Thu, 2 Oct 2025 15:00:23 +0200 Subject: [PATCH 1/2] roffit: add --man option for better external linking This new option accepts two directories. The first is where (prefix) to look for an existing man page soruce file. If that exists, it uses the second prefix to prepend to the genrated HTML file name when creating a link to it. --- roffit | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/roffit b/roffit index af2b9eb..07c4c4d 100755 --- a/roffit +++ b/roffit @@ -21,7 +21,7 @@ # # Web: https://daniel.haxx.se/projects/roffit -my $version = "0.17"; +my $version = "0.18"; use strict; #use warnings; @@ -50,6 +50,7 @@ my $mandir; my $hrefdir="."; my $filename; my $leavecase; +my %manhref; while($ARGV[0]) { if($ARGV[0] eq "--bare") { @@ -65,6 +66,14 @@ while($ARGV[0]) { $leavecase = 1; exit; } + elsif($ARGV[0] =~ /^--man=([^=]*)=(.*)/) { + # check for other man pages in the given dir, and if so, link to it + # using the second string. can be specified multiple times + push @mandirs, $1; + $manhref{$1} = $2; + $mandir = 1; # option used + shift @ARGV; + } elsif($ARGV[0] =~ /^--mandir=(.*)/) { # check for other HTMLized man pages in these given dirs # can be specified multiple times @@ -84,6 +93,8 @@ while($ARGV[0]) { " --bare do not put in HTML, HEAD, BODY tags\n", " --hrefdir= if a manpage is found in the --mandir, this is the\n", " dir we prefix the HTML file name with in the output\n", + " --man== if a manpage is found in DIR then link to it using\n", + " HREF\n", " --mandir= check for other HTMLized man pages in these dirs\n", " --preserve-case leave case of section headers untouched\n", " --version display roffit version and exit\n"; @@ -238,10 +249,15 @@ sub linkfile { my $file = "$d/$symbol.$section"; if(-r $file) { - my $html = "$hrefdir/$symbol.html"; + my $href = $hrefdir; + if($manhref{$d}) { + $href = $manhref{$d}; + } + my $html = "$href/$symbol.html"; # there is such a HTML file present, produce a # link to it! $link = "$symbol"; + $found = 1; last; # skip out of loop } } From 89241341f33c7769cfc0d36dd7cfee6e77491031 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Thu, 2 Oct 2025 17:11:53 +0200 Subject: [PATCH 2/2] fixup remove debug leftover --- roffit | 1 - 1 file changed, 1 deletion(-) diff --git a/roffit b/roffit index 07c4c4d..0315139 100755 --- a/roffit +++ b/roffit @@ -257,7 +257,6 @@ sub linkfile { # there is such a HTML file present, produce a # link to it! $link = "$symbol"; - $found = 1; last; # skip out of loop } }