[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Man2html-dev] Uncommited changes to man2html
From: |
Earl Hood |
Subject: |
[Man2html-dev] Uncommited changes to man2html |
Date: |
Thu, 22 May 2003 18:19:40 -0500 |
Here is the diff between the baseline man2html committed to Savannah
and the local edits I have had sitting around for a long time.
Many of the edits were to clean up the Perl 4 style of code to
make it more Perl 5-ish (like using my). However, there are
some real changes which I believe was due to some past feedback.
I could commit these changes, along with those to man.cgi, if
desired.
Index: man2html
===================================================================
RCS file: /cvsroot/man2html/man2html/man2html,v
retrieving revision 1.3
diff -p -u -r1.3 man2html
--- man2html 22 May 2003 23:04:26 -0000 1.3
+++ man2html 22 May 2003 23:17:11 -0000
@@ -39,6 +39,7 @@
package Man2Html;
use Getopt::Long;
+use vars qw($InFH $OutFH);
($PROG = $0) =~ s/.*\///;
$VERSION = "3.0.1";
@@ -57,7 +58,7 @@ $OutFH = \*STDOUT unless $OutFH;
## The section title can be a regular expression. Therefore, one must
## be careful about quoting special characters.
##
-%SectionHead = (
+my %SectionHead = (
'\S.*OPTIONS.*' => '<H2>',
'AUTHORS?' => '<H2>',
@@ -89,28 +90,29 @@ $OutFH = \*STDOUT unless $OutFH;
);
## Fallback tag if above is not found
-$HeadFallback = '<H2>';
+my $HeadFallback = '<H2>';
## Other gobals
-$Bare = 0; # Skip printing HTML head/foot flag
-$BTag = 'B'; # Overstrike tag
-$CgiUrl = ''; # CGI URL expression
-$Compress = 0; # Do blank line compression flag
-$K = 0; # Do keyword search processing flag
-$NoDepage = 0; # Do not strip page information
-$NoHeads = 0; # Do no header detection flag
-$SeeAlso = 0; # Do only SEE ALSO xrefs flag
-$Solaris = 0; # Solaris keyword search processing flag
-$Sun = 0; # Headers not overstriken flag
-$Title = ''; # Title
-$UTag = 'I'; # Underline tag
-$ftsz = 7; # Bottome margin size
-$hdsz = 7; # Top margin size
-$leftm = ''; # Left margin pad
-$leftmsz = 0; # Left margin size
-$pgsz = 66; # Size of page size
-$txsz = 52; # Text body length size
+my $Bare = 0; # Skip printing HTML head/foot flag
+my $BTag = 'B'; # Overstrike tag
+my $CgiUrl = ''; # CGI URL expression
+my $Compress = 0; # Do blank line compression flag
+my $K = 0; # Do keyword search processing flag
+my $NoDepage = 0; # Do not strip page information
+my $NoHeads = 0; # Do no header detection flag
+my $SeeAlso = 0; # Do only SEE ALSO xrefs flag
+my $Solaris = 0; # Solaris keyword search processing flag
+my $Sun = 0; # Headers not overstriken flag
+my $Target = "_top"; # Target frame for manpage xrefs
+my $Title = ''; # Title
+my $UTag = 'I'; # Underline tag
+my $ftsz = 7; # Bottome margin size
+my $hdsz = 7; # Top margin size
+my $leftm = ''; # Left margin pad
+my $leftmsz = 0; # Left margin size
+my $pgsz = 66; # Size of page size
+my $txsz = 52; # Text body length size
#############################################################################
## Main Block
@@ -183,10 +185,12 @@ sub do_it {
}
## Create anchor links for manpage references
- s/((((.\010)+)?[\+_\.\w-])+\(((.\010)+)?
- \d((.\010)+)?\w?\))
+ s/((?:(?:(?:.\010)+)?[\+_\.\w\->])+
+ \(
+ (?:(?:.\010)+)?[ln\d](?:(?:.\010)+)?(?:[A-Z]{1,2})?
+ \))
/make_xref($1)
- /geox if $see_also;
+ /geoxi if $see_also;
## Emphasize underlined words
# s/((_\010[^_])+[\.\(\)_]?(_\010[^_])+\)?)/emphasize($1)/oge;
@@ -199,7 +203,7 @@ sub do_it {
# to detect that. It does not work all the time, and it
# screws up other text, so a simplified expression is used.
- s/((_\010[^_])+)/emphasize($1)/oge;
+ s/((?:_\010[^_])+)/emphasize($1)/oge;
$secth = 0;
## Check for strong text and headings
@@ -228,10 +232,10 @@ EndOfDoItCode
s%<([^>]*)>$%</$1>%;
$_ = "\n</PRE>\n" . $_ . "<PRE>\n";
} else {
- s/(((.\010)+.)+)/strongize($1)/oge;
+ s/((?:(?:(.)\010)+\2)+)/strongize($1)/oge;
}
} else {
- s/(((.\010)+.)+)/strongize($1)/oge;
+ s/((?:(?:(.)\010)+\2)+)/strongize($1)/oge;
}
}
print $OutFH $_;
@@ -273,6 +277,7 @@ sub get_cli_opts {
"seealso", # Link to other manpages only in the SEE ALSO section
"solaris", # Parse 'man -k' output from a solaris system
"sun", # Section heads are not overstriked in input
+ "target=s", # Target frame for manpage xrefs
"title=s", # Title of manpage (def: Not defined)
"topm=i", # Number of lines for top margin (def: 7)
"uelem=s", # HTML Element for underlined text (def: "I")
@@ -442,11 +447,11 @@ sub make_xref {
if ($CgiUrl) {
my($title,$section,$subsection) =
- ($str =~ /([\+_\.\w-]+)\((\d)(\w?)\)/);
+ ($str =~ /([^(]+)\((.)(\w)+\)/i);
$title =~ s/\+/%2B/g;
my($href) = (eval $CgiUrl);
- qq|<B><A HREF="$href">$str</A></B>|;
+ qq|<B><A HREF="$href" TARGET="$Target">$str</A></B>|;
} else {
qq|<B>$str</B>|;
}
@@ -549,7 +554,9 @@ sub print_mank_sec {
$i = 0;
foreach (@refs) {
if ($CgiUrl) {
- print $OutFH qq|<B><A HREF="$xref">$_</A></B>|;
+ print $OutFH qq|<B><A HREF="$xref" TARGET="$Target">|,
+ $_,
+ qq|</A></B>|;
} else {
print $OutFH $_;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Man2html-dev] Uncommited changes to man2html,
Earl Hood <=