示例#1
0
 /**
  * Transforms the given text into HTML
  *
  * @param string $text
  *
  * @return string The HTML Output
  */
 public function parse($text)
 {
     $rstDoc = new \ezcDocumentRst($rstOptions = new \ezcDocumentRstOptions($this->config));
     $rstDoc->loadString($text);
     $htmlDoc = $rstDoc->getAsXhtml();
     return $htmlDoc->save();
 }
示例#2
0
 /**
  * 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 ezcDocumentRst();
     $rst->loadString($content);
     return $rst;
 }
<?php

require 'tutorial_autoload.php';
// Load custom directive
require '00_01_address_directive.php';
$document = new ezcDocumentRst();
$document->registerDirective('address', 'myAddressDirective');
$document->loadString(<<<EORST
Address example
===============

.. address:: John Doe
    :street: Some Lane 42
EORST
);
$docbook = $document->getAsDocbook();
echo $docbook->save();