Skip to content

Commit

Permalink
roffit: show SH names with upercase first + lowercase
Browse files Browse the repository at this point in the history
--preserve-case is introduced to be used to preserve the case from the
source

Closes #25
  • Loading branch information
bagder committed Oct 5, 2021
1 parent 10b524e commit 5b5b044
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
22 changes: 15 additions & 7 deletions roffit
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -37,6 +37,7 @@ my @mandirs;
my $mandir;
my $hrefdir=".";
my $filename;
my $leavecase;

while($ARGV[0]) {
if($ARGV[0] eq "--bare") {
Expand All @@ -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
Expand All @@ -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 {
Expand Down Expand Up @@ -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;
Expand Down
6 changes: 5 additions & 1 deletion roffit.1
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
.\" nroff -man roffit.1
.\" Written by Daniel Stenberg
.\"
.TH roffit 1 "27 Feb 2004" "roffit 0.6" "roffit Manual"
.TH roffit 1 "October 5 2021" "roffit 0.13" "roffit Manual"
.SH NAME
roffit \- convert nroff to HTML
.SH SYNOPSIS
Expand Down Expand Up @@ -32,6 +32,10 @@ section).
.IP \-\-hrefdir=<dir>
Specify a directory to prefix generated href links created with the \-\-mandir
option. This defaults to ".".
.IP \-\-preserve-case
When used, this makes roffit preserve the case in SH (section header) in the
output instead of uppercasing the first letter and doing the rest lowercase.
The case changing was introduced in roffit 0.13.
.SH "CSS CLASSES"
.IP h2.nroffsh
The nroff ".SH" section. These are normally the "headlines" before each sub
Expand Down

0 comments on commit 5b5b044

Please sign in to comment.