Skip to content
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

Maud and macro_rules don't play well together #21

Closed
lambda-fairy opened this issue Sep 12, 2015 · 0 comments
Closed

Maud and macro_rules don't play well together #21

lambda-fairy opened this issue Sep 12, 2015 · 0 comments

Comments

@lambda-fairy
Copy link
Owner

This doesn't work:

macro_rules! greet {
    () => ({
        let mut result = String::new();
        let name = "Pinkie Pie";
        html!(result, p { "Hello, " $name "!" });
        result
    })
}

That's because macro_rules! tries to expand $name itself, when it should be handled by Maud instead.

We can probably work around that by adding a new #splice magic operator. So the code above would look like this:

// ...
html!(result, p { "Hello, " #splice name "!" });
// ...

This works because it doesn't have a $ in it.

See rust-lang/rust#6994

Nemo157 added a commit to Nemo157/maud that referenced this issue Feb 2, 2016
@Nemo157 Nemo157 mentioned this issue Feb 2, 2016
Nemo157 added a commit to Nemo157/maud that referenced this issue Feb 3, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant