public function render(DOMRenderer $iterator, DOMElement $element)
 {
     $result = '';
     $result .= "\t" . '<tr>' . PHP_EOL;
     $result .= $iterator->renderNodes($element);
     $result .= "\t" . '</tr>' . PHP_EOL;
     return $result;
 }
Esempio n. 2
0
 public function render(DOMRenderer $renderer, DOMElement $element)
 {
     $generator = $renderer->getGenerator();
     $src = $element->getAttribute('src');
     $inputDir = $generator->getInputDirectory();
     $path = $renderer->getRenderer()->getBaseUrl() . '/' . $src;
     $assetManager = $generator->getAssetManager();
     $assetManager->addAsset($src, $inputDir . '/' . $src);
     return '<img src="' . $path . '" alt="image" width=300 />';
 }
 public function render(DOMRenderer $iterator, DOMElement $element)
 {
     $type = $this->type;
     if (!$type) {
         $type = $element->getAttribute('type');
     }
     $result = '<div class="admonition ' . $type . '">';
     $result .= $iterator->renderNodeList($element);
     return $result . '</div>' . PHP_EOL;
 }
 public function render(DOMRenderer $iterator, DOMElement $element)
 {
     $colspan = max(1, $element->getAttribute('colspan'));
     $rowspan = max(1, $element->getAttribute('rowspan'));
     $result = '';
     $result .= "\t\t";
     $result .= sprintf('<td colspan="%d" rowspan="%d">', $colspan, $rowspan);
     $result .= $iterator->renderNodes($element);
     $result .= '</td>' . PHP_EOL;
     return $result;
 }
 protected function parseLink(DOMRenderer $renderer, $href)
 {
     $result = array();
     $urlInfo = parse_url($href);
     if (!array_key_exists('scheme', $urlInfo)) {
         $renderer->getGenerator()->getPageManager()->getQueue()->enqueue($href);
         $result['href'] = $renderer->getRenderer()->getLink($href);
         $result['path'] = $href;
     } else {
         $result['href'] = $href;
         $result['path'] = null;
     }
     return $result;
 }
Esempio n. 6
0
 public function render(DOMRenderer $iterator, DOMElement $element)
 {
     $result = '';
     $type = $element->getAttribute('type');
     if (!$type) {
         $type = 'disc';
     }
     $result .= '<ul type="' . $type . '">' . PHP_EOL;
     foreach ($element->getElementsByTagName('li') as $node) {
         $result .= "\t" . '<li>' . $iterator->renderNodes($node) . '</li>' . PHP_EOL;
     }
     $result .= '</ul>';
     return $result . PHP_EOL . PHP_EOL;
 }
Esempio n. 7
0
 public function render(DOMRenderer $domRenderer, DOMElement $element)
 {
     $level = $this->level;
     if (!$level) {
         $level = $element->getAttribute('level');
     }
     $level = max(1, $level);
     $value = $domRenderer->renderNodes($element);
     $result = '';
     $id = $domRenderer->getRenderer()->createId($value);
     if ($level > 6) {
         $result = '<div id="' . $id . '" class="header' . $level . '">' . $value . '</div>';
     } else {
         $result = '<h' . $level . ' id="' . $id . '">' . $value . '</h' . $level . '>';
     }
     return $result . PHP_EOL . PHP_EOL;
 }
 public function render(DOMRenderer $iterator, DOMElement $element)
 {
     return '<em>' . $iterator->renderNodes($element) . '</em>';
 }
Esempio n. 9
0
 public function render(DOMRenderer $iterator, DOMElement $element)
 {
     $sourceFile = $iterator->getGenerator()->getPageManager()->getSourceFile($element->nodeValue);
     return $iterator->renderContentElement($sourceFile->getContent());
 }
Esempio n. 10
0
 public function render(DOMRenderer $iterator, DOMElement $element)
 {
     return '<table border="1">' . $iterator->renderNodes($element) . '</table>';
 }
Esempio n. 11
0
 /**
  * Builds the source files.
  *
  * @param Generator $generator The generator to build for.
  */
 public function build(Generator $generator)
 {
     $renderer = new DOMRenderer($generator, $this);
     $publisher = new Publisher($generator, $this);
     $pageManager = $this->loadPageManager($generator);
     while (!$pageManager->getQueue()->isEmpty()) {
         $page = $pageManager->getQueue()->dequeue();
         if ($pageManager->hasPage($page)) {
             continue;
         }
         // Parse the source file:
         $sourceFile = $pageManager->getSourceFile($page);
         // Register the page:
         $pageManager->addPage($page, $sourceFile);
         // Parse the content:
         $content = $renderer->renderContentElement($sourceFile->getContent());
         // And add the content to the publisher:
         $publisher->add($page, $content);
     }
     $publisher->publish();
 }