App-Dapper
view release on metacpan or search on metacpan
Toolkit templates.
Variable definitions in source files that carry special meaning are as
follows:
* `extension: .html` is the default used if not specified. To override,
specify a new value for `extension` for that particular page. `extension`
may also be specified in the `_config.yml` file to apply it globally.
* `urlpattern: /:category/:year/:month/:slug/` defines the URL path for
the file. This may also be specified in `_config.yml` as well. If not
specified, the following is used: `/:category/:year/:month/:slug/`. A
full list of pattern options are as follows:
- `:category` - The category of the page as defined by the page's
YAML.
- `:year` - The year the page was published as defined either by the
`date` field in the page's YAML part, or from the file modification
timestamp.
- `:month` - The month the page was published as defined either by
the
`date` field in the page's YAML part, or from the file modification
timestamp.
- `:day` - The day the page was published as defined either by the
`date` field in the page's YAML part, or from the file modification
timestamp.
- `:hour` - The hour the page was published as defined either by the
`date` field in the page's YAML part, or from the file modification
timestamp.
- `:minute` - The minute the page was published as defined either by
the `date` field in the page's YAML part, or from the file
modification timestamp.
- `:second` - The second the page was published as defined either by
the `date` field in the page's YAML part, or from the file
modification timestamp.
- `:slug` - The title of the page with all non-ASCII characters
removed, all non-word characters removed, all spaces converted to
hyphens (`-`), and converted to lowercase.
Here is an example that shows a few different types of YAML definitions
at the beginning of a source file and how to use those definitions in
templates.
```
---
name: My Site
menu:
Home: /
Portfolio: /portfolio/
About: /about/
Github: http://github.com/markdbenson
fruits:
- Apple
- Orange
- Banana
---
<h2>Name</h2>
[% page.name %]<br />
<h2>Menu</h2>
<ul>
[% for link in page.menu %]
<li><a href="[% link.value %]">[% link.key %]</a></li>
[% end %]
</ul>
<h2>Fruits</h2>
<ul>
[% for fruit in page.fruits %]
<li>[% fruit %]</li>
[% end %]
</ul>
```
Note that Dapper renders templates twice for each source file in the project. The
first time, the source file itself is rendered wherby all directives are
processed.
After Dapper combines the source file with the template file, Dapper
renders the template directives a second time. The only difference
between the variables available to source files versus the variables available to
layout files are that `[% page.content %]` is only available in layout files to
prevent circular references.
This double-rendering behavior of Dapper allows you to speciify layout
directives in the source file in addition to the layout file, and gives you some
extra flexibility. More information is available in [Appendix C:
Internals](#appendix-c-internals).
Dapper depends on
[MultiMarkdown](http://fletcherpenney.net/multimarkdown/). Or, more
specifically, the Perl module implementation of MultiMarkdown ([Text::
MultiMarkdown](http://search.cpan.org/~bobtfish/Text-MultiMarkdown/).
MultiMarkdown is based on the traditional definition of Markdown by
John Gruber of [Daring Fireball](http://daringfireball.net), but adds
additional nice features such as tables and footnotes.
The following sections describe the markup that Dapper accepts, including
headings, text, lists, footnotes, tables, and images. There are more
features of the MultiMarkdown engine that Dapper uses. See the
[MultiMarkdown documentation](http://fletcher.github.io/MultiMarkdown-4/)
on CPAN for details.
## Headings
Headings are specified by prefixing with pound signs (`#`):
```
# Heading 1
## Heading 2
### Heading 3
#### Heading 4
##### Heading 5
###### Heading 6
```
Alternatively, headings may be specified using an underline style:
```
( run in 1.197 second using v1.01-cache-2.11-cpan-cdf2f3d4e48 )