#!/usr/bin/perl my @lines = <>; my $text = join('', @lines); my $title; if($text =~ /^\*\* (.*?)\n/m){ $title = $1; $text = $` . $'; }else{ $title = "Untitled"; } $text =~ s/[ \t]+$//mg; $text =~ s/^$/

/mg; $text =~ s!\b([a-z0-9]+\.(c|s|pl|h))\b!$1!g; $text =~ s!^(Lecture [0-9]+\. .*?)$!$1!mg; $text =~ s!^\* (.*?)$!

$1

!mg; $text =~ s!((
)+\n)+

!\n

!g; $text =~ s!

\n?((
)+\n)+!\n!g; $text =~ s!((
)+\n)+!\n

!g; $text =~ s!\b\s*--\s*\b!\–!g; $text =~ s!\[([^\[\]|]+) \| ([^\[\]]+)\]!$2!g; $text =~ s!\[([^ \t]+)\]!$1!g; $text =~ s!``!\“!g; $text =~ s!''!\”!g; print < $title

$title



EOF print $text; print < EOF