/** * Generates a single page and saves it on the disk. * * @param Array $page The page meta-info. */ public function generate($page) { tfTags::setTagList($page['Tags']); $nav = array(); $this->_currentPage = $page; $nav[$page['Id']] = $page['Tags']['ShortTitle']; $parent = $page['_Parent']; do { $parent = $this->project->getMetaInfo($parent, false); if (!is_null($parent)) { $nav[$parent['Id']] = $parent['Tags']['ShortTitle']; $parent = $parent['_Parent']; } } while (!is_null($parent)); $nav = array_reverse($nav, true); $code = $this->createTopNavigator($page); $subtitle = ''; if (isset($page['Tags']['Appendix']) && $page['Tags']['Appendix']) { $subtitle = $this->translate->_('tags', 'appendix') . ' '; if (!$this->project->config['showNumbers']) { $subtitle = trim($subtitle) . ': '; } } if ($this->project->config['showNumbers']) { $code .= '<h1>' . $subtitle . $page['FullNumber'] . '. ' . $page['Tags']['Title'] . '</h1>'; } else { $code .= '<h1>' . $subtitle . $page['Tags']['Title'] . '</h1>'; } $this->_tagVersion = array(); $reference = tfTags::orderProcessTag('General', 'Author', $this) . tfTags::orderProcessTag('Status', 'Status', $this) . tfTags::orderProcessTags('Programming', $this) . tfTags::orderProcessTags('Behaviour', $this) . tfTags::orderProcessTags('VersionControl', $this); if (sizeof($this->_tagVersion) > 0) { $reference .= '<tr><th>' . $this->translate->_('tags', 'versions') . '</th><td>'; if (isset($this->_tagVersion['since'])) { $reference .= $this->translate->_('general', 'period_since') . ' <code>' . $this->_tagVersion['since'] . '</code>'; } if (isset($this->_tagVersion['to'])) { $reference .= ' ' . $this->translate->_('general', 'period_to') . ' <code>' . $this->_tagVersion['to'] . '</code>'; } $reference .= '</td></tr>' . PHP_EOL; } if ($reference != '') { $code .= '<div class="tf_reference"><table>' . $reference . '</table><hr/></div>'; } $code .= tfTags::orderProcessTag('General', 'FeatureInformationFrame', $this); $code .= $page['Content']; $code .= tfTags::orderProcessTag('Navigation', 'SeeAlso', $this); $this->pageContent[$page['Id']] = $code; }