예제 #1
0
 /**
  * add a single page
  *
  * @param Page $page 
  * @return void
  */
 public function addPage(Page $page)
 {
     $page->setChapter($this);
     $this->pages[] = $page;
 }
예제 #2
0
 /**
  * create page from FileInfo object
  *
  * @param FileInfo $fileInfo 
  * @return Page
  */
 private function createPageFromFileInfo(\SplFileInfo $fileInfo)
 {
     $page = new Page($this->getFilter());
     $page->setText(file_get_contents((string) $fileInfo));
     $matches = array();
     $found = preg_match('/#.*/', $page->getText(), $matches);
     if ($found === false) {
         $title = $file->getFilename();
     } else {
         $title = ltrim(array_shift($matches), '#');
     }
     $page->setTitle($this->stripNumberFromString($title));
     // //parse title out of body text
     $page->setPath($this->parsePath($fileInfo));
     //set "path" like identifier
     return $page;
 }