diff options
author | Karl Berry <karl@freefriends.org> | 2017-01-29 22:32:58 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2017-01-29 22:32:58 +0000 |
commit | e02235dda0e68d2131b9cf111af5448fa125ad58 (patch) | |
tree | 37ea12425820b8b346764911b170eefcc0a68b44 /Master/texmf-dist/source/latex/koma-script/doc/bin/genhtmlidx.pl | |
parent | 687ffbc778abf7b367ab1c6ed91c016e8138c2ad (diff) |
koma-script (29jan17)
git-svn-id: svn://tug.org/texlive/trunk@43084 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/koma-script/doc/bin/genhtmlidx.pl')
-rw-r--r-- | Master/texmf-dist/source/latex/koma-script/doc/bin/genhtmlidx.pl | 94 |
1 files changed, 59 insertions, 35 deletions
diff --git a/Master/texmf-dist/source/latex/koma-script/doc/bin/genhtmlidx.pl b/Master/texmf-dist/source/latex/koma-script/doc/bin/genhtmlidx.pl index a49935fd8df..c0f7be336ae 100644 --- a/Master/texmf-dist/source/latex/koma-script/doc/bin/genhtmlidx.pl +++ b/Master/texmf-dist/source/latex/koma-script/doc/bin/genhtmlidx.pl @@ -4,7 +4,7 @@ eval 'exec perl -S $0 ${1+"$@"}' # ====================================================================== # genhtmlidx.pl -# Copyright (c) Markus Kohm, 2002-2013 +# Copyright (c) Markus Kohm, 2002-2016 # # This file is part of the LaTeX2e KOMA-Script bundle. # @@ -22,7 +22,7 @@ eval 'exec perl -S $0 ${1+"$@"}' # This work consists of all files listed in manifest.txt. # ---------------------------------------------------------------------- # genhtmlidx.pl -# Copyright (c) Markus Kohm, 2002-2013 +# Copyright (c) Markus Kohm, 2002-2016 # # Dieses Werk darf nach den Bedingungen der LaTeX Project Public Lizenz, # Version 1.3c, verteilt und/oder veraendert werden. @@ -81,36 +81,51 @@ while ( $auxfile=shift ) { open AUX,"<$auxfile" or die "Cannot read $auxfile!\n"; while (<AUX>) { my $line=$_; - if ( /^\\newlabel{desc:[^}]+}{{[^}]*}{([^}]*)}{[^}]*}{([^}]*)}/ ) { - my $anchor=$2; - my $page=$1; - my $entry; - if ( $anchor =~ /^([^.]+)\.([^.]+)\.([^.]+)$/ ) { - $entry = "$3.$page.$1.$2"; - if ( "$2" eq "option" ) { - push @option,$entry; - } elsif ( "$2" eq "cmd" ) { - push @macro,$entry; - } elsif ( "$2" eq "env" ) { - push @environment,$entry; - } elsif ( "$2" eq "plength" ) { - push @plength,$entry; - } elsif ( "$2" eq "variable" ) { - push @variable,$entry; - } elsif ( "$2" eq "pagestyle" ) { - push @pagestyle,$entry; - } elsif ( "$2" eq "counter" ) { - push @counter,$entry; - } elsif ( "$2" eq "floatstyle" ) { - push @floatstyle,$entry; - } elsif ( "$2" eq "fontelement" ) { - push @fontelement,$entry; - } elsif ( "$2" eq "package" ) { - push @file,$entry; - } elsif ( "$2" eq "length" ) { - push @length,$entry; - } else { - print STDERR "Unknown type $2!\n"; + if ( /^\\newlabel{(desc:[^}]+)}{(.*)}$/ ) { + my $label=$1; + my $refargs=$2; + if ( $refargs =~ /^{([^{}]*({((?:(?>[^{}]*)|(?1))*)})*)}{([^}]+)}(.*)$/ ) { + my $ref=$1; + my $page=$4; + my $rest=$5; + if ( $rest =~ /^{([^{}]*({((?:(?>[^{}]*)|(?1))*)})*)}{([^}]*)}{(.*)}$/ ) { + my $title=$1; + my $anchor=$4; + my $ignore=$5; +# print STDERR "ref=\"$ref\", page=\"$page\", title=\"$title\", anchor=\"$anchor\", ignore=\"$ignore\"\n"; + my $entry; + if ( $anchor =~ /^desc:([^.]+)\.([^.]+)\.([^.]+)$/ ) { + $entry = "$3.$page.$1.$2"; + if ( "$2" eq "option" ) { + my $i=$1; + if ( $3 =~ /^([^=]+)=(.+)$/ ) { + $entry = "$1.$page.$i.option"; + } + push @option,$entry; + } elsif ( "$2" eq "cmd" ) { + push @macro,$entry; + } elsif ( "$2" eq "env" ) { + push @environment,$entry; + } elsif ( "$2" eq "plength" ) { + push @plength,$entry; + } elsif ( "$2" eq "variable" ) { + push @variable,$entry; + } elsif ( "$2" eq "pagestyle" ) { + push @pagestyle,$entry; + } elsif ( "$2" eq "counter" ) { + push @counter,$entry; + } elsif ( "$2" eq "floatstyle" ) { + push @floatstyle,$entry; + } elsif ( "$2" eq "fontelement" ) { + push @fontelement,$entry; + } elsif ( "$2" eq "package" ) { + push @file,$entry; + } elsif ( "$2" eq "length" ) { + push @length,$entry; + } else { + print STDERR "Unknown type $2!\n"; + } + } } } } @@ -124,6 +139,9 @@ sub process { my $arrayref=shift; my @entries=sort { $a cmp $b } @$arrayref; my $entry=""; + my $lastpage=""; + my $lastlink=""; + my $pageprefix=""; if ( @entries > 0 ) { print "<h2><a name=\"$group\">$titles{$group}</a></h2>\n"; print "<ul>\n"; @@ -132,11 +150,17 @@ sub process { if ( $entry ne $1 ) { print "</li>\n" if ( $entry ne "" ); $entry=$1; + $lastpage=""; + $lastlink=""; + $pageprefix=""; print "<li><a name=\"$4.$entry\"></a><a href=\"\#$4.$entry\">$prefix$entry</a> --> "; - } else { - print ", "; } - print "<a href=\"$baselink\#$3.$4.$1\">$2</a>"; + if ( ( $lastlink ne "$3.$4.$1" ) || ( $lastpage ne "$2" ) ) { + print "$pageprefix<a href=\"$baselink\#desc:$3.$4.$1\">$2</a>"; + $lastlink="$3.$4.$1"; + $lastpage="$2"; + $pageprefix=", "; + } } @entries; print "</li>\n" if ( $entry ne "" ); print "</ul>\n"; |