Add support for passing config.json and Output directory as parameters in CLI

Remove unnecessary line from libs/functions.php

Add './static' to gitignore

Add Default Timezone to prevent Date() Warnings
This commit is contained in:
Gautham Warrier 2014-03-08 11:31:32 +05:30
parent c71a6e3c04
commit 33b8144304
6 changed files with 66 additions and 14 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
node_modules
.DS_Store
/sftp-config.json
static

View File

@ -15,6 +15,7 @@
* Git/SVN Friendly
* Supports Google Analytics and Piwik Analytics
* Optional code float layout
* Static Output Generation
## Demos
@ -317,11 +318,12 @@ Generating a complete set of pages, with navigation
php index.php generate
```
Generating just one big file with each doc concatenated
You can optionally pass the location of config.json and (also optionally) the output directory for the static file
```bash
php index.php full-doc
php index.php generate '\path\to\config.json' 'out\dir'
```
If the directory has a '\' at the beginning, it is treated as an absolute path, otherwise as relative to the Daux Directory.
## Running on IIS

View File

@ -15,6 +15,7 @@
* Git/SVN Friendly
* Supports Google Analytics and Piwik Analytics
* Optional code float layout
* Static Output Generation
## Demos
@ -22,6 +23,8 @@ This is a list of sites using Daux.io:
* [Daux.io](http://daux.io)
* [Munee: Standalone PHP 5.3 Asset Optimisation & Manipulation](http://mun.ee)
* [ICADMIN: An admin panel powered by CodeIgniter.](http://istocode.com/shared/ic-admin/)
* [Daux.io in Chinese - Demonstrates muti-language installations](http://daux.emx2.co.uk/)
Do you use Daux.io? Send me a pull request or open an [issue](https://github.com/justinwalsh/daux.io/issues) and I will add you to the list.
@ -131,13 +134,21 @@ To create a custom color scheme, set the `theme` property to `custom` and then d
```
###Code Floating:
By deafult your code blocks will be floated to a column on the right side of your content. To disable this feature, set the `float` property to `false`.
By default your code blocks will be floated to a column on the right side of your content. To disable this feature, set the `float` property to `false`.
```json
{
"float": false
}
```
###Toggling Code Blocks
Some users might wish to hide the code blocks & view just the documentation. By setting the `toggle_code` property to `true`, you can offer a toggle button on the page.
```json
{
"toggle_code": true
}
```
###GitHub Repo:
@ -172,6 +183,8 @@ Include custom links in the sidebar.
```
###File editor:
![File editor](https://f.cloud.github.com/assets/1788727/1954191/44358884-81d1-11e3-859d-254b9fb81808.png)
Enable front-end Markdown editor. _Disabled by default_.
```json
@ -245,6 +258,37 @@ If your server does not have a default timezone set in php.ini, it may return er
}
```
###Multi-language
Enables multi-language support which needs seperate directories for each language in `docs/` folder.
```json
{
"languages": { "en": "English", "de": "German" }
}
```
Directory structure:
```
├── docs/
│ ├── index.md
│ ├── en
│ │ ├── 00_Getting_Started.md
│ │ ├── 01_Examples
│ │ │ ├── 01_GitHub_Flavored_Markdown.md
│ │ │ ├── 05_Code_Highlighting.md
│ │ ├── 05_More_Examples
│ │ │ ├── Hello_World.md
│ │ │ ├── 05_Code_Highlighting.md
│ ├── de
│ │ ├── 00_Getting_Started.md
│ │ ├── 01_Examples
│ │ │ ├── 01_GitHub_Flavored_Markdown.md
│ │ │ ├── 05_Code_Highlighting.md
│ │ ├── 05_More_Examples
│ │ │ ├── Hello_World.md
│ │ │ ├── 05_Code_Highlighting.md
```
## Running Remotely
Copy the files from the repo to a web server that can run PHP 5.3 or greater.
@ -274,12 +318,12 @@ Generating a complete set of pages, with navigation
php index.php generate
```
Generating just one big file with each doc concatenated
You can optionally pass the location of config.json and (also optionally) the output directory for the static file
```bash
php index.php full-doc
php index.php generate '\path\to\config.json' 'out\dir'
```
If the directory has a '\' at the beginning, it is treated as an absolute path, otherwise as relative to the Daux Directory.
## Running on IIS

View File

@ -75,7 +75,7 @@ if(isset($argv)){
switch ($argv[1]) {
//Generate static web documentation
case 'generate':
generate_static();
generate_static((isset($argv[3])) ? $argv[3] : '');
echo "Finished\n";
echo "The documentation is generated in static folder\n";
break;

View File

@ -3,12 +3,12 @@
require_once(dirname( __FILE__)."/markdown_extended.php");
$tree = array();
$base = dirname(dirname(__FILE__));
$options = get_options();
$options = get_options(isset($argv[2]) ? $argv[2] : '');
$docs_path = $base . '/' . $options['docs_path'];
$multilanguage = !empty($options['languages']) ? TRUE : FALSE;
// Options
function get_options() {
function get_options($config_file) {
global $base;
$options = array(
'title' => "Documentation",
@ -33,7 +33,8 @@
'template' => 'default'
);
// Load User Config
$config_file = $base . '/docs/config.json';
$config_file = (($config_file === '') ? 'docs/config.json' : $config_file);
if (substr($config_file, 0, 1) !== '/') $config_file = $base . '/' . $config_file;
if (file_exists($config_file)) {
$config = json_decode(file_get_contents($config_file), true);
$options = array_merge($options, $config);
@ -53,6 +54,7 @@
exit;
}
}
if (!ini_get('date.timezone')) date_default_timezone_set('GMT');
return $options;
}
@ -143,7 +145,6 @@
if (!$file) {
$page['path'] = '';
$page['markdown'] = '';
$page['content'] = '';
$page['title'] = 'Oh No';
$page['content'] = "<h3>Oh No. That page doesn't exist</h3>";
$options['file_editor'] = false;

View File

@ -1,10 +1,14 @@
<?php
// Generate Static Documentation
function generate_static() {
function generate_static($out_dir) {
global $tree, $base, $docs_path, $output_path, $options, $mode, $multilanguage, $output_language;
$mode = 'Static';
$output_path = $base . '/static';
if ($out_dir === '') $output_path = $base . '/static';
else {
if (substr($out_dir, 0, 1) !== '/') $output_path = $base . '/' . $out_dir;
else $output_path = $out_dir;
}
clean_copy_assets($output_path);
build_tree();
if (!$multilanguage) generate_static_branch($tree, '');