diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 6f7600a393..cb18b1eb1a 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -145,6 +145,7 @@ phutil_register_library_map(array( 'ConduitAPI_phriction_info_Method' => 'applications/conduit/method/phriction/info', 'ConduitAPI_project_Method' => 'applications/conduit/method/project/base', 'ConduitAPI_project_query_Method' => 'applications/conduit/method/project/query', + 'ConduitAPI_remarkup_process_Method' => 'applications/conduit/method/remarkup/process', 'ConduitAPI_slowvote_info_Method' => 'applications/conduit/method/slowvote/info', 'ConduitAPI_user_Method' => 'applications/conduit/method/user/base', 'ConduitAPI_user_find_Method' => 'applications/conduit/method/user/find', @@ -949,6 +950,7 @@ phutil_register_library_map(array( 'ConduitAPI_phriction_info_Method' => 'ConduitAPI_phriction_Method', 'ConduitAPI_project_Method' => 'ConduitAPIMethod', 'ConduitAPI_project_query_Method' => 'ConduitAPI_project_Method', + 'ConduitAPI_remarkup_process_Method' => 'ConduitAPIMethod', 'ConduitAPI_slowvote_info_Method' => 'ConduitAPIMethod', 'ConduitAPI_user_Method' => 'ConduitAPIMethod', 'ConduitAPI_user_find_Method' => 'ConduitAPI_user_Method', @@ -1040,6 +1042,7 @@ phutil_register_library_map(array( 'DiffusionContainsQuery' => 'DiffusionQuery', 'DiffusionController' => 'PhabricatorController', 'DiffusionDiffController' => 'DiffusionController', + 'DiffusionEmptyResultView' => 'DiffusionView', 'DiffusionGitBranchQuery' => 'DiffusionBranchQuery', 'DiffusionGitBranchQueryTestCase' => 'PhabricatorTestCase', 'DiffusionGitBrowseQuery' => 'DiffusionBrowseQuery', diff --git a/src/applications/conduit/method/remarkup/process/ConduitAPI_remarkup_process_Method.php b/src/applications/conduit/method/remarkup/process/ConduitAPI_remarkup_process_Method.php new file mode 100644 index 0000000000..fffb153fa4 --- /dev/null +++ b/src/applications/conduit/method/remarkup/process/ConduitAPI_remarkup_process_Method.php @@ -0,0 +1,71 @@ + 'Content may not be empty.', + 'ERR-INVALID-ENGINE' => 'Invalid markup engine.', + ); + } + + public function defineParamTypes() { + $available_contexts = array_keys($this->getEngineContexts()); + $available_contexts = implode(', ', $available_contexts); + + return array( + 'context' => 'required enum<'.$available_contexts.'>', + 'content' => 'required string', + ); + } + + protected function execute(ConduitAPIRequest $request) { + $content = $request->getValue('content'); + $context = $request->getValue('context'); + + $engine_class = idx($this->getEngineContexts(), $context); + if (!$engine_class) { + throw new ConduitException('ERR-INVALID_ENGINE'); + } + + $engine = PhabricatorMarkupEngine::$engine_class(); + + $result = array( + 'content' => $engine->markupText($content), + ); + + return $result; + } + + private function getEngineContexts() { + return array( + 'phriction' => 'newPhrictionMarkupEngine', + 'maniphest' => 'newManiphestMarkupEngine', + 'differential' => 'newDifferentialMarkupEngine', + ); + } +} diff --git a/src/applications/conduit/method/remarkup/process/__init__.php b/src/applications/conduit/method/remarkup/process/__init__.php new file mode 100644 index 0000000000..b8e3bdb69b --- /dev/null +++ b/src/applications/conduit/method/remarkup/process/__init__.php @@ -0,0 +1,16 @@ +