Bugfixes related to themes and Commonmark migration

This commit is contained in:
Stéphane Goetz 2015-05-22 15:05:16 +02:00 committed by Stéphane Goetz
parent 1fe3e62df3
commit 63d6b17ec4
5 changed files with 32 additions and 34 deletions

View File

@ -99,7 +99,7 @@ Daux provides native support for Clean URLs provided the webserver has its URL R
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
```json
@ -108,7 +108,7 @@ Change the title bar in the 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:
* daux-blue
@ -122,7 +122,7 @@ We have 4 built-in Bootstrap themes. To use one of the themes, just set the `the
}
```
###Custom Theme:
### Custom Theme:
To use a custom theme, just copy over the theme folder into the `themes` directory and set its value in the `theme` param in config.json
```json
@ -131,7 +131,7 @@ To use a custom theme, just copy over the theme folder into the `themes` directo
}
```
###Code Floating:
### Code Floating:
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
@ -140,7 +140,7 @@ By default your code blocks will be floated to a column on the right side of you
}
```
###Toggling Code Blocks
### 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
@ -150,7 +150,7 @@ Some users might wish to hide the code blocks & view just the documentation. By
```
###GitHub Repo:
### GitHub Repo:
Add a 'Fork me on GitHub' ribbon.
```json
@ -159,7 +159,7 @@ Add a 'Fork me on GitHub' ribbon.
}
```
###Twitter:
### Twitter:
Include twitter follow buttons in the sidebar.
```json
@ -168,7 +168,7 @@ Include twitter follow buttons in the sidebar.
}
```
###Links:
### Links:
Include custom links in the sidebar.
```json
@ -181,7 +181,7 @@ Include custom links in the sidebar.
}
```
###File editor:
### 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_.
@ -192,7 +192,7 @@ Enable front-end Markdown editor. _Disabled by default_.
}
```
###Google Analytics:
### Google Analytics:
This will embed the google analytics tracking code.
```json
@ -201,7 +201,7 @@ This will embed the google analytics tracking code.
}
```
###Piwik Analytics:
### Piwik Analytics:
This will embed the piwik tracking code.
```json
@ -218,7 +218,7 @@ You can Also give a specific Piwik ID as well.
}
```
###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.
```json
@ -230,7 +230,7 @@ Set custom files and entire folders to ignore within your `/docs` folder. For fi
}
```
###Breadcrumb titles
### Breadcrumb titles
Daux.io provides the option to present page titles as breadcrumb navigation. You can *optionally* specify the separator used for breadcrumbs.
```json
@ -240,7 +240,7 @@ Daux.io provides the option to present page titles as breadcrumb navigation. You
}
```
###Date Modified
### Date Modified
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
@ -249,7 +249,7 @@ By default, daux.io will display the last modified time as reported by the syste
}
```
###Timezone
### Timezone
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
@ -258,7 +258,7 @@ If your server does not have a default timezone set in php.ini, it may return er
}
```
###Multi-language
### Multi-language
Enables multi-language support which needs seperate directories for each language in `docs/` folder.
```json

View File

@ -109,6 +109,10 @@ class Daux
}
}
/**
* @todo make it an object
* @return array
*/
public function getParams()
{
$params = $this->options += array(
@ -138,13 +142,6 @@ class Daux
$params['index_key'] = 'index.html';
$params['base_page'] = $params['base_url'] = '';
$params['theme'] = DauxHelper::getTheme(
$this->options['theme-name'],
$params['base_url'],
$this->local_base,
$params['base_url']
);
return $params;
}
}

View File

@ -4,10 +4,10 @@ use Todaymade\Daux\Tree\Directory;
class DauxHelper
{
public static function getTheme($theme_name, $base_url, $local_base, $current_url)
public static function getTheme($params, $current_url)
{
$theme_folder = $local_base . DS . 'resources' . DS . 'themes' . DS . $theme_name;
$theme_url = $base_url . "resources/themes/" . $theme_name . '/';
$theme_folder = $params['local_base'] . DS . 'resources' . DS . 'themes' . DS . $params['theme-name'];
$theme_url = $params['base_url'] . "resources/themes/" . $params['theme-name'] . '/';
$theme = array();
if (is_file($theme_folder . DS . "config.json")) {
@ -19,7 +19,7 @@ class DauxHelper
//Default parameters for theme
$theme += [
'name' => $theme_name,
'name' => $params['theme-name'],
'css' => [],
'js' => [],
'fonts' => [],
@ -29,7 +29,11 @@ class DauxHelper
'templates' => $theme_folder . DS . 'templates',
];
$substitutions = ['<local_base>' => $local_base, '<base_url>' => $current_url, '<theme_url>' => $theme_url];
$substitutions = [
'<local_base>' => $params['local_base'],
'<base_url>' => $current_url,
'<theme_url>' => $theme_url
];
// Substitute some placeholders
$theme['templates'] = strtr($theme['templates'], $substitutions);

View File

@ -28,12 +28,7 @@ class Generator
$params['base_url'] = $params['base_page'] = $base_url;
// Rebase Theme
$params['theme'] = DauxHelper::getTheme(
$params['theme-name'],
$params['base_url'],
$params['local_base'],
$base_url
);
$params['theme'] = DauxHelper::getTheme($params, $base_url);
$params['image'] = str_replace('<base_url>', $base_url, $params['image']);
if ($base_url !== '') {

View File

@ -78,6 +78,8 @@ class Server
$params['image'] = str_replace('<base_url>', $params['base_url'], $params['image']);
}
$params['theme'] = DauxHelper::getTheme($params, $this->base_url);
return $params;
}