diff --git a/src/markup/engine/__tests__/remarkup/table-with-direct-content.txt b/src/markup/engine/__tests__/remarkup/table-with-direct-content.txt new file mode 100644 --- /dev/null +++ b/src/markup/engine/__tests__/remarkup/table-with-direct-content.txt @@ -0,0 +1,5 @@ +quack
+~~~~~~~~~~ +<table>quack</table> +~~~~~~~~~~ +quack
diff --git a/src/markup/engine/remarkup/blockrule/PhutilRemarkupTableBlockRule.php b/src/markup/engine/remarkup/blockrule/PhutilRemarkupTableBlockRule.php --- a/src/markup/engine/remarkup/blockrule/PhutilRemarkupTableBlockRule.php +++ b/src/markup/engine/remarkup/blockrule/PhutilRemarkupTableBlockRule.php @@ -53,7 +53,11 @@ } } - return phutil_implode_html('', $out); + if ($this->getEngine()->isTextMode()) { + return implode('', $out); + } else { + return phutil_implode_html('', $out); + } } private function newTable(PhutilDOMNode $table) { @@ -117,7 +121,7 @@ return $table->newRawString(); } - $content = $cell->getRawContentString(); + $content = $cell->newRawContentString(); $content = $this->applyRules($content); $cell_specs[] = array( diff --git a/src/parser/html/PhutilDOMNode.php b/src/parser/html/PhutilDOMNode.php --- a/src/parser/html/PhutilDOMNode.php +++ b/src/parser/html/PhutilDOMNode.php @@ -65,12 +65,12 @@ return $this; } - public function getRawString() { + public function newRawString() { $raw = array(); $raw[] = $this->rawHead; foreach ($this->getChildren() as $child) { - $raw[] = $child->getRawString(); + $raw[] = $child->newRawString(); } $raw[] = $this->rawTail; @@ -124,7 +124,7 @@ // Otherwise, this is some other tag. Convert it into a content // node. - $raw_string = $child->getRawString(); + $raw_string = $child->newRawString(); $nodes[] = id(new self()) ->setContent($raw_string) @@ -134,14 +134,14 @@ return $this->mergeContentNodes($nodes); } - public function getRawContentString() { + public function newRawContentString() { $content_node = $this->selectChildrenWithTags(array()); if (!$content_node) { return ''; } - return head($content_node)->getRawString(); + return head($content_node)->newRawString(); } public function mergeContent() { @@ -189,7 +189,7 @@ $parts = array(); foreach ($item as $content_node) { - $parts[] = $content_node->getRawString(); + $parts[] = $content_node->newRawString(); } $parts = implode('', $parts);