From 39a760b1266e43175ad271da39898659df0231e4 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Fri, 11 Jun 2010 18:35:35 +0200 Subject: add markdown rendering support Signed-off-by: Florian Pritz --- system/application/models/file_mod.php | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'system/application/models/file_mod.php') diff --git a/system/application/models/file_mod.php b/system/application/models/file_mod.php index 66817a7a6..0541d5d2b 100644 --- a/system/application/models/file_mod.php +++ b/system/application/models/file_mod.php @@ -172,13 +172,21 @@ class File_mod extends Model { $data['title'] = $filedata['filename']; $data['raw_link'] = site_url($id); $data['plain_link'] = site_url($id.'/plain'); + $data['auto_link'] = site_url($id).'/'; + $data['rmd_link'] = site_url($id.'/rmd'); header("Content-Type: text/html\n"); echo $this->load->view('file/html_header', $data, true); - // only rewrite if it's fast - // count(file($file)); isn't - echo passthru('/usr/bin/perl -ne \'print "$.\n"\' '.escapeshellarg($file)); - echo '
'."\n";
-          echo shell_exec(FCPATH.'scripts/syntax-highlighting.sh '.escapeshellarg($filedata['filename']).'.'.escapeshellarg($mode).' < '.escapeshellarg($file));
+          if ($mode == "rmd") {
+            echo '
'."\n";
+            passthru('/usr/bin/perl /usr/bin/perlbin/vendor/Markdown.pl '.escapeshellarg($file));
+          } else {
+            echo '
';
+            // only rewrite if it's fast
+            // count(file($file)); isn't
+            passthru('/usr/bin/perl -ne \'print "$.\n"\' '.escapeshellarg($file));
+            echo '
'."\n";
+            echo shell_exec(FCPATH.'scripts/syntax-highlighting.sh '.escapeshellarg($filedata['filename']).'.'.escapeshellarg($mode).' < '.escapeshellarg($file));
+          }
           echo $this->load->view('file/html_footer', $data, true);
         } else {
           if ($mode == 'plain') {
-- 
cgit v1.2.3-24-g4f1b