In this namespace is defined most of the functions and classes related to template rendering. More...
Classes | |
| struct | Action |
| Used during mustache template compilation to represent parsing actions. More... | |
| class | invalid_template_exception |
| Represents compilation error of an template. Throwed specially at mustache compile time. More... | |
| struct | rendered_template |
| Returned object after call the template_t::render() method. Its intended to be returned during a rule declaration. More... | |
| class | template_t |
| Compiled mustache template object. More... | |
Typedefs | |
| using | context = json::wvalue |
Enumerations | |
| enum class | ActionType { Ignore , Tag , UnescapeTag , OpenBlock , CloseBlock , ElseBlock , Partial } |
| Used in Action to represent different parsing behaviors. More... | |
Functions | |
| template_t | load (const std::string &filename) |
| Open, read and renders a file using a mustache compiler. It also sanitize the input before compilation. | |
| template_t | compile (const std::string &body) |
| The function that compiles a source into a mustache template. | |
| std::string | default_loader (const std::string &filename) |
| The default way that load, load_unsafe, load_text and load_text_unsafe use to read the contents of a file. | |
| void | set_base (const std::string &path) |
Defines the templates directory path at route level. By default is templates/. | |
| void | set_global_base (const std::string &path) |
Defines the templates directory path at global level. By default is templates/. | |
| void | set_loader (std::function< std::string(std::string)> loader) |
| Change the way that load, load_unsafe, load_text and load_text_unsafe reads a file. | |
| std::string | load_text (const std::string &filename) |
| Open, read and sanitize a file but returns a std::string without a previous rendering process. | |
| std::string | load_text_unsafe (const std::string &filename) |
| Open and read a file but returns a std::string without a previous rendering process. | |
| template_t | load_unsafe (const std::string &filename) |
| Open, read and renders a file using a mustache compiler. But it do not sanitize the input before compilation. | |
In this namespace is defined most of the functions and classes related to template rendering.
If you are here you might want to read these functions and classes:
As name suggest, crow uses mustache as main template rendering system.
You may be interested in taking a look at the Templating guide page.
|
strong |
|
inline |
Open, read and sanitize a file but returns a std::string without a previous rendering process.
Except for the sanitize process this function does the almost the same thing that load_text_unsafe.
|
inline |
Open and read a file but returns a std::string without a previous rendering process.
This function is more like a helper to reduce code like this...
... Into this...
|
inline |
Open, read and renders a file using a mustache compiler. But it do not sanitize the input before compilation.
|
inline |
Change the way that load, load_unsafe, load_text and load_text_unsafe reads a file.
By default, the previously mentioned functions load files using default_loader, that only reads a file and returns a std::string.