Selaa lähdekoodia

Tweak Theming docs.

Brit Butler 11 vuotta sitten
vanhempi
commit
9ad47016fb
1 muutettua tiedostoa jossa 15 lisäystä ja 19 poistoa
  1. 15 19
      docs/themes.md

+ 15 - 19
docs/themes.md

@@ -4,13 +4,9 @@ The theming support in coleslaw is very flexible and relatively easy
4 4
 to use. However it does require some knowledge of HTML, CSS, and how
5 5
 coleslaw processes content.
6 6
 
7
-To understand how coleslaw processes a blog, a look at the
8
-[overview][ovr] and [hacking][hck] documentation may prove
9
-useful. This document will focus mainly on the template engine and how
10
-you can influence the resulting HTML.
11
-
12
-**NOTE**: Themes are not able to change the generated file names or the
13
-generated file structure on disk. They can change the resulting HTML, nothing more.
7
+To understand how coleslaw works, a look at the [hacking][hck]
8
+documentation will prove useful. This document focuses mainly on the
9
+template engine and how you can influence the resulting HTML.
14 10
 
15 11
 ## High-Level Overview
16 12
 
@@ -33,8 +29,10 @@ A theme must have three templates which take *specific arguments*
33 29
 
34 30
 Coleslaw generates two types of pages: `index` pages and `post` pages.
35 31
 Every page other than those in the `posts/` directory is an `index`.
32
+
36 33
 **Every** page uses the `base.tmpl` and fills in the content using
37
-either the `post` or `index` templates.
34
+either the `post` or `index` templates. No important logic should be
35
+in *any* template, they are only used to give provide consistent layout.
38 36
 
39 37
 *  `base.tmpl` This template generates the outer shell of the HTML.
40 38
    It keeps a consistent look and feel for all pages in the blog. The
@@ -44,9 +42,6 @@ either the `post` or `index` templates.
44 42
    That is, any page with more than one content object, e.g. the homepage.
45 43
 
46 44
 *  `post.tmpl` This templates generates content for the individual posts.
47
-   Coleslaw already converts the content of the individual post to HTML
48
-   by using markdown (or RST). So this template is **not** used to
49
-   convert an individual post, merely to give it a standard layout.
50 45
 
51 46
 Here's a visual example to make things clearer:
52 47
 ```
@@ -69,8 +64,8 @@ simplest to either modify the existing default theme, `hyde`, or copy
69 64
 it in entirety and then tweak only the CSS of your new theme. A large
70 65
 amount of visual difference can be had with a minimum of (or no)
71 66
 template hacking. There is plenty of advice on CSS styling on the web.
72
-I'm no expert but feel free to send patches to hyde's `style.css` or a
73
-recommended CSS resource for this guide.
67
+I'm no expert but feel free to send pull requests modifying theme's
68
+CSS or improving this section, perhaps by recommending a CSS resource.
74 69
 
75 70
 ## Creating a Theme from Scratch (with code)
76 71
 
@@ -130,7 +125,7 @@ However as a short primer:
130 125
 
131 126
 ### Intermezzo II, Variables provided by Coleslaw
132 127
 
133
-The variable that is available in all templates is:
128
+The variable that should be available to all templates is:
134 129
 - **config**       This contains the `.coleslawrc` content.
135 130
 
136 131
 #### Base Template Variables
@@ -147,10 +142,10 @@ The variable that is available in all templates is:
147 142
                    `.name` and `.slug`.
148 143
 - **months**       A list of all months with posts as `yyyy-mm` strings.
149 144
 - **index**        This is the meat of the content. This variable has
150
-                   the following keys
151
- - `id`, the name of the page that will be rendered
152
- - `posts`, a list of posts (see below)
153
- - `title`, a string title to display to the user
145
+                   the following keys:
146
+   - `id`,    the name of the page that will be rendered
147
+   - `posts`, a list of posts (see below)
148
+   - `title`, a string title to display to the user
154 149
 - **prev**         If this index file is part of a chain, the `id`
155 150
                    of the previous index html in the chain.
156 151
                    If this is the first file, the value will be empty.
@@ -220,7 +215,8 @@ Good luck!
220 215
 
221 216
 As mentioned earlier, most files have a file name which is a slug of
222 217
 some sort. So if you want to create a link to a tag file you should
223
-do something like this: `<a href="${config.domain}/tags/{$tag.slug}.{$config.pageExt}">{$tag.name}</a>`.
218
+do something like this:
219
+`<a href="${config.domain}/tags/{$tag.slug}.{$config.pageExt}">{$tag.name}</a>`.
224 220
 
225 221
 [clt]: https://developers.google.com/closure/templates/
226 222
 [ovr]: https://github.com/redline6561/coleslaw/blob/master/docs/overview.md