Example #1
0
 /**
  * Render a directive
  *
  * Render a directive with the given paramters.
  *
  * @param string $name
  * @param string $parameter
  * @param array $options
  * @param string $content
  * @return string
  */
 protected function renderDirective($name, $parameter, array $options, $content = null)
 {
     $indentation = str_repeat(' ', ezcDocumentDocbookToWikiConverter::$indentation);
     // Show directive with given parameters
     $directive = sprintf("\n%s.. %s:: %s\n", $indentation, $name, $parameter);
     // Append options
     foreach ($options as $key => $value) {
         $directive .= sprintf("%s   :%s: %s\n", $indentation, ezcDocumentDocbookToWikiConverter::escapeWikiText($key), ezcDocumentDocbookToWikiConverter::escapeWikiText($value));
     }
     // Append content, if given
     if ($content !== null) {
         $directive .= "\n" . str_repeat(' ', ezcDocumentDocbookToWikiConverter::$indentation + 3) . trim(ezcDocumentDocbookToWikiConverter::wordWrap($content, 3)) . "\n";
     }
     // Append an additional newline after the directive contents
     $directive .= "\n";
     return $directive;
 }