templates

package
v0.38.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 13, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package templates provides tree-based template loading and rendering using HTML templates from the Go standard library.

Use Templates to obtain an acceptable.Processor loaded with the specified template files.

Index

Constants

View Source
const DefaultPage = "_index.html"

Variables

Fs is used to obtain file information and content. It can be stubbed for testing.

View Source
var ReloadOnTheFly = false

ReloadOnTheFly enables a development mode that reloads template files whenever they change, without restarting the server. This reduces performance and should be off (false) for production.

Functions

func ApplicationXhtmlOffer

func ApplicationXhtmlOffer(dir, suffix string, funcMap template.FuncMap) offer.Offer

ApplicationXhtmlOffer is an Offer for application/xhtml+xml content using the Template() processor.

func Templates

func Templates(dir, suffix string, funcMap template.FuncMap) offer.Processor

Templates finds all the templates in the directory dir and its subdirectories that have names ending with the given suffix (usually ".html").

Optionally, the suffix can be a pipe-separated list, e.g. ".html|.js".

The function map can be nil if not required.

A processor is returned that handles requests using the templates available.

func TextHtmlOffer

func TextHtmlOffer(dir, suffix string, funcMap template.FuncMap) offer.Offer

TextHtmleOffer is an Offer for text/html content using the Template() processor.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL