Apple_Exporter\Components\Body::node_matches PHP Method

node_matches() public static method

Look for node matches for this component.
public static node_matches ( DomNode $node ) : mixed
$node DomNode
return mixed
    public static function node_matches($node)
    {
        // We are only interested in p, ul and ol
        if (!in_array($node->nodeName, array('p', 'ul', 'ol'))) {
            return null;
        }
        // If the node is p, ul or ol AND it's empty, just ignore.
        if (empty($node->nodeValue)) {
            return null;
        }
        // There are several components which cannot be translated to markdown,
        // namely images, videos, audios and EWV. If these components are inside a
        // paragraph, split the paragraph.
        if ('p' == $node->nodeName) {
            $html = $node->ownerDocument->saveXML($node);
            return self::split_non_markdownable($html);
        }
        return $node;
    }