Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15529570
D18140.id43646.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D18140.id43646.diff
View Options
diff --git a/src/markup/engine/__tests__/remarkup/simple-table-with-empty-row.txt b/src/markup/engine/__tests__/remarkup/simple-table-with-empty-row.txt
new file mode 100644
--- /dev/null
+++ b/src/markup/engine/__tests__/remarkup/simple-table-with-empty-row.txt
@@ -0,0 +1,13 @@
+| Alpaca |
+| |
+| Zebra |
+~~~~~~~~~~
+<div class="remarkup-table-wrap"><table class="remarkup-table">
+<tr><td>Alpaca</td></tr>
+<tr><td></td></tr>
+<tr><td>Zebra</td></tr>
+</table></div>
+~~~~~~~~~~
+| Alpaca |
+| |
+| Zebra |
diff --git a/src/markup/engine/remarkup/blockrule/PhutilRemarkupSimpleTableBlockRule.php b/src/markup/engine/remarkup/blockrule/PhutilRemarkupSimpleTableBlockRule.php
--- a/src/markup/engine/remarkup/blockrule/PhutilRemarkupSimpleTableBlockRule.php
+++ b/src/markup/engine/remarkup/blockrule/PhutilRemarkupSimpleTableBlockRule.php
@@ -39,19 +39,35 @@
')*'.
')/', $line, $matches);
- $headings = true;
+ $any_header = false;
+ $any_content = false;
+
$cells = array();
foreach ($matches[1] as $cell) {
$cell = trim($cell);
- // Cell isn't empty and doesn't look like heading.
- if (!preg_match('/^(|--+)$/', $cell)) {
- $headings = false;
+ // If this row only has empty cells and "--" cells, and it has at
+ // least one "--" cell, it's marking the rows above as <th> cells
+ // instead of <td> cells.
+
+ // If it has other types of cells, it's always a content row.
+
+ // If it has only empty cells, it's an empty row.
+
+ if (strlen($cell)) {
+ if (preg_match('/^--+\z/', $cell)) {
+ $any_header = true;
+ } else {
+ $any_content = true;
+ }
}
+
$cells[] = array('type' => 'td', 'content' => $this->applyRules($cell));
}
- if (!$headings) {
+ $is_header = ($any_header && !$any_content);
+
+ if (!$is_header) {
$rows[] = array('type' => 'tr', 'content' => $cells);
} else if ($rows) {
// Mark previous row with headings.
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Apr 23, 8:54 PM (19 h, 48 m ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7373712
Default Alt Text
D18140.id43646.diff (2 KB)
Attached To
Mode
D18140: Make empty Remarkup table rows have more intuitive behavior
Attached
Detach File
Event Timeline
Log In to Comment