26.7 Escape String for Hyperref

Produce a string that can serve as hyperref index.

Note that we cannot simply replace parenthesis by open and closing brackets, since the generated output is going to be fed to NOWEAVE. Double opening brackets would cause problems.

323⟨auxiliary subroutines 301b⟩+≡   (326)  ⊲301b  324a ⊳
sub escapeForHyperref {
    my($s)=@_;
    $s =~ s/\s//g;
    $s =~ s/(\(|{)/\[./g;
    $s =~ s/(\)|})/.\]/g;
    $s =~ s/%/PER/g;
    $s =~ s/_/.0/g;
    $s =~ s/\^/.1/g;
    $s =~ s/~/.2/g;
    $s =~ s/\\/.3/g;
    $s =~s/#/.4/g;
    return $s;
}

Defines:
escapeForHyperref, used in chunks 321 and 324b.