Ejemplo n.º 1
0
// DefaultParser sets up and assigns the default parser to be used by Xslate.
func DefaultParser(tx *Xslate, args Args) error {
	syntax, ok := args.Get("Syntax")
	if !ok {
		syntax = "TTerse"
	}

	switch syntax {
	case "TTerse":
		tx.Parser = tterse.New()
	case "Kolon", "Kolonish":
		tx.Parser = kolonish.New()
	default:
		return errors.New("sytanx '" + syntax.(string) + "' is not available")
	}
	return nil
}
Ejemplo n.º 2
0
// DefaultParser sets up and assigns the default parser to be used by Xslate.
func DefaultParser(tx *Xslate, args Args) error {
	syntax, ok := args.Get("Syntax")
	if !ok {
		syntax = "TTerse"
	}

	switch syntax {
	case "TTerse":
		tx.Parser = tterse.New()
	case "Kolon", "Kolonish":
		tx.Parser = kolonish.New()
	default:
		return fmt.Errorf("error: Syntax '%s' not available", syntax)
	}
	return nil
}