Examples |
Latte examplesPlain textIn HTML, several common typographical symbols are "magic." If you want to include ", &, <, or > in your text, you must write them using special codes: ", &, <, and >. This tends to make your text hard to read, especially since the codes don't look anything like the characters they replace. Latte's only magic characters are \, {, and }, which are far less common in ordinary text than HTML's magic characters are; and to include them in a document, you need only precede them with \.
Paragraph breaksIn HTML, every paragraph must begin with <p>, even though in most other contexts we only need to insert a blank line to denote a paragraph break. Thus it is easy to forget the <p> in some places where it's needed, causing paragraphs to run together confusingly. Latte, on the other hand, allows you to separate paragraphs with a blank line as you're already accustomed to do.
E-mail addressesThe function \eaddr is defined and used on the Correspond page. It's for denoting clickable e-mail addresses. Here's a simple version of the function definition:
With this definition, here's how one can write `Send a message with the subject "subscribe" to <latte-request@zanshin.com>':
Alternating colorsIn the user survey form on the Download page, we use alternating background colors to visually distinguish the different questions. The basic HTML structure is this:
Rather than repeat those colors throughout the document, we define the colors in one place:
and then define a function, \next-color, that automatically alternates colors each time it's used. So the basic Latte structure is this:
and if we ever wish to change the color scheme, we only have to do it in one place. Also, inserting new questions in the middle of the survey won't mess up the alternation of colors; it'll just continue working. Of course, this is Latte; even the simplified structure just described is more repetitive than necessary. So we defined another function, \survey-question, that automatically includes the setting of bgcolor (among other things). So the real structure is this:
|