Skip to content
This repository has been archived by the owner. It is now read-only.

Document html composability clearly (aka partials) #6

Merged
merged 3 commits into from Aug 23, 2018

Conversation

@phansch
Copy link
Contributor

@phansch 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 lambda-fairy/maud#133

Copy link
Owner

@lambda-fairy lambda-fairy left a comment

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.

@lambda-fairy

lambda-fairy 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.

@lambda-fairy

lambda-fairy 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
Author 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.

@lambda-fairy

lambda-fairy Aug 18, 2018
Owner

Sub-templates has a hyphen I think

phansch added 2 commits Aug 20, 2018
@lambda-fairy lambda-fairy merged commit 0dba5a1 into lambda-fairy:master Aug 23, 2018
@lambda-fairy
Copy link
Owner

@lambda-fairy lambda-fairy commented Aug 23, 2018

Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants