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

Implementing a generic method to get content the partials #67

Open
ayourtch opened this issue Jan 12, 2020 · 0 comments
Open

Implementing a generic method to get content the partials #67

ayourtch opened this issue Jan 12, 2020 · 0 comments

Comments

@ayourtch
Copy link

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!

adri326 added a commit to adri326/rust-mustache that referenced this issue Jul 27, 2022
This fixes a few issues:
- nickel-org#67
- nickel-org#62 (by implementing
  a custom PartialLoader without the set_extension)

But it also adds a lot of complexity and breaks previous code.
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