tags
Class info¶
Classes¶
Name | Children | Inherits |
---|---|---|
BaseTemplateTag jinjarope.tags Base class for template tag extensions providing common functionality. |
||
ContainerTag jinjarope.tags Tag that wraps content and processes it. |
||
InclusionTag jinjarope.tags Tag that includes other templates with context. |
||
StandaloneTag jinjarope.tags Tag that renders to a single output without content block. |
🛈 DocStrings¶
Jinja2 template tag extensions.
BaseTemplateTag
¶
Bases: Extension
Base class for template tag extensions providing common functionality.
Source code in src/jinjarope/tags.py
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
|
init_parser
¶
init_parser(parser: Parser) -> None
Initialize parser by skipping the tag name.
Source code in src/jinjarope/tags.py
51 52 53 |
|
parse
¶
Parse the tag definition and return a Node.
Source code in src/jinjarope/tags.py
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
|
parse_args
¶
Parse arguments from the tag definition.
Source code in src/jinjarope/tags.py
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
|
ContainerTag
¶
Bases: BaseTemplateTag
Tag that wraps content and processes it.
Source code in src/jinjarope/tags.py
155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 |
|
create_node
¶
create_node(
parser: Parser,
args: list[Expr],
kwargs: list[Keyword],
*,
lineno: int,
**options: Any
) -> Node
Create a node that processes wrapped content.
Source code in src/jinjarope/tags.py
158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 |
|
InclusionTag
¶
Bases: StandaloneTag
Tag that includes other templates with context.
Source code in src/jinjarope/tags.py
191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 |
|
get_context
¶
Get additional context for template.
Source code in src/jinjarope/tags.py
216 217 218 |
|
get_template_names
¶
Get template name(s) to include.
Source code in src/jinjarope/tags.py
220 221 222 223 224 225 |
|
render
¶
Render included template with context.
Source code in src/jinjarope/tags.py
197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 |
|
StandaloneTag
¶
Bases: BaseTemplateTag
Tag that renders to a single output without content block.
Source code in src/jinjarope/tags.py
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 |
|
create_tag_extension
¶
create_tag_extension(
typ: Literal["standalone", "container", "inclusion"],
tag: str | list[str] | set[str],
render_fn: Callable[..., str],
)
Create a Jinja2 extension from a render function.
Source code in src/jinjarope/tags.py
228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 |
|