Пример #1
0
 public function render(DOMRenderer $iterator, DOMElement $element)
 {
     $sourceFile = $iterator->getGenerator()->getPageManager()->getSourceFile($element->nodeValue);
     return $iterator->renderContentElement($sourceFile->getContent());
 }
Пример #2
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();
 }