5 Einträge, 1 Seite |
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
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!<a\s+href="(.*?)"\s+id="\1"\s*><sup>(<span\s+class=[^>]*?>)?([0-9]+)(</span>)?</sup></a>!insert_fntext($3, $1)!ges; s!<span class="footnote-mark"><a\s+href="(.*?)\#.*?"><sup >([0-9]+)</sup></a></span>!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 = <FNOTE>; close(FNOTE); for (@fntext) {chomp();} my $fntext = join("\n", @fntext); $fntext =~ s!.*<body.*?><p class.+?>(.*)</body>.*!$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 = "<sup>$fnum</sup>"; # Fuflnotenziffer im Text $result .= '<div align=right><table cols=1 width=70% bgcolor=#cccccc>'; $result .= "<tr><td><font size=-1>\n"; # $result .= "<sup>$fnum</sup> ".get_fntext($fnfile)."\n"; $result .= get_fntext($fnfile)."\n"; $result .= "</font></td></tr></table></div>"; # my $result = "<font color=#ff0000> (<sup>$fnum</sup> ".get_fntext($fnfile).")</font>"; return $result; }
open my $filehandle, '>', $file or die "$file: $!\n";
1
2
3
4
\documentclass[12pt]{article}
\begin{document}
Dies ist eine Fu\ss{}note:\footnote{Bli bla blub}
\end{document}
1
2
3
4
5
6
7
8
9
10
11
12
<body>
Dies ist eine Fußnote:
<sup>1</sup><div align=right><table cols=1 width=70% bgcolor=#cccccc><tr><td><font size=-1>
<span class="footnote-mark">
<span
class="ecrm-0800"><sup>1</sup>   Bli bla blub</span>
</span></dd></dl>
</font></td></tr></table></div>
<\body>
5 Einträge, 1 Seite |