--- /usr/bin/collateindex.pl Tue Mar 6 20:23:47 2001 +++ collateindex.pl Thu Mar 8 00:31:29 2001 @@ -1,6 +1,7 @@ +#! /usr/bin/perl # -*- Perl -*- # -# $Id: collateindex.pl,v 1.2 2000/09/28 12:52:47 ndw Exp $ +# $Id: collateindex.pl,v 1.2 2001/03/07 22:31:29 mea Exp $ use Getopt::Std; @@ -27,10 +28,11 @@ -f Force the output file to be written, even if it appears to have been edited by hand. -N New index (generates an empty index file). + -d file tag filename. file The file containing index data generated by Jade with the DocBook HTML Stylesheet.\n"; -die $usage if ! getopts('Dfgi:NpP:s:o:S:I:t:x'); +die $usage if ! getopts('Dd:fgi:NpP:s:o:S:I:t:x'); $linkpoints = $opt_p; $lettergroups = $opt_g; @@ -45,6 +47,9 @@ $forceoutput = $opt_f; $newindex = $opt_N; $debug = $opt_D; +$DBHTML = ''; +$DBHTML = '' if ($opt_d); + $indextag = $setindex ? 'setindex' : 'index'; @@ -114,35 +119,74 @@ next; } + if (/^primary[\[ ](.*)$/i) { if (/^primary\[(.*?)\] (.*)$/i) { - $idx->{'psortas'} = $1; - $idx->{'primary'} = $2; + local($a1) = $1; + local($a2) = $2; + if ($a1 =~ m/\$[a-zA-Z]/) { + $idx->{'psortas'} = substr($a1, 1); + } else { + $idx->{'psortas'} = $a1; + } +#printf "PSORTAS[]='%s'\n",$idx->{'psortas'}; + $idx->{'primary'} = $a2; } else { - $idx->{'psortas'} = $1; - $idx->{'primary'} = $1; + local($a1) = $1; + local($a2) = $2; + if ($a1 =~ m/\$[a-zA-Z]/) { + $idx->{'psortas'} = substr($a1, 1); + } else { + $idx->{'psortas'} = $a1; + } +#printf "PSORTAS='%s'\n",$idx->{'psortas'}; + $idx->{'primary'} = $a1; } next; } if (/^secondary[\[ ](.*)$/i) { if (/^secondary\[(.*?)\] (.*)$/i) { - $idx->{'ssortas'} = $1; - $idx->{'secondary'} = $2; + local($a1) = $1; + local($a2) = $2; + if ($a1 =~ m/\$[a-zA-Z]/) { + $idx->{'ssortas'} = substr($a1, 1); + } else { + $idx->{'ssortas'} = $a1; + } + $idx->{'secondary'} = $a2; } else { - $idx->{'ssortas'} = $1; - $idx->{'secondary'} = $1; + local($a1) = $1; + local($a2) = $2; + if ($a1 =~ m/\$[a-zA-Z]/) { + $idx->{'ssortas'} = substr($a1, 1); + } else { + $idx->{'ssortas'} = $a1; + } + $idx->{'secondary'} = $a1; } next; } if (/^tertiary[\[ ](.*)$/i) { if (/^tertiary\[(.*?)\] (.*)$/i) { - $idx->{'tsortas'} = $1; - $idx->{'tertiary'} = $2; + local($a1) = $1; + local($a2) = $2; + if ($a1 =~ m/\$[a-zA-Z]/) { + $idx->{'tsortas'} = substr($a1, 1); + } else { + $idx->{'tsortas'} = $a1; + } + $idx->{'tertiary'} = $a2; } else { - $idx->{'tsortas'} = $1; - $idx->{'tertiary'} = $1; + local($a1) = $1; + local($a2) = $2; + if ($a1 =~ m/\$[a-zA-Z]/) { + $idx->{'tsortas'} = substr($a1, 1); + } else { + $idx->{'tsortas'} = $a1; + } + $idx->{'tertiary'} = $a1; } next; } @@ -224,7 +268,7 @@ # Write the index... if ($indexid) { - print OUT "<$indextag id='$indexid'>\n\n"; + print OUT "<$indextag id='$indexid'>$DBHTML\n\n"; } else { print OUT "<$indextag>\n\n"; }