tyler-sommer / stick

A golang port of the Twig templating engine
MIT License
183 stars 36 forks source link

Don't die when looking up non-existent map elements #40

Closed Alex-PK closed 3 years ago

Alex-PK commented 3 years ago

Hi,

I noticed that the default filter didn't work when used with map values, as the parser just stopped parsing if a key didn't exist in the map.

This patch will instead return nil and continue parsing, making the default filter work correctly.

Sorry for the other unrelated "fixes". Goland insists on "autofixing" the code with the gofmt conventions before doing a commit. Let me know if they are a problem and I'll see if I can find a way to remove them.

tyler-sommer commented 3 years ago

Awesome stuff, truly. Thanks very much for the great set of PRs.

tyler-sommer commented 3 years ago

@Alex-PK I added the hacktoberfest-accepted label to all of these in case you were interested in that. I hope that adding them after the fact does not invalidate them-- happy to put in a word to DO so you get credit, just let me know :)

Alex-PK commented 3 years ago

Thanks a lot, both for accepting and merging them so quickly and for the hacktoberfest tag. :) I hope I'll be able to implement some more twig functions in the near future, even if some of them are very PHP-based :D