Esempio n. 1
0
 /**
  * Handle a node
  *
  * Handle / transform a given node, and return the result of the
  * conversion.
  *
  * @param ezcDocumentElementVisitorConverter $converter
  * @param DOMElement $node
  * @param mixed $root
  * @return mixed
  */
 public function handle(ezcDocumentElementVisitorConverter $converter, DOMElement $node, $root)
 {
     // Reset indenteation level, ever we reach a new section
     ezcDocumentDocbookToWikiConverter::$indentation = 0;
     if ($node->tagName === 'title') {
         // Get actual title string by recursing into the title node
         $title = trim($converter->visitChildren($node, ''));
         return $root . sprintf("\n%s %s\n\n", str_repeat("=", $this->level + 1), $title);
     } else {
         ++$this->level;
         // Recurse
         $root = $converter->visitChildren($node, $root);
         // Reduce header level back to original state after recursion
         --$this->level;
     }
     return $root;
 }
Esempio n. 2
0
 /**
  * Initialize destination document
  *
  * Initialize the structure which the destination document could be build
  * with. This may be an initial DOMDocument with some default elements, or
  * a string, or something else.
  *
  * @return mixed
  */
 protected function initializeDocument()
 {
     self::$indentation = 0;
     self::$wordWrap = $this->options->wordWrap;
     return '';
 }