Exemple #1
0
 public function output($depth)
 {
     $document = new Document();
     $target = $this->getOption('target');
     $link = $this->getOption('link') ?: $target;
     $link_text = $this->getOption('link-text') ?: "See: {$link}";
     $pre_link_text = $this->getOption('link-pre-text') ?: '';
     $post_link_text = $this->getOption('link-post-text') ?: '';
     if (is_file($target) && !is_writable($target) || !$this->recursiveTouch($target)) {
         throw new TargetNotWritableException($target . ' not writable');
     }
     //		$output = '';
     foreach ($this->getChildren() as $child) {
         $document->appendChild($child->output(0));
     }
     file_put_contents($target, $document->exportMarkdown());
     return "{$pre_link_text}[{$link_text}]({$link}){$post_link_text}\n\n";
 }