Mercurial > piecrust2
annotate docs/templates/doc.html @ 380:f33712c4cfab
routing: Fix bugs with matching URLs with correct route but missing metadata.
When matching a route like `/foo/%slug%` against an URL like `/foo`, the route
will (correctly) return a match, but it will be completely missing the `slug`
metadata, resulting in problems elsewhere. This change makes it so that any
missing route metadata will be filled in with an empty string.
And because this means generated URLs may differ from the incoming URL when
using trailing slashes (`/foo/` _vs._ `/foo`), we make the assert in the
chef server handle those discrepancies.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Sun, 10 May 2015 00:34:21 -0700 |
parents | 8140ff806258 |
children | 61d53d2163d6 |
rev | line source |
---|---|
243
26e59f837558
docs: Add embryo of a documentation website.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
1 {% extends "default.html" %} |
26e59f837558
docs: Add embryo of a documentation website.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
2 |
353
8140ff806258
docs: Add "active page" style for the navigation menu.
Ludovic Chabant <ludovic@chabant.com>
parents:
294
diff
changeset
|
3 {% macro pagelink(title, url) -%} |
8140ff806258
docs: Add "active page" style for the navigation menu.
Ludovic Chabant <ludovic@chabant.com>
parents:
294
diff
changeset
|
4 <a href="{{url}}"{% if url == page.url %} class="active"{% endif %}>{{title}}</a> |
8140ff806258
docs: Add "active page" style for the navigation menu.
Ludovic Chabant <ludovic@chabant.com>
parents:
294
diff
changeset
|
5 {%- endmacro %} |
8140ff806258
docs: Add "active page" style for the navigation menu.
Ludovic Chabant <ludovic@chabant.com>
parents:
294
diff
changeset
|
6 |
294
f51b69ad09ae
docs: Add the ability to use Pygments highlighting.
Ludovic Chabant <ludovic@chabant.com>
parents:
276
diff
changeset
|
7 {% block head %} |
f51b69ad09ae
docs: Add the ability to use Pygments highlighting.
Ludovic Chabant <ludovic@chabant.com>
parents:
276
diff
changeset
|
8 {% if page.needs_pygments %} |
f51b69ad09ae
docs: Add the ability to use Pygments highlighting.
Ludovic Chabant <ludovic@chabant.com>
parents:
276
diff
changeset
|
9 <style type="text/css"> |
f51b69ad09ae
docs: Add the ability to use Pygments highlighting.
Ludovic Chabant <ludovic@chabant.com>
parents:
276
diff
changeset
|
10 {{highlight_css()}} |
f51b69ad09ae
docs: Add the ability to use Pygments highlighting.
Ludovic Chabant <ludovic@chabant.com>
parents:
276
diff
changeset
|
11 </style> |
f51b69ad09ae
docs: Add the ability to use Pygments highlighting.
Ludovic Chabant <ludovic@chabant.com>
parents:
276
diff
changeset
|
12 {% endif %} |
f51b69ad09ae
docs: Add the ability to use Pygments highlighting.
Ludovic Chabant <ludovic@chabant.com>
parents:
276
diff
changeset
|
13 {% endblock %} |
f51b69ad09ae
docs: Add the ability to use Pygments highlighting.
Ludovic Chabant <ludovic@chabant.com>
parents:
276
diff
changeset
|
14 |
243
26e59f837558
docs: Add embryo of a documentation website.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
15 {% block header %} |
26e59f837558
docs: Add embryo of a documentation website.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
16 <header class="documentation"> |
26e59f837558
docs: Add embryo of a documentation website.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
17 <h1>{{ page.title }}</h1> |
26e59f837558
docs: Add embryo of a documentation website.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
18 </header> |
26e59f837558
docs: Add embryo of a documentation website.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
19 {% endblock %} |
26e59f837558
docs: Add embryo of a documentation website.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
20 |
26e59f837558
docs: Add embryo of a documentation website.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
21 {% block content %} |
26e59f837558
docs: Add embryo of a documentation website.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
22 <div class="container"> |
26e59f837558
docs: Add embryo of a documentation website.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
23 <section class="col-md-8"> |
276
a5d21fac8e3f
docs: Change docs' templates after changes in Jinja's wrapper.
Ludovic Chabant <ludovic@chabant.com>
parents:
243
diff
changeset
|
24 {{ content|safe }} |
243
26e59f837558
docs: Add embryo of a documentation website.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
25 </section> |
26e59f837558
docs: Add embryo of a documentation website.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
26 <aside class="col-md-4"> |
26e59f837558
docs: Add embryo of a documentation website.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
27 <ul class="doc-level1"> |
26e59f837558
docs: Add embryo of a documentation website.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
28 {% for p in family.root %} |
26e59f837558
docs: Add embryo of a documentation website.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
29 {% if p.is_dir and p.is_page %} |
353
8140ff806258
docs: Add "active page" style for the navigation menu.
Ludovic Chabant <ludovic@chabant.com>
parents:
294
diff
changeset
|
30 <li>{{ pagelink(p.title, p.url) }} |
243
26e59f837558
docs: Add embryo of a documentation website.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
31 <ul class="doc-level2"> |
26e59f837558
docs: Add embryo of a documentation website.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
32 {% for p2 in p.children %} |
353
8140ff806258
docs: Add "active page" style for the navigation menu.
Ludovic Chabant <ludovic@chabant.com>
parents:
294
diff
changeset
|
33 <li>{{ pagelink(p2.title, p2.url) }}</li> |
243
26e59f837558
docs: Add embryo of a documentation website.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
34 {% endfor %} |
26e59f837558
docs: Add embryo of a documentation website.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
35 </ul> |
26e59f837558
docs: Add embryo of a documentation website.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
36 </li> |
26e59f837558
docs: Add embryo of a documentation website.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
37 {% elif not p.is_dir and p.order %} |
353
8140ff806258
docs: Add "active page" style for the navigation menu.
Ludovic Chabant <ludovic@chabant.com>
parents:
294
diff
changeset
|
38 <li>{{ pagelink(p.title, p.url) }}</li> |
243
26e59f837558
docs: Add embryo of a documentation website.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
39 {% endif %} |
26e59f837558
docs: Add embryo of a documentation website.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
40 {% endfor %} |
26e59f837558
docs: Add embryo of a documentation website.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
41 </ul> |
26e59f837558
docs: Add embryo of a documentation website.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
42 </aside> |
26e59f837558
docs: Add embryo of a documentation website.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
43 </div> |
26e59f837558
docs: Add embryo of a documentation website.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
44 {% endblock %} |
26e59f837558
docs: Add embryo of a documentation website.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
45 |