Add conditional negation
This commit is contained in:
parent
5c7db6cd23
commit
5557772957
2 changed files with 3 additions and 3 deletions
|
|
@ -38,7 +38,7 @@ public class ConditionalTagClass<TClass> : TagClass
|
|||
public ConditionalTag(ITemplateTag templateTag, RegexOptions options, Expression conditionExpression)
|
||||
: base(templateTag, conditionExpression)
|
||||
{
|
||||
NameMatcher = new Regex($"^<{templateTag.TagName}->", options);
|
||||
NameMatcher = new Regex($"^<(!)?{templateTag.TagName}->", options);
|
||||
NameCloseMatcher = new Regex($"^<-{templateTag.TagName}>", options);
|
||||
}
|
||||
|
||||
|
|
@ -59,6 +59,6 @@ public class ConditionalTagClass<TClass> : TagClass
|
|||
}
|
||||
}
|
||||
|
||||
protected override Expression GetTagExpression(string exactName, string formatter) => ExpressionValue;
|
||||
protected override Expression GetTagExpression(string exactName, string formatter) => formatter == "!" ? Expression.Not(ExpressionValue) : ExpressionValue;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue