Exemple #1
0
func ElseIfFactory(p *core.Parser, config *core.Configuration) (core.Tag, error) {
	condition, err := p.ReadConditionGroup()
	if err != nil {
		return nil, err
	}
	p.SkipPastTag()
	return &ElseIf{NewCommon(), condition}, nil
}
Exemple #2
0
func UnlessFactory(p *core.Parser, config *core.Configuration) (core.Tag, error) {
	condition, err := p.ReadConditionGroup()
	if err != nil {
		return nil, err
	}
	p.SkipPastTag()
	condition.Inverse()
	return &Unless{NewCommon(), condition, nil}, nil
}
Exemple #3
0
func IfFactory(p *core.Parser, config *core.Configuration) (core.Tag, error) {
	condition, err := p.ReadConditionGroup()
	if err != nil {
		return nil, err
	}
	i := &If{
		NewCommon(),
		condition,
		make([]IfSibling, 0, 3),
	}
	i.conditions = append(i.conditions, i)
	p.SkipPastTag()
	return i, nil
}