From f53494c28e362fb7752bbc83417b9ba47cff0bf5 Mon Sep 17 00:00:00 2001 From: rsc Date: Wed, 3 Sep 2008 04:50:04 +0000 Subject: DO NOT MAIL: xv6 web pages --- web/mkhtml | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100755 web/mkhtml (limited to 'web/mkhtml') diff --git a/web/mkhtml b/web/mkhtml new file mode 100755 index 0000000..74987e6 --- /dev/null +++ b/web/mkhtml @@ -0,0 +1,70 @@ +#!/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 -- cgit v1.2.3