parsedown\Parsedown::compile PHP Method

compile() private method

private compile ( array $blocks )
$blocks array
    private function compile(array $blocks)
    {
        $markup = '';
        foreach ($blocks as $block) {
            $markup .= "\n";
            if (isset($block['name'])) {
                $markup .= '<' . $block['name'];
                if (isset($block['attributes'])) {
                    foreach ($block['attributes'] as $name => $value) {
                        $markup .= ' ' . $name . '="' . $value . '"';
                    }
                }
                if ($block['content'] === null) {
                    $markup .= ' />';
                    continue;
                } else {
                    $markup .= '>';
                }
            }
            switch ($block['content type']) {
                case null:
                    $markup .= $block['content'];
                    break;
                case 'line':
                    $markup .= $this->parseLine($block['content']);
                    break;
                case 'lines':
                    $result = $this->findBlocks($block['content'], $block['name']);
                    if (is_string($result)) {
                        $markup .= $this->parseLine($result);
                        break;
                    }
                    $markup .= $this->compile($result);
                    break;
                case 'blocks':
                    $markup .= $this->compile($block['content']);
                    break;
            }
            if (isset($block['name'])) {
                $markup .= '</' . $block['name'] . '>';
            }
        }
        $markup .= "\n";
        return $markup;
    }