Templates
From StuffKeeper Wiki
When exporting one or more items to html, you can style the output using a template. It is even possible to generate non-html output, although stuffkeeper does escaping needed for html (this is configurable now). For more information about how the template is parsed, see here
Contents |
Default
<pre> <html> <head> <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" > <title> StuffKeeper - {title} </title> <style TYPE="text/css"> #heading \{ background: #99ccFF; font-size: 4em; text-align: center; border-bottom: 1px dotted black; \} body \{ margin: 0; \} #content\{ margin: 1em; \} #schema H3\{ background: #CCFFFF; border: 1px dotted black; padding: 0.5em; \} #index\{ margin: 1em; \} #item \{ \} #item H3 \{ background: #FFFFCC; border: 1px dotted black; padding: 0.5em; \} </style> </head> <body> <div id='heading'> StuffKeeper </div> <div id='index'> <H3>Index</H3> [b {schema:id <a href='#schema:%'>}{schema:title <H3>%</H3>}{schema:id </a>} <lu> [s <li><a href='#{item:id %}'>{item:title %}</a></li> ] </lu> ] </div> <div id='content'> [b <div id='schema'> {schema:id <a name='schema:%'>}{schema:title <H3>%</H3>}{schema:id </a>} [s <div id='item'> <H3><a name='{item:id %}'>{item:title %}</a></H3> <table> [i <tr> <td align='right' valign='top'> {field:name <b>%</b>} </td> <td> {field:string % }{field:text <p>%</p> }{field:link <a href='%'>%</a> }{field:slider %/100 }{field:integer % }{field:boolean <input type='checkbox' DISABLED %CHECKED:% /> }{field:image <img src='%' /> }{field:list <div id='list'> }{field:list <i>%</i><BR /> }{field:list </div>} </td> <tr> ] </table> </div> ] </div> ] </div> </body> </html> </pre>
CSV Exporting
{escape:csv}[b[s[i{field:integer"%"}{field:string"%"}{field:boolean"%1:0%"}{field:list"}{field:list%,}{field:list"}{field:text"%"}{field:list"%"}{field:slider"%"}{field:image"%"}:] ] ]
The escape:csv tells stuffkeeper to use the escaping as defined in the csv specification.
Tips and Tricks
Hide fields in the output
It is not possible to chose what fields of the item(s) to export, but you can hide them in the output using some creative css. Say, for example, you want to hide the field called "User Rating" in the output, you can do it by putting this in the template:
<div id='field{field:name%}'> <b>{field:name %}</b>{field:slider %}<BR> </div>
Then you can hide this entry by putting this in the css:
#fieldUser\\ Rating\{ display: none; \}
(take care that spaces and other characters in the field name propperly escaped. To get '\ ' in the output you need to escape the '\' in the template by '\\').