From 190c56e8489990bddc9a3ab5afa21896b9bd17dc Mon Sep 17 00:00:00 2001
From: Andreas Gohr <andi@splitbrain.org>
Date: Sun, 20 Sep 2009 19:36:37 +0200
Subject: [PATCH] add icons to code block downloads

Ignore-this: a9302ef2d646771934b76f7201b6fc9e

darcs-hash:20090920173637-7ad00-012f1f953b1d173fb9f557daaf4f7c1fd90e4d07.gz
---
 inc/parser/xhtml.php | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/inc/parser/xhtml.php b/inc/parser/xhtml.php
index e75fcb4c7..665307d45 100644
--- a/inc/parser/xhtml.php
+++ b/inc/parser/xhtml.php
@@ -389,8 +389,13 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
         global $lang;
 
         if($filename){
+            // add icon
+            list($ext) = mimetype($filename);
+            $class = preg_replace('/[^_\-a-z0-9]+/i','_',$ext);
+            $class = 'mediafile mf_'.$class;
+
             $this->doc .= '<dl class="'.$type.'">'.DOKU_LF;
-            $this->doc .= '<dt><a href="'.exportlink($ID,'code',array('codeblock'=>$this->_codeblock)).'" title="'.$lang['download'].'">';
+            $this->doc .= '<dt><a href="'.exportlink($ID,'code',array('codeblock'=>$this->_codeblock)).'" title="'.$lang['download'].'" class="'.$class.'">';
             $this->doc .= hsc($filename);
             $this->doc .= '</a></dt>'.DOKU_LF.'<dd>';
         }
-- 
GitLab