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