diff --git a/src/applications/phame/controller/blog/PhameBlogViewController.php b/src/applications/phame/controller/blog/PhameBlogViewController.php index 3ab5e528d2..058b7c0d80 100644 --- a/src/applications/phame/controller/blog/PhameBlogViewController.php +++ b/src/applications/phame/controller/blog/PhameBlogViewController.php @@ -107,6 +107,16 @@ final class PhameBlogViewController extends PhameController { pht('Joinable By'), $descriptions[PhabricatorPolicyCapability::CAN_JOIN]); + $engine = id(new PhabricatorMarkupEngine()) + ->setViewer($user) + ->addObject($blog, PhameBlog::MARKUP_FIELD_DESCRIPTION) + ->process(); + + $properties->addTextContent( + '
'. + $engine->getOutput($blog, PhameBlog::MARKUP_FIELD_DESCRIPTION). + '
'); + return $properties; } diff --git a/src/applications/phame/controller/post/PhamePostViewController.php b/src/applications/phame/controller/post/PhamePostViewController.php index d0a2747a0f..74cf64dff8 100644 --- a/src/applications/phame/controller/post/PhamePostViewController.php +++ b/src/applications/phame/controller/post/PhamePostViewController.php @@ -181,6 +181,16 @@ final class PhamePostViewController extends PhameController { ? pht('Draft') : phabricator_datetime($post->getDatePublished(), $user)); + $engine = id(new PhabricatorMarkupEngine()) + ->setViewer($user) + ->addObject($post, PhamePost::MARKUP_FIELD_BODY) + ->process(); + + $properties->addTextContent( + '
'. + $engine->getOutput($post, PhamePost::MARKUP_FIELD_BODY). + '
'); + return $properties; } } diff --git a/src/applications/phame/storage/PhameBlog.php b/src/applications/phame/storage/PhameBlog.php index 16905a813d..6e4b6e1167 100644 --- a/src/applications/phame/storage/PhameBlog.php +++ b/src/applications/phame/storage/PhameBlog.php @@ -19,7 +19,11 @@ /** * @group phame */ -final class PhameBlog extends PhameDAO implements PhabricatorPolicyInterface { +final class PhameBlog extends PhameDAO + implements PhabricatorPolicyInterface, PhabricatorMarkupInterface { + + const MARKUP_FIELD_DESCRIPTION = 'markup:description'; + const SKIN_DEFAULT = 'PhabricatorBlogSkin'; @@ -259,4 +263,35 @@ final class PhameBlog extends PhameDAO implements PhabricatorPolicyInterface { return false; } + +/* -( PhabricatorMarkupInterface Implementation )-------------------------- */ + + + public function getMarkupFieldKey($field) { + $hash = PhabricatorHash::digest($this->getMarkupText($field)); + return $this->getPHID().':'.$field.':'.$hash; + } + + + public function newMarkupEngine($field) { + return PhabricatorMarkupEngine::newPhameMarkupEngine(); + } + + + public function getMarkupText($field) { + return $this->getDescription(); + } + + + public function didMarkupText( + $field, + $output, + PhutilMarkupEngine $engine) { + return $output; + } + + public function shouldUseMarkupCache($field) { + return (bool)$this->getPHID(); + } + } diff --git a/src/applications/phame/storage/PhamePost.php b/src/applications/phame/storage/PhamePost.php index 66eeef1624..bebce50589 100644 --- a/src/applications/phame/storage/PhamePost.php +++ b/src/applications/phame/storage/PhamePost.php @@ -19,7 +19,10 @@ /** * @group phame */ -final class PhamePost extends PhameDAO implements PhabricatorPolicyInterface { +final class PhamePost extends PhameDAO + implements PhabricatorPolicyInterface, PhabricatorMarkupInterface { + + const MARKUP_FIELD_BODY = 'markup:body'; const VISIBILITY_DRAFT = 0; const VISIBILITY_PUBLISHED = 1; @@ -174,4 +177,35 @@ final class PhamePost extends PhameDAO implements PhabricatorPolicyInterface { } } + +/* -( PhabricatorMarkupInterface Implementation )-------------------------- */ + + + public function getMarkupFieldKey($field) { + return $this->getPHID().':'.$field; + } + + + public function newMarkupEngine($field) { + return PhabricatorMarkupEngine::newPhameMarkupEngine(); + } + + + public function getMarkupText($field) { + return $this->getBody(); + } + + + public function didMarkupText( + $field, + $output, + PhutilMarkupEngine $engine) { + return $output; + } + + + public function shouldUseMarkupCache($field) { + return (bool)$this->getPHID(); + } + }