Permalink
Browse files

Now called "Sparkdown", updated for Laravel 3

  • Loading branch information...
1 parent 8a8f91b commit f7431178fadc2b7d6e8b5793df8a42c287abc2bc @sparksp committed Feb 22, 2012
Showing with 78 additions and 57 deletions.
  1. +5 −0 apigen.neon
  2. +8 −1 bundle.php
  3. +9 −7 controllers/page.php
  4. +12 −2 parser.php
  5. +35 −16 readme.md
  6. +3 −25 start.php
  7. +6 −6 view.php
View
@@ -0,0 +1,5 @@
+title: Sparkdown Bundle
+main: Sparkdown
+source: .
+destination: api
+groups: packages
View
@@ -1 +1,8 @@
-<?php return array('name' => 'markdown');
+<?php return array(
+ // Copy the code below into your application/bundles.php to register Topos
+ // Note: Using 'autoloads' is not recommended with Sparkdown at this time.
+
+ 'sparkdown'
+
+ // -
+);
View
@@ -1,29 +1,31 @@
<?php
/**
- * Markdown Page Controller
+ * Sparkdown Page Controller
*
* <code>
- * Router::register('GET /(about)', 'markdown::page@show');
+ * Router::register('GET /(about)', 'sparkdown::page@show');
* </code>
*
- * @package Bundles
- * @subpackage Markdown
+ * @category Bundle
+ * @package Sparkdown
* @author Phill Sparks <me@phills.me.uk>
+ * @license MIT License <http://www.opensource.org/licenses/mit>
+ * @copyright 2012 Phill Sparks
*
* @see http://github.com/sparksp/laravel-markdown
*/
-class Markdown_Page_Controller extends Controller {
+class Sparkdown_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
+ * @return Sparkdown\View
*/
public function action_show($name)
{
- return Markdown\View::make($name);
+ return Sparkdown\View::make($name);
}
}
View
@@ -1,4 +1,10 @@
-<?php namespace Markdown;
+<?php namespace Sparkdown;
+
+// Config options for Sparkdown
+define('MARKDOWN_EMPTY_ELEMENT_SUFFIX', '>');
+define('MARKDOWN_PARSER_CLASS', 'Sparkdown\\MarkdownLaravel_Parser');
+
+
#
# Markdown Extra - A text-to-HTML conversion tool for web writers
@@ -2937,7 +2943,11 @@ function _doAbbreviations_callback($matches) {
/**
* MarkdownExtra for Laravel, passes URLs through the URL class.
*
- * @author Phill Sparks <me@phills.me.uk>
+ * @category Bundle
+ * @package Sparkdown
+ * @author Phill Sparks <me@phills.me.uk>
+ * @license MIT License <http://www.opensource.org/licenses/mit>
+ * @copyright 2012 Phill Sparks
*/
class MarkdownLaravel_Parser extends MarkdownExtra_Parser {
View
@@ -1,33 +1,52 @@
-# Markdown for Laravel
+# Sparkdown Bundle
A simple bundle to provide [Markdown](http://daringfireball.net/projects/markdown/) and [Markdown Extra](http://michelf.com/projects/php-markdown/) functions.
Links and image URLs are passed through Laravel\URL::to and Larave\URL::to_asset.
## Installation
-Drop the **Markdown** bundle into your **/bundles** directory.
+Install via the Artisan CLI:
-## Parse some text
+```sh
+php artisan bundle:install sparkdown
+```
-Just start using Markdown\Markdown
+Or download the zip and unpack into your bundles directory.
- echo Markdown\Markdown($text);
+## Bundle Registration
-## View a markdown file
+Just add `'sparkdown'` to your **application/bundles.php** file.
-You can create Markdown\View objects, like Laravel\View objects
+## Guide
- Router::register('GET /about', function()
- {
- // View of application/views/about.md
- return Markdown\View::make('about');
+### Parse some text
- // Also supports bundles and paths...
- // View of bundles/bundle/views/path/file.md
- return Markdown\View::make('bundle::path.file');
- });
+Start the bundle and use Sparkdown\Markdown
+
+```php
+Bundle::start('sparkdown');
+echo Sparkdown\Markdown($text);
+```
+
+### View a markdown file
+
+You can create Sparkdown\View objects, like Laravel\View objects
+
+```php
+Router::register('GET /about', function()
+{
+ // View of application/views/about.md
+ return Sparkdown\View::make('about');
+
+ // Also supports bundles and paths...
+ // View of bundles/bundle/views/path/file.md
+ return Sparkdown\View::make('bundle::path.file');
+});
+```
And you can route to the handy controller (needs 1 parameter).
- Router::register('GET /(about)', 'markdown::page@show');
+```php
+Route::get('(about)', 'sparkdown::page@show');
+```
View
@@ -1,33 +1,11 @@
<?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,
+ 'Sparkdown\\View' => __DIR__.DS.'view'.EXT,
+ 'Sparkdown_Page_Controller' => __DIR__.DS.'controllers'.DS.'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";
+require __DIR__.DS."parser.php";
View
@@ -1,20 +1,20 @@
-<?php namespace Markdown;
+<?php namespace Sparkdown;
// Note: much of this code is taken from \Laravel\View and will need maintaining as
// the core View class is updated.
use Bundle, Event;
/**
- * Markdown View
+ * Sparkdown View
*
* Markdown view files are found in standard views directories; bundle syntax works too.
*
- * @package Bundles
- * @subpackage Markdown
+ * @category Bundle
+ * @package Sparkdown
* @author Phill Sparks <me@phills.me.uk>
- *
- * @see http://github.com/sparksp/laravel-markdown
+ * @license MIT License <http://www.opensource.org/licenses/mit>
+ * @copyright 2012 Phill Sparks
*/
class View extends \Laravel\View {

0 comments on commit f743117

Please sign in to comment.