From: David Bremner Date: Sun, 28 Sep 2008 11:40:35 +0000 (-0300) Subject: pass text/html parts though X-Git-Tag: 0.6~1 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=74e60b1ef10fbc09ed5103c3d945acbddc9e365e;p=ikiwiki.git pass text/html parts though --- diff --git a/IkiWiki/Plugin/mailbox.pm b/IkiWiki/Plugin/mailbox.pm index 92ddf99f3..039512c0c 100644 --- a/IkiWiki/Plugin/mailbox.pm +++ b/IkiWiki/Plugin/mailbox.pm @@ -196,10 +196,12 @@ sub format_message(@){ $_->content_type_set('text/plain'); $_->body_set("[ omitting part $partcount: $allowed ]"); - } + } + $partcount++; } - my $body= join("\n", map { $_->body } @parts); + my $body= join("\n", map { format_part($_->content_type, $_->body) } + @parts); $template->param(body=>format_body($body)); @@ -207,13 +209,27 @@ sub format_message(@){ return $output; } +sub format_part($$){ + my $mime_type=shift; + my $body=shift; + + my $rval=""; + + # for debugging: + $rval .= "[ $mime_type ]\n"; + + if ($mime_type =~ "^text/html"){ + $rval.= $body; + } else { + $rval .= "
".escapeHTML($body)."
"; + } + return $rval; +} sub format_body($){ my $body=shift; - # it is not completely clear to me the right way to go here. - # passing things straight to markdown is not working all that - # well. - return "
".escapeHTML($body)."
"; + return $body; + } ### Utilities