aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Weiske <cweiske@cweiske.de>2012-09-19 00:10:19 +0200
committerChristian Weiske <cweiske@cweiske.de>2012-09-19 00:10:19 +0200
commit027c801a4dc51db673bcbfcfbd396845f244e357 (patch)
tree4be2941bd3d92d7cd1f07b61fd3c072b0007abe3
parent72dac890a041b8261262c7df7d7f8a8a816a146b (diff)
parentd316adab970b993504ba38736a0f8753ef4bb052 (diff)
downloadphorkie-027c801a4dc51db673bcbfcfbd396845f244e357.tar.gz
phorkie-027c801a4dc51db673bcbfcfbd396845f244e357.zip
Merge remote-tracking branch 'jnovack/markdown'
Conflicts: ChangeLog
-rw-r--r--ChangeLog4
-rw-r--r--README.rst3
-rw-r--r--data/config.default.php5
-rw-r--r--src/phorkie/Renderer/Markdown.php27
4 files changed, 39 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 4a9cfc5..1dc1447 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2012-09-18 Justin J. Novack <jnovack@gmail.com>
+
+ * Add Markdown as a known file-type.
+
2012-09-17 Justin J. Novack <jnovack@gmail.com>
* Add OpenID authentication
diff --git a/README.rst b/README.rst
index 2ad6ff0..d41d89b 100644
--- a/README.rst
+++ b/README.rst
@@ -84,6 +84,9 @@ phorkie stands on the shoulders of giants.
$ pear channel-discover zustellzentrum.cweiske.de
$ pear install zz/mime_type_plaindetect-alpha
+ $ pear channel-discover pear.michelf.ca
+ $ pear install michelf/Markdown
+
Note that this version of GeSHi is a bit outdated, but it's the fastest
way to install it.
diff --git a/data/config.default.php b/data/config.default.php
index a087767..abcb43e 100644
--- a/data/config.default.php
+++ b/data/config.default.php
@@ -66,6 +66,11 @@ $GLOBALS['phorkie']['languages'] = array(
'mime' => 'application/javascript',
'geshi' => 'javascript'
),
+ 'md' => array(
+ 'title' => 'Markdown',
+ 'mime' => 'text/x-markdown',
+ 'renderer' => '\\phorkie\\Renderer_Markdown'
+ ),
'pl' => array(
'title' => 'Perl',
'mime' => 'application/x-perl',
diff --git a/src/phorkie/Renderer/Markdown.php b/src/phorkie/Renderer/Markdown.php
new file mode 100644
index 0000000..628d87f
--- /dev/null
+++ b/src/phorkie/Renderer/Markdown.php
@@ -0,0 +1,27 @@
+<?php
+namespace phorkie;
+
+class Renderer_Markdown
+{
+ /**
+ * Converts the code to HTML
+ *
+ * @param File $file File to render
+ * @param Tool_Result $res Tool result to integrate
+ *
+ * @return string HTML
+ */
+ public function toHtml(File $file, Tool_Result $res = null)
+ {
+ /**
+ */
+ require_once 'markdown.php';
+ $markdown = \markdown($file->getContent());
+
+ return '<div class="markdown">'
+ . $markdown
+ . '</div>';
+ }
+}
+
+?>