the little static site engine that could
Booklit documents are basically just text files with special syntax for function calls. Aside from those, everything is either text or a comment.
Text files are bit more complicated than they sound, though, so here are the rules:
The top-level of a document is a series of paragraphs, separated by one or more blank lines.
A paragraph is a series of lines, separated by linebreaks.
A line is a series of words.
A word is either a string, an invoke, or an interpolated word.
A string is a series of characters other than {}\
, or a \
followed by one of those characters, all within one line.
An invoke is a function call.
An interpolated word is a word wrapped in curly braces ({}
). This is useful for cases where a zero-argument invoke has to be smashed in the middle of a word, just{\like}this
.
Comments are delimited by {-
and -}
. They can be multi-line, appear in between words, and they can also be nested. This makes commenting out large blocks of content easy:
Hi, I'm{- a comment -} in the middle of a sentence!
{-
I'm hanging out at the top level,
{- being nested and stuff -}
with multiple lines.
-}
Function calls are denoted by a single backslash (\
), followed by series of alphanumeric characters and hyphens (foo-bar
), forming the function name.
Following the name, there may be any number of arguments, which can come in a few different forms:
{line}
With no linebreak after the {
, the argument forms a single line.
{word wrapped
line}
As above, but the word wrapping point gets converted into a single space, as if it were written as {word wrapped line}
.
{
paragraph 1
paragraph 2
}
With a linebreak after the {
, the argument forms a block of paragraphs.
{{
paragraph 1
indented paragraph 2
\with{syntax}
}}
With doubled-up curly braces, whitespace is preserved in the content, rather than being parsed into paragraphs.
Note that the first line of the content determines an indentation level that is then skipped for all lines. It is the only whitespace that is ignored.
{{{
paragraph 1
indented {paragraph} 2
\with{no-syntax}
}}}
Tripled-up curly braces form a verbatim argument. Similar to preformatted, whitespace is preserved. In addition, there is no interpreting or parsing of Booklit syntax within. This is useful for large code blocks where the content may contain special characters that Booklit normally may interpret (e.g. \
, {
, }
).