Skip to content

Commit

Permalink
Added post processor render plugin spots
Browse files Browse the repository at this point in the history
  • Loading branch information
jmather committed Dec 17, 2010
1 parent c1d6809 commit e316e79
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 9 deletions.
8 changes: 8 additions & 0 deletions config/app.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
all:
majaxMarkdown:
style: markdown_extra
smartypants_enabled: true
smartypants_style: smartypants_typographer
smartypants_options: 1
post_render: false
post_preview: false
13 changes: 9 additions & 4 deletions lib/majaxMarkdown.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,20 @@ class majaxMarkdown
{
public static function transform($string)
{
$path = dirname(__FILE__).'/../vendor/'.sfConfig::get('app_markdown_style', 'markdown_extra').'/markdown.php';
$path = dirname(__FILE__).'/../vendor/'.sfConfig::get('app_majaxMarkdown_style', 'markdown_extra').'/markdown.php';
require_once($path);
$string = Markdown($string);
if (sfConfig::get('app_markdown_smartypants_enabled', true))
if (sfConfig::get('app_majaxMarkdown_smartypants_enabled', true))
{
$style = sfConfig::get('app_markdown_smartypants_style', 'smartypants_typographer');
$style = sfConfig::get('app_majaxMarkdown_smartypants_style', 'smartypants_typographer');
$path = dirname(__FILE__).'/../vendor/'.$style.'/smartypants.php';
require_once($path);
$string = SmartyPants($string, sfConfig::get('app_markdown_smartypants_options', 1));
$string = SmartyPants($string, sfConfig::get('app_majaxMarkdown_smartypants_options', 1));
}
if (sfConfig::get('app_majaxMarkdown_post_render', false))
{
$render = sfConfig::get('app_majaxMarkdown_post_render');
$string = call_user_func($render, $string);
}
return $string;
}
Expand Down
8 changes: 7 additions & 1 deletion modules/majaxMarkdown/actions/actions.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@ class majaxMarkdownActions extends BasemajaxMarkdownActions
{
public function executePreview(sfWebRequest $request)
{
$this->preview = majaxMarkdown::transform($request->getParameter('markdown'));
$preview = majaxMarkdown::transform($request->getParameter('markdown'));
if (sfConfig::get('app_majaxMarkdown_post_preview', false))
{
$render = sfConfig::get('app_majaxMarkdown_post_preview');
$preview = call_user_func($render, $preview);
}
$this->preview = $preview;
}
public function executePreviewFrame(sfWebRequest $request)
{
Expand Down
23 changes: 19 additions & 4 deletions package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
<email>jmather@itsmajax.com</email>
<active>yes</active>
</lead>
<date>2010-11-22</date>
<time>12:08:21</time>
<date>2010-12-17</date>
<time>10:50:00</time>
<version>
<release>1.0.0</release>
<api>1.0.0</api>
<release>1.1.0</release>
<api>1.1.0</api>
</version>
<stability>
<release>stable</release>
Expand Down Expand Up @@ -167,5 +167,20 @@ Initial release
Initial release
</notes>
</release>
<release>
<version>
<release>1.1.0</release>
<api>1.1.0</api>
</version>
<stability>
<release>stable</release>
<api>stable</api>
</stability>
<date>2010-12-17</date>
<license uri="http://www.opensource.org/licenses/mit-license.html">MIT</license>
<notes>
Added post processing configuration, and post preview configuration, to customize rendering.
</notes>
</release>
</changelog>
</package>

0 comments on commit e316e79

Please sign in to comment.