@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.

Order readme files based on how well we can get the markup right.

Summary:
Handling readmes with no extension is a bit of a hack, but seemed like a small cost.

The Big Win here is that you can commit README.remarkup and README.md and have both Phabricator and GitHub render __with__ //all// ##the## ~~pretty~~ **markup**.

Test Plan: Looked at some readme files.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

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

authored by

Asher Baker and committed by
epriestley
556bca30 c006cca9

+28 -3
+28 -3
src/applications/diffusion/conduit/DiffusionReadmeQueryConduitAPIMethod.php
··· 32 32 $paths[] = DiffusionRepositoryPath::newFromDictionary($dict); 33 33 } 34 34 35 + $best = -1; 35 36 $readme = ''; 36 37 foreach ($paths as $result_path) { 37 38 $file_type = $result_path->getFileType(); ··· 41 42 continue; 42 43 } 43 44 44 - $path = $result_path->getPath(); 45 + $path = strtolower($result_path->getPath()); 46 + 47 + if ($path === 'readme') { 48 + $path .= '.txt'; 49 + } 50 + 51 + if (strncmp($path, 'readme.', 7) !== 0) { 52 + continue; 53 + } 54 + 55 + $priority = 0; 56 + switch (substr($path, 7)) { 57 + case 'remarkup': 58 + $priority = 100; 59 + break; 60 + case 'rainbow': 61 + $priority = 90; 62 + break; 63 + case 'md': 64 + $priority = 50; 65 + break; 66 + case 'txt': 67 + $priority = 10; 68 + break; 69 + } 45 70 46 - if (preg_match('/^readme(|\.txt|\.remarkup|\.rainbow|\.md)$/i', $path)) { 71 + if ($priority > $best) { 72 + $best = $priority; 47 73 $readme = $result_path; 48 - break; 49 74 } 50 75 } 51 76