src/Parsing/Html.php
protected function getTextAction(Token $token)
    {
        // action to use for each line of the content of a <pre> Tag
        $tagPreBr = new Node('br', array('style' => array(), 'num' => 0), false);

        $actions = array();

        // if we are not in a <pre> tag
        if (!$this->tagPreIn) {
            // save the action
            $actions[] = new Node('write', array('txt' => $this->textParser->prepareTxt($token->getData())), false);
        } else { // else (if we are in a <pre> tag)
            // prepare the text
            $data = str_replace("\r", '', $token->getData());
            $lines = explode("\n", $data);

            // foreach line of the text
            foreach ($lines as $k => $txt) {
                // transform the line
                $txt = str_replace("\t", self::HTML_TAB, $txt);
                $txt = str_replace(' ', '&nbsp;', $txt);

                // add a break line
                if ($k > 0) {
                    $actions[] = clone $tagPreBr;
                }

                // save the action
                $actions[] = new Node('write', array('txt' => $this->textParser->prepareTxt($txt, false)), false);
            }
        }
        return $actions;
    }
protected function getTextAction(Token $token)
    {
        // action to use for each line of the content of a <pre> Tag
        $tagPreBr = new Node('br', array('style' => array(), 'num' => 0), false);

        $actions = array();

        // if we are not in a <pre> tag
        if (!$this->tagPreIn) {
            // save the action
            $actions[] = new Node('write', array('txt' => $this->textParser->prepareTxt($token->getData())), false);
        } else { // else (if we are in a <pre> tag)
            // prepare the text
            $data = str_replace("\r", '', $token->getData());
            $lines = explode("\n", $data);

            // foreach line of the text
            foreach ($lines as $k => $txt) {
                // transform the line
                $txt = str_replace("\t", self::HTML_TAB, $txt);
                $txt = str_replace(' ', '&nbsp;', $txt);

                // add a break line
                if ($k > 0) {
                    $actions[] = clone $tagPreBr;
                }

                // save the action
                $actions[] = new Node('write', array('txt' => $this->textParser->prepareTxt($txt, false)), false);
            }
        }
        return $actions;
    }
protected function getTextAction ( Token $ token ) { // action to use for each line of the content of a <pre> Tag $ tagPreBr = new Node ( 'br' , array ( 'style' => array ( ) , 'num' => 0 ) , false ) ; $ actions = array ( ) ; // if we are not in a <pre> tag if ( ! $ this -> tagPreIn ) { // save the action $ actions [ ] = new Node ( 'write' , array ( 'txt' => $ this -> textParser -> prepareTxt ( $ token -> getData ( ) ) ) , false ) ; } else { // else (if we are in a <pre> tag) // prepare the text $ data = str_replace ( "\r" , '' , $ token -> getData ( ) ) ; $ lines = explode ( "\n" , $ data ) ; // foreach line of the text foreach ( $ lines as $ k => $ txt ) { // transform the line $ txt = str_replace ( "\t" , self :: HTML_TAB , $ txt ) ; $ txt = str_replace ( ' ' , '&nbsp;' , $ txt ) ; // add a break line if ( $ k > 0 ) { $ actions [ ] = clone $ tagPreBr ; } // save the action $ actions [ ] = new Node ( 'write' , array ( 'txt' => $ this -> textParser -> prepareTxt ( $ txt , false ) ) , false ) ; } } return $ actions ; }
get the Text action

@param Token $token

@return array
get the Text action