public function testCreateDocumentFromDocbook() { $doc = new ezcDocumentDocbook(); $doc->loadFile(dirname(__FILE__) . '/files/docbook/wiki/s_001_empty.xml'); $wiki = new ezcDocumentWiki(); $wiki->createFromDocbook($doc); $this->assertSame($wiki->save(), file_get_contents(dirname(__FILE__) . '/files/docbook/wiki/s_001_empty.txt')); }
/** * Create document from structure * * Build a ezcDocumentDocument object from the structure created during the * visiting process. * * @param mixed $content * @return ezcDocumentDocument */ protected function createDocument($content) { // Append footnotes and citations to document $content = $this->finishDocument($content); // Create document object out of contents $rst = new ezcDocumentWiki(); $rst->loadString($content); return $rst; }
/** * @dataProvider getTestDocuments */ public function testParseWikiFile($from, $to) { if (!is_file($to)) { $this->markTestSkipped("Comparision file '{$to}' not yet defined."); } $type = ucfirst(basename(dirname($from))); $tokenizerClass = 'ezcDocumentWiki' . $type . 'Tokenizer'; $document = new ezcDocumentWiki(); $document->options->errorReporting = E_PARSE | E_ERROR | E_WARNING; $document->options->tokenizer = new $tokenizerClass(); $document->registerPlugin('currenttimeplugin', 'ezcDocumentTestDummyPlugin'); $document->registerPlugin('calendar', 'ezcDocumentTestDummyPlugin'); $document->registerPlugin('html', 'ezcDocumentTestDummyPlugin'); $document->registerPlugin('php', 'ezcDocumentTestDummyPlugin'); $document->loadFile($from); $docbook = $document->getAsDocbook(); $xml = $docbook->save(); // Store test file, to have something to compare on failure $tempDir = $this->createTempDir('wiki_visitor_' . $type . '_') . '/'; file_put_contents($tempDir . basename($to), $xml); // Validate generated docbook $this->assertTrue($docbook->validateString($xml)); $this->assertEquals(file_get_contents($to), $xml, 'Document not visited as expected.'); // Remove tempdir, when nothing failed. $this->removeTempDir(); }
/** * Construct RST document. * * @ignore * @param ezcDocumentWikiOptions $options * @return void */ public function __construct(ezcDocumentWikiOptions $options = null) { parent::__construct($options === null ? new ezcDocumentWikiOptions() : $options); $this->options->tokenizer = new ezcDocumentWikiDokuwikiTokenizer(); }
<?php require 'tutorial_autoload.php'; $document = new ezcDocumentWiki(); $document->loadString(' = Example text = Just some exaple paragraph with a heading, some **emphasis** markup and a [[http://ezcomponents.org|link]].'); $docbook = $document->getAsDocbook(); echo $docbook->save();
<?php require 'tutorial_autoload.php'; $document = new ezcDocumentWiki(); $document->options->tokenizer = new ezcDocumentWikiConfluenceTokenizer(); $document->loadString(' h1. Example text Just some exaple paragraph with a heading, some *emphasis* markup and a [link|http://ezcomponents.org].'); $docbook = $document->getAsDocbook(); echo $docbook->save();
<?php require 'tutorial_autoload.php'; $docbook = new ezcDocumentDocbook(); $docbook->loadFile('docbook.xml'); $document = new ezcDocumentWiki(); $document->createFromDocbook($docbook); echo $document->save();