mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-13 10:22:42 +01:00
ef85f49adc
Summary: This commit doesn't change license of any file. It just makes the license implicit (inherited from LICENSE file in the root directory). We are removing the headers for these reasons: - It wastes space in editors, less code is visible in editor upon opening a file. - It brings noise to diff of the first change of any file every year. - It confuses Git file copy detection when creating small files. - We don't have an explicit license header in other files (JS, CSS, images, documentation). - Using license header in every file is not obligatory: http://www.apache.org/dev/apply-license.html#new. This change is approved by Alma Chao (Lead Open Source and IP Counsel at Facebook). Test Plan: Verified that the license survived only in LICENSE file and that it didn't modify externals. Reviewers: epriestley, davidrecordon Reviewed By: epriestley CC: aran, Korvin Maniphest Tasks: T2035 Differential Revision: https://secure.phabricator.com/D3886
87 lines
2.5 KiB
PHP
87 lines
2.5 KiB
PHP
<?php
|
|
|
|
/**
|
|
* An object which has one or more fields containing markup that can be
|
|
* rendered into a display format. Commonly, the fields contain Remarkup and
|
|
* are rendered into HTML. Implementing this interface allows you to render
|
|
* objects through @{class:PhabricatorMarkupEngine} and benefit from caching
|
|
* and pipelining infrastructure.
|
|
*
|
|
* An object may have several "fields" of markup. For example, Differential
|
|
* revisions have a "summary" and a "test plan". In these cases, the `$field`
|
|
* parameter is used to identify which field is being operated on. For simple
|
|
* objects like comments, you might only have one field (say, "body"). In
|
|
* these cases, the implementation can largely ignore the `$field` parameter.
|
|
*
|
|
* @task markup Markup Interface
|
|
*
|
|
* @group markup
|
|
*/
|
|
interface PhabricatorMarkupInterface {
|
|
|
|
|
|
/* -( Markup Interface )--------------------------------------------------- */
|
|
|
|
|
|
/**
|
|
* Get a key to identify this field. This should uniquely identify the block
|
|
* of text to be rendered and be usable as a cache key. If the object has a
|
|
* PHID, using the PHID and the field name is likley reasonable:
|
|
*
|
|
* "{$phid}:{$field}"
|
|
*
|
|
* @param string Field name.
|
|
* @return string Cache key up to 125 characters.
|
|
*
|
|
* @task markup
|
|
*/
|
|
public function getMarkupFieldKey($field);
|
|
|
|
|
|
/**
|
|
* Build the engine the field should use.
|
|
*
|
|
* @param string Field name.
|
|
* @return PhutilRemarkupEngine Markup engine to use.
|
|
* @task markup
|
|
*/
|
|
public function newMarkupEngine($field);
|
|
|
|
|
|
/**
|
|
* Return the contents of the specified field.
|
|
*
|
|
* @param string Field name.
|
|
* @return string The raw markup contained in the field.
|
|
* @task markup
|
|
*/
|
|
public function getMarkupText($field);
|
|
|
|
|
|
/**
|
|
* Callback for final postprocessing of output. Normally, you can return
|
|
* the output unmodified.
|
|
*
|
|
* @param string Field name.
|
|
* @param string The finalized output of the engine.
|
|
* @param string The engine which generated the output.
|
|
* @return string Final output.
|
|
* @task markup
|
|
*/
|
|
public function didMarkupText(
|
|
$field,
|
|
$output,
|
|
PhutilMarkupEngine $engine);
|
|
|
|
|
|
/**
|
|
* Determine if the engine should try to use the markup cache or not.
|
|
* Generally you should use the cache for durable/permanent content but
|
|
* should not use the cache for temporary/draft content.
|
|
*
|
|
* @return bool True to use the markup cache.
|
|
* @task markup
|
|
*/
|
|
public function shouldUseMarkupCache($field);
|
|
|
|
}
|