CiceroneDocumentation

Partials and Slots

A partial is the basic building block of your content in Cicerone. A partial determines how a particular bit of content is rendered on the page.

To use a Partial, you must first declare it, and then you can create an instance in your content.

Partials

Partials are the building block of your pages. Every part of your page is a partial: paragraphs, sections, page-wraps, list-items, etc...

A Partial often consists of a snippet of HTML and associated CSS, and possibly some assets. In addition a Partial specifies its Slot Rules (more on that below).

A Partial Declaration can be stored as a Definition on a Node, in which case a Root Node that refers to that Partial by name is a Partial Instance.

Paragraph Partial Instances in nodes below the Paragraph Definition

A Partial can also be stored directly on the node that uses it. This is called an Ad Hoc Partial. It is not named and therefore is used solely by the node it is configured on.

An Ad Hoc Partial is declared and used on the same node

Partial Declaration

A Partial is made up of a Plugin Name, Plugin Data, Assets, and Slot Rules.

For now most partials use one Plugin: "DomTache."

Note:"DomTache" is a concatenation of DOM and Mustache because it is originally inspired by the Mustache templating engine, and it operates at the DOM node level. However there is little overlap between Mustache and DomTache in terms of functionality.

In a DomTache partial you write HTML and CSS as plugin data, which Cicerone will use when rendering your page. Within the HTML you can create slots by typing something like {{some-slot}}.

You can also attach assets to the partial and refer to them in the HTML or CSS.

Slot Rules tell Cicerone whether {{some-slot}} is a text slot or a partial slot, and which text styles or partials are allowed within it.

Partial Instance

When you insert a Partial in your content by dragging it onto the page, or by any other means, you are creating a Partial Instance.

A Partial Instance consists of a Root Node which refers to the Partial Definition via its "Def name" property.

It is also possible to create a Partial Instance by defining an Ad Hoc Partial directly on the Node.

Partial Subtrees, Roots, and Slots

As we saw above, Content Tree Nodes can be Partial Root nodes and Slot nodes.

A partial instance's subtree starts at the root node that references the partial definition, and ends at the nearest descendants that are Slot.

A set of content tree nodes that make up a partial subtree

A Root node can be a Slot too. The partial subtree is then a single node. This is common for simple partials, like a Paragraph partial that only has a single text slot.

Note:To ensure that the content tree is coherent Cicerone treats all children of a Slot as Root nodes, and the parent of every Root as a Slot. This is why you might see that a node is treated as a Root or a Slot even though it is not set as such.

Slots and Slot Rules

Slots are the mechanism through which the building blocks of your content are assembled.

A slot can be of type Partials, Text or Linkable.

In addition to specifying the Type, Slot Rules can be used to restrict the content of the slot.

Partials Slot

A Partials slot allows the author to insert a new instance of partials in that slot. The Slot Rules can restrict the list of allowed partials.

A partials slot can also have a "Default" partial, which is a partial that is created automatically by Cicerone under certain circumstances. A common use of Default partial is to make a "Paragraph" partial the default, such that when the author presses "Enter" on their keyboard a new paragraph is created.

Text Slot

Making a slot "Text" means Cicerone gives the author the ability to type. If the slot specifies that there can be children (as in text styles) then the author will be able to highlight sections of that slot's text and apply these styles.

Linkable Slot

A "linkable" slot is a powerful building block of Cicerone (as yet not fully realized). It lets author link to an asset, or it can let the author link to another Cicerone-generated piece of content (such as an svg?), or it can be used to link to outside resources.