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

Allow some form of robust templating #614

Closed
patcon opened this issue Nov 28, 2018 · 8 comments
Closed

Allow some form of robust templating #614

patcon opened this issue Nov 28, 2018 · 8 comments

Comments

@patcon
Copy link
Contributor

patcon commented Nov 28, 2018

Handlebar is a templating library that allows simple logic. It might be nice to use it to allow for more robust templating for certain types of messages/strings.

One benefit of this is that comprehensive format rules could be set at General level, rather than setting them at each gateway.

Places to implement:

Seems the best library in go: https://github.com/aymerick/raymond

@patcon
Copy link
Contributor Author

patcon commented Nov 28, 2018

We could perhaps also use custom helpers to do away with config like "StripNick", as people could do that via templates: https://github.com/aymerick/raymond#helpers

@patcon
Copy link
Contributor Author

patcon commented Nov 28, 2018

Potential use-cases:

  • Allow special avatar for system user.
  • Allow messages to have quick-access permalink to original message if they're on the same team, for example, during translation.
  • Append "thread reply: " prefix if parent message is unthreaded.

@patcon
Copy link
Contributor Author

patcon commented Nov 28, 2018

Defaults here would be helpful, so might be nice to have a more robust default process, rather than simply empty strings or falsey values

@patcon
Copy link
Contributor Author

patcon commented Feb 14, 2019

Not sure whether mustache is the most appropriate engine, so generalizing this issue

@qaisjp
Copy link
Collaborator

qaisjp commented Feb 17, 2019

Go has a text templating system in its standard library: text/template.

@patcon
Copy link
Contributor Author

patcon commented Feb 17, 2019

Thanks @qaisjp! text/template's looping doesn't feel very friendly to the vast number of people more familiar with non-golang template engines -- and feels like templates would be very user-facing :)

@42wim
Copy link
Owner

42wim commented Apr 8, 2019

I think using tengo is the solution for this instead of templating, much more powerful

@patcon
Copy link
Contributor Author

patcon commented Apr 16, 2019

Good call. Closing out :) Thanks!

@patcon patcon closed this as completed Apr 16, 2019
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

3 participants