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

Set attribute based on value of another - attribute_filter enhancement? #163

Open
OJFord opened this issue Jun 23, 2022 · 0 comments
Open

Comments

@OJFord
Copy link

OJFord commented Jun 23, 2022

Sorry if this is already possible, but I don't think it is: I'd like to be able to use attribute_filter, or something like it, in order to set a different attrB using (or not) the value from the attrA that was present and found by the filter (attrB may or may not exist already).

For example it might look something like:

use ammonia::Builder;
let a = Builder::new()
    .attribute_filter(|element, attribute, value| {
        match (element, attribute) {
            ("a", "href") => Some(hashset![("href", value), ("title", value)]),
            _ => None
        }
    })
OJFord added a commit to OJFord/amail that referenced this issue Jun 23, 2022
I don't think it's possible to do this (yet?) with ammonia, cf.
rust-ammonia/ammonia#163.
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