/** * Create document from structure * * Build a ezcDocumentDocument object from the structure created during the * visiting process. * * @param mixed $content * @return ezcDocumentDocbook */ protected function createDocument($content) { $document = $content->ownerDocument; $ezxml = new ezcDocumentDocbook(); $ezxml->setDomDocument($document); return $ezxml; }
/** * Return document compiled to the docbook format * * The internal document structure is compiled to the docbook format and * the resulting docbook document is returned. * * This method is required for all formats to have one central format, so * that each format can be compiled into each other format using docbook as * an intermediate format. * * You may of course just call an existing converter for this conversion. * * @return ezcDocumentDocbook */ public function getAsDocbook() { $tokenizer = $this->options->tokenizer; $parser = new ezcDocumentWikiParser(); $parser->options->errorReporting = $this->options->errorReporting; $this->ast = $parser->parse($tokenizer->tokenizeString($this->contents)); $document = new ezcDocumentDocbook(); $visitor = new ezcDocumentWikiDocbookVisitor($this, $this->path); $document->setDomDocument($visitor->visit($this->ast, $this->path)); $document->setPath($this->path); // Merge errors from converter $this->errors = array_merge($this->errors, $parser->getErrors(), $visitor->getErrors()); return $document; }
/** * @dataProvider getItemizedListTypes */ public function testRenderItemizedListTypes($type, array $items) { $mock = $this->getMock('ezcTestDocumentPdfMockDriver', array('createPage', 'drawWord')); // Expectations $mock->expects($this->at(1))->method('drawWord')->with($this->equalTo(10, 1.0), $this->equalTo(18, 1.0), $this->equalTo($items[0])); $mock->expects($this->at(4))->method('drawWord')->with($this->equalTo(10, 1.0), $this->equalTo(33, 1.0), $this->equalTo($items[1])); $docbook = new ezcDocumentDocbook(); $docbook->loadFile(dirname(__FILE__) . '/../files/pdf/bullet_list.xml'); // Set numeration type in document $dom = $docbook->getDomDocument(); $xpath = new DOMXPath($dom); $xpath->registerNamespace('doc', 'http://docbook.org/ns/docbook'); $list = $xpath->evaluate('//doc:itemizedlist')->item(0); $list->setAttribute('mark', $type); $docbook->setDomDocument($dom); $renderer = new ezcDocumentPdfMainRenderer($mock, $this->styles); $pdf = $renderer->render($docbook, new ezcDocumentPdfDefaultHyphenator()); }
/** * Return document compiled to the docbook format * * The internal document structure is compiled to the docbook format and * the resulting docbook document is returned. * * This method is required for all formats to have one central format, so * that each format can be compiled into each other format using docbook as * an intermediate format. * * You may of course just call an existing converter for this conversion. * * @return ezcDocumentDocbook */ public function getAsDocbook() { $tokenizer = $this->options->tokenizer; $parser = new ezcDocumentWikiParser(); $parser->options->errorReporting = $this->options->errorReporting; $this->ast = $parser->parse($tokenizer->tokenizeString($this->contents)); $document = new ezcDocumentDocbook(); $visitor = new ezcDocumentWikiDocbookVisitor($this, $this->path); $document->setDomDocument($visitor->visit($this->ast, $this->path)); return $document; }
/** * Return document compiled to the docbook format * * The internal document structure is compiled to the docbook format and * the resulting docbook document is returned. * * This method is required for all formats to have one central format, so * that each format can be compiled into each other format using docbook as * an intermediate format. * * You may of course just call an existing converter for this conversion. * * @return ezcDocumentDocbook */ public function getAsDocbook() { foreach ($this->filters as $filter) { $filter->filter($this->document); } $docbook = new ezcDocumentDocbook(); $docbook->setDomDocument($this->buildDocbookDocument($this->document)); $docbook->setPath($this->path); return $docbook; }