Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions roffit
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#
# Web: https://daniel.haxx.se/projects/roffit

my $version = "0.17";
my $version = "0.18";

use strict;
#use warnings;
Expand Down Expand Up @@ -50,6 +50,7 @@ my $mandir;
my $hrefdir=".";
my $filename;
my $leavecase;
my %manhref;

while($ARGV[0]) {
if($ARGV[0] eq "--bare") {
Expand All @@ -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
Expand All @@ -84,6 +93,8 @@ while($ARGV[0]) {
" --bare do not put in HTML, HEAD, BODY tags\n",
" --hrefdir=<dir> 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=<dir>=<href> if a manpage is found in DIR then link to it using\n",
" HREF\n",
" --mandir=<dir> 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";
Expand Down Expand Up @@ -238,7 +249,11 @@ 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 = "<a Class=\"$style\" href=\"$html\">$symbol</a>";
Expand Down