public class ExtendsTag extends Tag
You would make a "skeleton" template like so:
<html>
<head>
<title>Page title</title>
</head>
<body>
{% block "content" %}foo{% end %}
</body>
</html>
And another file to "extend" it, like so:
{% extends "skeleton.html" %}
{% block "content" %}
bar
{% end %}
The contents of the second file will then be the contents of the skeleton file, and the "content" block will be replaced with the content inside the block.
Constructor and Description |
---|
ExtendsTag() |
Modifier and Type | Method and Description |
---|---|
boolean |
isBlockTag() |
void |
parseStatement(StatementParser stmtParser)
Parse the statement that appears after the tag in the markup.
|
void |
render(CarrotEngine engine,
java.io.Writer writer,
TagNode tagNode,
Scope scope)
Render this
Tag to the given Writer . |
public boolean isBlockTag()
isBlockTag
in class Tag
public void parseStatement(StatementParser stmtParser) throws CarrotException
Tag
Tag.isBlockTag()
or Tag.canChain(Tag)
.parseStatement
in class Tag
stmtParser
- A StatementParser
for parsing the statement.CarrotException
- if there is an unrecoverable error parsing the statement.public void render(CarrotEngine engine, java.io.Writer writer, TagNode tagNode, Scope scope) throws CarrotException
Tag
Tag
to the given Writer
.render
in class Tag
engine
- The current CarrotEngine
.writer
- The Writer
to render to.tagNode
- The TagNode
that we're enclosed in. You can use this to render the children, or query
the children or whatever.scope
- The current Scope
.CarrotException
- if there's an error parsing or rendering the template