3 ini_set("include_path", "/etc/diogenes:/usr/share/diogenes/include:/usr/share/php");
4 require_once("diogenes.common.inc.php");
5 require_once("diogenes.script.inc.php");
6 require_once("System.php");
7 require_once("Barrel.php");
9 /** Import a single Perl POD file.
17 function importPod(&$caller, $pod, $docdir, $docbase, $template = '')
20 $barrel =& $caller->barrel
;
22 $pid = $barrel->makePath($docdir, $caller);
23 $page = Diogenes_Barrel_Page
::fromDb($barrel, $pid);
24 if (!$page->props
['PID']) {
25 echo "failed to get Page $pid\n";
29 # produce HTML from POD
30 $pod = realpath($pod);
31 if (($tmpdir = System
::mktemp('-d')) == false
) {
32 $this->kill("Error : could not create temporary directory!");
34 $content = shell_exec("cd $tmpdir && pod2html --htmlroot=FOODOCBASE --infile=".escapeshellarg($pod));
35 $content = str_replace('<hr />', '', $content);
36 $content = preg_replace('/FOODOCBASE(.*).html/', "/$docbase$1/", $content);
39 if (preg_match("/<title>(.*)<\/title>/si", $content, $matches))
41 $page->props
['title'] = addslashes($matches[1]);
43 $page->props
['template'] = $template;
44 $page->toDb(0, $caller);
47 # strip un-needed info
48 $rcs = $caller->getRcs();
49 $content = $rcs->importHtmlString($content);
50 if (preg_match("/<h1><a name=\"synopsis\">.*/si", $content, $matches))
51 $content = $matches[0];
53 $content = str_replace("h1>", "h2>", $content);
54 $rcs->commit($pid,$globals->htmlfile
,$content,"automatic import");
58 /** Import a set of Perl POD files.
65 function importPods(&$caller, $docarray, $docbase, $template = '')
67 foreach ($docarray as $pod => $docdir)
69 importPod($caller, $pod, $docdir, $docbase, $template);
74 /** Print program usage and exit.
78 echo "Usage : pod2diogenes.php
85 $alias = "umts_tools
";
86 $script = new Diogenes_Script($alias, "sharky
");
88 importPods($script, $docs, "docs
", "barrel
:pod
.tpl
");