Skip to content

Add a render builtin#45

Closed
piojo-zz wants to merge 4 commits intoquattor:masterfrom
piojo-zz:render-builtin
Closed

Add a render builtin#45
piojo-zz wants to merge 4 commits intoquattor:masterfrom
piojo-zz:render-builtin

Conversation

@piojo-zz
Copy link
Member

We use heavily format but we miss the ability to do named substitutions like we do in Python. This is just a proof of concept (and it lacks documentation) of a render built-in. It uses StringTemplate to do substitutions like

"/foo" = render("hello <foo>", nlist("foo", "world"));

The new dependency is BSD-licensed. Before I continue polyshing it, I'd like to know if this approach is acceptable in the compiler.

@jrha
Copy link
Member

jrha commented Feb 25, 2014

I'm not sure about this. Maybe it's not so useful now we have metaconfig? Also the <tag> syntax makes me fear mixing this any config that looks like xml.

@jrha
Copy link
Member

jrha commented Feb 25, 2014

I've just been pointed at StrSubstitutor by a colleague from this discussion.

@ned21
Copy link
Contributor

ned21 commented Feb 25, 2014

I think the idea is good, we would find it very useful, but I agree that the syntax means XML needs escaping. ${tag} would be better.

@jouvin
Copy link
Contributor

jouvin commented Mar 31, 2014

Would be good to hear from Cal, I just pinged him...

@loomis
Copy link

loomis commented Mar 31, 2014

My opinions:

  • I prefer the ${} syntax to an XML like syntax.
  • StrSubstitutor has no runtime dependencies => good
  • StringTemplate pulls in the ANTLR runtime => bad
  • StrSubstitutor is maintained in the central maven repository => good
  • StringTemplate only delivers recent releases from GitHub => bad

Preference: Implementation based on StrSubstitutor, if this is still desired functionality.

@loomis
Copy link

loomis commented May 25, 2014

I've added a public branch and pull request to allow direct collaboration on the implementation. See pull request #59.

@loomis loomis closed this May 25, 2014
@loomis loomis added this to the 10.1 milestone May 25, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

5 participants