Merge pull request #98 from r0n22/master

Commit Piwik Tracking ID
This commit is contained in:
Denis Kisselev 2013-10-28 00:14:04 -07:00
commit 6b0fb5b7f0
5 changed files with 348 additions and 331 deletions

666
README.md
View File

@ -1,329 +1,337 @@
**Daux.io** is an documentation generator that uses a simple folder structure and Markdown files to create custom documentation on the fly. It helps you create great looking documentation in a developer friendly way. **Daux.io** is an documentation generator that uses a simple folder structure and Markdown files to create custom documentation on the fly. It helps you create great looking documentation in a developer friendly way.
## Features ## Features
* 100% Mobile Responsive * 100% Mobile Responsive
* Supports GitHub Flavored Markdown * Supports GitHub Flavored Markdown
* Auto created homepage/landing page * Auto created homepage/landing page
* Auto Syntax Highlighting * Auto Syntax Highlighting
* Auto Generated Navigation * Auto Generated Navigation
* 4 Built-In Themes or roll your own * 4 Built-In Themes or roll your own
* Functional, Flat Design Style * Functional, Flat Design Style
* Shareable/Linkable SEO Friendly URLs * Shareable/Linkable SEO Friendly URLs
* Built On Bootstrap * Built On Bootstrap
* No Build Step * No Build Step
* Git/SVN Friendly * Git/SVN Friendly
* Supports Google Analytics and Piwik Analytics * Supports Google Analytics and Piwik Analytics
* Optional code float layout * Optional code float layout
## Demos ## Demos
This is a list of sites using Daux.io: This is a list of sites using Daux.io:
* [Daux.io](http://daux.io) * [Daux.io](http://daux.io)
* [Munee: Standalone PHP 5.3 Asset Optimisation & Manipulation](http://mun.ee) * [Munee: Standalone PHP 5.3 Asset Optimisation & Manipulation](http://mun.ee)
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. 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.
## Download ## Download
Download this repository as a zip, and unpack. Copy the files to a web server that can run PHP 5.3 or greater. You can also run the documentation locally using Grunt.js, which is covered at the end of this readme. Download this repository as a zip, and unpack. Copy the files to a web server that can run PHP 5.3 or greater. You can also run the documentation locally using Grunt.js, which is covered at the end of this readme.
## Folders ## Folders
By default, the generator will look for folders in the `/docs` folder. Add your folders inside the `/docs` folder. This project contains some example folders and files to get you started. By default, the generator will look for folders in the `/docs` folder. Add your folders inside the `/docs` folder. This project contains some example folders and files to get you started.
You can nest folders any number of levels to get the exact structure you want. The folder structure will be converted to the nested navigation. You can nest folders any number of levels to get the exact structure you want. The folder structure will be converted to the nested navigation.
If you'd prefer to keep your docs somewhere else (like outside of the daux.io root directory) you can specify your docs path in the `config.json` file. If you'd prefer to keep your docs somewhere else (like outside of the daux.io root directory) you can specify your docs path in the `config.json` file.
## Files ## Files
The generator will look for Markdown `*.md` files inside the `/docs` folder and any of the subfolders within /docs. The generator will look for Markdown `*.md` files inside the `/docs` folder and any of the subfolders within /docs.
You must use the `.md` file extension for your files. Also, you must use underscores instead of spaces. Here are some example file names and what they will be converted to: You must use the `.md` file extension for your files. Also, you must use underscores instead of spaces. Here are some example file names and what they will be converted to:
**Good:** **Good:**
* 01_Getting_Started.md = Getting Started * 01_Getting_Started.md = Getting Started
* API_Calls.md = API Calls * API_Calls.md = API Calls
* 200_Something_Else-Cool.md = Something Else-Cool * 200_Something_Else-Cool.md = Something Else-Cool
**Bad:** **Bad:**
* File Name With Space.md = FAIL * File Name With Space.md = FAIL
## Sorting ## Sorting
To sort your files and folders in a specific way, you can prefix them with a number and underscore, e.g. `/docs/01_Hello_World.md` and `/docs/05_Features.md` This will list *Hello World* before *Features*, overriding the default alpha-numeric sorting. The numbers will be stripped out of the navigation and urls. To sort your files and folders in a specific way, you can prefix them with a number and underscore, e.g. `/docs/01_Hello_World.md` and `/docs/05_Features.md` This will list *Hello World* before *Features*, overriding the default alpha-numeric sorting. The numbers will be stripped out of the navigation and urls.
## Landing page ## Landing page
If you want to create a beautiful landing page for your project, simply create a `index.md` file in the root of the `/docs` folder. This file will then be used to create a landing page. You can also add a tagline and image to this page using the config file like this: If you want to create a beautiful landing page for your project, simply create a `index.md` file in the root of the `/docs` folder. This file will then be used to create a landing page. You can also add a tagline and image to this page using the config file like this:
```json ```json
{ {
"title": "Daux.io", "title": "Daux.io",
"tagline": "The Easiest Way To Document Your Project", "tagline": "The Easiest Way To Document Your Project",
"image": "img/app.png" "image": "img/app.png"
} }
``` ```
Note: The image can be a local or remote image. Note: The image can be a local or remote image.
## Configuration ## Configuration
To customize the look and feel of your documentation, you can create a `config.json` file in the of the `/docs` folder. The `config.json` file is a simple JSON object that you can use to change some of the basic settings of the documentation. To customize the look and feel of your documentation, you can create a `config.json` file in the of the `/docs` folder. The `config.json` file is a simple JSON object that you can use to change some of the basic settings of the documentation.
###Title: ###Title:
Change the title bar in the docs Change the title bar in the docs
```json ```json
{ {
"title": "Daux.io" "title": "Daux.io"
} }
``` ```
###Docs Path: ###Docs Path:
If you'd prefer to keep your docs outside of the Daux.io directory, you can provide the filepath. If you'd prefer to keep your docs outside of the Daux.io directory, you can provide the filepath.
Note: Your `config.json` file will need to remain in `/daux.io/docs`. Note: Your `config.json` file will need to remain in `/daux.io/docs`.
```json ```json
{ {
"docs_path": "../../my_docs" "docs_path": "../../my_docs"
} }
``` ```
###Themes: ###Themes:
We have 4 built-in Bootstrap themes. To use one of the themes, just set the `theme` option to one of the following: We have 4 built-in Bootstrap themes. To use one of the themes, just set the `theme` option to one of the following:
* blue * blue
* green * green
* navy * navy
* red * red
```json ```json
{ {
"theme": "blue" "theme": "blue"
} }
``` ```
###Custom Theme: ###Custom Theme:
To create a custom color scheme, set the `theme` property to `custom` and then define the required colors. Copy the following configuration to get started: To create a custom color scheme, set the `theme` property to `custom` and then define the required colors. Copy the following configuration to get started:
```json ```json
{ {
"theme": "custom", "theme": "custom",
"colors": { "colors": {
"sidebar-background": "#f7f7f7", "sidebar-background": "#f7f7f7",
"sidebar-hover": "#c5c5cb", "sidebar-hover": "#c5c5cb",
"lines": "#e7e7e9", "lines": "#e7e7e9",
"dark": "#3f4657", "dark": "#3f4657",
"light": "#82becd", "light": "#82becd",
"text": "#2d2d2d", "text": "#2d2d2d",
"syntax-string": "#022e99", "syntax-string": "#022e99",
"syntax-comment": "#84989b", "syntax-comment": "#84989b",
"syntax-number": "#2f9b92", "syntax-number": "#2f9b92",
"syntax-label": "#840d7a" "syntax-label": "#840d7a"
} }
} }
``` ```
###Code Floating: ###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 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`.
```json ```json
{ {
"float": false "float": false
} }
``` ```
###GitHub Repo: ###GitHub Repo:
Add a 'Fork me on GitHub' ribbon. Add a 'Fork me on GitHub' ribbon.
```json ```json
{ {
"repo": "justinwalsh/daux.io" "repo": "justinwalsh/daux.io"
} }
``` ```
###Twitter: ###Twitter:
Include twitter follow buttons in the sidebar. Include twitter follow buttons in the sidebar.
```json ```json
{ {
"twitter": ["justin_walsh", "todaymade"] "twitter": ["justin_walsh", "todaymade"]
} }
``` ```
###Links: ###Links:
Include custom links in the sidebar. Include custom links in the sidebar.
```json ```json
{ {
"links": { "links": {
"GitHub Repo": "https://github.com/justinwalsh/daux.io", "GitHub Repo": "https://github.com/justinwalsh/daux.io",
"Help/Support/Bugs": "https://github.com/justinwalsh/daux.io/issues", "Help/Support/Bugs": "https://github.com/justinwalsh/daux.io/issues",
"Made by Todaymade": "http://todaymade.com" "Made by Todaymade": "http://todaymade.com"
} }
} }
``` ```
###Google Analytics: ###Google Analytics:
This will embed the google analytics tracking code. This will embed the google analytics tracking code.
```json ```json
{ {
"google_analytics": "UA-XXXXXXXXX-XX" "google_analytics": "UA-XXXXXXXXX-XX"
} }
``` ```
###Piwik Analytics: ###Piwik Analytics:
This will embed the piwik tracking code. This will embed the piwik tracking code.
```json ```json
{ {
"piwik_analytics": "my-url-for-piwik.com" "piwik_analytics": "my-url-for-piwik.com"
} }
``` ```
###Ignore: You can Also give a specific Piwik ID as well.
Set custom files and entire folders to ignore within your `/docs` folder. For files make sure to include the file extension in the name. For both files and folders, names are case-sensitive.
```json
```json {
{ "piwik_analytics_id": "43"
"ignore": { }
"files": ["Work_In_Progress.md"], ```
"folders": ["99_Not_Ready"]
} ###Ignore:
} Set custom files and entire folders to ignore within your `/docs` folder. For files make sure to include the file extension in the name. For both files and folders, names are case-sensitive.
```
```json
###Disabling clean URLs {
By default, Daux.io will create clean url's that do not include index.php. On servers running Apache, uploading the included .htaccess file should be enough for them to work properly. On servers that are not running Apache or that do not allow custom .htaccess files, you may need to disable clean_urls: "ignore": {
"files": ["Work_In_Progress.md"],
```json "folders": ["99_Not_Ready"]
{ }
"clean_urls": false }
} ```
```
###Disabling clean URLs
###Date Modified By default, Daux.io will create clean url's that do not include index.php. On servers running Apache, uploading the included .htaccess file should be enough for them to work properly. On servers that are not running Apache or that do not allow custom .htaccess files, you may need to disable clean_urls:
By default, daux.io will display the last modified time as reported by the system underneath the title for each document. To disable this, change the option in your config.json to false.
```json
```json {
{ "clean_urls": false
"date_modified": false }
} ```
```
###Date Modified
###Timezone By default, daux.io will display the last modified time as reported by the system underneath the title for each document. To disable this, change the option in your config.json to false.
If your server does not have a default timezone set in php.ini, it may return errors when it tries to generate the last modified date/time for docs. To fix these errors, specify a timezone in your config file. Valid options are available in the [PHP Manual](http://php.net/manual/en/timezones.php).
```json
```json {
{ "date_modified": false
"timezone": "America/Los_Angeles" }
} ```
```
###Timezone
###Multi-language If your server does not have a default timezone set in php.ini, it may return errors when it tries to generate the last modified date/time for docs. To fix these errors, specify a timezone in your config file. Valid options are available in the [PHP Manual](http://php.net/manual/en/timezones.php).
Enables multi-language support which needs seperate directories for each language in `docs/` folder.
```json
```json {
{ "timezone": "America/Los_Angeles"
"languages": { "en": "English", "de": "German" } }
} ```
```
###Multi-language
Directory structure: Enables multi-language support which needs seperate directories for each language in `docs/` folder.
```
├── docs/ ```json
│ ├── index.md {
│ ├── en "languages": { "en": "English", "de": "German" }
│ │ ├── 00_Getting_Started.md }
│ │ ├── 01_Examples ```
│ │ │ ├── 01_GitHub_Flavored_Markdown.md
│ │ │ ├── 05_Code_Highlighting.md Directory structure:
│ │ ├── 05_More_Examples ```
│ │ │ ├── Hello_World.md ├── docs/
│ │ │ ├── 05_Code_Highlighting.md │ ├── index.md
│ ├── de │ ├── en
│ │ ├── 00_Getting_Started.md │ │ ├── 00_Getting_Started.md
│ │ ├── 01_Examples │ │ ├── 01_Examples
│ │ │ ├── 01_GitHub_Flavored_Markdown.md │ │ │ ├── 01_GitHub_Flavored_Markdown.md
│ │ │ ├── 05_Code_Highlighting.md │ │ │ ├── 05_Code_Highlighting.md
│ │ ├── 05_More_Examples │ │ ├── 05_More_Examples
│ │ │ ├── Hello_World.md │ │ │ ├── Hello_World.md
│ │ │ ├── 05_Code_Highlighting.md │ │ │ ├── 05_Code_Highlighting.md
``` │ ├── de
│ │ ├── 00_Getting_Started.md
## Running Remotely │ │ ├── 01_Examples
│ │ │ ├── 01_GitHub_Flavored_Markdown.md
Copy the files from the repo to a web server that can run PHP 5.3 or greater. │ │ │ ├── 05_Code_Highlighting.md
│ │ ├── 05_More_Examples
## Running Locally │ │ │ ├── Hello_World.md
│ │ │ ├── 05_Code_Highlighting.md
There are several ways to run the docs locally. You can use something like <a href="http://www.mamp.info/en/index.html" target="_blank">MAMP</a> or <a href="http://www.wampserver.com/en/" target="_blank">WAMP</a>. If you are like me and use alot of Node.js and <a href="http://gruntjs.com/" target="_blank">Grunt.js</a>, then you can use the optional grunt command I have packaged with the project which will start a PHP web server for you in the project folder. ```
The Grunt.js task uses the built in web server in PHP 5.4 to host the docs on your local machine. This is really only intended be used when you are writing/updating a ton of docs and want to preview the changes locally. ## Running Remotely
**To use the optional Grunt command you will need:** Copy the files from the repo to a web server that can run PHP 5.3 or greater.
* Node.js ## Running Locally
* npm
* Grunt.js There are several ways to run the docs locally. You can use something like <a href="http://www.mamp.info/en/index.html" target="_blank">MAMP</a> or <a href="http://www.wampserver.com/en/" target="_blank">WAMP</a>. If you are like me and use alot of Node.js and <a href="http://gruntjs.com/" target="_blank">Grunt.js</a>, then you can use the optional grunt command I have packaged with the project which will start a PHP web server for you in the project folder.
* PHP 5.4 or greater (This is because of the built-in web server packaged in 5.4)
The Grunt.js task uses the built in web server in PHP 5.4 to host the docs on your local machine. This is really only intended be used when you are writing/updating a ton of docs and want to preview the changes locally.
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>
**To use the optional Grunt command you will need:**
## Running on IIS
* Node.js
If you have set up a local or remote IIS web site, you may need a `web.config` with: * npm
* Grunt.js
* A rewrite configuration, for handling clean urls. * PHP 5.4 or greater (This is because of the built-in web server packaged in 5.4)
* A mime type handler for less files, if using a custom theme.
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>
### Clean URLs
## Running on IIS
The `web.config` needs an entry for `<rewrite>` under `<system.webServer>`:
If you have set up a local or remote IIS web site, you may need a `web.config` with:
```xml
<configuration> * A rewrite configuration, for handling clean urls.
<system.webServer> * A mime type handler for less files, if using a custom theme.
<rewrite>
<rules> ### Clean URLs
<rule name="Main Rule" stopProcessing="true">
<match url=".*" /> The `web.config` needs an entry for `<rewrite>` under `<system.webServer>`:
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> ```xml
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> <configuration>
</conditions> <system.webServer>
<action type="Rewrite" url="index.php" appendQueryString="false" /> <rewrite>
</rule> <rules>
</rules> <rule name="Main Rule" stopProcessing="true">
</rewrite> <match url=".*" />
</system.webServer> <conditions logicalGrouping="MatchAll">
</configuration> <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
``` <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
To use clean URLs on IIS 6, you will need to use a custom URL rewrite module, such as [URL Rewriter](http://urlrewriter.net/). <action type="Rewrite" url="index.php" appendQueryString="false" />
</rule>
### Less Mime Type </rules>
</rewrite>
The `web.config` needs a new `<mimeMap>` entry, under `<staticContent>` in `<system.webServer>`: </system.webServer>
</configuration>
```xml ```
<staticContent>
<mimeMap fileExtension=".less" mimeType="text/css" /> To use clean URLs on IIS 6, you will need to use a custom URL rewrite module, such as [URL Rewriter](http://urlrewriter.net/).
</staticContent>
``` ### Less Mime Type
You will only need the mime map entry if you are using a custom theme and receive 404s for `.less` files. The `web.config` needs a new `<mimeMap>` entry, under `<staticContent>` in `<system.webServer>`:
If you have a global mime map entry for `.less` files set for the server, you will receive an internal server (500) error for having duplicate mime map entries. ```xml
<staticContent>
## Support <mimeMap fileExtension=".less" mimeType="text/css" />
</staticContent>
If you need help using Daux.io, or have found a bug, please create an issue on the <a href="https://github.com/justinwalsh/daux.io/issues" target="_blank">GitHub repo</a>. ```
You will only need the mime map entry if you are using a custom theme and receive 404s for `.less` files.
If you have a global mime map entry for `.less` files set for the server, you will receive an internal server (500) error for having duplicate mime map entries.
## Support
If you need help using Daux.io, or have found a bug, please create an issue on the <a href="https://github.com/justinwalsh/daux.io/issues" target="_blank">GitHub repo</a>.

View File

@ -189,6 +189,14 @@ This will embed the piwik tracking code.
} }
``` ```
You can Also give a specific Piwik ID as well.
```json
{
"piwik_analytics_id": "43"
}
```
###Ignore: ###Ignore:
Set custom files and entire folders to ignore within your `/docs` folder. For files make sure to include the file extension in the name. For both files and folders, names are case-sensitive. Set custom files and entire folders to ignore within your `/docs` folder. For files make sure to include the file extension in the name. For both files and folders, names are case-sensitive.

View File

@ -14,4 +14,4 @@
"Help/Support/Bugs": "https://github.com/justinwalsh/daux.io/issues", "Help/Support/Bugs": "https://github.com/justinwalsh/daux.io/issues",
"Made by Todaymade": "http://todaymade.com" "Made by Todaymade": "http://todaymade.com"
} }
} }

View File

@ -347,7 +347,7 @@ if ($homepage && $homepage_url !== '/') {
(function() { (function() {
var u=(("https:" == document.location.protocol) ? "https" : "http") + "://<?php echo $options['piwik_analytics'];?>/"; var u=(("https:" == document.location.protocol) ? "https" : "http") + "://<?php echo $options['piwik_analytics'];?>/";
_paq.push(["setTrackerUrl", u+"piwik.php"]); _paq.push(["setTrackerUrl", u+"piwik.php"]);
_paq.push(["setSiteId", "1"]); _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"; 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); g.defer=true; g.async=true; g.src=u+"piwik.js"; s.parentNode.insertBefore(g,s);
})(); })();

View File

@ -44,6 +44,7 @@ function get_options() {
'clean_urls' => true, 'clean_urls' => true,
'google_analytics' => false, 'google_analytics' => false,
'piwik_analytics' => false, 'piwik_analytics' => false,
'piwik_analytics_id' => 1,
'ignore' => array(), 'ignore' => array(),
'languages' => array() 'languages' => array()
); );