diff options
author | Harald Welte <laforge@gnumonks.org> | 2015-10-25 21:00:20 +0100 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2015-10-25 21:00:20 +0100 |
commit | fca59bea770346cf1c1f9b0e00cb48a61b44a8f3 (patch) | |
tree | a2011270df48d3501892ac1a56015c8be57e8a7d /2004/netfilter-failover-ols2004/OLS2004-proceedings/bin/makeMainPaper.pl |
import of old now defunct presentation slides svn repo
Diffstat (limited to '2004/netfilter-failover-ols2004/OLS2004-proceedings/bin/makeMainPaper.pl')
-rwxr-xr-x | 2004/netfilter-failover-ols2004/OLS2004-proceedings/bin/makeMainPaper.pl | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/2004/netfilter-failover-ols2004/OLS2004-proceedings/bin/makeMainPaper.pl b/2004/netfilter-failover-ols2004/OLS2004-proceedings/bin/makeMainPaper.pl new file mode 100755 index 0000000..60f3782 --- /dev/null +++ b/2004/netfilter-failover-ols2004/OLS2004-proceedings/bin/makeMainPaper.pl @@ -0,0 +1,81 @@ +#!/usr/bin/perl -w + +# +# Creates all papers with minimal content. Caution: clobbers existing papers! +# Run from top-level directory (GCC2004 or OLS2004), and relies on the +# Master.tex file being correct. +# +# It's probably easier to make a copy of TEMPLATES/Blank.tex and edit +# it by hand than to mess with this script. But it's included anyway, +# just in case it's handy. + +open(IN,'<MasterOLS.tex') || die 'Cannot open MasterOLS.tex'; +my $inEntry = 0; +my $author = ''; +my $instit = ''; +my $title = ''; +my $dirName = ''; +my @hrefs; +my $paperCount = 0; +my @keyNames = qw(__TITLE__ __AUTHOR__ __INSTITUTION__ __EMAIL__ __ABSTRACT__); + +while (defined($ln = <IN>)) { + chomp $ln; + next if ($ln =~ m/^\s*%*\s*$/); # skip blanks/comments + if (($ln =~ m/coltocauthor/) || (1 == $inEntry)) { + if ($ln =~ m/coltocauthor{(.*?)}\s+%\s+(.*)/) { + $author = $1; + $instit = $2; + $inEntry = 1; + $instit =~ s/\s+$//g; + } elsif ($ln =~ m/coltoctitle{(.*?)}/) { + $title = $1; + } elsif ($ln =~ m/import{([^}]+)}/) { + $dirName = $1; + push @hrefs, { + __AUTHOR__ => $author, + __INSTITUTION__ => $instit, + __TITLE__ => $title, + __EMAIL__ => 'your@email.address', + dirName => $dirName, + __ABSTRACT__ => ($dirName . '-abstract')}; + $author = ''; + $instit = ''; + $title = ''; + $dirName = ''; + $inEntry = 0; + } elsif ($ln =~ m/label{gccart/) { + $paperCount++; + } + } +} +close(IN); + +print "found: count: $paperCount with ", (1 + $#hrefs), " entries\n"; +my $i = 1; +for my $h (@hrefs) { + my $paper = $h->{dirName} . '/' . $h->{dirName} . '.tex'; + printf "%02d: %s: %s | %s | %s | %s\n", $i, $paper, + $h->{__AUTHOR__}, + $h->{__INSTITUTION__}, + $h->{__TITLE__}, + $h->{dirName}; + $i++; + + open(OUT, ">$paper") || die "Cannot open $paper for writing"; + open(IN, '<TEMPLATES/Blank.tex') || die 'Cannot open TEMPLATES/Blank.tex for reading'; + while (defined($ln = <IN>)) { + chomp $ln; + for my $r (@keyNames) { + my $v = $h->{$r}; + $ln =~ s/$r/$v/; + } + print OUT "$ln\n"; + } + print OUT "\n"; + close(IN); + close(OUT); +} + + + |