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

Wrapping and finding template functions #28

Open
7 of 10 tasks
technosophos opened this issue Feb 11, 2022 · 0 comments
Open
7 of 10 tasks

Wrapping and finding template functions #28

technosophos opened this issue Feb 11, 2022 · 0 comments

Comments

@technosophos
Copy link
Collaborator

technosophos commented Feb 11, 2022

Per #25, implement the Sprig functions for Bartholomew. Rather than file an issue for each function, I figured I'd break these down into small batches. (Note: I am not entirely sure all of the functions can be done with the same syntax. I am no pro in writing the Handlebars functions.)

  • wrap COUNT STRING Wrap text at a particular length (line ending: \n)
  • wrap_with COUNT ENDING STRING Wrap STRING using ENDING as the line ending. e.g. wrap_with "<br>" some_text will use <br> instead of a line break
  • contains SUBSTRING STRING returns boolean true if SUBSTRING is contained within STRING
  • has_prefix PREFIX STRING returns boolean true if PREFIX is found at the beginning of STRING
  • has_suffix SUFFIX STRING returns boolean true if SUFFIX is found at the end of STRING
  • cat STRING... Concatenates the given strings with spaces in between. cat "hello" "world" becomes hello world
  • indent COUNT STRING indent the string COUNT characters
  • nindent COUNT STRING add a new line and indent the string COUNT characters, (might not need this... it was originally really for YAML formatting)
  • replace TARGET REPLACEMENT STRING Replace all instances of TARGET with REPLACEMENT in the STRING
  • shuffle STRING randomly reorder the characters in STRING
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

1 participant