use File::Copy; @maintext = <>; print STDERR "stripping EOLs off main document..."; # STDERR: Standardfehlerausgabe for (@maintext) {chomp();} print STDERR "done\njoining lines..."; $_ = join("\n", @maintext); open(CLEAR_BAT, ">delfn.bat"); print CLEAR_BAT "\@echo off\n"; print STDERR "done\nstart substituting footnotes (this may take a while)...\n"; #s!(]*?>)?([0-9]+)()?!insert_fntext($3, $1)!ges; s!([0-9]+)!insert_fntext($2, $1)!ges; print CLEAR_BAT "echo all footnote files deleted"; close(CLEAR_BAT); print STDERR "file 'delfn.bat' created (can be used to remove the single footnote files)\n"; print $_; print STDERR "ready\n"; # Fussnotentext aus uebergebener HTML-Datei holen und zurueckliefern sub get_fntext #sub: Unterroutine { my $fnfile = shift; $fnfile =~ s/\s*(.*)\s*/$1/; # Leerzeichen am Anfang und Ende des Dateinamens entfernen open(FNOTE, "<".$fnfile) || print STDERR "footnote file '$fnfile' not found"; print STDERR "processing footnote file '$fnfile'..."; my @fntext = ; close(FNOTE); for (@fntext) {chomp();} my $fntext = join("\n", @fntext); $fntext =~ s!.*

(.*).*!$1!s; print STDERR "done\n"; return $fntext; } sub insert_fntext { my ($fnum, $fnfile) = @_; # Fussnotenzahl und Name der Datei, die FN-Text enthaelt print CLEAR_BAT "del $fnfile\n"; my $result = "$fnum"; # Fuflnotenziffer im Text $result .= '

'; $result .= "
\n"; # $result .= "$fnum ".get_fntext($fnfile)."\n"; $result .= get_fntext($fnfile)."\n"; $result .= "
"; # my $result = " ($fnum ".get_fntext($fnfile).")"; return $result; }