Permalink
Browse files

Markdown for Laravel

  • Loading branch information...
0 parents commit 10550e3d3e230fbb597ca591b21fb4960e0c8ea5 @sparksp committed Jan 27, 2012
Showing with 3,211 additions and 0 deletions.
  1. +7 −0 LICENSE
  2. +33 −0 bundle.php
  3. +29 −0 controllers/page.php
  4. +3,013 −0 parser.php
  5. +33 −0 readme.md
  6. +96 −0 view.php
@@ -0,0 +1,7 @@
+Copyright (c) 2012 Phill Sparks
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,33 @@
+<?php
+
+/**
+ * Markdown for Laravel
+ *
+ * A simple bundle to provide Markdown functions.
+ *
+ * <code>
+ * echo Markdown($text);
+ * </code>
+ *
+ * @package Bundles
+ * @subpackage Markdown
+ * @author Phill Sparks <me@phills.me.uk>
+ *
+ * @see http://github.com/sparksp/laravel-markdown
+ * @see http://michelf.com/projects/php-markdown/
+ */
+
+
+// Config options for Markdown
+define('MARKDOWN_EMPTY_ELEMENT_SUFFIX', '>');
+define('MARKDOWN_PARSER_CLASS', 'Markdown\\MarkdownLaravel_Parser');
+
+// Map the Markdown classes
+Autoloader::map(array(
+ 'Markdown\\View' => __DIR__.DIRECTORY_SEPARATOR.'view'.EXT,
+ 'Markdown_Page_Controller' => __DIR__.DIRECTORY_SEPARATOR.'controllers'.DIRECTORY_SEPARATOR.'page'.EXT,
+));
+
+// It's safe to assume that if you've started the bundle you're
+// going to want to use the parser.
+require __DIR__.DIRECTORY_SEPARATOR."parser.php";
@@ -0,0 +1,29 @@
+<?php
+
+/**
+ * Markdown Page Controller
+ *
+ * <code>
+ * Router::register('GET /(about)', 'markdown::page@show');
+ * </code>
+ *
+ * @package Bundles
+ * @subpackage Markdown
+ * @author Phill Sparks <me@phills.me.uk>
+ *
+ * @see http://github.com/sparksp/laravel-markdown
+ */
+class Markdown_Page_Controller extends Controller {
+
+ /**
+ * A simple action to show the given slug.
+ *
+ * @param string $name The file name of the markdown view to show
+ * @return Markdown\View
+ */
+ public function action_show($name)
+ {
+ return Markdown\View::make($name);
+ }
+
+}
Oops, something went wrong.

0 comments on commit 10550e3

Please sign in to comment.