-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Syntax sugar for no-query-result condition #28
Comments
Shouldn't this be outside of the content block? Like using something like |
It is pretty close to the dynamic block concept (I'm still working on the issue for that), indeed! We need to figure out an unobstructed syntax here -- it would be too cumbersome for the template authors to wrap every content block into another dynamic block. It needs to be a small addition, not a syntax change. Maybe these in-block fields can be syntactic sugar implemented through the dynamic blocks in the logic. |
with #142 in mind, I think this issue still stands -- dynamic blocks are not well suitable for not-null checks |
@traut What if we added a child block type for all content table {
query = "..."
...
empty_result {
content text {
value = "Empty data!"
}
} This would be a bit more flexible because we could specify any fallback content block. |
that's neat, it's declarative and provides more options. To reduce the nest-iness, maybe it can be a content block with some flag, like content table {
query = "..."
...
when_empty content text {
value = "Empty data!"
}
} ? and we can use content table {
query = "..."
...
when_empty content ref {
base = content.text.empty_data
}
} |
still not great :) it's confusing -- is |
|
oh, that's lovely. content table {
query = "..."
...
on_empty content text {
value = "Empty data!"
}
}
content table {
query = "..."
...
on_empty content ref {
base = content.text.empty_data
}
} would be ok, I think |
content
blocks
moving this to draft since #142 already can provide the functionality, even though in a bit wordy way |
Background
#142 introduces
dynamic
blocks. One typical pattern is to select which content to render based on the query result.Design
Implement syntactic sugar t
is unpacked into
Deliverables
The text was updated successfully, but these errors were encountered: