Skip to content

Implementing a generic method to get content the partials #67

@ayourtch

Description

@ayourtch

For my project (https://github.com/ayourtch/rsp10)
I would like to embed into the framework code the default formatting of the html elements, which implies that any partial under html/* would need to be loaded from within the framework rather than the file on disk..

Is that something that you might consider interesting to merge ? If no - then please discard the rest of this text :-)

If yes:

In particular, I plan to refactor out this bit: https://github.com/nickel-org/rust-mustache/blob/master/src/compiler.rs#L66..L90
Into something more pluggable.

One option seems to make a PartialsMap a trait, and abstract both the HashMap and the code to supply the text of the partials in there..

Another option is to allow to specify a closure Fn(&str)->Result, which would be called first and return Err to trigger the current behavior of loading from files...

Is either of these two acceptable ? Or there is some other approach ?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions