2.3 - A Brief Introduction to Built-ins and Styles

See also:  [ghost] ,  [glos] ,  [gstyle] ,  [listg] ,  [locs] ,  [spage]  and  [style] 

2.3.1 - Overview

Styles are the heart of what class   macro()   is about. The built-ins you'll be reading about throughout this manual are the low-level bricks and mortar that get things done, but styles are how you get things done cleanly and easily and sanely using the built-ins. They also let you go beyond the built-ins into wholly custom text generation.

2.3.2 - Built-ins

You specify a built-in using square brackets. Here's how to do HTML italics. What happens is that the built-in named "i" receives "my text" as content. It then wraps HTML italics tags around that content, and returns it that way:

[i my text]

<i>my italic text</i>

2.3.3 - Styles

Here are the primary components of a style:

You can easily create an italics style to do the exactly same thing as the italics built-in:

[style i <i>[b]</i>]
{i my italic text}

<i>my italic text</i>

aa_macro's built-ins are designed with an eye towards HTML rendering. But perhaps you have a need to generate text to be processed by something other than a web browser (such as markdown, which has to be processed further) where italics are indicated by underscore. In that case, you'd do this:

[style i _[b]_]
{i my italic text}

_my italic text_

You can write sets of styles and place them in files to be included in your projects. So you can write styles that generate, for instance, HTML and markdown from the same source documents. In fact, I do that very thing using the aagen command in the aa_macro repo to generate the quick reference documentation:

aagen -i qr_html.txt -f quickref.html quickref.txt -r aagen -i qr_markdown.txt -f quickref.md quickref.txt -r

On the first line, the  -i qr_html.txt  includes styles that generate to HTML.

On the second line, the  -i qr_markdown.txt  includes styles that generate to markdown.

Both command invocations take  quickref.txt  as the primary source input, and each generates to a different file,  quickref.html  and  quickref.md  respectively.

See also:  [ghost] ,  [glos] ,  [gstyle] ,  [helps] ,  [helps2] ,  [listg] ,  [locs] ,  [s] ,  [spage]  and  [style] 

Keyboard Navigation
, Previous Page . Next Page t TOC i Index

Valid HTML 4.01 Loose

This manual was generated with wtfm
wtfm uses aa_macro and SqLite
aa_macro uses Python 2.7