Merge pull request #136 from GrahamForks/markdown

Use a better markdown solution
This commit is contained in:
James Brooks 2014-12-30 13:07:40 +00:00
commit 21c266bba5
5 changed files with 111 additions and 12 deletions

View File

@ -124,6 +124,7 @@ return [
'Dingo\Api\Provider\ApiServiceProvider',
'GrahamCampbell\Throttle\ThrottleServiceProvider',
'GrahamCampbell\Markdown\MarkdownServiceProvider',
'Thujohn\Rss\RssServiceProvider',
'CachetHQ\Cachet\Support\ServiceProviders\RepositoryServiceProvider',
@ -199,6 +200,7 @@ return [
'API' => 'Dingo\Api\Facade\API',
'Throttle' => 'GrahamCampbell\Throttle\Facades\Throttle',
'Markdown' => 'GrahamCampbell\Markdown\Facades\Markdown',
'RSS' => 'Thujohn\Rss\RssFacade',
],

View File

@ -0,0 +1,35 @@
<?php
/*
* This file is part of Laravel Markdown by Graham Campbell.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at http://bit.ly/UWsjkb.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
return [
/*
|--------------------------------------------------------------------------
| Enable The Engines
|--------------------------------------------------------------------------
|
| This option specifies if the view engines are enabled so you can write
| markdown views and have them compiled into html. The following extensions
| are currently supported: ".md", ".md.php", and ".md.blade.php". You may
| disable the engines if they are conflicting with another package.
|
| Default: true
|
*/
'engines' => false,
];

View File

@ -1,11 +1,12 @@
<?php
use Dingo\Api\Transformer\TransformableInterface;
use Illuminate\Database\Eloquent\SoftDeletingTrait;
use Watson\Validating\ValidatingTrait;
class Incident extends Eloquent implements \Dingo\Api\Transformer\TransformableInterface
class Incident extends Eloquent implements TransformableInterface
{
use ValidatingTrait;
use Illuminate\Database\Eloquent\SoftDeletingTrait;
use SoftDeletingTrait, ValidatingTrait;
protected $rules = [
'user_id' => 'required|integer',
@ -21,7 +22,8 @@ class Incident extends Eloquent implements \Dingo\Api\Transformer\TransformableI
/**
* An incident belongs to a component.
* @return Illuminate\Database\Eloquent\Relations\BelongsTo
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function component()
{
@ -30,6 +32,7 @@ class Incident extends Eloquent implements \Dingo\Api\Transformer\TransformableI
/**
* Returns a human readable version of the status.
*
* @return string
*/
public function getHumanStatusAttribute()
@ -41,6 +44,7 @@ class Incident extends Eloquent implements \Dingo\Api\Transformer\TransformableI
/**
* Finds the icon to use for each status.
*
* @return string
*/
public function getIconAttribute()
@ -55,18 +59,18 @@ class Incident extends Eloquent implements \Dingo\Api\Transformer\TransformableI
/**
* Returns a Markdown formatted version of the status.
*
* @return string
*/
public function getFormattedMessageAttribute()
{
$parseDown = new ParsedownExtra();
return $parseDown->text($this->message);
return Markdown::render($this->message);
}
/**
* Get the transformer instance.
* @return CachetHQ\Cachet\Transformers\IncidentTransformer
*
* @return \CachetHQ\Cachet\Transformers\IncidentTransformer
*/
public function getTransformer()
{
@ -75,7 +79,8 @@ class Incident extends Eloquent implements \Dingo\Api\Transformer\TransformableI
/**
* Check if Incident has message.
* @return boolean
*
* @return bool
*/
public function hasMessage()
{

View File

@ -14,10 +14,10 @@
"guzzlehttp/guzzle": "~5.0",
"dingo/api": "0.8.*",
"graham-campbell/throttle": "~2.0",
"graham-campbell/markdown": "~2.0",
"watson/validating": "0.10.*",
"thujohn/rss": "~1.0",
"doctrine/dbal": "2.5.*",
"erusev/parsedown-extra": "~0.1"
"doctrine/dbal": "2.5.*"
},
"require-dev": {
"phpunit/phpunit": "~4.3",

59
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"hash": "def3f0fcb615467e21e9eccf44a39a73",
"hash": "4cbce9aaf02d3c94bd12d972d20f00be",
"packages": [
{
"name": "classpreloader/classpreloader",
@ -768,6 +768,63 @@
],
"time": "2014-10-26 09:05:09"
},
{
"name": "graham-campbell/markdown",
"version": "v2.0.5",
"source": {
"type": "git",
"url": "https://github.com/GrahamCampbell/Laravel-Markdown.git",
"reference": "d316f586fcaf59ecdf9d2f60f26da277cd6c8e8d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/GrahamCampbell/Laravel-Markdown/zipball/d316f586fcaf59ecdf9d2f60f26da277cd6c8e8d",
"reference": "d316f586fcaf59ecdf9d2f60f26da277cd6c8e8d",
"shasum": ""
},
"require": {
"erusev/parsedown": "~1.1",
"erusev/parsedown-extra": "~0.2.2",
"illuminate/support": "~4.1",
"illuminate/view": "~4.1",
"php": ">=5.4.7"
},
"require-dev": {
"graham-campbell/testbench": "~1.0"
},
"type": "library",
"autoload": {
"psr-4": {
"GrahamCampbell\\Markdown\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache-2.0"
],
"authors": [
{
"name": "Graham Campbell",
"email": "graham@mineuk.com"
}
],
"description": "Markdown Is A Parsedown Extra Wrapper For Laravel 4.1/4.2",
"keywords": [
"Graham Campbell",
"GrahamCampbell",
"Laravel Markdown",
"Laravel-Markdown",
"Parsedown Extra",
"framework",
"laravel",
"markdown",
"markdown wrapper",
"parsedown",
"parsedown extra wrapper",
"parsedown wrapper"
],
"time": "2014-10-05 14:49:46"
},
{
"name": "graham-campbell/throttle",
"version": "v2.0.1",