-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.php
55 lines (49 loc) · 1.3 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php
require('libs/markdown.php');
require('libs/geshi/geshi.php');
$url = explode("/", $_SERVER["REQUEST_URI"]);
$section = $url[2];
$type = $url[3];
$method = $url[4];
$path = "Docs/$section/$type/$method.md";
$html = markdown(file_get_contents($path));
function geshi($matches){
$source = $matches[0];
$source = preg_replace('{<\/?pre>}', "", $source);
$source = preg_replace('{<\/?code>}', "", $source);
$geshi = new GeSHi($source, 'javascript');
$geshi->enable_classes();
return $geshi->parse_code();
}
$html = preg_replace_callback('{<pre[^>]*>([\s\S]*?)<\/pre>}', "geshi", $html);
?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>MooTools Docs</title>
<link href="/assets/css/main.css" rel="stylesheet" type="text/css" />
<link href="/assets/css/demos.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="header">
<div>
<h1>MooTools</h1>
</div>
</div>
<div id="wrapper">
<div id="content">
<div id="leftcolumn">
<ul>
<li><h4><a href="/">Docs</a></h4></li>
<li><a href="/core/class/class">Class</a></li>
<li><a href="/core/element/element">Element</a></li>
</ul>
</div>
<div id="rightcolumn">
<?php echo $html;?>
</div>
</div>
</div>
</body>
</html>