[Umts-tools-commits] r646 - umts-tools/trunk
sharky at cartier.jerryweb.org
sharky at cartier.jerryweb.org
Fri Jul 21 22:11:22 BST 2006
Author: sharky
Date: 2006-07-21 22:11:21 +0100 (Fri, 21 Jul 2006)
New Revision: 646
Modified:
umts-tools/trunk/gendocs.php
Log:
use new facilities in Diogenes 0.9.20pre2 for HTML document generation
Modified: umts-tools/trunk/gendocs.php
===================================================================
--- umts-tools/trunk/gendocs.php 2006-07-21 15:31:14 UTC (rev 645)
+++ umts-tools/trunk/gendocs.php 2006-07-21 21:11:21 UTC (rev 646)
@@ -2,59 +2,16 @@
<?php
ini_set("include_path", "/etc/diogenes:/usr/share/diogenes/include:/usr/share/php");
require_once("diogenes.common.inc.php");
+require_once("diogenes.script.inc.php");
require_once("System.php");
require_once("Barrel.php");
-class Diogenes_Script
+function genModuleDoc(&$script,$pod,$docdir)
{
- function Diogenes_Script($alias,$login)
- {
- $this->alias = $alias;
- $this->login = $login;
- }
-
- function kill($msg)
- {
- echo "KILL: $msg\n";
- exit(1);
- }
-
- function info($msg)
- {
- echo "INFO: $msg\n";
- }
-
- function getRcs()
- {
- global $globals;
- return new $globals->rcs($this,$this->alias,$this->login);
- }
-
- function log($action, $data="")
- {
- echo "LOG: $action $data\n";
- }
-}
-
-
-function genModuleDoc(&$script,&$barrel,$pod,$docdir)
-{
global $globals;
-
- $pid = $barrel->getPID($docdir);
- if (!$pid) {
- echo "could not find page '$docdir', creating it..\n";
- $parent_name = dirname($docdir);
- $p_location = basename($docdir);
- $parent_id = $barrel->getPID($parent_name);
- if (!$parent_id) {
- echo "could not find parrent page '$parent_name'";
- exit(1);
- }
- $tpage = new Diogenes_Barrel_Page($barrel, array('parent' => $parent_id, 'location' => $p_location));
- $tpage->toDb(0, $script);
- $pid = $barrel->getPID($docdir);
- }
+ $barrel =& $script->barrel;
+
+ $pid = $barrel->makePath($docdir, $script);
$page = Diogenes_Barrel_Page::fromDb($barrel, $pid);
if (!$page->props['PID']) {
echo "failed to get Page $pid\n";
@@ -62,7 +19,11 @@
}
# produce HTML from POD
- $content = shell_exec('pod2html --htmlroot=FOODOCBASE --infile='.escapeshellarg($pod).' | sed -e "s/FOODOCBASE\(.*\)\.html/\/docs\1\//g" | sed -e "s/<hr \/>//g"');
+ $pod = realpath($pod);
+ if (($tmpdir = System::mktemp('-d')) == false) {
+ $this->kill("Error : could not create temporary directory!");
+ }
+ $content = shell_exec('cd '.$tmpdir.' && pod2html --htmlroot=FOODOCBASE --infile='.escapeshellarg($pod).' | sed -e "s/FOODOCBASE\(.*\)\.html/\/docs\1\//g" | sed -e "s/<hr \/>//g"');
# extract title
if (preg_match("/<title>(.*)<\/title>/si", $content, $matches))
@@ -87,7 +48,6 @@
{
$alias = "umts_tools";
$script = new Diogenes_Script($alias, "sharky");
- $barrel = new Diogenes_Barrel($alias);
$docs = array(
'src/umts-answer.pl' => 'docs/answer',
'src/umts-dialer.pl' => 'docs/dialer',
@@ -120,7 +80,7 @@
);
foreach ($docs as $pod => $docdir)
{
- genModuleDoc($script,$barrel,$pod,$docdir);
+ genModuleDoc($script,$pod,$docdir);
}
}
More information about the umts-tools-commits
mailing list