From ffb1770349df5fa5ac78779011f37a9900d913e4 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Thu, 23 Dec 2010 23:37:56 +0000 Subject: latex2man 1.24 (23dec10) git-svn-id: svn://tug.org/texlive/trunk@20844 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/scripts/latex2man/latex2man | 238 ++++++++++++++++++-------- 1 file changed, 168 insertions(+), 70 deletions(-) (limited to 'Master/texmf-dist/scripts') diff --git a/Master/texmf-dist/scripts/latex2man/latex2man b/Master/texmf-dist/scripts/latex2man/latex2man index 45da55fb578..5987a8c8c0c 100755 --- a/Master/texmf-dist/scripts/latex2man/latex2man +++ b/Master/texmf-dist/scripts/latex2man/latex2man @@ -3,7 +3,7 @@ # Descr: Latex --> MAN-page (groff -man), HTML and TexInfo; # Language: PERL (>= 5.0) # Author: Dr. Jürgen Vollmer, Juergen.Vollmer@informatik-vollmer.de -# $Id: latex2man,v 1.151 2008/11/11 07:21:14 vollmer Exp $ +# $Id: latex2man,v 1.156 2010/12/22 12:44:30 vollmer Exp $ # # Copyright (C) 1998 Dr. Juergen Vollmer # Viktoriastrasse 15, D-76133 Karlsruhe, Germany @@ -26,8 +26,8 @@ $CMD=`basename $0`; chop ($CMD); $gen_date = `date`; chomp $gen_date; # date when the output was generated sub date2str; -$VERSION = "1.23"; -$DATE = date2str ('$Date: 2008/11/11 07:21:14 $' =~ m|(\d+/\d+/\d+)|); +$VERSION = "1.24"; +$DATE = date2str ('$Date: 2010/12/22 12:44:30 $' =~ m|(\d+/\d+/\d+)|); $tmp = "/tmp/$CMD.$$"; @@ -35,17 +35,19 @@ $tmp = "/tmp/$CMD.$$"; # check option and arguments ################################################################## -getopts('o:t:VhMHTLC:D:a:'); # -D1: write each read line -D2: write each word +getopts('o:t:c:VhMHTLC:D:a:'); # -D1: write each read line -D2: write each word sub usage { print <<'END'; -usage: latex2man [-t transfile] [-HTML] [-C name] [-h] [-V] infile outfile. +usage: latex2man [-t transfile] [-c cssfile] [-HTML] [-C name] [-h] [-V] infile outfile. A tool to translate UNIX manual pages written with LaTeX into a format understood by the UNIX man(1)-command. Reads infile, writes outfile. -t transfile: Translation for user defined LaTeX macros. + -c CSSfile: If -H is given, add a link to the \`CSSfile\' and use those + CSS definitions. -M: Produce output suitable for the man(1) command (default). -H: Instead of producing output suitable for the man(1) command, HTML code is produced (despite of the name of the command). @@ -396,68 +398,133 @@ $htmlMacro1a{'verb'} = ''; $htmlMacro1b{'verb'} = ''; $htmlMacro1a{'underline'} = ''; $htmlMacro1b{'underline'} = ''; -$htmlMacro1a{'section'} = '\n

'; - $htmlMacro1b{'section'} = '

\n'; -$htmlMacro1a{'subsection'} = '\n

'; - $htmlMacro1b{'subsection'} = '

\n'; -$htmlMacro1a{'subsubsection'} = '\n
'; - $htmlMacro1b{'subsubsection'} = '
\n'; -$htmlMacro1a{'Email'} = '\n'; - $htmlMacro1b{'Email'} = ''; -$htmlMacro1a{'URL'} = '\n'; - $htmlMacro1b{'URL'} = ''; - -$htmlMacro1a{'Prog'} = ''; - $htmlMacro1b{'Prog'} = ''; -$htmlMacro1a{'File'} = ''; - $htmlMacro1b{'File'} = ''; -$htmlMacro1a{'Opt'} = ''; - $htmlMacro1b{'Opt'} = ''; -$htmlMacro1a{'oOpt'} = '['; - $htmlMacro1b{'oOpt'} = ']'; -$htmlMacro1a{'Arg'} = ''; - $htmlMacro1b{'Arg'} = ''; -$htmlMacro1a{'oArg'} = '['; - $htmlMacro1b{'oArg'} = ']'; + $htmlMacro1a{'section'} = '\n

