Skip to content

Commit

Permalink
Doxter 0.5.6
Browse files Browse the repository at this point in the history
* Adds the ability to handle empty fields safely @see issue #5
* Fixes issue #5 by patching infinite loop triggered by an empty string
* Improves the doxter filter/function by only processing non empty strings
  • Loading branch information
selvinortiz committed Feb 21, 2014
1 parent c1bc14e commit 79f9f09
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
4 changes: 2 additions & 2 deletions DoxterPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
namespace Craft;

/**
* Doxter 0.5.5
* Doxter 0.5.6
*
* Doxter is a markdown plugin designed to improve your workflow for writing docs
*
Expand Down Expand Up @@ -49,7 +49,7 @@ public function getName($real=false)

public function getVersion()
{
return '0.5.5';
return '0.5.6';
}

public function getDeveloper()
Expand Down
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
![Doxter](resources/img/doxter.png)

## Doxter 0.5.5
## Doxter 0.5.6
*by* [Selvin Ortiz](http://twitter.com/selvinortiz)

----
Expand Down Expand Up @@ -44,6 +44,12 @@ That means that you can use **Scrawl Markdown** or a **Plain Text** field type t

### Changelog

----
#### 0.5.6
* Adds support for the `parseRefs` filter returned value
* Adds flexibility by allowing empty and non empty string, and objects
* Fixes issue #6 where objects that implement `__toString` were ignored

----
#### 0.5.5
* Adds the ability to handle empty fields safely @see issue #5
Expand Down
13 changes: 11 additions & 2 deletions twigextensions/DoxterTwigExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,19 @@ public function getName()
return 'Doxter';
}

/**
* The doxter funtion/filter converts markdown to html
*
* - Handle empty strings safely @link https://github.com/selvinortiz/craft.doxter/issues/5
* - Handle parseRefs returned value @link https://github.com/selvinortiz/craft.doxter/issues/6
*
* @param mixed $source The source string or object that implements __toString
* @param array $params Filter/Function arguments passed in from twig
* @return mixed The parsed string or false if not a valid source
*/
public function doxter($source='', array $params=array())
{
// Only transform non empty strings @see issue #5
if (is_string($source) && !empty($source))
if (!empty($source) && (is_string($source) || method_exists($source, '__toString')))
{
return craft()->doxter->transform($source, $params);
}
Expand Down

0 comments on commit 79f9f09

Please sign in to comment.