1
0
mirror of synced 2025-02-01 13:01:45 +03:00
This commit is contained in:
zYne 2007-02-23 19:41:42 +00:00
parent 83677290e8
commit 7de3e31a32
5 changed files with 58 additions and 14 deletions

View File

@ -112,16 +112,17 @@
while($count--) { while($count--) {
array_shift($p); array_shift($p);
} }
if ( ! empty($p)) {
print "<div class=level" . $l . '><font class=level' . $l . '>' . $i[$x]['index'];
?>
print "<div class=level" . $l . '><font class=level' . $l . '>'; <a href=documentation2.php?chapter=<?php print urlencode($i[$x]['name']) . '>' . end($p); ?></a>
?> </font></div>
<?php
<a href=documentation2.php?chapter=<?php print urlencode($i[$x]['name']) . '>' . end($p); ?></a> if (strncmp($i[$x]['name'], $_GET['chapter'], strlen($_GET['chapter'])) !== 0) {
</font></div> break;
<?php }
if (strncmp($i[$x]['name'], $_GET['chapter'], strlen($_GET['chapter'])) !== 0) {
break;
} }
} }
} }

View File

@ -42,7 +42,37 @@ function render($title,$t,$e) {
} }
print "<br>"; print "<br>";
} }
/**
public function parseIndex($index, $path = array(), $counters = array())
{
$ret = array();
foreach ($index as $k => $v) {
$i = count($path) - 1;
$counters[$i]++;
if (is_array($v)) {
if ( ! is_numeric($k)) {
$tmp = $path;
$tmp[] = $k;
$chapterName = ( ! empty($path)) ? implode(' - ', $path) . ' - ' . $k : $k;
$ret[] = array('index' => implode('.', $counters),
'name' => $chapterName);
}
$ret = array_merge($ret, $this->parseIndex($v, $tmp, $counters));
} else {
$chapterName = ( ! empty($path)) ? implode(' - ', $path) . ' - ' . $v : $v;
$ret[] = array('index' => implode('.', $counters),
'name' => $chapterName);
}
}
return $ret;
}*/
function render_block($name) { function render_block($name) {
if(file_exists("docs/$name.php")) { if(file_exists("docs/$name.php")) {

View File

@ -1,12 +1,19 @@
<?php <?php
include("top.php"); include("top.php");
require_once("highlight.php"); require_once("highlight.php");
error_reporting(E_ALL | E_STRICT); error_reporting(E_ALL);
set_include_path(dirname(__FILE__) . '/../vendor/');
$f = file_get_contents('menu.php'); $f = file_get_contents('menu.php');
$a = explode(PHP_EOL, $f); $a = explode(PHP_EOL, $f);
$res = array(); $res = array();
$curr = false; $curr = false;
require_once('Text/Wiki.php');
require_once('Text/Wiki/MediaWiki.php');
class DocTool class DocTool
{ {
@ -14,9 +21,12 @@ class DocTool
protected $highlighter; protected $highlighter;
protected $wiki;
public function __construct() public function __construct()
{ {
$this->highlighter = new PHP_Highlight; $this->highlighter = new PHP_Highlight;
$this->wiki = new Text_Wiki;
} }
public function parseIndex2($index) public function parseIndex2($index)
{ {
@ -74,7 +84,7 @@ class DocTool
if(substr($c, 0, 5) == "<?php") { if(substr($c, 0, 5) == "<?php") {
include("docs/$name.php"); include("docs/$name.php");
} else { } else {
print $c."<br><br>"; print $this->wiki->transform($c) . "<br><br>";
} }
} }
if(file_exists("codes/$name.php")) { if(file_exists("codes/$name.php")) {

View File

@ -339,7 +339,7 @@ class PHP_Highlight
// Format code // Format code
$source = $this->toArray($funcref); $source = $this->toArray($funcref);
$out = "<div class='code'>\n"; $out = "<div class='code'>";
foreach ($source as $i => $line) { foreach ($source as $i => $line) {
$out .= ' '; $out .= ' ';
@ -350,7 +350,7 @@ class PHP_Highlight
$out .= empty($line) ? '&nbsp;' : $line; $out .= empty($line) ? '&nbsp;' : $line;
$out .= "<br />\n"; $out .= "<br />\n";
} }
$out .= "</div>\n"; $out .= "</div>";
if ($return === true) { if ($return === true) {
return $out; return $out;

View File

@ -106,6 +106,9 @@ font-size: 14 px;
i { i {
color: #367FAC; color: #367FAC;
} }
em {
color: #367FAC;
}
a { a {
color: #367FAC; color: #367FAC;
} }