'; + $htmlMacro1b{'section'} = '

\n'; + $htmlMacro1a{'subsection'} = '\n

'; + $htmlMacro1b{'subsection'} = '

\n'; + $htmlMacro1a{'subsubsection'} = '\n
'; + $htmlMacro1b{'subsubsection'} = '
\n'; +if ($opt_c) { + # use CSS + # thanks to Tom Brand + $htmlMacro1a{'Email'} = '\n'; + $htmlMacro1b{'Email'} = ''; + $htmlMacro1a{'URL'} = '\n'; + $htmlMacro1b{'URL'} = ''; + + $htmlMacro1a{'Prog'} = ''; + $htmlMacro1b{'Prog'} = ''; + $htmlMacro1a{'File'} = ''; + $htmlMacro1b{'File'} = ''; + $htmlMacro1a{'Opt'} = ''; + $htmlMacro1b{'Opt'} = ''; + $htmlMacro1a{'oOpt'} = '['; + $htmlMacro1b{'oOpt'} = ']'; + $htmlMacro1a{'Arg'} = ''; + $htmlMacro1b{'Arg'} = ''; + $htmlMacro1a{'oArg'} = '['; + $htmlMacro1b{'oArg'} = ']'; +} else { + # don't use CSS + $htmlMacro1a{'Email'} = '\n'; + $htmlMacro1b{'Email'} = ''; + $htmlMacro1a{'URL'} = '\n'; + $htmlMacro1b{'URL'} = ''; + + $htmlMacro1a{'Prog'} = ''; + $htmlMacro1b{'Prog'} = ''; + $htmlMacro1a{'File'} = ''; + $htmlMacro1b{'File'} = ''; + $htmlMacro1a{'Opt'} = ''; + $htmlMacro1b{'Opt'} = ''; + $htmlMacro1a{'oOpt'} = '['; + $htmlMacro1b{'oOpt'} = ']'; + $htmlMacro1a{'Arg'} = ''; + $htmlMacro1b{'Arg'} = ''; + $htmlMacro1a{'oArg'} = '['; + $htmlMacro1b{'oArg'} = ']'; +} # LaTeX macros with two arguments -$htmlMacro2a{'Cmd'} = ''; - $htmlMacro2b{'Cmd'} = '('; - $htmlMacro2c{'Cmd'} = ')'; -$htmlMacro2a{'OptArg'} = ''; - $htmlMacro2b{'OptArg'} = ''; - $htmlMacro2c{'OptArg'} = ''; -$htmlMacro2a{'OptoArg'} = ''; - $htmlMacro2b{'OptoArg'} = '['; - $htmlMacro2c{'OptoArg'} = ']'; -$htmlMacro2a{'oOptArg'} = '['; - $htmlMacro2b{'oOptArg'} = ''; - $htmlMacro2c{'oOptArg'} = ']'; -$htmlMacro2a{'oOptoArg'} = '['; - $htmlMacro2b{'oOptoArg'} = '['; - $htmlMacro2c{'oOptoArg'} = ']]'; +if (opt_c) { + $htmlMacro2a{'Cmd'} = ''; + $htmlMacro2b{'Cmd'} = '('; + $htmlMacro2c{'Cmd'} = ')'; + $htmlMacro2a{'OptArg'} = ''; + $htmlMacro2b{'OptArg'} = ''; + $htmlMacro2c{'OptArg'} = ''; + $htmlMacro2a{'OptoArg'} = ''; + $htmlMacro2b{'OptoArg'} = '['; + $htmlMacro2c{'OptoArg'} = ']'; + $htmlMacro2a{'oOptArg'} = '['; + $htmlMacro2b{'oOptArg'} = ''; + $htmlMacro2c{'oOptArg'} = ']'; + $htmlMacro2a{'oOptoArg'} = '['; + $htmlMacro2b{'oOptoArg'} = '['; + $htmlMacro2c{'oOptoArg'} = ']]'; +} else { + $htmlMacro2a{'Cmd'} = ''; + $htmlMacro2b{'Cmd'} = '('; + $htmlMacro2c{'Cmd'} = ')'; + $htmlMacro2a{'OptArg'} = ''; + $htmlMacro2b{'OptArg'} = ''; + $htmlMacro2c{'OptArg'} = ''; + $htmlMacro2a{'OptoArg'} = ''; + $htmlMacro2b{'OptoArg'} = '['; + $htmlMacro2c{'OptoArg'} = ']'; + $htmlMacro2a{'oOptArg'} = '['; + $htmlMacro2b{'oOptArg'} = ''; + $htmlMacro2c{'oOptArg'} = ']'; + $htmlMacro2a{'oOptoArg'} = '['; + $htmlMacro2b{'oOptoArg'} = '['; + $htmlMacro2c{'oOptoArg'} = ']]'; +} $htmlMacro2a{'setlength'} = ''; $htmlMacro2b{'setlength'} = ''; $htmlMacro2c{'setlength'} = ''; # we handle sections in HTML as having two arguments, 1. the number, 2. the name -$htmlMacro2a{'section'} = '\n

