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

Proposal: add template function library #17

Open
apstndb opened this issue Jan 1, 2025 · 1 comment
Open

Proposal: add template function library #17

apstndb opened this issue Jan 1, 2025 · 1 comment

Comments

@apstndb
Copy link

apstndb commented Jan 1, 2025

I think that the power of text/template template is depending on available functions.
There are popular function libraries for text/template which can be easily embedded into knife/hagane as (*Template).FuncMap.

Note

@apstndb
Copy link
Author

apstndb commented Jan 1, 2025

I have checked function name collisions between knife and sprout.
Result: last and slice are only collided. typeOf and typeof is ambiguous.

details are folded Note: I have used `comm` tool, output is tab indented, meaning is `only_knife only_sprout both`.
	add
	add1
	add1f
	addf
	adler32Sum
	adler32sum
	all
	any
	append
array
	base32Decode
	base32Encode
	base64Decode
	base64Encode
basic
br
cap
	capitalize
	cat
	ceil
chan
	chunk
	coalesce
	compact
	concat
	contains
data
	date
	dateAgo
	dateInZone
	dateModify
	deepCopy
	deepEqual
	default
	dict
	dig
	div
	divf
doc
	duration
	durationRound
	ellipsis
	ellipsisBoth
	empty
	env
	expandEnv
exported
	first
	floor
	fromJson
	fromYaml
	get
	has
	hasField
	hasKey
	hasPrefix
	hasSuffix
	hello
	htmlDate
	htmlDateInZone
identical
implements
	indent
	initial
	initials
interface
	join
	keys
	kindIs
	kindOf
		last
len
	list
map
	max
	maxf
	md5Sum
	md5sum
	merge
	mergeOverwrite
methods
	min
	minf
	mod
	mul
	mulf
	mustAppend
	mustChunk
	mustCompact
	mustDateModify
	mustDeepCopy
	mustFirst
	mustFromJson
	mustFromYaml
	mustHas
	mustInitial
	mustLast
	mustMerge
	mustMergeOverwrite
	mustPrepend
	mustRegexFind
	mustRegexFindAll
	mustRegexMatch
	mustRegexReplaceAll
	mustRegexReplaceAllLiteral
	mustRegexSplit
	mustRest
	mustReverse
	mustSlice
	mustToDate
	mustToJson
	mustToPrettyJson
	mustToRawJson
	mustToYaml
	mustUniq
	mustWithout
named
names
	nindent
	nospace
	now
objectof
	omit
	osBase
	osClean
	osDir
	osExt
	osIsAbs
	pathBase
	pathClean
	pathDir
	pathExt
	pathIsAbs
	pick
pkg
	pluck
	plural
pointer
pos
	prepend
ptr
	quote
	randAlpha
	randAlphaNum
	randAscii
	randBytes
	randInt
	randNumeric
	regexFind
	regexFindAll
	regexMatch
	regexQuoteMeta
	regexReplaceAll
	regexReplaceAllLiteral
	regexSplit
	repeat
	replace
	rest
	reverse
	round
	semver
	semverCompare
	seq
	set
	sha1Sum
	sha1sum
	sha256Sum
	sha256sum
	sha512Sum
	shuffle
signature
		slice
	sortAlpha
	split
	splitList
	splitn
	squote
	strSlice
struct
	sub
	subf
	substr
	swapCase
	ternary
	toBool
	toCamelCase
	toConstantCase
	toDate
	toDotCase
	toDuration
	toFloat64
	toInt
	toInt64
	toJson
	toKebabCase
	toLower
	toOctal
	toPascalCase
	toPathCase
	toPrettyJson
	toRawJson
	toSnakeCase
	toString
	toTitleCase
	toUint
	toUint64
	toUpper
	toYaml
	trim
	trimAll
	trimPrefix
	trimSuffix
	trunc
	typeIs
	typeIsLike
	typeOf
typeof
	uncapitalize
under
	uniq
	unixEpoch
	unset
	until
	untilStep
	untitle
	uuidv4
	values
	without
	wrap
	wrapWith

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