Skip to content

Instantly share code, notes, and snippets.

@Keats
Created September 28, 2017 03:17
Show Gist options
  • Save Keats/e5fb6aad409f28721c0ba14161644c57 to your computer and use it in GitHub Desktop.
Save Keats/e5fb6aad409f28721c0ba14161644c57 to your computer and use it in GitHub Desktop.
/// All Tera nodes that can be encountered
#[derive(Clone, Debug, PartialEq)]
pub enum Node {
/// A call to `{{ super() }}` in a block
Super,
/// Some actual text
Text(String),
/// A `{{ }}` block
VariableBlock(Expr),
/// A `{% macro hello() %}...{% endmacro %}`
MacroDefinition(WS, MacroDefinition, WS),
/// The `{% extends "blabla.html" %}` node, contains the template name
Extends(WS, String),
/// The `{% include "blabla.html" %}` node, contains the template name
Include(WS, String),
/// The `{% import "macros.html" as macros %}`
ImportMacro(WS, String, String),
/// The `{% set val = something %}` tag
Set(WS, Set),
/// The text between `{% raw %}` and `{% endraw %}`
Raw(WS, String, WS),
/// A filter section node `{{ filter name(param="value") }} content {{ endfilter }}`
FilterSection(WS, FilterSection, WS),
/// A `{% block name %}...{% endblock %}`
Block(WS, Block, WS),
/// A `{% for i in items %}...{% endfor %}`
Forloop(WS, Forloop, WS),
/// A if/elif/else block, WS for the if/elif/else is directly in the struct
If(If, WS),
}
{% extends "docs.html" %}
{% block doc_content %}
{{ page.content | safe }}
{% endblock doc_content %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment