Skip to content
This repository has been archived by the owner on May 9, 2021. It is now read-only.

Commit

Permalink
Added markdown parsing to the comments view.
Browse files Browse the repository at this point in the history
  • Loading branch information
ddreier committed Jun 22, 2012
1 parent c3d8677 commit 1e85ecc
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 16 deletions.
3 changes: 2 additions & 1 deletion app/application/bundles.php
Expand Up @@ -33,4 +33,5 @@
|
*/

return array('sparkdown');
return array(
'sparkdown' => array('auto' => 'true'));
15 changes: 1 addition & 14 deletions app/application/models/project/issue/comment.php
Expand Up @@ -96,19 +96,6 @@ public static function delete_comment($comment)
*/
public static function format($body)
{
/*$pattern = '#\b(([\w-]+://?|www[.])[^\s()<>]+(?:\([\w\d]+\)|([^[:punct:]\s]|/)))#';
$callback = create_function('$matches', '
$url = array_shift($matches);
$url_parts = parse_url($url);
$text = parse_url($url, PHP_URL_HOST) . parse_url($url, PHP_URL_PATH);
$text = preg_replace("/^www./", "", $text);
return sprintf(\'<a href="%s">%s</a>\', $url, $text);
');
return nl2br(preg_replace_callback($pattern, $callback, $body));*/
\Bundle::start('sparkdown');
return \Sparkdown\Markdown($body);
return \Sparkdown\Markdown($body);
}
}
2 changes: 1 addition & 1 deletion app/application/views/activity/comment.php
Expand Up @@ -6,7 +6,7 @@

<div class="data">
<span class="comment">
"<?php echo Str::limit($comment->comment, 60); ?>"
<?php echo str_replace(array("<p>","</p>"), "", \Sparkdown\Markdown('"' . Str::limit($comment->comment, 60) . '"')); ?>
</span>
by
<strong><?php echo $user->firstname . ' ' . $user->lastname; ?></strong> on issue <a href="<?php echo $issue->to(); ?>"><?php echo $issue->title; ?></a>
Expand Down

0 comments on commit 1e85ecc

Please sign in to comment.