'; - $htmlMacro2c{'section'} = '

\n'; -$htmlMacro2a{'subsection'} = '\n

'; - $htmlMacro2c{'subsection'} = '

\n'; -$htmlMacro2a{'subsubsection'} = '\n
'; - $htmlMacro2c{'subsubsection'} = '
\n'; - -# we handle Email and URL special in HTML, the LaTeX argument is doubled. -$htmlMacro2a{'Email'} = ''; - $htmlMacro2c{'Email'} = ''; -$htmlMacro2a{'URL'} = ''; - $htmlMacro2c{'URL'} = ''; +if ($opt_c) { + # use CSS + # thanks to Tom Brand + $htmlMacro2a{'section'} = '\n

'; + $htmlMacro2c{'section'} = '

\n'; + $htmlMacro2a{'subsection'} = '\n

'; + $htmlMacro2c{'subsection'} = '

\n'; + $htmlMacro2a{'subsubsection'} = '\n
'; + $htmlMacro2c{'subsubsection'} = '
\n'; + + # we handle Email and URL special in HTML, the LaTeX argument is doubled. + $htmlMacro2a{'Email'} = ''; + $htmlMacro2c{'Email'} = ''; + $htmlMacro2a{'URL'} = ''; + $htmlMacro2c{'URL'} = ''; + +}else{ + # don't use CSS + $htmlMacro2a{'section'} = '\n

'; + $htmlMacro2c{'section'} = '

\n'; + $htmlMacro2a{'subsection'} = '\n

'; + $htmlMacro2c{'subsection'} = '

\n'; + $htmlMacro2a{'subsubsection'} = '\n
'; + $htmlMacro2c{'subsubsection'} = '
\n'; + + # we handle Email and URL special in HTML, the LaTeX argument is doubled. + $htmlMacro2a{'Email'} = ''; + $htmlMacro2c{'Email'} = ''; + $htmlMacro2a{'URL'} = ''; + $htmlMacro2c{'URL'} = ''; +} ######################################################################## # Translation for LaTeX macros for TexInfo @@ -768,18 +835,31 @@ sub manVerbatimLine sub htmlStart { Print ""; NL; - Print ""; NL; + Print ""; NL; Print ""; NL; - Print "$Name"; NL; - Print ""; NL; - Print "

"; NL; + Print "$Name"; NL; + + if ($opt_c) { + Print ''; NL; + Print ""; NL; + Print '

'; NL; + interpret_line $title; + Print '

'; NL; + Print '

'; interpret_word $author; Print '

'; NL; + Print "

$date

"; NL; + Print "

Version $version

"; NL; + } else { + Print ""; NL; + + Print "

"; NL; interpret_line $title; Print "

"; NL; Print "

"; interpret_word $author; Print "

"; NL; Print "

$date

"; NL; Print "

Version $version

"; NL; + } } sub htmlEnd { @@ -873,14 +953,24 @@ sub htmlTableStart { my $columns = $_[0]; my $width = $_[1]; - NL; Print ""; NL: + NL; + if ($opt_c) { + Print '
'; + } else{ + Print '
'; + } + NL; } sub htmlTableSep { if ($first_column == 0) { Print '\n'; } - Print '\n'; + if ($opt_c) { + Print '\n\n'; + } else { + Print '\n\n'; + } + } + if ($opt_c) { + Print '\n\n\n\n
'; + if ($opt_c) { + Print ''; + } else { + Print ''; + } } sub htmlTableEnd { @@ -1120,9 +1210,17 @@ sub interpret_word return; } if (/^\\hline/) { - Print '\n



'; + } else { + Print '\n
'; } - Print '\n
'; } $first_column = 0; } -- cgit v1.2.3