▲ | itishappy 9 days ago | |||||||
Thanks mate! (BTW: Indenting code with four spaces makes HN format it like code.) So the thing I'm still not getting from your example is allowing the template itself to be customized.
| ||||||||
▲ | ratorx 9 days ago | parent [-] | |||||||
template1 is a function that takes in a parameter evil (with a SanitisedString type that wraps a regular str) and returns the fully expanded str. It is implemented by just returning an f-string equivalent to the t-string in your example. Same with template2. Using the SanitisedString type forces the user to explicitly call a sanitiser function that returns a SanitisedString and prevents them from passing in an unsanitised str. | ||||||||
|