Skip to content
This repository has been archived by the owner on Dec 27, 2018. It is now read-only.

Commit

Permalink
Updates docs (#133)
Browse files Browse the repository at this point in the history
* Update 1.Overview.md
* Update 2.Content.md
* Update 3.Layouts.md
* Update and rename 4.Options.md to 4.Configuration.md
  • Loading branch information
ArnaudLigny committed Aug 31, 2016
1 parent 8cbb80f commit e04c527
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 26 deletions.
10 changes: 5 additions & 5 deletions docs/1.Overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
To create a new website, we need 3 things:
1. Documents written in [Markdown](https://daringfireball.net/projects/markdown/)
2. [Twig](http://twig.sensiolabs.org) templates
3. [PHPoole CLI](https://github.com/Narno/PHPoole) or a build script
3. [PHPoole CLI](https://github.com/Narno/PHPoole) **or** a build script

## Content organization
```
Expand All @@ -17,9 +17,9 @@ To create a new website, we need 3 things:
| └─ About.md <- A Page in the root
├─ layouts <- Contains Twig templates
| ├─ _default <- Contains default templates
| | ├─ list.html <- Used by a _list_ node type (ie: Section)
| | └─ page.html <- Used by the _page_ node type
| └─ index.html <- Used by the _homepage_ node type
| | ├─ list.html.twig <- Used by a 'list' node type (ie: a Section)
| | └─ page.html.twig <- Used by the 'page' node type
| └─ index.html.twig <- Used by the 'homepage' node type
└─ static <- Contains static files
└─ robots.txt <- A static file
```
Expand All @@ -31,7 +31,7 @@ Use [PHPoole](https://github.com/Narno/PHPoole) CLI and run the following comman
$ phpoole build -s
```

Or create a PHP script:
**Or** create a PHP script:
```php
<?php
date_default_timezone_set('Europe/Paris');
Expand Down
12 changes: 6 additions & 6 deletions docs/2.Content.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
# Content

The content is represented by [Markdown](http://daringfireball.net/projects/markdown/) files, called _Pages_, organized in folders.
Content is a bunch of [Markdown](http://daringfireball.net/projects/markdown/) files (or plain text files), called _Pages_, organized in folders.
Folders in the root are called _Section_ (ie: "Blog", "Project", etc.).

## Pages
## Pages

A _Page_ can contain a front matter ([YAML](http://www.yaml.org/spec/1.2/spec.html#Preview)) and/or a body ([Markdown](http://daringfireball.net/projects/markdown/syntax)).
A _Page_ can contain a front matter and/or a body.

### Front matter

Any file that contains a YAML front matter will be processed to extract some variables. The front matter must be the first thing in the file and must be a valid YAML.
Any file that contains a front matter will be processed to extract some variables. The front matter must be the first thing in the file and must be a valid [YAML](http://www.yaml.org/spec/1.2/spec.html#Preview).

**Predefined variables**

| Variable | Description | Default value |
| ------------- | ------------- | --------------------------------- |
| title | Title | File basename (without extension) |
| section | Section | Root directory of the file path |
| layout | Layout | See [_Layout fallback logic_] |
| date | Date | File modification time |
| layout | Layout | See _Layout fallback logic_ |
| date | Date | File modification datetime |
| menu | Menu | Homepage and Sections |
| tags | Tags | _Empty_ |
| categories | Categories | _Empty_ |
Expand Down
30 changes: 20 additions & 10 deletions docs/3.Layouts.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Otherwise:

### Site

Contains all variables under _site_ key in options.
Contains all variables under _site_ key in configuration.

| Variable | Description |
| ------------- | ----------------- |
Expand All @@ -53,7 +53,7 @@ Menu entry keys:

### Page

Contains all variables setted in the page's front matter.
Contains all page variables and those set in the page's front matter.

| Variable | Description | Example |
| --------------- | -------------------------------- | ------------- |
Expand Down Expand Up @@ -87,11 +87,11 @@ Contains all variables setted in the page's front matter.

### PHPoole

| Variable | Description |
| ----------------- | ----------------------------- |
| phpoole.url | URL to the official website |
| phpoole.version | Current version |
| phpoole.poweredby | "PHPoole-library v" + version |
| Variable | Description |
| ----------------- | --------------------------- |
| phpoole.url | URL to the official website |
| phpoole.version | Current version |
| phpoole.poweredby | "PHPoole v" + version |

## Example

Expand All @@ -113,6 +113,16 @@ Creates an URL.
{{ url(page) }}
{{ url('tags/' ~ tag) }}
{{ url(menu.url) }}
{{ url('css/style.css') }}
{{ url('http://narno.org') }}
```

#### _minify_

Minify a CSS or a Javascript file.
```
{{ minify('css/style.css') }}
{{ minify('js/script.js') }}
```

### Filters
Expand Down Expand Up @@ -145,9 +155,9 @@ Sorts a menu entries collection by weight.
{{ menu|sortByWeight }}
```

#### _filterBySection_
#### _filterBy_

Filters a pages collection by section name.
Filters a pages collection by variable name.
```
{{ pages|filterBySection('blog') }}
{{ pages|filterBy('section', 'blog') }}
```
22 changes: 17 additions & 5 deletions docs/4.Options.md → docs/4.Configuration.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Options
# Configuration

Options are defined by:
Configuration is defined by:
* a YAML file named _phpoole.yml_ with [PHPoole](https://github.com/Narno/PHPoole) CLI
* a PHP array with PHP script
* a PHP array (or a _PHPoole\Config_ instance) with PHP script

## Default options
## Default configuration

```php
[
Expand All @@ -21,10 +21,14 @@ Options are defined by:
'max' => 5,
'path' => 'page',
],
'date' => [
'format' => 'j F Y',
'timezone' => 'Europe/Paris',
],
],
'content' => [
'dir' => 'content',
'ext' => 'md',
'ext' => ['md', 'markdown', 'mdown', 'mkdn', 'mkd', 'text', 'txt'],
],
'frontmatter' => [
'format' => 'yaml',
Expand All @@ -45,5 +49,13 @@ Options are defined by:
'themes' => [
'dir' => 'themes',
],
'generators' => [
10 => 'PHPoole\Generator\Section',
20 => 'PHPoole\Generator\Taxonomy',
30 => 'PHPoole\Generator\Homepage',
40 => 'PHPoole\Generator\Pagination',
50 => 'PHPoole\Generator\Alias',
35 => 'PHPoole\Generator\ExternalBody',
],
];
```

0 comments on commit e04c527

Please sign in to comment.