jehugaleahsa / mustache-sharp

An extension of the mustache text template engine for .NET.
The Unlicense
306 stars 80 forks source link

ConditionTagDefinition #72

Open PaulGrimshaw opened 7 years ago

PaulGrimshaw commented 7 years ago

Could we make this class public? It is a useful one to be able to inherit from and add as a custom tag (have tested successfully)

oscaruribe commented 7 years ago

I've done my own #compare (like #if but with operators).

compare @index 'eq' 0 // Will be true if current index EQuals 0

compare @index 'ne' 0 // Will be true if current index is Not Equal to 0

compare @index 'factor' 2 // Will be true if current index is evenly divided by 2

compare @index 'gt' 0 // Will be true if current index greater than 0

compare @index 'ge' 1 // Will be true if current index greater than or equal to 1

compare @index 'lt' 10 // Will be true if current index less than 10

compare @index 'le' 9 // Will be true if current index less than or equal to 9

Only had to reproduce a minimal amount of code from ConditionTag into it but I agree. If I could have inherited ConditionTagDefinition it'd be cleaner.

ranaadeel0300 commented 2 years ago

Can u please give me a complete example , how you create ur own #compare tag. i also need to do this type of work.