public function outputProcess()
    {
        // remove doctype.
        $this->output['raw'] = preg_replace(
                '/^<!DOCTYPE[^>]+>/U', '', $this->output['raw']
        );

        if ($this->outputProcess && $this->getOption('process')) {

            // Remove doctype added by DOMDocument (hacky)
            $this->output['raw'] = $this->getDoctype() . $this->output['raw'];

            /**
             * Process img, br, hr, tags, change html to xhtml.
             * 
             * <img> <img src=""> <img src="/image.png">
             * Are changed to xhtml
             * <img /> <img src="" /> <img src="/image.png" />
             */
            if ($this->getOption('process.body.image')) {
                $this->output['raw'] = preg_replace(
                        '/<img(.*)>/sU', '<img\\1 />', $this->output['raw']
                );
            }

            if ($this->getOption('process.body.br')) {
                $this->output['raw'] = preg_replace(
                        '/<br(.*)>/sU', '<br\\1 />', $this->output['raw']
                );
            }

            if ($this->getOption('process.body.hr')) {
                $this->output['raw'] = preg_replace(
                        '/<hr(.*)>/sU', '<hr\\1 />', $this->output['raw']
                );
            }

            // Trim whitespace need this to get exactly the wanted data back for test cases, mmm.
            $this->output['raw'] = trim($this->output['raw']);

            return $this->outputProcess;
        }
        return $this->outputProcess;
    }
public function outputProcess()
    {
        // remove doctype.
        $this->output['raw'] = preg_replace(
                '/^<!DOCTYPE[^>]+>/U', '', $this->output['raw']
        );

        if ($this->outputProcess && $this->getOption('process')) {

            // Remove doctype added by DOMDocument (hacky)
            $this->output['raw'] = $this->getDoctype() . $this->output['raw'];

            /**
             * Process img, br, hr, tags, change html to xhtml.
             * 
             * <img> <img src=""> <img src="/image.png">
             * Are changed to xhtml
             * <img /> <img src="" /> <img src="/image.png" />
             */
            if ($this->getOption('process.body.image')) {
                $this->output['raw'] = preg_replace(
                        '/<img(.*)>/sU', '<img\\1 />', $this->output['raw']
                );
            }

            if ($this->getOption('process.body.br')) {
                $this->output['raw'] = preg_replace(
                        '/<br(.*)>/sU', '<br\\1 />', $this->output['raw']
                );
            }

            if ($this->getOption('process.body.hr')) {
                $this->output['raw'] = preg_replace(
                        '/<hr(.*)>/sU', '<hr\\1 />', $this->output['raw']
                );
            }

            // Trim whitespace need this to get exactly the wanted data back for test cases, mmm.
            $this->output['raw'] = trim($this->output['raw']);

            return $this->outputProcess;
        }
        return $this->outputProcess;
    }
public function outputProcess ( ) { // remove doctype.
 $ this -> output [ 'raw' ] = preg_replace ( '/^<!DOCTYPE[^>]+>/U' , '' , $ this -> output [ 'raw' ] ) ; if ( $ this -> outputProcess && $ this -> getOption ( 'process' ) ) { // Remove doctype added by DOMDocument (hacky)
 $ this -> output [ 'raw' ] = $ this -> getDoctype ( ) . $ this -> output [ 'raw' ] ; /**
             * Process img, br, hr, tags, change html to xhtml.
             * 
             * <img> <img src=""> <img src="/image.png">
             * Are changed to xhtml
             * <img /> <img src="" /> <img src="/image.png" />
             */ if ( $ this -> getOption ( 'process.body.image' ) ) { $ this -> output [ 'raw' ] = preg_replace ( '/<img(.*)>/sU' , '<img\\1 />' , $ this -> output [ 'raw' ] ) ; } if ( $ this -> getOption ( 'process.body.br' ) ) { $ this -> output [ 'raw' ] = preg_replace ( '/<br(.*)>/sU' , '<br\\1 />' , $ this -> output [ 'raw' ] ) ; } if ( $ this -> getOption ( 'process.body.hr' ) ) { $ this -> output [ 'raw' ] = preg_replace ( '/<hr(.*)>/sU' , '<hr\\1 />' , $ this -> output [ 'raw' ] ) ; } // Trim whitespace need this to get exactly the wanted data back for test cases, mmm.
 $ this -> output [ 'raw' ] = trim ( $ this -> output [ 'raw' ] ) ; return $ this -> outputProcess ; } return $ this -> outputProcess ; }
Time to sort out the plethora of DOMDocument bugs.

TODO Styles create compiled CSS file, insert into reference into the head.
TODO Script create compiled JS file, insert into the page footer.
TODO Both should be configurable using options.
Time to sort out the plethora of DOMDocument bugs .