Browse Source

Fixes to theming docs.

Brit Butler 10 years ago
parent
commit
41186fb41c
3 changed files with 21 additions and 27 deletions
  1. 1 1
      NEWS.md
  2. 0 1
      docs/hacking.md
  3. 20 25
      docs/themes.md

+ 1 - 1
NEWS.md

11
   Additionally, `{$month}` should become `{$month.name}`.
11
   Additionally, `{$month}` should become `{$month.name}`.
12
   Correspondingly, changes to `:routing` would previously break links in
12
   Correspondingly, changes to `:routing` would previously break links in
13
   the templates but now work seamlessly.
13
   the templates but now work seamlessly.
14
-* **Docs**: Improved README. New Config File docs.
14
+* **Docs**: Improved README and Theming docs. New Config File docs.
15
 * Loading content is more robust when empty lines or metadata are passed.
15
 * Loading content is more robust when empty lines or metadata are passed.
16
   Thanks to @PuercoPop for the bug report and preliminary fix.
16
   Thanks to @PuercoPop for the bug report and preliminary fix.
17
 * The config `:repo` option is now deprecated as its value has become
17
 * The config `:repo` option is now deprecated as its value has become

+ 0 - 1
docs/hacking.md

218
 ### TODO for 0.9.6
218
 ### TODO for 0.9.6
219
 
219
 
220
 * Finish docs updates to:
220
 * Finish docs updates to:
221
-  * themes.md     -> Note debugging issues. Valid slots. Changed URL handling.
222
   * plugin-use.md -> Incremental plugin, Versioned plugin. Twitter summary cards.
221
   * plugin-use.md -> Incremental plugin, Versioned plugin. Twitter summary cards.
223
 * A real test suite with Stefil that at *least* tests:
222
 * A real test suite with Stefil that at *least* tests:
224
   * `read-content`
223
   * `read-content`

+ 20 - 25
docs/themes.md

32
 
32
 
33
 **Every** page uses the `base.tmpl` and fills in the content using
33
 **Every** page uses the `base.tmpl` and fills in the content using
34
 either the `post` or `index` templates. No important logic should be
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.
35
+in *any* template, they are only used to provide a consistent layout.
36
 
36
 
37
 *  `base.tmpl` This template generates the outer shell of the HTML.
37
 *  `base.tmpl` This template generates the outer shell of the HTML.
38
    It keeps a consistent look and feel for all pages in the blog. The
38
    It keeps a consistent look and feel for all pages in the blog. The
64
 it in entirety and then tweak only the CSS of your new theme. A large
64
 it in entirety and then tweak only the CSS of your new theme. A large
65
 amount of visual difference can be had with a minimum of (or no)
65
 amount of visual difference can be had with a minimum of (or no)
66
 template hacking. There is plenty of advice on CSS styling on the web.
66
 template hacking. There is plenty of advice on CSS styling on the web.
67
-I'm no expert but feel free to send pull requests modifying theme's
67
+I'm no expert but feel free to send pull requests modifying a theme's
68
 CSS or improving this section, perhaps by recommending a CSS resource.
68
 CSS or improving this section, perhaps by recommending a CSS resource.
69
 
69
 
70
 ## Creating a Theme from Scratch (with code)
70
 ## Creating a Theme from Scratch (with code)
114
 However as a short primer:
114
 However as a short primer:
115
 
115
 
116
 *  Everything is output literally, except template commands.
116
 *  Everything is output literally, except template commands.
117
-*  Template commands are enclosed in `{` and `}`
117
+*  Template commands are enclosed in `{` and `}`.
118
 *  Variables, which are provided by coleslaw, can be referenced
118
 *  Variables, which are provided by coleslaw, can be referenced
119
    inside a template command. So to use a variable you have to say
119
    inside a template command. So to use a variable you have to say
120
    `{$variable}` or `{$variable.key}`.
120
    `{$variable}` or `{$variable.key}`.
121
+   **WARNING**: At present, cl-closure-template does not have great debugging.
122
+   If you typo this, e.g. `${variable}`, you will receive an *uninformative*
123
+   and apparently unrelated error. Also, attempted access of non-existent keys
124
+   fails silently. We are exploring options for making debugging easier in a
125
+   future release.
121
 *  If statements are written as `{if ...} ... {else} ... {/if}`.
126
 *  If statements are written as `{if ...} ... {else} ... {/if}`.
122
    Typical examples are: `{if $injections.body} ... {/if}` or
127
    Typical examples are: `{if $injections.body} ... {/if}` or
123
    `{if not isLast($link)} ... {/if}`.
128
    `{if not isLast($link)} ... {/if}`.
139
 #### Index Template Variables
144
 #### Index Template Variables
140
 
145
 
141
 - **tags**         A list containing all the tags, each with keys
146
 - **tags**         A list containing all the tags, each with keys
142
-                   `.name` and `.slug`.
143
-- **months**       A list of all months with posts as `yyyy-mm` strings.
147
+                   `name` and `url`.
148
+- **months**       A list of all the content months, each with keys
149
+                   `name` and `url`.
144
 - **index**        This is the meat of the content. This variable has
150
 - **index**        This is the meat of the content. This variable has
145
                    the following keys:
151
                    the following keys:
146
-   - `id`,    the name of the page that will be rendered
147
    - `content`, a list of content (see below)
152
    - `content`, a list of content (see below)
148
-   - `title`, a string title to display to the user
149
-- **prev**         If this index file is part of a chain, the `id`
150
-                   of the previous index html in the chain.
151
-                   If this is the first file, the value will be empty.
152
-- **next**         If this index file is part of a chain, the `id`
153
-                   of the next index html in the chain.
154
-                   If this is the last file, the value will be empty.
153
+   - `name`,  a name to use in links or href tags
154
+   - `title`, a title to use in H1 or header tags
155
+- **prev**         Nil or the previous index with keys: `url` and `title`.
156
+- **next**         Nil or the next index with keys: `url` and `title`.
155
 
157
 
156
 #### Post Template Variable
158
 #### Post Template Variable
157
 
159
 
160
 - **post**         All these variables are post objects. **prev** and
162
 - **post**         All these variables are post objects. **prev** and
161
                    **next** are the adjacent posts when put in
163
                    **next** are the adjacent posts when put in
162
                    chronological order. Each post has the following keys:
164
                    chronological order. Each post has the following keys:
163
-   - `tags`, a list of tags (each with keys `name` and `slug`)
164
-   - `slug`, the slug of the post
165
+   - `url`, the relative url of the post
166
+   - `tags`, a list of tags (each with keys `name` and `url`)
165
    - `date`, the date of posting
167
    - `date`, the date of posting
166
    - `text`, the HTML of the post's body
168
    - `text`, the HTML of the post's body
167
    - `title`, the title of the post
169
    - `title`, the title of the post
190
 {namespace coleslaw.theme.trivial}
192
 {namespace coleslaw.theme.trivial}
191
 {template index}
193
 {template index}
192
 {foreach $obj in $index.content}
194
 {foreach $obj in $index.content}
193
-<h1>{$obj.title}</h1>
194
-  {$obj.text |noAutoescape}
195
+<h1>{$object.title}</h1>
196
+  {$object.text |noAutoescape}
195
 {/foreach}
197
 {/foreach}
196
 {/template}
198
 {/template}
197
 ```
199
 ```
209
 
211
 
210
 All of the files are now populated with content. There are still no links
212
 All of the files are now populated with content. There are still no links
211
 between the pages so navigation is cumbersome but adding links is simple.
213
 between the pages so navigation is cumbersome but adding links is simple.
212
-Good luck!
213
-
214
-## Note on adding links
215
-
216
-As mentioned earlier, most files have a file name which is a slug of
217
-some sort. So if you want to create a link to a tag file you should
218
-do something like this:
219
-`<a href="${config.domain}/tags/{$tag.slug}.{$config.pageExt}">{$tag.name}</a>`.
214
+Just do: `<a href="{$config.domain}/{$object.url}">{$object.name}</a>`.
220
 
215
 
221
 [clt]: https://developers.google.com/closure/templates/
216
 [clt]: https://developers.google.com/closure/templates/
222
 [ovr]: https://github.com/redline6561/coleslaw/blob/master/docs/overview.md
217
 [ovr]: https://github.com/redline6561/coleslaw/blob/master/docs/overview.md