fhd / clostache

{{ mustache }} for Clojure
GNU Lesser General Public License v3.0
318 stars 62 forks source link

Fix to enable using dotted access notation in a section #44

Closed markwoodhall closed 6 years ago

markwoodhall commented 9 years ago

Hi,

First, thanks for making clostache, I've used it in a few different projects so I appreciate the effort you've put in.

This pull requests is to create tests and an implementation for dotted access inside a section. Like so:

"Hello, {{#person}}{{#felix}}{{name.first}}{{/felix}}{{/person}}"

or

"Hello, {{#person}}{{#felix}}{{name.first}} {{name.last}}{{/felix}}{{/person}}"

Its worth saying that I'm pretty new to Clojure, so I don't doubt that there is a better implementation available. This does work though and all of the tests pass. I'm happy if the implementation needs to change, I just needed to get it fixed.

I'd be interested to know your thoughts and eager to understand any improvements you can think of or any problems I might have unknowingly caused.

As a brief summary, what I've done is enabled the data passed into convert-path to be valid for the given dot notation. I've done this by doing a (get-in data in-sections). I've derived in-sections based on the positioning of the dot notation within (nested)section nodes.

I'd be interested to know if there is a better, more concise way to do this with a single regex matcher.

Cheers!

markwoodhall commented 8 years ago

@fhd is there any update on this? I'm currently using a patched version and it would be great to not have to worry about that.

fhd commented 7 years ago

Sorry, I've been somewhat missing in action for my GitHub projects... Given how it's been a while, let me know if you've given up on having this merged, I'd understand. If you'd still like to have it merged, I'll happily review it :smile:

markwoodhall commented 7 years ago

No problem at all. Sure, I'd be interested in getting it merged. It might need a bit of polish first though?

fhd commented 7 years ago

Probably not, I won't be able to do a good review since my Clojure has gotten rusty lately. I'll focus on making sure I understand the changes :smile: