Merging and resolving PR 111, Adding template support and static page generation

This commit is contained in:
Denis Kisselev 2014-02-12 02:42:33 -08:00
parent 400914222c
commit 123b7a66b4
10 changed files with 625 additions and 325 deletions

View File

@ -299,6 +299,22 @@ The Grunt.js task uses the built in web server in PHP 5.4 to host the docs on yo
This project contains a package.json file, so once you have the requirements installed, you can simply run a `npm install` and then `grunt` in the projects folder to start the local web server. By default the server will run at: <a href="http://localhost:8085" target="_blank">http://localhost:8085</a>
## Generating a set of static files
These can be uploaded to a static site hosting service such as pages.github.com
Generating a complete set of pages, with navigation
```bash
php index.php generate
```
Generating just one big file with each doc concatenated
```bash
php index.php full-doc
```
## Running on IIS
If you have set up a local or remote IIS web site, you may need a `web.config` with:

29
css/full-doc.css Normal file
View File

@ -0,0 +1,29 @@
html,body{
background: #fff;
}
body{
margin: 10px 30px;
}
h1{
font-size: 17px;
}
h2{
font-size: 16px;
}
h3{
font-size: 15px;
}
.page-header{
border-top: #000 1px solid;
border-bottom: #000 1px solid;
clear: both;
}
.page-header h1{
font-size: 18px;
}
blockquote p{
font-size: 14px;
}

View File

@ -264,6 +264,23 @@ The Grunt.js task uses the built in web server in PHP 5.4 to host the docs on yo
This project contains a package.json file, so once you have the requirements installed, you can simply run a `npm install` and then `grunt` in the projects folder to start the local web server. By default the server will run at: <a href="http://localhost:8085" target="_blank">http://localhost:8085</a>
## Generating a set of static files
These can be uploaded to a static site hosting service such as pages.github.com
Generating a complete set of pages, with navigation
```bash
php index.php generate
```
Generating just one big file with each doc concatenated
```bash
php index.php full-doc
```
## Running on IIS
If you have set up a local or remote IIS web site, you may need a `web.config` with:

View File

@ -4,6 +4,7 @@
"docs_path": "docs",
"image": "img/app.png",
"theme": "navy",
"template":"default",
"date_modified": true,
"repo": "justinwalsh/daux.io",
"twitter": ["justin_walsh", "todaymade"],

404
index.php
View File

@ -66,321 +66,99 @@ software, even if advised of the possibility of such damage.
require_once('libs/functions.php');
$options = get_options();
$tree = get_tree($options['docs_path'], $base_url);
// If a language is set in the config, rewrite urls based on the language
if (! isset($language) || $language === null) {
$homepage_url = homepage_url($tree);
$docs_url = docs_url($tree);
} else {
$homepage_url = "/";
$command_line=FALSE;
if(isset($argv)){
define("CLI",TRUE);
echo 'Daux.io documentation generator'."\n";
if(!isset($argv[1]))
$argv[1]= 'help';
switch ($argv[1]) {
//Generate static web documentation
case 'generate':
clean_copy_assets(dirname(__FILE__).'/static');
//Generate index.html
$markdown_structure = array();
$base_url = '.';
$index = generate_page($options, array(''), $base_url, TRUE, $markdown_structure);
file_put_contents('./static/index.html', $index);
echo '.';
foreach ($markdown_structure as $element) {
echo '.';
$flat_tree_tmp = array();
if( preg_match('/\.\/(.*)\/(.*)$/', $element['url'], $final_folder) ){
@mkdir('./static/'.$final_folder[1]);
$url_params = preg_split('/\//',$final_folder[1] );
$folder_count = count($url_params);
array_push( $url_params , $final_folder[2] );
$base_url = relative_base($folder_count);
$file = generate_page($options, $url_params, $base_url, TRUE, $flat_tree_tmp);
file_put_contents('./static/'.$final_folder[1].'/'.$final_folder[2].'.html', $file);
}else{
$strFile = str_replace('./', '', $element['url']);
$base_url = '.';
$file = generate_page($options, array($strFile), $base_url, TRUE, $flat_tree_tmp);
file_put_contents('./static/'.$strFile.'.html', $file);
}
}
echo "finished\n";
echo "The documentation is generated in static folder\n";
break;
//Generate one-page documentation
case 'full-doc':
clean_copy_assets(dirname(__FILE__).'/static');
$options['template'] ='full-doc';
$markdown_structure = array();
//Generate index.html
$markdown_structure = array();
$base_url = '.';
$index = generate_page($options, array(''), $base_url, TRUE, $markdown_structure);
file_put_contents('./static/full-doc.html', load_tpl_block('full-doc-blocks/head', $options, $base_url).$index);
echo '.';
array_pop($markdown_structure);
foreach ($markdown_structure as $element) {
echo '.';
$flat_tree_tmp = array();
if( preg_match('/\.\/(.*)\/(.*)$/', $element['url'], $final_folder) ){
$url_params = preg_split('/\//',$final_folder[1] );
$folder_count = count($url_params);
array_push( $url_params , $final_folder[2] );
$file = generate_page($options, $url_params, $base_url, TRUE, $flat_tree_tmp);
file_put_contents('./static/full-doc.html', $file, FILE_APPEND);
}else{
$strFile = str_replace('./', '', $element['url']);
$file = generate_page($options, array($strFile), $base_url, TRUE, $flat_tree_tmp);
file_put_contents('./static/full-doc.html', $file, FILE_APPEND);
}
}
file_put_contents('./static/full-doc.html', file_get_contents('template/full-doc-blocks/foot.tpl'), FILE_APPEND);
echo "finished\n";
echo "The documentation is generated in static folder\n";
break;
default:
echo "\n";
echo 'Usage:'."\n";
echo ' php index.php generate'."\n";
echo ' php index.php full-doc'."\n";
echo "\n";
echo 'generate. Generate static web'."\n";
echo 'fulldoc. Generate one-file documentation static html'."\n";
echo "\n";
break;
}
exit();
}
define("CLI", FALSE);
$docs_url = docs_url($tree);
$url_params = url_params();
generate_page($options, $url_params, get_base_url());
if (count($options['languages']) > 0 && count($url_params) > 0 && strlen($url_params[0]) > 0) {
$language = array_shift($url_params);
$base_path = $options['docs_path'] . $language;
} else {
$language = null;
$base_path = $options['docs_path'];
}
$tree = get_tree($base_path, $base_url, '', true, $language);
$page = load_page($tree, $url_params);
// Handle AJAX requests
if(isset($_POST["markdown"]) && $options["file_editor"] === true) {
handle_editor_post($_POST, $page);
die;
}
// If a timezone has been set in the config file, override the default PHP timezone for this application.
if(isset($options['timezone']))
{
date_default_timezone_set($options['timezone']);
}
// Redirect to docs, if there is no homepage
if ($homepage && $homepage_url !== '/') {
header('Location: '.$homepage_url);
}
?>
<!doctype html>
<!--[if lt IE 7]> <html class="no-js ie6 oldie" lang="en"> <![endif]-->
<!--[if IE 7]> <html class="no-js ie7 oldie" lang="en"> <![endif]-->
<!--[if IE 8]> <html class="no-js ie8 oldie" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<head>
<title><?php echo $options['title']; ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="description" content="<?php echo $options['tagline'];?>" />
<meta name="author" content="<?php echo $options['title']; ?>">
<?php if ($options['colors']) { ?>
<link rel="icon" href="<?php echo $base_url ?>/img/favicon.png" type="image/x-icon">
<?php } else { ?>
<link rel="icon" href="<?php echo $base_url ?>/img/favicon-<?php echo $options['theme'];?>.png" type="image/x-icon">
<?php } ?>
<!-- Mobile -->
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Font -->
<link href='http://fonts.googleapis.com/css?family=Roboto+Slab:400,700,300,100' rel='stylesheet' type='text/css'>
<!-- LESS -->
<?php if ($options['colors']) { ?>
<style type="text/less">
<?php foreach($options['colors'] as $k => $v) { ?>
@<?php echo $k;?>: <?php echo $v;?>;
<?php } ?>
@import "<?php echo $base_url ?>/less/import/daux-base.less";
</style>
<script src="<?php echo $base_url ?>/js/less.min.js"></script>
<?php } else { ?>
<link rel="stylesheet" href="<?php echo $base_url ?>/css/daux-<?php echo $options['theme'];?>.css">
<?php } ?>
</head>
<body>
<?php if ($homepage) { ?>
<!-- Hompage -->
<div class="navbar navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="brand pull-left" href="<?php echo $base_url ?><?php echo $homepage_url;?>"><?php echo $options['title']; ?></a>
<p class="navbar-text pull-right">
Generated by <a href="http://daux.io">Daux.io</a>
</p>
</div>
</div>
</div>
<div class="homepage-hero well container-fluid">
<div class="container">
<div class="row">
<div class="text-center span12">
<?php if ($options['tagline']) { ?>
<h2><?php echo $options['tagline'];?></h2>
<?php } ?>
</div>
</div>
<div class="row">
<div class="span10 offset1">
<?php if ($options['image']) { ?>
<img class="homepage-image" src="<?php echo $base_url ?>/<?php echo $options['image'];?>" alt="<?php echo $options['title'];?>">
<?php } ?>
</div>
</div>
</div>
</div>
<div class="hero-buttons container-fluid">
<div class="container">
<div class="row">
<div class="text-center span12">
<?php if ($options['repo']) { ?>
<a href="https://github.com/<?php echo $options['repo']; ?>" class="btn btn-secondary btn-hero">
View On GitHub
</a>
<?php } ?>
<?php if (count($options['languages']) > 0) { ?>
<?php foreach ($options['languages'] as $language_key => $language_name) { ?>
<a href="<?php echo $base_url . "/" . $language_key . "/"; ?>" class="btn btn-primary btn-hero">
<?php echo $language_name; ?>
</a>
<?php } ?>
<?php } else { ?>
<a href="<?php echo $docs_url;?>" class="btn btn-primary btn-hero">
View Documentation
</a>
<?php } ?>
</div>
</div>
</div>
</div>
<div class="homepage-content container-fluid">
<div class="container">
<div class="row">
<div class="span10 offset1">
<?php echo $page['html'];?>
</div>
</div>
</div>
</div>
<div class="homepage-footer well container-fluid">
<div class="container">
<div class="row">
<div class="span5 offset1">
<?php if (!empty($options['links'])) { ?>
<ul class="footer-nav">
<?php foreach($options['links'] as $name => $url) { ?>
<li><a href="<?php echo $url;?>" target="_blank"><?php echo $name;?></a></li>
<?php } ?>
</ul>
<?php } ?>
</div>
<div class="span5">
<div class="pull-right">
<?php if (!empty($options['twitter'])) { ?>
<?php foreach($options['twitter'] as $handle) { ?>
<div class="twitter">
<iframe allowtransparency="true" frameborder="0" scrolling="no" style="width:162px; height:20px;" src="https://platform.twitter.com/widgets/follow_button.html?screen_name=<?php echo $handle;?>&amp;show_count=false"></iframe>
</div>
<?php } ?>
<?php } ?>
</div>
</div>
</div>
</div>
</div>
<?php } else { ?>
<!-- Docs -->
<?php if ($options['repo']) { ?>
<a href="https://github.com/<?php echo $options['repo']; ?>" target="_blank" id="github-ribbon"><img src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png" alt="Fork me on GitHub"></a>
<?php } ?>
<div class="container-fluid fluid-height wrapper">
<div class="navbar navbar-fixed-top">
<div class="navbar-inner">
<a class="brand pull-left" href="<?php echo $base_url ?><?php echo $homepage_url;?>"><?php echo $options['title']; ?></a>
<p class="navbar-text pull-right">
Generated by <a href="http://daux.io">Daux.io</a>
</p>
</div>
</div>
<div class="row-fluid columns content">
<div class="left-column article-tree span3">
<!-- For Mobile -->
<div class="responsive-collapse">
<button type="button" class="btn btn-sidebar" id="menu-spinner-button">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<div id="sub-nav-collapse" class="sub-nav-collapse">
<!-- Navigation -->
<?php echo build_nav($tree, $url_params); ?>
<?php if (!empty($options['links']) || !empty($options['twitter'])) { ?>
<div class="well well-sidebar">
<!-- Links -->
<?php foreach($options['links'] as $name => $url) { ?>
<a href="<?php echo $url;?>" target="_blank"><?php echo $name;?></a><br>
<?php } ?>
<!-- Twitter -->
<?php foreach($options['twitter'] as $handle) { ?>
<div class="twitter">
<hr/>
<iframe allowtransparency="true" frameborder="0" scrolling="no" style="width:162px; height:20px;" src="https://platform.twitter.com/widgets/follow_button.html?screen_name=<?php echo $handle;?>&amp;show_count=false"></iframe>
</div>
<?php } ?>
</div>
<?php } ?>
</div>
</div>
<div class="right-column <?php echo ($options['float']?'float-view':''); ?> content-area span9">
<div class="content-page">
<article>
<?php if($options['date_modified'] && isset($page['modified'])) { ?>
<div class="page-header sub-header clearfix">
<h1><?php echo $page['title'];?>
<?php if($options["file_editor"]) { ?>
<a href="javascript:;" id="editThis" class="btn">Edit this page</a>
<?php } ?>
</h1>
<span style="float: left; font-size: 10px; color: gray;">
<?php echo date("l, F j, Y", $page['modified']);?>
</span>
<span style="float: right; font-size: 10px; color: gray;">
<?php echo date ("g:i A", $page['modified']);?>
</span>
</div>
<?php } else { ?>
<div class="page-header">
<h1><?php echo $page['title'];?>
<?php if($options["file_editor"]) { ?>
<a href="javascript:;" id="editThis" class="btn">Edit this page</a>
<?php } ?>
</h1>
</div>
<?php } ?>
<?php echo $page['html'];?>
<?php if($options["file_editor"]) { ?>
<div class="editor <?php if(!$options['date_modified']) { ?>paddingTop<?php } ?>">
<h3>You are editing <?php echo $page['path']; ?>&nbsp;<a href="javascript:;" class="closeEditor btn btn-warning">Close</a></h3>
<div class="navbar navbar-inverse navbar-default navbar-fixed-bottom" role="navigation">
<div class="navbar-inner">
<a href="javascript:;" class="save_editor btn btn-primary navbar-btn pull-right">Save file</a>
</div>
</div>
<textarea id="markdown_editor"><?php echo $page['markdown'];?></textarea>
<div class="clearfix"></div>
</div>
<?php } ?>
</article>
</div>
</div>
</div>
</div>
<?php } ?>
<?php if ($options['google_analytics']) { ?>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', '<?php echo $options['google_analytics'];?>', '<?php echo $_SERVER['HTTP_HOST'];?>');
ga('send', 'pageview');
</script>
<?php } ?>
<?php if ($options['piwik_analytics']) { ?>
<script type="text/javascript">
var _paq = _paq || [];
_paq.push(["trackPageView"]);
_paq.push(["enableLinkTracking"]);
(function() {
var u=(("https:" == document.location.protocol) ? "https" : "http") + "://<?php echo $options['piwik_analytics'];?>/";
_paq.push(["setTrackerUrl", u+"piwik.php"]);
_paq.push(["setSiteId", <?php echo $options['piwik_analytics_id'];?>]);
var d=document, g=d.createElement("script"), s=d.getElementsByTagName("script")[0]; g.type="text/javascript";
g.defer=true; g.async=true; g.src=u+"piwik.js"; s.parentNode.insertBefore(g,s);
})();
</script>
<?php } ?>
<!-- hightlight.js -->
<script src="<?php echo $base_url ?>/js/highlight.min.js"></script>
<script>hljs.initHighlightingOnLoad();</script>
<!-- Navigation -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.0/jquery.min.js"></script>
<?php if($options["file_editor"]) { ?>
<!-- Front end file editor -->
<script src="<?php echo $base_url ?>/js/editor.js"></script>
<?php } ?>
<script>
if (typeof jQuery == 'undefined') {
document.write(unescape("%3Cscript src='<?php echo $base_url ?>/js/jquery-1.10.2.min.js' type='text/javascript'%3E%3C/script%3E"));
}
</script>
<script src="<?php echo $base_url ?>/js/bootstrap.min.js"></script>
<script src="<?php echo $base_url ?>/js/custom.js"></script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</body>
</html>

View File

@ -20,6 +20,7 @@ require_once('libs/markdown_extended.php');
$homepage = (get_uri(false) === "") ? true : false;
// Stores the base url under which daux is running
global $base_url;
$base_url = '/';
// Set the base url of where the script is located
@ -28,6 +29,12 @@ if (isset($_SERVER['SCRIPT_NAME']))
$base_url = substr($_SERVER['SCRIPT_NAME'], 0, strrpos($_SERVER['SCRIPT_NAME'] , '/')); // find the full URL to this application from server root
}
function get_base_url()
{
global $base_url;
return $base_url;
};
// Daux.io Functions
function get_options() {
$options = array(
@ -45,10 +52,11 @@ function get_options() {
'clean_urls' => true,
'google_analytics' => false,
'piwik_analytics' => false,
'piwik_analytics_id' => 1,
'ignore' => array(),
'languages' => array(),
'file_editor' => false
'piwik_analytics_id' => 1,
'ignore' => array(),
'languages' => array(),
'file_editor' => false,
'template' => 'default'
);
// Load User Config
@ -136,7 +144,7 @@ function load_page($tree, $url_params) {
$page['html'] = "<h3>Oh No. That page doesn't exist</h3>";
}
return $page;
}
@ -168,7 +176,7 @@ function find_branch($tree, $url_params) {
}
function url_path() {
$url = parse_url($_SERVER['REQUEST_URI']);
$url = parse_url((isset($_SERVER['REQUEST_URI']))?$_SERVER['REQUEST_URI']:'');
$url = $url['path'];
return $url;
}
@ -229,7 +237,7 @@ function build_nav($tree, $url_params) {
$html .= '<a href="#" class="aj-nav folder">'.$val['name'].'</a>';
$html .= build_nav($val['tree'], $url_params);
} else {
$html .= '<a href="'.$val['url'].'">'.$val['name'].'</a>';
$html .= '<a href="'.$val['url'].((CLI)?'.html':'').'">'.$val['name'].'</a>';
}
$html .= '</li>';
@ -263,7 +271,7 @@ function get_ignored() {
return $all_ignored;
}
function get_tree($path = '.', $clean_path = '', $title = '', $first = true, $language = null){
function get_tree($path = '.', $clean_path = '', $title = '', $first = true, $language = null, &$flat_tree = null){
$options = get_options();
$tree = array();
$ignore = get_ignored();
@ -281,7 +289,7 @@ function get_tree($path = '.', $clean_path = '', $title = '', $first = true, $la
// Sort paths
sort($paths);
if ($first && $language !== null) {
$language_path = $language . "/";
} else {
@ -332,7 +340,9 @@ function get_tree($path = '.', $clean_path = '', $title = '', $first = true, $la
'path' => $full_path,
'clean' => $clean_sort,
'url' => $url,
'tree'=> get_tree($full_path, $url, $full_title, false, $language)
'tree'=> (isset($flat_tree) && $flat_tree!==NULL)?
get_tree($full_path, $url, $full_title, false, $language, $flat_tree):
get_tree($full_path, $url, $full_title, false, $language)
);
} else {
// File
@ -344,6 +354,9 @@ function get_tree($path = '.', $clean_path = '', $title = '', $first = true, $la
'clean' => $clean_sort,
'url' => $url,
);
if(isset($flat_tree) && $flat_tree!==NULL)
array_push($flat_tree, $tree[$clean_sort]);
}
}
$index++;
@ -423,6 +436,125 @@ function handle_editor_post($post, $page) {
if(file_exists($page["path"])) {
file_put_contents($page["path"], $post["markdown"]);
} else {
throw new Exception("File doesn't exists", 1);
throw new Exception("File doesn't exist", 1);
}
}
}
/**
* Generate the page using the correct $url_params
*/
function generate_page($options, $url_params, $base_url, $return=FALSE, &$flat_tree=NULL){
//documentation folder defined in various folder languages
if (count($options['languages']) > 0 && count($url_params) > 0 && strlen($url_params[0]) > 0) {
$language = array_shift($url_params);
$base_path = $options['docs_path']. DIRECTORY_SEPARATOR . $language;
} else {
$language = null;
$base_path = $options['docs_path'];
}
// If a timezone has been set in the config file, override the default PHP timezone for this application.
if(isset($options['timezone']))
{
date_default_timezone_set($options['timezone']);
}
$tree = (isset($flat_tree))?
get_tree($base_path, $base_url, '', true, $language,$flat_tree):
get_tree($base_path, $base_url, '', true, $language);
// If a language is set in the config, rewrite urls based on the language
if (! isset($language) || $language === null) {
$homepage_url = homepage_url($tree);
} else {
$homepage_url = "/";
}
// Redirect to docs, if there is no homepage
if ($homepage_url !== '/') {
header('Location: '.$homepage_url);
}
$docs_url = docs_url($tree);
$page = load_page($tree, $url_params);
// Handle AJAX requests for file editing
if(isset($_POST["markdown"]) && $options["file_editor"] === true) {
handle_editor_post($_POST, $page);
die;
}
if($url_params[0]=='')
$homepage = TRUE;
else
$homepage = FALSE;
ob_start();
include('template/'.$options['template'].'.tpl');
if ($return === TRUE)
{
$buffer = ob_get_contents();
@ob_end_clean();
return $buffer;
}else{
ob_end_flush();
@ob_end_clean();
}
}
function load_tpl_block($file, $options, $base_url){
ob_start();
include('template/'.$file.'.tpl');
$buffer = ob_get_contents();
@ob_end_clean();
return $buffer;
}
function copy_recursive($source, $dest){
$src_folder=str_replace(array('.','/'), '', $source);
@mkdir($dest.DIRECTORY_SEPARATOR.$src_folder);
foreach (
$iterator = new RecursiveIteratorIterator(
new RecursiveDirectoryIterator($source, RecursiveDirectoryIterator::SKIP_DOTS),
RecursiveIteratorIterator::SELF_FIRST) as $item
) {
if ($item->isDir()) {
@mkdir($dest . DIRECTORY_SEPARATOR . $src_folder . DIRECTORY_SEPARATOR .$iterator->getSubPathName());
} else {
@copy($item, $dest . DIRECTORY_SEPARATOR .$src_folder. DIRECTORY_SEPARATOR .$iterator->getSubPathName());
}
}
}
function clean_directory($directory){
foreach (
$iterator = new RecursiveIteratorIterator(
new RecursiveDirectoryIterator($directory, RecursiveDirectoryIterator::SKIP_DOTS),
RecursiveIteratorIterator::SELF_FIRST) as $item
) {
@unlink($directory.DIRECTORY_SEPARATOR.$iterator->getSubPathName());
}
}
function relative_base($count){
$relative = '';
for ($i=0; ($i < $count); $i++ ){
if (! ($i == 0))
$relative .= '/';
$relative .= '..';
}
return $relative;
}
function clean_copy_assets($path){
@mkdir($path);
//Clean
clean_directory($path);
//Copy assets
copy_recursive('./css', $path.'/');
copy_recursive('./img', $path.'/');
copy_recursive('./js', $path.'/');
}

275
template/default.tpl Normal file
View File

@ -0,0 +1,275 @@
<!doctype html>
<!--[if lt IE 7]> <html class="no-js ie6 oldie" lang="en"> <![endif]-->
<!--[if IE 7]> <html class="no-js ie7 oldie" lang="en"> <![endif]-->
<!--[if IE 8]> <html class="no-js ie8 oldie" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<head>
<title><?php echo $options['title']; ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="description" content="<?php echo $options['tagline'];?>" />
<meta name="author" content="<?php echo $options['title']; ?>">
<?php if ($options['colors']) { ?>
<link rel="icon" href="<?php echo $base_url ?>/img/favicon.png" type="image/x-icon">
<?php } else { ?>
<link rel="icon" href="<?php echo $base_url ?>/img/favicon-<?php echo $options['theme'];?>.png" type="image/x-icon">
<?php } ?>
<!-- Mobile -->
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Font -->
<link href='http://fonts.googleapis.com/css?family=Roboto+Slab:400,700,300,100' rel='stylesheet' type='text/css'>
<!-- LESS -->
<?php if ($options['colors']) { ?>
<style type="text/less">
<?php foreach($options['colors'] as $k => $v) { ?>
@<?php echo $k;?>: <?php echo $v;?>;
<?php } ?>
@import "<?php echo $base_url ?>/less/import/daux-base.less";
</style>
<script src="<?php echo $base_url ?>/js/less.min.js"></script>
<?php } else { ?>
<link rel="stylesheet" href="<?php echo $base_url ?>/css/daux-<?php echo $options['theme'];?>.css">
<?php } ?>
</head>
<body>
<?php if ($homepage) { ?>
<!-- Hompage -->
<div class="navbar navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="brand pull-left" href="<?php echo $base_url ?><?php echo $homepage_url;?>"><?php echo $options['title']; ?></a>
<p class="navbar-text pull-right">
Generated by <a href="http://daux.io">Daux.io</a>
</p>
</div>
</div>
</div>
<div class="homepage-hero well container-fluid">
<div class="container">
<div class="row">
<div class="text-center span12">
<?php if ($options['tagline']) { ?>
<h2><?php echo $options['tagline'];?></h2>
<?php } ?>
</div>
</div>
<div class="row">
<div class="span10 offset1">
<?php if ($options['image']) { ?>
<img class="homepage-image" src="<?php echo $base_url ?>/<?php echo $options['image'];?>" alt="<?php echo $options['title'];?>">
<?php } ?>
</div>
</div>
</div>
</div>
<div class="hero-buttons container-fluid">
<div class="container">
<div class="row">
<div class="text-center span12">
<?php if ($options['repo']) { ?>
<a href="https://github.com/<?php echo $options['repo']; ?>" class="btn btn-secondary btn-hero">
View On GitHub
</a>
<?php } ?>
<?php if (count($options['languages']) > 0) { ?>
<?php foreach ($options['languages'] as $language_key => $language_name) { ?>
<a href="<?php echo $base_url . "/" . $language_key . "/"; ?>" class="btn btn-primary btn-hero">
<?php echo $language_name; ?>
</a>
<?php } ?>
<?php } else { ?>
<a href="<?php echo $docs_url;?>" class="btn btn-primary btn-hero">
View Documentation
</a>
<?php } ?>
</div>
</div>
</div>
</div>
<div class="homepage-content container-fluid">
<div class="container">
<div class="row">
<div class="span10 offset1">
<?php echo $page['html'];?>
</div>
</div>
</div>
</div>
<div class="homepage-footer well container-fluid">
<div class="container">
<div class="row">
<div class="span5 offset1">
<?php if (!empty($options['links'])) { ?>
<ul class="footer-nav">
<?php foreach($options['links'] as $name => $url) { ?>
<li><a href="<?php echo $url;?>" target="_blank"><?php echo $name;?></a></li>
<?php } ?>
</ul>
<?php } ?>
</div>
<div class="span5">
<div class="pull-right">
<?php if (!empty($options['twitter'])) { ?>
<?php foreach($options['twitter'] as $handle) { ?>
<div class="twitter">
<iframe allowtransparency="true" frameborder="0" scrolling="no" style="width:162px; height:20px;" src="https://platform.twitter.com/widgets/follow_button.html?screen_name=<?php echo $handle;?>&amp;show_count=false"></iframe>
</div>
<?php } ?>
<?php } ?>
</div>
</div>
</div>
</div>
</div>
<?php } else { ?>
<!-- Docs -->
<?php if ($options['repo']) { ?>
<a href="https://github.com/<?php echo $options['repo']; ?>" target="_blank" id="github-ribbon"><img src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png" alt="Fork me on GitHub"></a>
<?php } ?>
<div class="container-fluid fluid-height wrapper">
<div class="navbar navbar-fixed-top">
<div class="navbar-inner">
<a class="brand pull-left" href="<?php echo $base_url ?><?php echo $homepage_url;?>"><?php echo $options['title']; ?></a>
<p class="navbar-text pull-right">
Generated by <a href="http://daux.io">Daux.io</a>
</p>
</div>
</div>
<div class="row-fluid columns content">
<div class="left-column article-tree span3">
<!-- For Mobile -->
<div class="responsive-collapse">
<button type="button" class="btn btn-sidebar" id="menu-spinner-button">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<div id="sub-nav-collapse" class="sub-nav-collapse">
<!-- Navigation -->
<?php echo build_nav($tree, $url_params); ?>
<?php if (!empty($options['links']) || !empty($options['twitter'])) { ?>
<div class="well well-sidebar">
<!-- Links -->
<?php foreach($options['links'] as $name => $url) { ?>
<a href="<?php echo $url;?>" target="_blank"><?php echo $name;?></a><br>
<?php } ?>
<!-- Twitter -->
<?php foreach($options['twitter'] as $handle) { ?>
<div class="twitter">
<hr/>
<iframe allowtransparency="true" frameborder="0" scrolling="no" style="width:162px; height:20px;" src="https://platform.twitter.com/widgets/follow_button.html?screen_name=<?php echo $handle;?>&amp;show_count=false"></iframe>
</div>
<?php } ?>
</div>
<?php } ?>
</div>
</div>
<div class="right-column <?php echo ($options['float']?'float-view':''); ?> content-area span9">
<div class="content-page">
<article>
<?php if($options['date_modified'] && isset($page['modified'])) { ?>
<div class="page-header sub-header clearfix">
<h1><?php echo $page['title'];?>
<?php if($options["file_editor"]) { ?>
<a href="javascript:;" id="editThis" class="btn">Edit this page</a>
<?php } ?>
</h1>
<span style="float: left; font-size: 10px; color: gray;">
<?php echo date("l, F j, Y", $page['modified']);?>
</span>
<span style="float: right; font-size: 10px; color: gray;">
<?php echo date ("g:i A", $page['modified']);?>
</span>
</div>
<?php } else { ?>
<div class="page-header">
<h1><?php echo (isset($page['title']))?$page['title']:$options['title'];?></h1>
<?php if($options["file_editor"]) { ?>
<a href="javascript:;" id="editThis" class="btn">Edit this page</a>
<?php } ?>
</h1>
</div>
<?php } ?>
<?php echo $page['html'];?>
<?php if($options["file_editor"]) { ?>
<div class="editor <?php if(!$options['date_modified']) { ?>paddingTop<?php } ?>">
<h3>You are editing <?php echo $page['path']; ?>&nbsp;<a href="javascript:;" class="closeEditor btn btn-warning">Close</a></h3>
<div class="navbar navbar-inverse navbar-default navbar-fixed-bottom" role="navigation">
<div class="navbar-inner">
<a href="javascript:;" class="save_editor btn btn-primary navbar-btn pull-right">Save file</a>
</div>
</div>
<textarea id="markdown_editor"><?php echo $page['markdown'];?></textarea>
<div class="clearfix"></div>
</div>
<?php } ?>
</article>
</div>
</div>
</div>
</div>
<?php } ?>
<?php if ($options['google_analytics']) { ?>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', '<?php echo $options['google_analytics'];?>', '<?php echo (isset($_SERVER['HTTP_HOST']))?$_SERVER['HTTP_HOST']:''; ?>');
ga('send', 'pageview');
</script>
<?php } ?>
<?php if ($options['piwik_analytics']) { ?>
<script type="text/javascript">
var _paq = _paq || [];
_paq.push(["trackPageView"]);
_paq.push(["enableLinkTracking"]);
(function() {
var u=(("https:" == document.location.protocol) ? "https" : "http") + "://<?php echo $options['piwik_analytics'];?>/";
_paq.push(["setTrackerUrl", u+"piwik.php"]);
_paq.push(["setSiteId", <?php echo $options['piwik_analytics_id'];?>]);
var d=document, g=d.createElement("script"), s=d.getElementsByTagName("script")[0]; g.type="text/javascript";
g.defer=true; g.async=true; g.src=u+"piwik.js"; s.parentNode.insertBefore(g,s);
})();
</script>
<?php } ?>
<!-- hightlight.js -->
<script src="<?php echo $base_url ?>/js/highlight.min.js"></script>
<script>hljs.initHighlightingOnLoad();</script>
<!-- Navigation -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.0/jquery.min.js"></script>
<?php if($options["file_editor"]) { ?>
<!-- Front end file editor -->
<script src="<?php echo $base_url ?>/js/editor.js"></script>
<?php } ?>
<script>
if (typeof jQuery == 'undefined') {
document.write(unescape("%3Cscript src='<?php echo $base_url ?>/js/jquery-1.10.2.min.js' type='text/javascript'%3E%3C/script%3E"));
}
</script>
<script src="<?php echo $base_url ?>/js/bootstrap.min.js"></script>
<script src="<?php echo $base_url ?>/js/custom.js"></script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</body>
</html>

View File

@ -0,0 +1,2 @@
</body>
</html>

View File

@ -0,0 +1,45 @@
<!DOCTYPE html>
<html>
<head>
<title><?php echo $options['title']; ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="description" content="<?php echo $options['tagline'];?>" />
<meta name="author" content="<?php echo $options['title']; ?>">
<?php if ($options['colors']) { ?>
<link rel="icon" href="<?php echo $base_url ?>/img/favicon.png" type="image/x-icon">
<?php } else { ?>
<link rel="icon" href="<?php echo $base_url ?>/img/favicon-<?php echo $options['theme'];?>.png" type="image/x-icon">
<?php } ?>
<!-- LESS -->
<?php if ($options['colors']) { ?>
<style type="text/less">
<?php foreach($options['colors'] as $k => $v) { ?>
@<?php echo $k;?>: <?php echo $v;?>;
<?php } ?>
@import "<?php echo $base_url ?>/less/import/daux-base.less";
</style>
<script src="<?php echo $base_url ?>/js/less.min.js"></script>
<?php } else { ?>
<link rel="stylesheet" href="<?php echo $base_url ?>/css/daux-<?php echo $options['theme'];?>.css">
<?php } ?>
<link rel="stylesheet" href="<?php echo $base_url ?>/css/full-doc.css">
<!-- hightlight.js -->
<script src="<?php echo $base_url ?>/js/highlight.min.js"></script>
<script>hljs.initHighlightingOnLoad();</script>
<!-- Navigation -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.0/jquery.min.js"></script>
<script>
if (typeof jQuery == 'undefined') {
document.write(unescape("%3Cscript src='<?php echo $base_url ?>/js/jquery-1.10.2.min.js' type='text/javascript'%3E%3C/script%3E"));
}
</script>
<script src="<?php echo $base_url ?>/js/bootstrap.min.js"></script>
<script src="<?php echo $base_url ?>/js/custom.js"></script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body>

5
template/full-doc.tpl Normal file
View File

@ -0,0 +1,5 @@
<div class="page-header">
<h1><?php echo (isset($page['title']))?$page['title']:$options['title'];?></h1>
</div>
<?php echo $page['html'];?>