very early indexing support

This commit is contained in:
david 2002-05-25 22:44:15 +00:00
parent b2d104f201
commit 0e5d380dde
2 changed files with 132 additions and 106 deletions

View File

@ -1,7 +1,21 @@
2002-05-05 0.3 Initial public release
2002-05-05 0.4 Added Makefile.PL, INSTALL, man page, Changelog
Added -V, same as --version
2002-05-23 0.4.1 Bugfix, remove backslashes from id tags
2002-04-25 0.4.2 Adds support for @documentlanguage tag,
Thanks to Jaime Irving Davila Lotorre for patch.
<jadavila@uniandes.edu.co>
CVS Adds minimal indexing support.
Switch -v and -V, -v is now version, -V verbose.
Ordinarily, changing options is a no-no, but I have
few users, and the change will never cause damage.
When table formats are set to a literal, and another
literal is inside the column, delete the one inside.

View File

@ -6,7 +6,7 @@ use File::Basename;
use FileHandle;
use HTML::Entities;
$VERSION = "0.4.2";
$VERSION = "0.4.2-cvs";
$errors = 0;
$error = 0;
@ -277,10 +277,10 @@ $replacement = "";
'@appendixsubsec' =>'SECT2',
'@appendixsubsubsec' =>'SECT3',
'@cindex' =>'DROPLINE', # TODO (temporary placement)
'@cindex' =>'CINDEX', # TODO (temporary placement)
'@cmindex' =>'DROPLINE',
'@cvindex' =>'DROPLINE',
'@findex' =>'DROPLINE',
'@findex' =>'CINDEX',
'@kindex' =>'DROPLINE',
'@pindex' =>'DROPLINE',
'@tindex' =>'DROPLINE',
@ -545,9 +545,6 @@ $macrotext = "";
while (1) {
if ($ARGV[0] eq '') {
last;
} elsif (($ARGV[0] eq '-V') or ($ARGV[0] eq '--version')) {
&version;
exit(0);
} elsif (($ARGV[0] eq '-i') or ($ARGV[0] eq '--include')) {
shift(@ARGV);
if (($ARGV[0] eq 'HTML') or ($ARGV[0] eq 'TEX') or ($ARGV[0] eq 'INFO')) {
@ -571,8 +568,11 @@ while (1) {
} elsif (($ARGV[0] eq '-e') or ($ARGV[0] eq '--max-errors')) {
shift(@ARGV);
$maxerrors = $ARGV[0];
} elsif (($ARGV[0] eq '-v') or ($ARGV[0] eq '--verbose')) {
} elsif (($ARGV[0] eq '-V') or ($ARGV[0] eq '--verbose')) {
$verbose++;
} elsif (($ARGV[0] eq '-v') or ($ARGV[0] eq '--version')) {
&version;
exit(0);
} elsif (($ARGV[0] eq '-h') or ($ARGV[0] eq '--help')) {
&usage;
} else {
@ -814,100 +814,103 @@ LINE: while ($line = <$fh>) {
}
sub doaction {
if ($action eq 'DROP2') {
$line =~ s/\@\w+\s+\w+\s*//;
&writeconverted;
} elsif ($action eq 'SEEKEND') {
$seekend = $pattern;
$seekend =~ s/\@/\@end /;
} elsif ($action eq 'LITERALBLOCK') {
&literalblock;
} elsif ($action eq 'ALIAS') {
&alias;
} elsif ($action eq 'MACRO') {
&macro;
} elsif ($action eq 'META') {
&meta;
} elsif ($action eq 'NODE') {
&node;
} elsif ($action eq 'MENU') {
&menu;
} elsif ($action eq 'APPENDIX') {
$line =~ s/^\@\w+\s+//;
&convertinline;
&appendix($line);
} elsif ($action eq 'SECT1') {
$line =~ s/^\@\w+\s+//;
&convertinline;
&sect1($line);
} elsif ($action eq 'SECT2') {
$line =~ s/^\@\w+\s+//;
&convertinline;
&sect2($line);
} elsif ($action eq 'SECT3') {
$line =~ s/^\@\w+\s+//;
&convertinline;
&sect3($line);
} elsif ($action eq 'SECT4') {
$line =~ s/^\@\w+\s+//;
&convertinline;
&sect4($line);
} elsif ($action eq 'PARA') {
&closeformalpara;
&para;
} elsif ($action eq 'DEFFN') {
&deffn;
} elsif ($action eq 'ORDEREDLIST') {
&orderedlist;
} elsif ($action eq 'ORDEREDLISTEND') {
&closeorderedlist;
} elsif ($action eq 'ITEMIZEDLIST') {
&itemizedlist;
} elsif ($action eq 'ITEMIZEDLISTEND') {
&closeitemizedlist;
} elsif ($action eq 'ITEM') {
&item;
&writeconverted;
} elsif ($action eq 'TABLE') {
&table;
$line =~ s/^\@\w+\s+//;
$tableformat[-1] = $line;
&message("table format: $tableformat[-1]") if ($verbose > 2);
$infirstcol[-1] = 0;
} elsif ($action eq 'MULTITABLE') {
&multitable;
} elsif ($action eq 'TABLEEND') {
&closetable;
} elsif ($action eq 'INDEX') {
&message("indexing not yet supported") if ($verbose > 1);
} elsif ($action eq 'DEFINFOENCLOSE') {
&definfoenclose;
} elsif ($action eq 'SET') {
&set;
} elsif ($action eq 'CLEAR') {
&clear;
} elsif ($action eq 'IFSET') {
$seekend = '\@end ifset' unless (&ifset());
} elsif ($action eq 'IFCLEAR') {
$seekend = '\@end ifclear' if (&ifset());
} elsif ($action eq 'BYE') {
&closesect1;
last;
} elsif ($action eq 'ERROR') {
&raiseerror("Hit ERROR tag with $pattern on $line");
} elsif ($action eq '') {
if ($nest[-1] eq 'table') { # multitables just write the line
&tableline;
}
if ($suppressconversion) {
&writeline;
if ($action eq 'DROP2') {
$line =~ s/\@\w+\s+\w+\s*//;
&writeconverted;
} elsif ($action eq 'SEEKEND') {
$seekend = $pattern;
$seekend =~ s/\@/\@end /;
} elsif ($action eq 'LITERALBLOCK') {
&literalblock;
} elsif ($action eq 'ALIAS') {
&alias;
} elsif ($action eq 'MACRO') {
&macro;
} elsif ($action eq 'META') {
&meta;
} elsif ($action eq 'NODE') {
&node;
} elsif ($action eq 'MENU') {
&menu;
} elsif ($action eq 'APPENDIX') {
$line =~ s/^\@\w+\s+//;
&convertinline;
&appendix($line);
} elsif ($action eq 'SECT1') {
$line =~ s/^\@\w+\s+//;
&convertinline;
&sect1($line);
} elsif ($action eq 'SECT2') {
$line =~ s/^\@\w+\s+//;
&convertinline;
&sect2($line);
} elsif ($action eq 'SECT3') {
$line =~ s/^\@\w+\s+//;
&convertinline;
&sect3($line);
} elsif ($action eq 'SECT4') {
$line =~ s/^\@\w+\s+//;
&convertinline;
&sect4($line);
} elsif ($action eq 'CINDEX') {
$line =~ s/^\@\w+\s+//;
&convertinline;
&indexterm($line);
} elsif ($action eq 'PARA') {
&closeformalpara;
&para;
} elsif ($action eq 'DEFFN') {
&deffn;
} elsif ($action eq 'ORDEREDLIST') {
&orderedlist;
} elsif ($action eq 'ORDEREDLISTEND') {
&closeorderedlist;
} elsif ($action eq 'ITEMIZEDLIST') {
&itemizedlist;
} elsif ($action eq 'ITEMIZEDLISTEND') {
&closeitemizedlist;
} elsif ($action eq 'ITEM') {
&item;
&writeconverted;
} elsif ($action eq 'TABLE') {
&table;
$line =~ s/^\@\w+\s+//;
$tableformat[-1] = $line;
&message("table format: $tableformat[-1]") if ($verbose > 2);
$infirstcol[-1] = 0;
} elsif ($action eq 'MULTITABLE') {
&multitable;
} elsif ($action eq 'TABLEEND') {
&closetable;
} elsif ($action eq 'INDEX') {
&message("indexing not yet supported") if ($verbose > 1);
} elsif ($action eq 'DEFINFOENCLOSE') {
&definfoenclose;
} elsif ($action eq 'SET') {
&set;
} elsif ($action eq 'CLEAR') {
&clear;
} elsif ($action eq 'IFSET') {
$seekend = '\@end ifset' unless (&ifset());
} elsif ($action eq 'IFCLEAR') {
$seekend = '\@end ifclear' if (&ifset());
} elsif ($action eq 'BYE') {
&closesect1;
last;
} elsif ($action eq 'ERROR') {
&raiseerror("Hit ERROR tag with $pattern on $line");
} elsif ($action eq '') {
if ($nest[-1] eq 'table') { # multitables just write the line
&tableline;
}
if ($suppressconversion) {
&writeline;
} else {
&writeconverted;
}
} else {
&writeconverted;
&raiseerror("Unknown action: $action on command $pattern");
}
} else {
&raiseerror("Unknown action: $action on command $pattern");
}
}
@ -993,15 +996,20 @@ TAG: while ($line =~ /\@\w+\{[^\{]*?\}/) {
&message("CMDLINE: $line") if ($verbose > 2);
&message("CMD: $command, tag: $tag, tagplain: $tagplain, contents: $contents") if ($verbose > 2);
# If we're in a table's first column, and this column is already wrapped in the same tag,
# don't process internal tag.
# If we're in a table's first column, and this column already contains
# the same tag, remove the internal tag.
# Otherwise, we wind up with nested literals, which DocBook disallows.
#
if (scalar @tableformat) {
if (($infirstcol[-1]) and ($tableformat[-1] eq $tag)) {
&message("not doubly wrapping tag $tag") if ($verbose >2);
$replacement = $contents;
&replaceinline;
next TAG;
&message("not doubly wrapping tag $tag, removing the nested one") if ($verbose >2);
$contents =~ s/\<$tag\>//;
$contents =~ s/\<\/$tag\>//;
#$replacement = $contents;
#&replaceinline;
#next TAG;
}
}
@ -1710,7 +1718,7 @@ sub appendix {
sub sect1 {
&writeabstract;
&message("sect1: $nodetitle") if ($verbose > 1);
&closesect1;
&closeappendix;
if ($nodeinit) {
&sect($_[0]);
} else {
@ -2050,6 +2058,10 @@ sub comment {
$line = $start;
}
sub indexterm {
$buf .= "\<indexterm\>\<primary\>$_[0]\</primary\>\</indexterm\>\n";
}
sub closeappendix {
&closesect1;
if ($inappendix) {