1 // Copyright 2016 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
13 Register("video", parseVideo)
17 Cmd string // original command from present source
24 func (v Video) PresentCmd() string { return v.Cmd }
25 func (v Video) TemplateName() string { return "video" }
27 func parseVideo(ctx *Context, fileName string, lineno int, text string) (Elem, error) {
28 args := strings.Fields(text)
30 return nil, fmt.Errorf("incorrect video invocation: %q", text)
32 vid := Video{Cmd: text, URL: args[1], SourceType: args[2]}
33 a, err := parseArgs(fileName, lineno, args[3:])
41 // If a parameter is empty (underscore) or invalid
42 // leave the field set to zero. The "video" action
43 // template will then omit that vid tag attribute and
44 // the browser will calculate the value to preserve
46 if v, ok := a[0].(int); ok {
49 if v, ok := a[1].(int); ok {
53 return nil, fmt.Errorf("incorrect video invocation: %q", text)