Apple_Exporter\Components\Body::split_non_markdownable PHP Method

split_non_markdownable() private static method

Split the non markdownable content for processing.
private static split_non_markdownable ( string $html ) : array
$html string
return array
    private static function split_non_markdownable($html)
    {
        if (empty($html)) {
            return array();
        }
        preg_match('#<(img|video|audio|iframe).*?(?:>(.*?)</\\1>|/?>)#si', $html, $matches);
        if (!$matches) {
            return array(array('name' => 'p', 'value' => $html));
        }
        list($whole, $tag_name) = $matches;
        list($left, $right) = explode($whole, $html, 3);
        $para = array('name' => 'p', 'value' => self::clean_html($left . '</p>'));
        // If the paragraph is empty, just return the right-hand-side
        if ('<p></p>' == $para['value']) {
            return array_merge(array(array('name' => $tag_name, 'value' => $whole)), self::split_non_markdownable(self::clean_html('<p>' . $right)));
        }
        return array_merge(array($para, array('name' => $tag_name, 'value' => $whole)), self::split_non_markdownable(self::clean_html('<p>' . $right)));
    }