#!/usr/bin/perl -w $/ = ""; use File::Basename; $kl = $ARGV[0]; if ($kl && ($kl =~ /-h|-\?/)) {&message(); exit(1);} $file = @ARGV; if ($file < 1) {&message(); exit(1);} $a = $ARGV[0]; open(VCHOD, "$a") || die "Sorry, I cannot open $a: $!\n"; print STDERR "Making reference tags... \n"; &hesh_stup(); while(){ &format1(); &name_href(); &format2(); print; } sub hesh_stup { $schet_stup = 0; while(){ if (/\\TEZA{(\w\w)}/) {$schet_stup++; $stup{"$1"} = "$schet_stup";} if (/\\STEZA{(\w\w)}{(\w\w)}/) {$schet_stup++; $stup{"$1"} = "$schet_stup";} } seek (VCHOD, 0, 0); } END { close (VCHOD); } sub format1 { s@@$1@g; s@(\\TEZA{\w\w})@$1\.@gi; s@(\\STEZA{\w\w}{\w\w})@$1\.@gi; s@(\\SSYLKA{\w\w})@ ... $1\.@gi; } sub name_href { s@\\TEZA{(\w\w)}@$stup{$1}<\/a>@g; s@\\STEZA{(\w\w)}{(\w\w)}@$stup{$1}<\/a>\($stup{$2}<\/a>\)@g; s@\\SSYLKA{(\w\w)}@$stup{$1}<\/a>@g; } sub format2 { s@\\documentclass.*@@gi; s@\\usepackage.*@@gi; s@\\begin.*@@gi; s@\\end.*@@gi; s@

%@@gi; s@\\i *{}@i@gsi; s@\$\\times\$@×\;@gi; s@\\#@-@gi; s@\\<|<<@«\;@g; s@\\>|>>@»\;@g; s@~@ \;@gi; s@---|\\---@—@gi; s@(\\T+?)(.*?)\n\n@ ... $2\n\n@gsi; s@\\KN (.+?) @$1 @gsi; s@\\NN (.+?) (.+?) @$1 $2 @gsi; s@\\K *{(.+?)}@$1@gsi; s@\\J *{(.+?)}@$1@gsi; s@\\textit *{(.+?)}@$1@gsi; s@\\textbf *{(.+?)}@$1@gsi; s@

\\FK@

@sgi; s@

@

@sgi; s@\\AN@–@gi; s@\\AAN|\\AAAN@=@gi; s@ +?@ @sgi; s@\\'@@sgi; s@\\i{}@@sgi; } sub message { $Me = basename($0); print <File2] END_OF_MESSAGE } #