Page MenuHomePhabricator

D15281.id36869.diff
No OneTemporary

D15281.id36869.diff

diff --git a/src/applications/calendar/controller/PhabricatorCalendarEventViewController.php b/src/applications/calendar/controller/PhabricatorCalendarEventViewController.php
--- a/src/applications/calendar/controller/PhabricatorCalendarEventViewController.php
+++ b/src/applications/calendar/controller/PhabricatorCalendarEventViewController.php
@@ -363,11 +363,7 @@
->getIconLabel($event->getIcon()));
if (strlen($event->getDescription())) {
- $description = PhabricatorMarkupEngine::renderOneObject(
- id(new PhabricatorMarkupOneOff())->setContent($event->getDescription()),
- 'default',
- $viewer);
-
+ $description = new PHUIRemarkupView($viewer, $event->getDescription());
$properties->addSectionHeader(
pht('Description'),
PHUIPropertyListView::ICON_SUMMARY);
diff --git a/src/applications/config/controller/PhabricatorConfigWelcomeController.php b/src/applications/config/controller/PhabricatorConfigWelcomeController.php
--- a/src/applications/config/controller/PhabricatorConfigWelcomeController.php
+++ b/src/applications/config/controller/PhabricatorConfigWelcomeController.php
@@ -341,23 +341,14 @@
$header = id(new PHUIHeaderView())
->setHeader(pht('Welcome to Phabricator'));
- $setup_header = PhabricatorMarkupEngine::renderOneObject(
- id(new PhabricatorMarkupOneOff())
- ->setContent(pht('=Setup and Configuration')),
- 'default',
- $viewer);
-
- $explore_header = PhabricatorMarkupEngine::renderOneObject(
- id(new PhabricatorMarkupOneOff())
- ->setContent(pht('=Explore Phabricator')),
- 'default',
- $viewer);
-
- $quick_header = PhabricatorMarkupEngine::renderOneObject(
- id(new PhabricatorMarkupOneOff())
- ->setContent(pht('=Quick Start Guides')),
- 'default',
- $viewer);
+ $setup_header = new PHUIRemarkupView(
+ $viewer, pht('=Setup and Configuration'));
+
+ $explore_header = new PHUIRemarkupView(
+ $viewer, pht('=Explore Phabricator'));
+
+ $quick_header = new PHUIRemarkupView(
+ $viewer, pht('=Quick Start Guide'));
return id(new PHUIDocumentView())
->setHeader($header)
@@ -376,10 +367,7 @@
$icon = id(new PHUIIconView())
->setIcon($icon.' fa-2x');
- $content = PhabricatorMarkupEngine::renderOneObject(
- id(new PhabricatorMarkupOneOff())->setContent($content),
- 'default',
- $viewer);
+ $content = new PHUIRemarkupView($viewer, $content);
$icon = phutil_tag(
'div',
diff --git a/src/applications/countdown/controller/PhabricatorCountdownViewController.php b/src/applications/countdown/controller/PhabricatorCountdownViewController.php
--- a/src/applications/countdown/controller/PhabricatorCountdownViewController.php
+++ b/src/applications/countdown/controller/PhabricatorCountdownViewController.php
@@ -132,11 +132,7 @@
$description = $countdown->getDescription();
if (strlen($description)) {
- $description = PhabricatorMarkupEngine::renderOneObject(
- id(new PhabricatorMarkupOneOff())->setContent($description),
- 'default',
- $viewer);
-
+ $description = new PHUIRemarkupView($viewer, $description);
$view->addSectionHeader(
pht('Description'),
PHUIPropertyListView::ICON_SUMMARY);
diff --git a/src/applications/differential/customfield/DifferentialRevertPlanField.php b/src/applications/differential/customfield/DifferentialRevertPlanField.php
--- a/src/applications/differential/customfield/DifferentialRevertPlanField.php
+++ b/src/applications/differential/customfield/DifferentialRevertPlanField.php
@@ -44,12 +44,7 @@
return null;
}
- return PhabricatorMarkupEngine::renderOneObject(
- id(new PhabricatorMarkupOneOff())
- ->setPreserveLinebreaks(true)
- ->setContent($this->getValue()),
- 'default',
- $this->getViewer());
+ return new PHUIRemarkupView($this->getViewer(), $this->getValue());
}
public function shouldAppearInGlobalSearch() {
diff --git a/src/applications/differential/customfield/DifferentialSummaryField.php b/src/applications/differential/customfield/DifferentialSummaryField.php
--- a/src/applications/differential/customfield/DifferentialSummaryField.php
+++ b/src/applications/differential/customfield/DifferentialSummaryField.php
@@ -122,12 +122,7 @@
return null;
}
- return PhabricatorMarkupEngine::renderOneObject(
- id(new PhabricatorMarkupOneOff())
- ->setPreserveLinebreaks(true)
- ->setContent($this->getValue()),
- 'default',
- $this->getViewer());
+ return new PHUIRemarkupView($this->getViewer(), $this->getValue());
}
public function getApplicationTransactionRemarkupBlocks(
diff --git a/src/applications/differential/customfield/DifferentialTestPlanField.php b/src/applications/differential/customfield/DifferentialTestPlanField.php
--- a/src/applications/differential/customfield/DifferentialTestPlanField.php
+++ b/src/applications/differential/customfield/DifferentialTestPlanField.php
@@ -136,12 +136,7 @@
return null;
}
- return PhabricatorMarkupEngine::renderOneObject(
- id(new PhabricatorMarkupOneOff())
- ->setPreserveLinebreaks(true)
- ->setContent($this->getValue()),
- 'default',
- $this->getViewer());
+ return new PHUIRemarkupView($this->getViewer(), $this->getValue());
}
public function getApplicationTransactionRemarkupBlocks(
diff --git a/src/applications/diffusion/controller/DiffusionRepositoryController.php b/src/applications/diffusion/controller/DiffusionRepositoryController.php
--- a/src/applications/diffusion/controller/DiffusionRepositoryController.php
+++ b/src/applications/diffusion/controller/DiffusionRepositoryController.php
@@ -290,10 +290,7 @@
$description = $repository->getDetail('description');
if (strlen($description)) {
- $description = PhabricatorMarkupEngine::renderOneObject(
- $repository,
- 'description',
- $user);
+ $description = new PHUIRemarkupView($user, $description);
$view->addSectionHeader(
pht('Description'), PHUIPropertyListView::ICON_SUMMARY);
$view->addTextContent($description);
diff --git a/src/applications/diffusion/controller/DiffusionRepositoryEditMainController.php b/src/applications/diffusion/controller/DiffusionRepositoryEditMainController.php
--- a/src/applications/diffusion/controller/DiffusionRepositoryEditMainController.php
+++ b/src/applications/diffusion/controller/DiffusionRepositoryEditMainController.php
@@ -309,10 +309,7 @@
if (!strlen($description)) {
$description = phutil_tag('em', array(), pht('No description provided.'));
} else {
- $description = PhabricatorMarkupEngine::renderOneObject(
- $repository,
- 'description',
- $viewer);
+ $description = new PHUIRemarkupView($viewer, $description);
}
$view->addTextContent($description);
diff --git a/src/applications/diviner/controller/DivinerBookController.php b/src/applications/diviner/controller/DivinerBookController.php
--- a/src/applications/diviner/controller/DivinerBookController.php
+++ b/src/applications/diviner/controller/DivinerBookController.php
@@ -94,11 +94,7 @@
$preface = $book->getPreface();
$preface_view = null;
if (strlen($preface)) {
- $preface_view =
- PhabricatorMarkupEngine::renderOneObject(
- id(new PhabricatorMarkupOneOff())->setContent($preface),
- 'default',
- $viewer);
+ $preface_view = new PHUIRemarkupView($viewer, $preface);
}
$document->appendChild($preface_view);
diff --git a/src/applications/diviner/controller/DivinerMainController.php b/src/applications/diviner/controller/DivinerMainController.php
--- a/src/applications/diviner/controller/DivinerMainController.php
+++ b/src/applications/diviner/controller/DivinerMainController.php
@@ -61,11 +61,7 @@
" %s\n\n",
'phabricator/ $ ./bin/diviner generate');
- $text = PhabricatorMarkupEngine::renderOneObject(
- id(new PhabricatorMarkupOneOff())->setContent($text),
- 'default',
- $viewer);
-
+ $text = new PHUIRemarkupView($viewer, $text);
$document->appendChild($text);
}
diff --git a/src/applications/doorkeeper/option/PhabricatorAsanaConfigOptions.php b/src/applications/doorkeeper/option/PhabricatorAsanaConfigOptions.php
--- a/src/applications/doorkeeper/option/PhabricatorAsanaConfigOptions.php
+++ b/src/applications/doorkeeper/option/PhabricatorAsanaConfigOptions.php
@@ -111,10 +111,7 @@
"The Asana Workspaces your linked account has access to are:\n\n%s",
$out);
- return PhabricatorMarkupEngine::renderOneObject(
- id(new PhabricatorMarkupOneOff())->setContent($out),
- 'default',
- $viewer);
+ return new PHUIRemarkupView($viewer, $out);
}
private function renderContextualProjectDescription(
@@ -155,10 +152,7 @@
$out = implode("\n", $out);
- return PhabricatorMarkupEngine::renderOneObject(
- id(new PhabricatorMarkupOneOff())->setContent($out),
- 'default',
- $viewer);
+ return new PHUIRemarkupView($viewer, $out);
}
}
diff --git a/src/applications/fund/controller/FundInitiativeViewController.php b/src/applications/fund/controller/FundInitiativeViewController.php
--- a/src/applications/fund/controller/FundInitiativeViewController.php
+++ b/src/applications/fund/controller/FundInitiativeViewController.php
@@ -98,11 +98,7 @@
$description = $initiative->getDescription();
if (strlen($description)) {
- $description = PhabricatorMarkupEngine::renderOneObject(
- id(new PhabricatorMarkupOneOff())->setContent($description),
- 'default',
- $viewer);
-
+ $description = new PHUIRemarkupView($viewer, $description);
$view->addSectionHeader(
pht('Description'), PHUIPropertyListView::ICON_SUMMARY);
$view->addTextContent($description);
@@ -110,11 +106,7 @@
$risks = $initiative->getRisks();
if (strlen($risks)) {
- $risks = PhabricatorMarkupEngine::renderOneObject(
- id(new PhabricatorMarkupOneOff())->setContent($risks),
- 'default',
- $viewer);
-
+ $risks = new PHUIRemarkupView($viewer, $risks);
$view->addSectionHeader(
pht('Risks/Challenges'), 'fa-ambulance');
$view->addTextContent($risks);
diff --git a/src/applications/harbormaster/controller/HarbormasterBuildViewController.php b/src/applications/harbormaster/controller/HarbormasterBuildViewController.php
--- a/src/applications/harbormaster/controller/HarbormasterBuildViewController.php
+++ b/src/applications/harbormaster/controller/HarbormasterBuildViewController.php
@@ -181,16 +181,10 @@
if ($step) {
$description = $step->getDescription();
if ($description) {
- $rendered = PhabricatorMarkupEngine::renderOneObject(
- id(new PhabricatorMarkupOneOff())
- ->setContent($description)
- ->setPreserveLinebreaks(true),
- 'default',
- $viewer);
-
+ $description = new PHUIRemarkupView($viewer, $description);
$properties->addSectionHeader(
pht('Description'), PHUIPropertyListView::ICON_SUMMARY);
- $properties->addTextContent($rendered);
+ $properties->addTextContent($description);
}
} else {
$target_box->setFormErrors(
diff --git a/src/applications/legalpad/controller/LegalpadDocumentSignController.php b/src/applications/legalpad/controller/LegalpadDocumentSignController.php
--- a/src/applications/legalpad/controller/LegalpadDocumentSignController.php
+++ b/src/applications/legalpad/controller/LegalpadDocumentSignController.php
@@ -258,11 +258,7 @@
$preamble_box = null;
if (strlen($document->getPreamble())) {
- $preamble_text = PhabricatorMarkupEngine::renderOneObject(
- id(new PhabricatorMarkupOneOff())->setContent(
- $document->getPreamble()),
- 'default',
- $viewer);
+ $preamble_text = new PHUIRemarkupView($viewer, $document->getPreamble());
// NOTE: We're avoiding `setObject()` here so we don't pick up extra UI
// elements like "Subscribers". This information is available on the
diff --git a/src/applications/meta/controller/PhabricatorApplicationDetailViewController.php b/src/applications/meta/controller/PhabricatorApplicationDetailViewController.php
--- a/src/applications/meta/controller/PhabricatorApplicationDetailViewController.php
+++ b/src/applications/meta/controller/PhabricatorApplicationDetailViewController.php
@@ -104,14 +104,11 @@
}
$overview = $application->getOverview();
- if ($overview) {
+ if (strlen($overview)) {
+ $overview = new PHUIRemarkupView($viewer, $overview);
$properties->addSectionHeader(
pht('Overview'), PHUIPropertyListView::ICON_SUMMARY);
- $properties->addTextContent(
- PhabricatorMarkupEngine::renderOneObject(
- id(new PhabricatorMarkupOneOff())->setContent($overview),
- 'default',
- $viewer));
+ $properties->addTextContent($overview);
}
$descriptions = PhabricatorPolicyQuery::renderPolicyDescriptions(
diff --git a/src/applications/meta/controller/PhabricatorApplicationEmailCommandsController.php b/src/applications/meta/controller/PhabricatorApplicationEmailCommandsController.php
--- a/src/applications/meta/controller/PhabricatorApplicationEmailCommandsController.php
+++ b/src/applications/meta/controller/PhabricatorApplicationEmailCommandsController.php
@@ -117,10 +117,7 @@
$crumbs->addTextCrumb($title);
$crumbs->setBorder(true);
- $content_box = PhabricatorMarkupEngine::renderOneObject(
- id(new PhabricatorMarkupOneOff())->setContent($content),
- 'default',
- $viewer);
+ $content_box = new PHUIRemarkupView($viewer, $content);
$info_view = null;
if (!PhabricatorEnv::getEnvConfig('metamta.reply-handler-domain')) {
diff --git a/src/applications/nuance/source/NuancePhabricatorFormSourceDefinition.php b/src/applications/nuance/source/NuancePhabricatorFormSourceDefinition.php
--- a/src/applications/nuance/source/NuancePhabricatorFormSourceDefinition.php
+++ b/src/applications/nuance/source/NuancePhabricatorFormSourceDefinition.php
@@ -120,11 +120,7 @@
PHUIPropertyListView $view) {
$complaint = $item->getNuanceProperty('complaint');
- $complaint = PhabricatorMarkupEngine::renderOneObject(
- id(new PhabricatorMarkupOneOff())->setContent($complaint),
- 'default',
- $viewer);
-
+ $complaint = new PHUIRemarkupView($viewer, $complaint);
$view->addSectionHeader(
pht('Complaint'), 'fa-exclamation-circle');
$view->addTextContent($complaint);
diff --git a/src/applications/owners/controller/PhabricatorOwnersDetailController.php b/src/applications/owners/controller/PhabricatorOwnersDetailController.php
--- a/src/applications/owners/controller/PhabricatorOwnersDetailController.php
+++ b/src/applications/owners/controller/PhabricatorOwnersDetailController.php
@@ -189,13 +189,10 @@
$description = $package->getDescription();
if (strlen($description)) {
+ $description = new PHUIRemarkupView($viewer, $description);
$view->addSectionHeader(
pht('Description'), PHUIPropertyListView::ICON_SUMMARY);
- $view->addTextContent(
- $output = PhabricatorMarkupEngine::renderOneObject(
- id(new PhabricatorMarkupOneOff())->setContent($description),
- 'default',
- $viewer));
+ $view->addTextContent($description);
}
$view->invokeWillRenderEvent();
diff --git a/src/applications/phame/controller/blog/PhameBlogManageController.php b/src/applications/phame/controller/blog/PhameBlogManageController.php
--- a/src/applications/phame/controller/blog/PhameBlogManageController.php
+++ b/src/applications/phame/controller/blog/PhameBlogManageController.php
@@ -118,10 +118,7 @@
$properties->invokeWillRenderEvent();
if (strlen($blog->getDescription())) {
- $description = PhabricatorMarkupEngine::renderOneObject(
- id(new PhabricatorMarkupOneOff())->setContent($blog->getDescription()),
- 'default',
- $viewer);
+ $description = new PHUIRemarkupView($viewer, $description);
$properties->addSectionHeader(
pht('Description'),
PHUIPropertyListView::ICON_SUMMARY);
diff --git a/src/applications/pholio/controller/PholioInlineController.php b/src/applications/pholio/controller/PholioInlineController.php
--- a/src/applications/pholio/controller/PholioInlineController.php
+++ b/src/applications/pholio/controller/PholioInlineController.php
@@ -86,16 +86,13 @@
),
$author_handle->renderLink());
+ $inline_content = new PHUIRemarkupView($viewer, $inline->getContent());
$comment_body = phutil_tag(
'div',
array(
'class' => 'pholio-inline-comment-body',
),
- PhabricatorMarkupEngine::renderOneObject(
- id(new PhabricatorMarkupOneOff())
- ->setContent($inline->getContent()),
- 'default',
- $viewer));
+ $inline_content);
return $this->newDialog()
->setTitle(pht('Inline Comment'))
diff --git a/src/applications/phortune/controller/PhortuneCartController.php b/src/applications/phortune/controller/PhortuneCartController.php
--- a/src/applications/phortune/controller/PhortuneCartController.php
+++ b/src/applications/phortune/controller/PhortuneCartController.php
@@ -48,12 +48,7 @@
return null;
}
- $output = PhabricatorMarkupEngine::renderOneObject(
- id(new PhabricatorMarkupOneOff())
- ->setPreserveLinebreaks(true)
- ->setContent($description),
- 'default',
- $this->getViewer());
+ $output = new PHUIRemarkupView($this->getUser(), $description);
$box = id(new PHUIBoxView())
->addMargin(PHUI::MARGIN_LARGE)
diff --git a/src/applications/phortune/controller/PhortuneMerchantViewController.php b/src/applications/phortune/controller/PhortuneMerchantViewController.php
--- a/src/applications/phortune/controller/PhortuneMerchantViewController.php
+++ b/src/applications/phortune/controller/PhortuneMerchantViewController.php
@@ -136,11 +136,7 @@
$description = $merchant->getDescription();
if (strlen($description)) {
- $description = PhabricatorMarkupEngine::renderOneObject(
- id(new PhabricatorMarkupOneOff())->setContent($description),
- 'default',
- $viewer);
-
+ $description = new PHUIRemarkupView($viewer, $description);
$view->addSectionHeader(
pht('Description'), PHUIPropertyListView::ICON_SUMMARY);
$view->addTextContent($description);
diff --git a/src/applications/phurl/controller/PhabricatorPhurlURLViewController.php b/src/applications/phurl/controller/PhabricatorPhurlURLViewController.php
--- a/src/applications/phurl/controller/PhabricatorPhurlURLViewController.php
+++ b/src/applications/phurl/controller/PhabricatorPhurlURLViewController.php
@@ -134,16 +134,12 @@
$properties->invokeWillRenderEvent();
- if (strlen($url->getDescription())) {
- $description = PhabricatorMarkupEngine::renderOneObject(
- id(new PhabricatorMarkupOneOff())->setContent($url->getDescription()),
- 'default',
- $viewer);
-
+ $description = $url->getDescription();
+ if (strlen($description)) {
+ $description = new PHUIRemarkupView($viewer, $description);
$properties->addSectionHeader(
pht('Description'),
PHUIPropertyListView::ICON_SUMMARY);
-
$properties->addTextContent($description);
}
diff --git a/src/applications/slowvote/controller/PhabricatorSlowvotePollController.php b/src/applications/slowvote/controller/PhabricatorSlowvotePollController.php
--- a/src/applications/slowvote/controller/PhabricatorSlowvotePollController.php
+++ b/src/applications/slowvote/controller/PhabricatorSlowvotePollController.php
@@ -122,13 +122,13 @@
$view->invokeWillRenderEvent();
- if (strlen($poll->getDescription())) {
- $view->addTextContent(
- $output = PhabricatorMarkupEngine::renderOneObject(
- id(new PhabricatorMarkupOneOff())->setContent(
- $poll->getDescription()),
- 'default',
- $viewer));
+ $description = $poll->getDescription();
+ if (strlen($description)) {
+ $description = new PHUIRemarkupView($viewer, $description);
+ $view->addSectionHeader(
+ pht('Description'),
+ PHUIPropertyListView::ICON_SUMMARY);
+ $view->addTextContent($description);
}
return $view;
diff --git a/src/applications/slowvote/view/SlowvoteEmbedView.php b/src/applications/slowvote/view/SlowvoteEmbedView.php
--- a/src/applications/slowvote/view/SlowvoteEmbedView.php
+++ b/src/applications/slowvote/view/SlowvoteEmbedView.php
@@ -74,13 +74,9 @@
$header = id(new PHUIHeaderView())
->setHeader($link_to_slowvote);
- $description = null;
- if ($poll->getDescription()) {
- $description = PhabricatorMarkupEngine::renderOneObject(
- id(new PhabricatorMarkupOneOff())->setContent(
- $poll->getDescription()),
- 'default',
- $this->getUser());
+ $description = $poll->getDescription();
+ if (strlen($description)) {
+ $description = new PHUIRemarkupView($this->getUser(), $description);
$description = phutil_tag(
'div',
array(
diff --git a/src/applications/spaces/controller/PhabricatorSpacesViewController.php b/src/applications/spaces/controller/PhabricatorSpacesViewController.php
--- a/src/applications/spaces/controller/PhabricatorSpacesViewController.php
+++ b/src/applications/spaces/controller/PhabricatorSpacesViewController.php
@@ -83,15 +83,10 @@
$description = $space->getDescription();
if (strlen($description)) {
- $description = PhabricatorMarkupEngine::renderOneObject(
- id(new PhabricatorMarkupOneOff())->setContent($description),
- 'default',
- $viewer);
-
+ $description = new PHUIRemarkupView($viewer, $description);
$list->addSectionHeader(
pht('Description'),
PHUIPropertyListView::ICON_SUMMARY);
-
$list->addTextContent($description);
}
diff --git a/src/applications/transactions/controller/PhabricatorApplicationTransactionCommentRawController.php b/src/applications/transactions/controller/PhabricatorApplicationTransactionCommentRawController.php
--- a/src/applications/transactions/controller/PhabricatorApplicationTransactionCommentRawController.php
+++ b/src/applications/transactions/controller/PhabricatorApplicationTransactionCommentRawController.php
@@ -50,10 +50,7 @@
$details_text = pht(
'For full details, run `/bin/mail show-outbound --id %d`',
$source_id);
- $addendum = PhabricatorMarkupEngine::renderOneObject(
- id(new PhabricatorMarkupOneOff())->setContent($details_text),
- 'default',
- $viewer);
+ $addendum = new PHUIRemarkupView($viewer, $details_text);
}
}
}
diff --git a/src/applications/typeahead/controller/PhabricatorTypeaheadFunctionHelpController.php b/src/applications/typeahead/controller/PhabricatorTypeaheadFunctionHelpController.php
--- a/src/applications/typeahead/controller/PhabricatorTypeaheadFunctionHelpController.php
+++ b/src/applications/typeahead/controller/PhabricatorTypeaheadFunctionHelpController.php
@@ -121,11 +121,7 @@
}
$content = implode("\n\n", $content);
-
- $content_box = PhabricatorMarkupEngine::renderOneObject(
- id(new PhabricatorMarkupOneOff())->setContent($content),
- 'default',
- $viewer);
+ $content_box = new PHUIRemarkupView($viewer, $content);
$header = id(new PHUIHeaderView())
->setHeader($title);
diff --git a/src/applications/uiexample/examples/PhabricatorRemarkupUIExample.php b/src/applications/uiexample/examples/PhabricatorRemarkupUIExample.php
--- a/src/applications/uiexample/examples/PhabricatorRemarkupUIExample.php
+++ b/src/applications/uiexample/examples/PhabricatorRemarkupUIExample.php
@@ -40,10 +40,7 @@
EOCONTENT
);
- $remarkup = PhabricatorMarkupEngine::renderOneObject(
- id(new PhabricatorMarkupOneOff())->setContent($content),
- 'default',
- $viewer);
+ $remarkup = new PHUIRemarkupView($viewer, $content);
$frame = id(new PHUIBoxView())
->addPadding(PHUI::PADDING_LARGE)
diff --git a/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldRemarkup.php b/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldRemarkup.php
--- a/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldRemarkup.php
+++ b/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldRemarkup.php
@@ -39,12 +39,7 @@
// end of the world.
$viewer = $this->getViewer();
- return PhabricatorMarkupEngine::renderOneObject(
- id(new PhabricatorMarkupOneOff())
- ->setContent($value)
- ->setPReserveLinebreaks(true),
- 'default',
- $viewer);
+ return new PHUIRemarkupView($viewer, $value);
}
public function getApplicationTransactionTitle(
diff --git a/src/infrastructure/markup/view/PHUIRemarkupView.php b/src/infrastructure/markup/view/PHUIRemarkupView.php
--- a/src/infrastructure/markup/view/PHUIRemarkupView.php
+++ b/src/infrastructure/markup/view/PHUIRemarkupView.php
@@ -12,22 +12,41 @@
final class PHUIRemarkupView extends AphrontView {
private $corpus;
+ private $markupType;
+
+ const DOCUMENT = 'document';
public function __construct(PhabricatorUser $viewer, $corpus) {
$this->setUser($viewer);
$this->corpus = $corpus;
}
+ private function setMarkupType($type) {
+ $this->markupType($type);
+ return $this;
+ }
+
public function render() {
$viewer = $this->getUser();
$corpus = $this->corpus;
- return PhabricatorMarkupEngine::renderOneObject(
+ $content = PhabricatorMarkupEngine::renderOneObject(
id(new PhabricatorMarkupOneOff())
->setPreserveLinebreaks(true)
->setContent($corpus),
'default',
$viewer);
+
+ if ($this->markupType == self::DOCUMENT) {
+ return phutil_tag(
+ 'div',
+ array(
+ 'class' => 'phabricator-remarkup phui-document-view',
+ ),
+ $content);
+ }
+
+ return $content;
}
}
diff --git a/src/view/form/AphrontFormView.php b/src/view/form/AphrontFormView.php
--- a/src/view/form/AphrontFormView.php
+++ b/src/view/form/AphrontFormView.php
@@ -84,11 +84,7 @@
}
public function appendRemarkupInstructions($remarkup) {
- return $this->appendInstructions(
- PhabricatorMarkupEngine::renderOneObject(
- id(new PhabricatorMarkupOneOff())->setContent($remarkup),
- 'default',
- $this->getUser()));
+ return new PHUIRemarkupView($this->getUser(), $remarkup);
}
public function buildLayoutView() {
diff --git a/src/view/form/PHUIFormLayoutView.php b/src/view/form/PHUIFormLayoutView.php
--- a/src/view/form/PHUIFormLayoutView.php
+++ b/src/view/form/PHUIFormLayoutView.php
@@ -35,11 +35,10 @@
throw new PhutilInvalidStateException('setUser');
}
- return $this->appendInstructions(
- PhabricatorMarkupEngine::renderOneObject(
- id(new PhabricatorMarkupOneOff())->setContent($remarkup),
- 'default',
- $this->getUser()));
+ $viewer = $this->getUser();
+ $instructions = new PHUIRemarkupView($viewer, $remarkup);
+
+ return $this->appendInstructions($instructions);
}
public function render() {
diff --git a/src/view/form/PHUIFormPageView.php b/src/view/form/PHUIFormPageView.php
--- a/src/view/form/PHUIFormPageView.php
+++ b/src/view/form/PHUIFormPageView.php
@@ -74,11 +74,8 @@
}
public function addRemarkupInstructions($remarkup, $before = null) {
- return $this->addInstructions(
- PhabricatorMarkupEngine::renderOneObject(
- id(new PhabricatorMarkupOneOff())->setContent($remarkup),
- 'default',
- $this->getUser()), $before);
+ $remarkup = new PHUIRemarkupView($this->getUser(), $remarkup);
+ return $this->addInstructions($remarkup, $before);
}
public function addControl(AphrontFormControl $control) {

File Metadata

Mime Type
text/plain
Expires
Fri, Sep 20, 9:21 AM (14 h, 15 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6623159
Default Alt Text
D15281.id36869.diff (27 KB)

Event Timeline