public function render($text)
    {
        $text = $this->config->onStart($text);

        $linesIterator = new \ArrayIterator(preg_split("/\015\012|\015|\012/", $text)); // we split the text at all line feeds
        $this->documentGenerator->clear();
        $this->errors = array();

        while ($linesIterator->valid()) {
            $line = $linesIterator->current();
            if ($line != '') {
                $blockGen = $this->parseBlock($linesIterator, $line, null);
                if (is_object($blockGen)) {
                    $this->documentGenerator->addBlock($blockGen);
                    continue;
                }
            }
            // no block found, we use a default block
            if (trim($line) == '') {
                $blockGenerator = new Generator\SingleLineBlock($this->documentGenerator->getConfig());
            } else {
                $inline = $this->inlineParser->parse($line);
                $blockGenerator = $this->documentGenerator->getDefaultBlock($inline);
                if (!$blockGenerator) {
                    $blockGenerator = new Generator\SingleLineBlock($this->documentGenerator->getConfig());
                    $blockGenerator->setLineAsString($inline);
                }
            }
            $this->documentGenerator->addBlock($blockGenerator);
            $this->nextLine($linesIterator);
        }

        $result = $this->documentGenerator->generate();

        if ($this->documentGenerator->getConfig()->generateHeaderFooter) {
            $result = $this->documentGenerator->generateHeader()
                     .$result
                     .$this->documentGenerator->generateFooter();
        }

        return $this->config->onParse($result);
    }
public function render($text)
    {
        $text = $this->config->onStart($text);

        $linesIterator = new \ArrayIterator(preg_split("/\015\012|\015|\012/", $text)); // we split the text at all line feeds
        $this->documentGenerator->clear();
        $this->errors = array();

        while ($linesIterator->valid()) {
            $line = $linesIterator->current();
            if ($line != '') {
                $blockGen = $this->parseBlock($linesIterator, $line, null);
                if (is_object($blockGen)) {
                    $this->documentGenerator->addBlock($blockGen);
                    continue;
                }
            }
            // no block found, we use a default block
            if (trim($line) == '') {
                $blockGenerator = new Generator\SingleLineBlock($this->documentGenerator->getConfig());
            } else {
                $inline = $this->inlineParser->parse($line);
                $blockGenerator = $this->documentGenerator->getDefaultBlock($inline);
                if (!$blockGenerator) {
                    $blockGenerator = new Generator\SingleLineBlock($this->documentGenerator->getConfig());
                    $blockGenerator->setLineAsString($inline);
                }
            }
            $this->documentGenerator->addBlock($blockGenerator);
            $this->nextLine($linesIterator);
        }

        $result = $this->documentGenerator->generate();

        if ($this->documentGenerator->getConfig()->generateHeaderFooter) {
            $result = $this->documentGenerator->generateHeader()
                     .$result
                     .$this->documentGenerator->generateFooter();
        }

        return $this->config->onParse($result);
    }
public function render ( $ text ) { $ text = $ this -> config -> onStart ( $ text ) ; $ linesIterator = new \ ArrayIterator ( preg_split ( "/\015\012|\015|\012/" , $ text ) ) ; // we split the text at all line feeds $ this -> documentGenerator -> clear ( ) ; $ this -> errors = array ( ) ; while ( $ linesIterator -> valid ( ) ) { $ line = $ linesIterator -> current ( ) ; if ( $ line != '' ) { $ blockGen = $ this -> parseBlock ( $ linesIterator , $ line , null ) ; if ( is_object ( $ blockGen ) ) { $ this -> documentGenerator -> addBlock ( $ blockGen ) ; continue ; } } // no block found, we use a default block if ( trim ( $ line ) == '' ) { $ blockGenerator = new Generator \ SingleLineBlock ( $ this -> documentGenerator -> getConfig ( ) ) ; } else { $ inline = $ this -> inlineParser -> parse ( $ line ) ; $ blockGenerator = $ this -> documentGenerator -> getDefaultBlock ( $ inline ) ; if ( ! $ blockGenerator ) { $ blockGenerator = new Generator \ SingleLineBlock ( $ this -> documentGenerator -> getConfig ( ) ) ; $ blockGenerator -> setLineAsString ( $ inline ) ; } } $ this -> documentGenerator -> addBlock ( $ blockGenerator ) ; $ this -> nextLine ( $ linesIterator ) ; } $ result = $ this -> documentGenerator -> generate ( ) ; if ( $ this -> documentGenerator -> getConfig ( ) -> generateHeaderFooter ) { $ result = $ this -> documentGenerator -> generateHeader ( ) . $ result . $ this -> documentGenerator -> generateFooter ( ) ; } return $ this -> config -> onParse ( $ result ) ; }
Main method to call to convert a wiki text into an other format, according to the
rules given to the constructor.

@param string $text The wiki text to convert.

@return string The converted text.
Main method to call to convert a wiki text into an other format according to the rules given to the constructor .