Mustache

Documentation
Login
Bounty program for improvements to Tcl and certain Tcl packages.


[ Home | Main Table Of Contents | Table Of Contents | Keyword Index ]

NAME

mustache::context - Mustache - Field resolution context

Table Of Contents

SYNOPSIS

package require mustache::context

::mustache context create obj frame
::mustache context new frame
has? field
focus field
pop
push frame
iterable?
nil?
value
iter script
template? name
template: name specification
template name

DESCRIPTION

Welcome to the Mustache project for Tcl, written by Andreas Kupries.

It provides a set of five related Tcl packages for the parsing and rendering of mustache-style logic-less templates, plus an application for easy command-line access to the functionality.

For availability please read Mustache - How To Get The Sources.

Overview

The mustache render command provided by package mustache::render requires a context as the source of the values to interpolate into the template it is invoked with.

This package provides a suitable TclOO class.

Note however that any command prefix supporting the Instance API below will be suitable.

Class API

Instance API

Contexts are what the mustache renderer delegates field resolution to, and retrieves the values to interpolate from.

From its point of view a context is a stack of data frames from which it can pull values. The data frame at the top of the stack is called dot. Any search for named fields starts at dot, moving deeper into the stack only on misses.

During rendering data frames are pushed on and popped of the stack at the behest of the renderer, as it walks the template structure.

Bugs, Ideas, Feedback

Both the package(s) and this documentation will undoubtedly contain bugs and other problems. Please report such at Mustache Tracker.

Please also report any ideas you may have for enhancements of either package(s) and/or documentation.

KEYWORDS

context, contexts, dot, logic-less templates, mustache, templating

COPYRIGHT

Copyright © 2019-2021 Andreas Kupries
Copyright © 2019-2021 Documentation, Andreas Kupries