ITTF documents are the source files of the Wizzi Factory. ITTF stands for Indented Text Tree Format, a human-friendly text format for representing a tree data structure of node names and values.
Sample ITTF document
1 html
2 body
3 ul
4 li
5 a The Wizzi Factory
6 href https://wizzifactory.github.io
Every line is a node consisting of a name-value pair. The name is the first string of chars of the line and is separated from the value by a space or a tab.
Child nodes are indented to their parent.
An ITTF document can include or merge others ITTF documents.
1 html
2 body
3 $include footer
The root node can be a mixer or includer.
Root node that mixes its container.
1 ${dollar}append appbar
2 ul undefined
3 ${dollar}foreach item in menulist
4 li
5 a ${dollar}{item.name}
6 href ${dollar}{item.path}
An ITTF document is a template and can be merged and interpolated with context data.
1 ul
2 $foreach item in site.TopMenu.items
3 li
4 a ${item.label}
5 href ${item.url}
Scripts can be used to manipulate nodes.
1 div
2 $ var i = 0
3 $while i < 5
4 p Hello number ${i}
5 $ i++
Sample container ITTF document
1 html
2 $params title
3 head
4 title ${title}
5 body
6 header
7 h1 ${title}
8 $hook appbar
9 section
10 $hook
ITTF documents are of three kinds
- Primary: the document is the entry item of an ITTF processing.
- Mix: the document can receive parameters and my have hook nodes where to append child nodes of the merger document.
- Include: the document is inserted as is and cannot receive parameters.
A sample 'mix' ITTF document.
1 li
2 $params text, href
3 a ${text}
4 href ${href}
A sample 'include' ITTF Document.
1 div License MIT
2 span copy Stefano Bassoli.
JsWizzi
The template engine of the wizzi factory uses a customized subset of the ECMA-262 javascript standard, sandboxed, and tailored for ITTF processing. JsWizzi is built on the esprima parser and is run by a custom javascript engine (JsWizziRunner).
mTrees
A document may have semantic and template nodes. Semantic nodes, that can contain interpolation variables, are the document data. Template nodes drive the document composition and its merging with context data and disappear in the final tree structure. The ITTF Processor is agnostic about the content of semantic nodes. It processes template nodes and interpolates semantic node names and values. The result of an ITTF process is a tree data structure of semantic nodes that must have a single root node.
The tree data structure resulting from an ITTF processing is a javascript object named `mTree`.
Document types
Documents become usefull when they target a specific domain. Domain specific schemas can be applied to the result of an ITTF processing, see Wizzi Schemas. The name of the Wizzi Schema that is applyed to an ITTF Document is said to be the type of the document. An ITTF document of type `js` is a document designed to be validated by the `js` Wizzi Schema.
Each development team may create its own document types or use those already availables, see Wizzi Plugins.
Document file name and extension
An ITTF document must have extension '.ittf' and the extension must be preceded by '.' the name of the Wizzi Schema that describes the document or by '.ittf' again if the document is not typed.