Page MenuHomePhabricator

D7479.id16857.diff
No OneTemporary

D7479.id16857.diff

Index: src/__phutil_library_map__.php
===================================================================
--- src/__phutil_library_map__.php
+++ src/__phutil_library_map__.php
@@ -226,6 +226,7 @@
'ConduitAPI_releephwork_record_Method' => 'applications/releeph/conduit/work/ConduitAPI_releephwork_record_Method.php',
'ConduitAPI_releephwork_recordpickstatus_Method' => 'applications/releeph/conduit/work/ConduitAPI_releephwork_recordpickstatus_Method.php',
'ConduitAPI_remarkup_process_Method' => 'applications/remarkup/conduit/ConduitAPI_remarkup_process_Method.php',
+ 'ConduitAPI_remarkup_processbulk_Method' => 'applications/remarkup/conduit/ConduitAPI_remarkup_processbulk_Method.php',
'ConduitAPI_repository_Method' => 'applications/repository/conduit/ConduitAPI_repository_Method.php',
'ConduitAPI_repository_create_Method' => 'applications/repository/conduit/ConduitAPI_repository_create_Method.php',
'ConduitAPI_repository_query_Method' => 'applications/repository/conduit/ConduitAPI_repository_query_Method.php',
@@ -2440,6 +2441,7 @@
'ConduitAPI_releephwork_record_Method' => 'ConduitAPI_releeph_Method',
'ConduitAPI_releephwork_recordpickstatus_Method' => 'ConduitAPI_releeph_Method',
'ConduitAPI_remarkup_process_Method' => 'ConduitAPIMethod',
+ 'ConduitAPI_remarkup_processbulk_Method' => 'ConduitAPIMethod',
'ConduitAPI_repository_Method' => 'ConduitAPIMethod',
'ConduitAPI_repository_create_Method' => 'ConduitAPI_repository_Method',
'ConduitAPI_repository_query_Method' => 'ConduitAPI_repository_Method',
Index: src/applications/remarkup/conduit/ConduitAPI_remarkup_process_Method.php
===================================================================
--- src/applications/remarkup/conduit/ConduitAPI_remarkup_process_Method.php
+++ src/applications/remarkup/conduit/ConduitAPI_remarkup_process_Method.php
@@ -62,6 +62,9 @@
'phriction' => 'newPhrictionMarkupEngine',
'maniphest' => 'newManiphestMarkupEngine',
'differential' => 'newDifferentialMarkupEngine',
+ 'phame' => 'newPhameMarkupEngine',
+ 'feed' => 'newFeedMarkupEngine',
+ 'diffusion' => 'newDiffusionMarkupEngine',
);
}
}
Index: src/applications/remarkup/conduit/ConduitAPI_remarkup_processbulk_Method.php
===================================================================
--- src/applications/remarkup/conduit/ConduitAPI_remarkup_processbulk_Method.php
+++ src/applications/remarkup/conduit/ConduitAPI_remarkup_processbulk_Method.php
@@ -1,13 +1,13 @@
<?php
-final class ConduitAPI_remarkup_process_Method extends ConduitAPIMethod {
+final class ConduitAPI_remarkup_processbulk_Method extends ConduitAPIMethod {
public function getMethodStatus() {
return self::METHOD_STATUS_UNSTABLE;
}
public function getMethodDescription() {
- return 'Process text through remarkup in phabricator context.';
+ return 'Bulk process text through remarkup in phabricator context.';
}
public function defineReturnType() {
@@ -27,12 +27,12 @@
return array(
'context' => 'required enum<'.$available_contexts.'>',
- 'content' => 'required string',
+ 'contents' => 'required list<string>',
);
}
protected function execute(ConduitAPIRequest $request) {
- $content = $request->getValue('content');
+ $contents = $request->getValue('contents');
$context = $request->getValue('context');
$engine_class = idx($this->getEngineContexts(), $context);
@@ -43,18 +43,19 @@
$engine = PhabricatorMarkupEngine::$engine_class();
$engine->setConfig('viewer', $request->getUser());
- $text = $engine->markupText($content);
- if ($text) {
- $content = hsprintf('%s', $text)->getHTMLContent();
- } else {
- $content = '';
+ $results = array();
+ foreach ($contents as $content) {
+ $text = $engine->markupText($content);
+ if ($text) {
+ $content = hsprintf('%s', $text)->getHTMLContent();
+ } else {
+ $content = '';
+ }
+ $results[] = array(
+ 'content' => $content,
+ );
}
-
- $result = array(
- 'content' => $content,
- );
-
- return $result;
+ return $results;
}
private function getEngineContexts() {
@@ -62,6 +63,9 @@
'phriction' => 'newPhrictionMarkupEngine',
'maniphest' => 'newManiphestMarkupEngine',
'differential' => 'newDifferentialMarkupEngine',
+ 'phame' => 'newPhameMarkupEngine',
+ 'feed' => 'newFeedMarkupEngine',
+ 'diffusion' => 'newDiffusionMarkupEngine',
);
}
}

File Metadata

Mime Type
text/plain
Expires
Fri, Nov 8, 9:37 AM (1 w, 5 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6753135
Default Alt Text
D7479.id16857.diff (4 KB)

Event Timeline