@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Implement text mode for Phabricator Remarkup rules

Test Plan:
lang=remarkup
D1
{D1}
{C1}
{F1}
[[ Test ]]
iiam
{meme, src=iiam, above="I\'m not always", below="But I am"}
@{function:pht}
@vrana

Reviewers: epriestley, edward

Reviewed By: epriestley

CC: aran, Korvin

Maniphest Tasks: T2617

Differential Revision: https://secure.phabricator.com/D5392

+73 -15
+11 -1
src/applications/countdown/remarkup/PhabricatorCountdownRemarkupRule.php
··· 19 19 if (!$countdown) { 20 20 return $matches[0]; 21 21 } 22 - $id = celerity_generate_unique_node_id(); 23 22 24 23 $engine = $this->getEngine(); 24 + 25 + if ($engine->isTextMode()) { 26 + $date = $countdown->getDatepoint(); 27 + $viewer = $engine->getConfig('viewer'); 28 + if ($viewer) { 29 + $date = phabricator_datetime($date, $viewer); 30 + } 31 + return $engine->storeText($date); 32 + } 33 + 34 + $id = celerity_generate_unique_node_id(); 25 35 $token = $engine->storeText(''); 26 36 27 37 $metadata_key = self::KEY_RULE_COUNTDOWN;
+8 -2
src/applications/diviner/markup/DivinerRemarkupRuleSymbol.php
··· 100 100 $href = $renderer->getHrefForAtomRef($ref); 101 101 } 102 102 } else { 103 - // Here, we're generating commment text or something like that. Just 103 + // Here, we're generating comment text or something like that. Just 104 104 // link to Diviner and let it sort things out. 105 105 106 106 $href = id(new PhutilURI('/diviner/find/')) 107 107 ->setQueryParams($ref_dict + array('jump' => true)); 108 108 } 109 109 110 - if ($href) { 110 + if ($this->getEngine()->isTextMode()) { 111 + if ($href) { 112 + $link = $title.' <'.PhabricatorEnv::getProductionURI($href).'>'; 113 + } else { 114 + $link = $title; 115 + } 116 + } else if ($href) { 111 117 $link = phutil_tag( 112 118 'a', 113 119 array(
+7 -1
src/applications/files/remarkup/PhabricatorRemarkupRuleEmbedFile.php
··· 27 27 if (!$file) { 28 28 return $matches[0]; 29 29 } 30 - $phid = $file->getPHID(); 31 30 32 31 $engine = $this->getEngine(); 32 + 33 + if ($engine->isTextMode()) { 34 + return $engine->storeText($file->getBestURI()); 35 + } 36 + 37 + $phid = $file->getPHID(); 38 + 33 39 $token = $engine->storeText(''); 34 40 $metadata_key = self::KEY_RULE_EMBED_FILE; 35 41 $metadata = $engine->getTextMetadata($metadata_key, array());
+8
src/applications/macro/remarkup/PhabricatorRemarkupRuleImageMacro.php
··· 35 35 $phid = $this->images[$name]; 36 36 37 37 $file = id(new PhabricatorFile())->loadOneWhere('phid = %s', $phid); 38 + 39 + if ($this->getEngine()->isTextMode()) { 40 + if ($file) { 41 + $name .= ' <'.$file->getBestURI().'>'; 42 + } 43 + return $this->getEngine()->storeText($name); 44 + } 45 + 38 46 $style = null; 39 47 $src_uri = null; 40 48 if ($file) {
+12 -5
src/applications/macro/remarkup/PhabricatorRemarkupRuleMeme.php
··· 30 30 ->alter('uppertext', $options['above']) 31 31 ->alter('lowertext', $options['below']); 32 32 33 - $img = phutil_tag( 34 - 'img', 35 - array( 36 - 'src' => (string)$uri, 37 - )); 33 + if ($this->getEngine()->isTextMode()) { 34 + $img = 35 + ($options['above'] != '' ? "\"{$options['above']}\"\n" : ''). 36 + $options['src'].' <'.PhabricatorEnv::getProductionURI($uri).'>'. 37 + ($options['below'] != '' ? "\n\"{$options['below']}\"" : ''); 38 + } else { 39 + $img = phutil_tag( 40 + 'img', 41 + array( 42 + 'src' => (string)$uri, 43 + )); 44 + } 38 45 39 46 return $this->getEngine()->storeText($img); 40 47 }
+5
src/applications/people/remarkup/PhabricatorRemarkupRuleMention.php
··· 29 29 30 30 protected function markupMention($matches) { 31 31 $engine = $this->getEngine(); 32 + 33 + if ($engine->isTextMode()) { 34 + return $engine->storeText($matches[0]); 35 + } 36 + 32 37 $token = $engine->storeText(''); 33 38 34 39 // Store the original text exactly so we can preserve casing if it doesn't
+8 -6
src/applications/phriction/remarkup/PhrictionRemarkupRule.php
··· 29 29 30 30 if ($this->getEngine()->getState('toc')) { 31 31 $text = $name; 32 + } else if ($this->getEngine()->isTextMode()) { 33 + return PhabricatorEnv::getProductionURI($href); 32 34 } else { 33 35 $text = phutil_tag( 34 - 'a', 35 - array( 36 - 'href' => $href, 37 - 'class' => 'phriction-link', 38 - ), 39 - $name); 36 + 'a', 37 + array( 38 + 'href' => $href, 39 + 'class' => 'phriction-link', 40 + ), 41 + $name); 40 42 } 41 43 42 44 return $this->getEngine()->storeText($text);
+9
src/infrastructure/markup/rule/PhabricatorRemarkupRuleObject.php
··· 50 50 } 51 51 } 52 52 53 + if ($this->getEngine()->isTextMode()) { 54 + return PhabricatorEnv::getProductionURI($href); 55 + } 56 + 53 57 $status_closed = PhabricatorObjectHandleStatus::STATUS_CLOSED; 54 58 55 59 $attr = array( ··· 63 67 protected function renderObjectEmbed($object, $handle, $options) { 64 68 $name = $handle->getFullName(); 65 69 $href = $handle->getURI(); 70 + 71 + if ($this->getEngine()->isTextMode()) { 72 + return $name.' <'.PhabricatorEnv::getProductionURI($href).'>'; 73 + } 74 + 66 75 $attr = array( 67 76 'phid' => $handle->getPHID(), 68 77 );
+5
src/infrastructure/markup/rule/PhabricatorRemarkupRuleYoutube.php
··· 20 20 21 21 public function markupYoutubeLink() { 22 22 $v = idx($this->uri->getQueryParams(), 'v'); 23 + 24 + if ($this->getEngine()->isTextMode()) { 25 + return $this->getEngine()->storeText('http://youtu.be/'.$v); 26 + } 27 + 23 28 $youtube_src = 'https://www.youtube.com/embed/'.$v; 24 29 $iframe = hsprintf( 25 30 '<div class="embedded-youtube-video">%s</div>',