From 81c2f94e59b2b4e51cc39104d11b2ec1c4485f43 Mon Sep 17 00:00:00 2001 From: Julian Gonggrijp Date: Mon, 19 Apr 2021 03:26:03 +0200 Subject: Clarify the namespaces of Parents and Blocks --- specs/~inheritance.json | 2 +- specs/~inheritance.yml | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/specs/~inheritance.json b/specs/~inheritance.json index 88ebd1e..9453560 100644 --- a/specs/~inheritance.json +++ b/specs/~inheritance.json @@ -1,6 +1,6 @@ { "__ATTN__": "Do not edit this file; changes belong in the appropriate YAML file.", - "overview": "Like partials, Parent tags are used to expand an external template into the\ncurrent template. Contrary to partials, Parent tags may contain optional\narguments delimited by block tags. For this reason, Parent tags may also be\nreferred to as Parametric Partials.\n\nThe Parent tags' content MUST be a non-whitespace character sequence NOT\ncontaining the current closing delimiter; each Parent tag MUST be followed by\nan End Section tag with the same content within the matching Parent tag.\n\nThis tag's content names the Parent template to inject. Set Delimiter tags\nMUST NOT affect the parsing of a Parent template. The Parent MUST be rendered\nagainst the context stack local to the tag. If the named Parent cannot be\nfound, the empty string SHOULD be used instead, as in interpolations.\n\nParent tags SHOULD be treated as standalone when appropriate. If this tag is\nused standalone, any whitespace preceding the tag should be treated as\nindentation, and prepended to each line of the Parent before rendering.\n\nThe Block tags' content MUST be a non-whitespace character sequence NOT\ncontaining the current closing delimiter. Each Block tag MUST be followed by\nan End Section tag with the same content within the matching Block tag. This\ntag's content determines the parameter or argument name.\n\nBlock tags may appear both inside and outside of Parent tags. In both cases,\nthey specify a position within the template that can be overridden; it is a\nparameter of the containing template. The template text between the Block tag\nand its matching End Section tag defines the default content to render when\nthe parameter is not overridden from outside.\n\nIn addition, when used inside of a Parent tag, the template text between a\nBlock tag and its matching End Section tag defines content that replaces the\ndefault defined in the Parent template. This content is the argument passed\nto the Parent template.\n\nThe practice of injecting an external template using a Parent tag is referred\nto as inheritance. If the Parent tag includes a Block tag that overrides a\nparameter of the Parent template, this may also be referred to as\nsubstitution.\n", + "overview": "Like partials, Parent tags are used to expand an external template into the\ncurrent template. Contrary to partials, Parent tags may contain optional\narguments delimited by block tags. For this reason, Parent tags may also be\nreferred to as Parametric Partials.\n\nThe Parent tags' content MUST be a non-whitespace character sequence NOT\ncontaining the current closing delimiter; each Parent tag MUST be followed by\nan End Section tag with the same content within the matching Parent tag.\n\nThis tag's content names the Parent template to inject. Set Delimiter tags\nMUST NOT affect the parsing of a Parent template. The Parent MUST be rendered\nagainst the context stack local to the tag. If the named Parent cannot be\nfound, the empty string SHOULD be used instead, as in interpolations.\n\nParent tags SHOULD be treated as standalone when appropriate. If this tag is\nused standalone, any whitespace preceding the tag should be treated as\nindentation, and prepended to each line of the Parent before rendering.\n\nThe Block tags' content MUST be a non-whitespace character sequence NOT\ncontaining the current closing delimiter. Each Block tag MUST be followed by\nan End Section tag with the same content within the matching Block tag. This\ntag's content determines the parameter or argument name.\n\nBlock tags may appear both inside and outside of Parent tags. In both cases,\nthey specify a position within the template that can be overridden; it is a\nparameter of the containing template. The template text between the Block tag\nand its matching End Section tag defines the default content to render when\nthe parameter is not overridden from outside.\n\nIn addition, when used inside of a Parent tag, the template text between a\nBlock tag and its matching End Section tag defines content that replaces the\ndefault defined in the Parent template. This content is the argument passed\nto the Parent template.\n\nThe practice of injecting an external template using a Parent tag is referred\nto as inheritance. If the Parent tag includes a Block tag that overrides a\nparameter of the Parent template, this may also be referred to as\nsubstitution.\n\nParent templates are taken from the same namespace as regular Partial\ntemplates and in fact, injecting a regular Partial is exactly equivalent to\ninjecting a Parent without making any substitutions. Parameter and arguments\nnames live in a namespace that is distinct from both Partials and the context.\n", "tests": [ { "name": "Default", diff --git a/specs/~inheritance.yml b/specs/~inheritance.yml index c4fb430..4c60790 100644 --- a/specs/~inheritance.yml +++ b/specs/~inheritance.yml @@ -37,6 +37,11 @@ overview: | to as inheritance. If the Parent tag includes a Block tag that overrides a parameter of the Parent template, this may also be referred to as substitution. + + Parent templates are taken from the same namespace as regular Partial + templates and in fact, injecting a regular Partial is exactly equivalent to + injecting a Parent without making any substitutions. Parameter and arguments + names live in a namespace that is distinct from both Partials and the context. tests: - name: Default desc: Default content should be rendered if the block isn't overridden -- cgit v1.2.1