Documents Directory

This directory contains some writings. They are written in Markdown and are rendered to HTML using a slightly modified version of Markdown.pl by Daring Fireball.

218,220c218,231
<           $text = <>;
<       }
<         print Markdown($text);
---
>           open my $fh, '<', $ENV{'DOCUMENT_ROOT'} . $ENV{'DOCUMENT_URI'} or do {
>               print "Status: 500 Internal Server Error\nContent-Type: text/plain\n\nCouldn't open file";
>               die "Couldn't open file";
>           };
>           $text = <$fh>;
>       }   
>       if ($ENV{'QUERY_STRING'} eq 'raw=1') {
>           print "Status: 200 OK\nContent-Type: text/markdown; charset=utf-8\n\n";
>           print $text;
>       } else {
>           print "Status: 200 OK\nContent-Type: text/html; charset=utf-8\n\n<!DOCTYPE html>";
>           print "<title>" . substr($text, 2, index($text, "\n") - 2) . "</title>" if (substr($text, 0, 2) eq "# ");
>           print Markdown($text);
>       }

This patch allows Markdown to run as a CGI program. It also allows the user to add raw=1 as a parameter to receive the file as unprocessed Markdown. (which you'll have to do if you want to copy-paste this patch into patch(1))