コード例 #1
0
 /**
  * @return SiteDoc
  */
 function getDoc()
 {
     if (!$this->siteDoc) {
         $this->siteDoc = XmlSiteDocBuilder::create($this->xmlDocPath)->build();
     }
     return $this->siteDoc;
 }
コード例 #2
0
ファイル: make-entry.php プロジェクト: phoebius/phoebius.com
{
    if ($m) {
        message($m);
        echo PHP_EOL;
    }
    help();
    exit(1);
}
function help()
{
    global $argv;
    echo <<<EOT
Usage: {$argv[0]} document.xml

The HTML-rendered result is directed to stdout.

EOT;
}
if (!isset($argv[1])) {
    stop();
}
$docPath = realpath($argv[1]);
if (!is_file($argv[1])) {
    stop('Incorrect path to an XML document');
}
$siteDocBuilder = new XmlSiteDocBuilder($docPath);
$siteDoc = $siteDocBuilder->build();
$renderer = new SiteDocContentBlockRenderer();
foreach ($siteDoc->getChapters() as $chapter) {
    echo $chapter->toHtml($renderer);
}