File: jwebfrob.pl

package info (click to toggle)
boost 1.32.0-6
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 93,952 kB
  • ctags: 128,458
  • sloc: cpp: 492,477; xml: 52,125; python: 13,519; ansic: 13,013; sh: 1,773; yacc: 853; makefile: 526; perl: 418; lex: 110; csh: 6
file content (72 lines) | stat: -rwxr-xr-x 1,846 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72


$lastpage = 0;
$thispage = 1;
$counter =  1;
$alphabet = "\@abcdefghijklmnopqrstuvwxyz";
$Alphabet = "\@ABCDEFGHIJKLMNOPQRSTUVWXYZ";
$out = "";
$saved_full = "";
$saved_empty = "";

while(<>) {

# These changes are so that it works when we aren't using hyperref

#  if (/(\\newlabel.*\{\{)([0-9]+)(\}\{)([0-9ivx]+)(\}.*JWebCtr\.)([0-9]+)(.*)/) {
  if (/\\newlabel\{sec:.*/) {
    # make sure not to munge normal (non jweb part) section labels
    print ;
  } elsif (/\\newlabel\{class:.*/) {
    # make sure not to munge normal (non jweb part) class labels
    print ;
  } elsif (/\\newlabel\{tab:.*/) {
    # make sure not to munge normal (non jweb part) table labels
    print ;
  } elsif (/\\newlabel\{concept:.*/) {
    # make sure not to munge normal (non jweb part) concept labels
    print ;
  } elsif (/\\newlabel\{fig:.*/) {
    # make sure not to munge normal (non jweb part) class labels
    print ;
  } elsif (/(\\newlabel.*\{\{)([0-9\.]+)(\}\{)([0-9ivx]+)(\}.*)(.*)/) {
    $thispage = $4;

    if ($thispage ne $lastpage) {
      
      $counter = 1;

      print $saved_empty;

#      $saved_full = "$1".substr($alphabet,$counter,1)."$3$4$5$6$7\n";
#      $saved_empty = "$1"."$3$4$5$6$7\n";
      $saved_full = "$1".substr($alphabet,$counter,1)."$3$4$5\n";
      $saved_empty = "$1"."$3$4$5\n";

    } else {
      print $saved_full;
#      print "$1".substr($alphabet,$counter,1)."$3$4$5$counter$7\n";
      print "$1".substr($alphabet,$counter,1)."$3$4$5\n";
      $saved_full = "";
      $saved_empty = "";
    }

    $lastpage = $thispage;
    $counter++;

  } else {
    print ;
  }
}
print $saved_empty;



# get a line
# cases
# - ref
#   - if it is first, save off someplace
#     - if there is a first saved, dump the empty version
#   - else
#     - if there is a first saved, dump the non empty version
# - not a ref