diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -2672,6 +2672,7 @@ 'PhabricatorConfigProxySource' => 'infrastructure/env/PhabricatorConfigProxySource.php', 'PhabricatorConfigPurgeCacheController' => 'applications/config/controller/PhabricatorConfigPurgeCacheController.php', 'PhabricatorConfigRegexOptionType' => 'applications/config/custom/PhabricatorConfigRegexOptionType.php', + 'PhabricatorConfigRemarkupRule' => 'infrastructure/markup/rule/PhabricatorConfigRemarkupRule.php', 'PhabricatorConfigRequestExceptionHandlerModule' => 'applications/config/module/PhabricatorConfigRequestExceptionHandlerModule.php', 'PhabricatorConfigResponse' => 'applications/config/response/PhabricatorConfigResponse.php', 'PhabricatorConfigSchemaQuery' => 'applications/config/schema/PhabricatorConfigSchemaQuery.php', @@ -8409,6 +8410,7 @@ 'PhabricatorConfigProxySource' => 'PhabricatorConfigSource', 'PhabricatorConfigPurgeCacheController' => 'PhabricatorConfigController', 'PhabricatorConfigRegexOptionType' => 'PhabricatorConfigJSONOptionType', + 'PhabricatorConfigRemarkupRule' => 'PhutilRemarkupRule', 'PhabricatorConfigRequestExceptionHandlerModule' => 'PhabricatorConfigModule', 'PhabricatorConfigResponse' => 'AphrontStandaloneHTMLResponse', 'PhabricatorConfigSchemaQuery' => 'Phobject', diff --git a/src/applications/config/option/PhabricatorAuthenticationConfigOptions.php b/src/applications/config/option/PhabricatorAuthenticationConfigOptions.php --- a/src/applications/config/option/PhabricatorAuthenticationConfigOptions.php +++ b/src/applications/config/option/PhabricatorAuthenticationConfigOptions.php @@ -33,7 +33,7 @@ pht( 'If true, email addresses must be verified (by clicking a link '. 'in an email) before a user can login. By default, verification '. - 'is optional unless {{auth.email-domains}} is nonempty.')), + 'is optional unless @{config:auth.email-domains} is nonempty.')), $this->newOption('auth.require-approval', 'bool', true) ->setBoolOptions( array( @@ -55,7 +55,7 @@ "registration, you can disable the queue to reduce administrative ". "overhead.\n\n". "NOTE: Before you disable the queue, make sure ". - "{{auth.email-domains}} is configured correctly ". + "@{config:auth.email-domains} is configured correctly ". "for your install!")), $this->newOption('auth.email-domains', 'list', array()) ->setSummary(pht('Only allow registration from particular domains.')) @@ -66,7 +66,7 @@ "here.\n\nUsers will only be allowed to register using email ". "addresses at one of the domains, and will only be able to add ". "new email addresses for these domains. If you configure this, ". - "it implies {{auth.require-email-verification}}.\n\n". + "it implies @{config:auth.require-email-verification}.\n\n". "You should omit the `@` from domains. Note that the domain must ". "match exactly. If you allow `yourcompany.com`, that permits ". "`joe@yourcompany.com` but rejects `joe@mail.yourcompany.com`.")) diff --git a/src/applications/config/option/PhabricatorConfigOption.php b/src/applications/config/option/PhabricatorConfigOption.php --- a/src/applications/config/option/PhabricatorConfigOption.php +++ b/src/applications/config/option/PhabricatorConfigOption.php @@ -209,12 +209,6 @@ return null; } - // TODO: Some day, we should probably implement this as a real rule. - $description = preg_replace( - '/{{([^}]+)}}/', - '[[/config/edit/\\1/ | \\1]]', - $description); - return new PHUIRemarkupView($viewer, $description); } diff --git a/src/infrastructure/markup/PhabricatorMarkupEngine.php b/src/infrastructure/markup/PhabricatorMarkupEngine.php --- a/src/infrastructure/markup/PhabricatorMarkupEngine.php +++ b/src/infrastructure/markup/PhabricatorMarkupEngine.php @@ -510,6 +510,7 @@ $rules[] = new PhutilRemarkupDocumentLinkRule(); $rules[] = new PhabricatorNavigationRemarkupRule(); $rules[] = new PhabricatorKeyboardRemarkupRule(); + $rules[] = new PhabricatorConfigRemarkupRule(); if ($options['youtube']) { $rules[] = new PhabricatorYoutubeRemarkupRule(); diff --git a/src/infrastructure/markup/rule/PhabricatorConfigRemarkupRule.php b/src/infrastructure/markup/rule/PhabricatorConfigRemarkupRule.php new file mode 100644 --- /dev/null +++ b/src/infrastructure/markup/rule/PhabricatorConfigRemarkupRule.php @@ -0,0 +1,50 @@ +getPriority() - 1; + } + + public function markupConfig(array $matches) { + if (!$this->isFlatText($matches[0])) { + return $matches[0]; + } + + $config_key = $matches[1]; + + try { + $option = PhabricatorEnv::getEnvConfig($config_key); + } catch (Exception $ex) { + return $matches[0]; + } + + $is_text = $this->getEngine()->isTextMode(); + $is_html_mail = $this->getEngine()->isHTMLMailMode(); + + if ($is_text || $is_html_mail) { + return pht('"%s"', $config_key); + } + + $link = phutil_tag( + 'a', + array( + 'href' => urisprintf('/config/edit/%s/', $config_key), + 'target' => '_blank', + ), + $config_key); + + return $this->getEngine()->storeText($link); + } + +}