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

Document html composability clearly (aka partials) #6

Merged
merged 3 commits into from Aug 23, 2018

Conversation

2 participants
@phansch
Contributor

phansch commented Aug 14, 2018

When I was evaluating maud, I ran into the same issue as @max-frai regarding partials/sub templates. This documents that it's super easy to compose the templates using plain Rust functions.

Closes lfairy/maud#133

@lfairy

Thanks for the PR! I like the approach you're taking here.

partials.md Outdated
Maud does not have a built-in concept of partials or sub templates. Instead, you can compose your markup with any function that returns `Markup`.
The following uses a `header` and `footer` function that are used in the `page` function to return a final result.

This comment has been minimized.

@lfairy

lfairy Aug 18, 2018

Owner

The following example?

partials.md Outdated
}
/// The final Markup, including `header` and `footer`.
pub fn page(title: &str) -> Markup {

This comment has been minimized.

@lfairy

lfairy Aug 18, 2018

Owner

I think it's worth demonstrating that functions can accept Markup values as well as return them.

See the first few lines of https://github.com/lfairy/karkinos/blob/master/src/views.rs

What do you think?

This comment has been minimized.

@phansch

phansch Aug 20, 2018

Contributor

That makes sense 👍

partials.md Outdated
@@ -0,0 +1,50 @@
# Partials
Maud does not have a built-in concept of partials or sub templates. Instead, you can compose your markup with any function that returns `Markup`.

This comment has been minimized.

@lfairy

lfairy Aug 18, 2018

Owner

Sub-templates has a hyphen I think

phansch added some commits Aug 20, 2018

@lfairy lfairy merged commit 0dba5a1 into lfairy:master Aug 23, 2018

@lfairy

This comment has been minimized.

Owner

lfairy commented Aug 23, 2018

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment