Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

texl

The texl namespace is bound by the Texl engine in every template. It is not available in plain Swan.

texl.import

texl.import uri -> Promise

Loads the document at uri, renders it, and returns a promise of a namespace that describes it:

MemberTypeContent
uriTextThe full URI of the document
sourceTextThe template source
dataNamespaceThe names the document's tags bound
renderingTextThe rendered text

If the document cannot be loaded, the promise resolves to Nothing.

A relative uri is resolved against the URI of the importing document. Each document is loaded and rendered at most once per engine: importing it again, even through a different relative path, returns the same result.

<% texl.import("partials/header.texl") ~> (doc -> doc.rendering) %>

See Documents and imports for the details.