Renderingla

forma

Captured backtick templates for bound payloads.

Syntax: template(args)

Category

template

Related

Examples

examples/corpus/literalia/forma.fab (canonical · literal)

Captured backtick templates for bound payloads.

# Captured `forma` templates
#
# Backtick template application captures template text and parameters into the
# builtin `forma` genus. It does not render holes into the template string.
#
# EXPECTED OUTPUT:
#   Raw template text lines showing preserved § holes.

incipit {
    fixum textus tenantId ← "tenant-42"
    fixum textus plan ← "pro"

    fixum _ q ← `
        select id, email, plan
        from accounts
        where tenant_id = §
          and plan = §
    `(tenantId, plan)

    nota q.template

    fixum _ indexed ← `where tenant_id = §0 or parent_tenant_id = §0`(tenantId)
    nota indexed.template

    fixum _ bare ← `select 1`
    nota bare.template
}

Expected output:

        select id, email, plan
        from accounts
        where tenant_id = §
          and plan = §

where tenant_id = §0 or parent_tenant_id = §0
select 1