Every call adds a node
A builder call adds a typed node to Source and returns that node. Calling another builder method on it creates a child. Indentation and local variables make the hierarchy readable; they do not create a separate rendering system.
The following is the authoring example from the current guide. It belongs in a Page module served by an adapter; it is not a standalone server program.
from gramlot import Page as BasePage
class Page(BasePage):
title = "People"
def main(self, root):
panel = root.div("People", id="people")
panel.p("Choose a person")Keep structure and values separate
The text above is literal. Later, a pointer will connect a node to a Data value. Source can also change at runtime: inserting or removing a node updates its rendered branch. The framework owns that translation.
Plain helper methods can organize a larger Page. Keep the declarations and their literal bindings visible so the reader can follow a section without decoding a second recipe language.
Your turn
Try it yourself
- Read Hello World in the gallery, then locate its heading in Source.
- In your local project, add a literal paragraph below an existing heading.
- Save, restart and reload; inspect the parent and child nodes.
Check your understanding
Does adding a paragraph require a new Data value?
Show the answer and expected result
No. Literal page structure and text can be declared directly in Source. Introduce Data when a value needs to be shared, edited or observed. A helper method can group declarations without changing this distinction.