1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-26 00:32:42 +01:00

Respect linebreaks in full HTML tables in Remarkup

Summary:
Fixes T5427. See PHI1630. See also T13160 and D20568.

In the full HTML table syntax with "<table>", respect linebreaks as literals inside "<td>" cells.

Test Plan: Previewed some full-HTML tables with and without linebreaks, saw what seemed like sensible rendering behavior.

Maniphest Tasks: T5427

Differential Revision: https://secure.phabricator.com/D20971
This commit is contained in:
epriestley 2020-02-06 14:48:08 -08:00
parent 9d1af762d5
commit 2327578adc

View file

@ -121,8 +121,19 @@ final class PhutilRemarkupTableBlockRule extends PhutilRemarkupBlockRule {
return $table->newRawString(); return $table->newRawString();
} }
// Respect newlines in table cells as literal linebreaks.
$content = $cell->newRawContentString(); $content = $cell->newRawContentString();
$content = $this->applyRules($content); $content = trim($content, "\r\n");
$lines = phutil_split_lines($content, $retain_endings = false);
foreach ($lines as $key => $line) {
$lines[$key] = $this->applyRules($line);
}
$content = phutil_implode_html(
phutil_tag('br'),
$lines);
$cell_specs[] = array( $cell_specs[] = array(
'type' => $cell->getTagName(), 'type' => $cell->getTagName(),