github.com/rur/treetop (go): Package treetop implements tools for constructing HTTP handlers for nested templates  To read about nested template support in Go see https://tip.golang.org/pkg/text/template/#hdr-Nested_template_definitions  Multi-page web apps require a lot of endpoints. Template inheritance is commonly used to reduce HTML boilerplate and improve reuse. Treetop views incorporate request handlers into the hierarchy to gain the same advantage.  A 'View' is a template string (usually file path) paired with a handler function. Go templates can contain named nested blocks. Defining a 'SubView' associates a handler and a template with a block embedded within a parent template. HTTP handlers can then be constructed for various page configurations.  Example of a basic template hierarchy  Example of using the library to constructs handlers for HTTP routes.  The generated handlers bind togeather related views. Thus views can be mixed and matched to create many endpoints.  Note, many levels of nesting are possible once block names remain unique.  The constructed handlers are capable of rendering just sections of the page depending upon the request headers. See the Treetop JS library for more details. (https://github.com/rur/treetop-client)
Keywords: golang-library|html-template|http-handlers