-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
roffit: show SH names with upercase first + lowercase
--preserve-case is introduced to be used to preserve the case from the source Closes #25
- Loading branch information
Showing
2 changed files
with
20 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,7 @@ | |
# Author: Daniel Stenberg <[email protected]> | ||
# Web: https://daniel.haxx.se/projects/roffit | ||
|
||
my $version = "0.12"; | ||
my $version = "0.13"; | ||
|
||
use strict; | ||
#use warnings; | ||
|
@@ -37,6 +37,7 @@ my @mandirs; | |
my $mandir; | ||
my $hrefdir="."; | ||
my $filename; | ||
my $leavecase; | ||
|
||
while($ARGV[0]) { | ||
if($ARGV[0] eq "--bare") { | ||
|
@@ -48,6 +49,10 @@ while($ARGV[0]) { | |
print "roffit $version (https://daniel.haxx.se/projects/roffit/)\n"; | ||
exit; | ||
} | ||
elsif($ARGV[0] eq "--preserve-case") { | ||
$leavecase = 1; | ||
exit; | ||
} | ||
elsif($ARGV[0] =~ /^--mandir=(.*)/) { | ||
# check for other HTMLized man pages in these given dirs | ||
# can be specified multiple times | ||
|
@@ -63,12 +68,14 @@ while($ARGV[0]) { | |
} | ||
elsif($ARGV[0] =~ /^(--help|-h)/) { | ||
print $debugFH "Usage: roffit [options] [infile] < infile > outfile\n", | ||
"Options:\n", | ||
" --version display roffit version and exit\n", | ||
" --bare do not put in HTML, HEAD, BODY tags\n", | ||
" --mandir=<dir> check for other HTMLized man pages in these dirs\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"; | ||
"Options:\n", | ||
" --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", | ||
" --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"; | ||
|
||
exit; | ||
} | ||
else { | ||
|
@@ -384,6 +391,7 @@ sub parsefile { | |
|
||
$rest =~ s/\"//g; # cut off quotes | ||
$rest = do_encode($rest); | ||
$rest = ucfirst(lc($rest)) if(!$leavecase); | ||
$out = "<a name=\"$name\"></a><h2 class=\"nroffsh\">$rest</h2>"; | ||
$indentlevel=0; | ||
$within_tp=0; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters