jwebfrob.pl 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. # Copyright (c) 2002 Trustees of Indiana University
  2. #
  3. # Distributed under the Boost Software License, Version 1.0.
  4. # (See accompanying file LICENSE_1_0.txt or copy at
  5. # http://www.boost.org/LICENSE_1_0.txt)
  6. $lastpage = 0;
  7. $thispage = 1;
  8. $counter = 1;
  9. $alphabet = "\@abcdefghijklmnopqrstuvwxyz";
  10. $Alphabet = "\@ABCDEFGHIJKLMNOPQRSTUVWXYZ";
  11. $out = "";
  12. $saved_full = "";
  13. $saved_empty = "";
  14. while(<>) {
  15. # These changes are so that it works when we aren't using hyperref
  16. # if (/(\\newlabel.*\{\{)([0-9]+)(\}\{)([0-9ivx]+)(\}.*JWebCtr\.)([0-9]+)(.*)/) {
  17. if (/\\newlabel\{sec:.*/) {
  18. # make sure not to munge normal (non jweb part) section labels
  19. print ;
  20. } elsif (/\\newlabel\{class:.*/) {
  21. # make sure not to munge normal (non jweb part) class labels
  22. print ;
  23. } elsif (/\\newlabel\{tab:.*/) {
  24. # make sure not to munge normal (non jweb part) table labels
  25. print ;
  26. } elsif (/\\newlabel\{concept:.*/) {
  27. # make sure not to munge normal (non jweb part) concept labels
  28. print ;
  29. } elsif (/\\newlabel\{fig:.*/) {
  30. # make sure not to munge normal (non jweb part) class labels
  31. print ;
  32. } elsif (/(\\newlabel.*\{\{)([0-9\.]+)(\}\{)([0-9ivx]+)(\}.*)(.*)/) {
  33. $thispage = $4;
  34. if ($thispage ne $lastpage) {
  35. $counter = 1;
  36. print $saved_empty;
  37. # $saved_full = "$1".substr($alphabet,$counter,1)."$3$4$5$6$7\n";
  38. # $saved_empty = "$1"."$3$4$5$6$7\n";
  39. $saved_full = "$1".substr($alphabet,$counter,1)."$3$4$5\n";
  40. $saved_empty = "$1"."$3$4$5\n";
  41. } else {
  42. print $saved_full;
  43. # print "$1".substr($alphabet,$counter,1)."$3$4$5$counter$7\n";
  44. print "$1".substr($alphabet,$counter,1)."$3$4$5\n";
  45. $saved_full = "";
  46. $saved_empty = "";
  47. }
  48. $lastpage = $thispage;
  49. $counter++;
  50. } else {
  51. print ;
  52. }
  53. }
  54. print $saved_empty;
  55. # get a line
  56. # cases
  57. # - ref
  58. # - if it is first, save off someplace
  59. # - if there is a first saved, dump the empty version
  60. # - else
  61. # - if there is a first saved, dump the non empty version
  62. # - not a ref