]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/commitdiff
pass text/html parts though
authorDavid Bremner <bremner@unb.ca>
Sun, 28 Sep 2008 11:40:35 +0000 (08:40 -0300)
committerDavid Bremner <bremner@unb.ca>
Sun, 28 Sep 2008 11:40:35 +0000 (08:40 -0300)
IkiWiki/Plugin/mailbox.pm

index 92ddf99f32f65f141f471b0590b61ba4d443d91c..039512c0c2f99613fb088cf709d3be687d4627b3 100644 (file)
@@ -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 .= "<pre>".escapeHTML($body)."</pre>";
+    }
+    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 "<pre>".escapeHTML($body)."</pre>";
+    return $body;
+
 }
 ### Utilities