Skip to content

Instantly share code, notes, and snippets.

@cjse
Created September 28, 2009 16:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cjse/195558 to your computer and use it in GitHub Desktop.
Save cjse/195558 to your computer and use it in GitHub Desktop.
StringTemplater with no tokens
- returns blank string if the given string is blank
- returns a non-blank string unchanged
StringTemplater with one token
- replaces token with empty string if no value in context
- replaces token with value from context
- leaves the rest of the string unchanged
StringTemplater with two tokens
- replaces each token with the value from the context
- replaces with blank string the tokens that have no value in context
- replaces tokens that are adjacent
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment