2014-07-15 09:23:16 -06:00
|
|
|
// Copyright 2012 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.
|
|
|
|
|
|
|
|
package present
|
|
|
|
|
|
|
|
import "strings"
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
Register("caption", parseCaption)
|
|
|
|
}
|
|
|
|
|
|
|
|
type Caption struct {
|
2020-03-09 20:20:35 -06:00
|
|
|
Cmd string // original command from present source
|
2014-07-15 09:23:16 -06:00
|
|
|
Text string
|
|
|
|
}
|
|
|
|
|
2020-03-09 20:20:35 -06:00
|
|
|
func (c Caption) PresentCmd() string { return c.Cmd }
|
2014-07-15 09:23:16 -06:00
|
|
|
func (c Caption) TemplateName() string { return "caption" }
|
|
|
|
|
|
|
|
func parseCaption(_ *Context, _ string, _ int, text string) (Elem, error) {
|
|
|
|
text = strings.TrimSpace(strings.TrimPrefix(text, ".caption"))
|
2020-03-09 20:20:35 -06:00
|
|
|
return Caption{text, text}, nil
|
2014-07-15 09:23:16 -06:00
|
|
|
}
|