Created
September 21, 2011 15:57
-
-
Save tsibley/1232457 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
middleware="" | |
if [[ "$1" == "markdown" || "$1" == "md" || "$1" == "wiki" ]]; then | |
wikilinks=0 | |
if [[ "$1" == "wiki" ]]; then wikilinks=1; fi | |
shift | |
middleware=' | |
enable_if { $_[0]->{REQUEST_URI} =~ /\.(md|mkdwn|markdown)$/ } | |
SimpleContentFilter => filter => sub { | |
use Text::MultiMarkdown qw(markdown); | |
$_ = markdown($_, {use_wikilinks=>'"$wikilinks"'}) | |
}; | |
enable_if { $_[0]->{REQUEST_URI} =~ /\.(md|mkdwn|markdown)$/ } | |
Header => set => [qw(Content-Type text/html)]; | |
enable Expires => | |
content_type => qr/./, | |
expires => "now plus 1 second";' | |
fi | |
plackngo --port 4242 -MPlack::App::Directory -e "$middleware; Plack::App::Directory->new({ root => '.' })->to_app" "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment