github.com/powerman/golang-tools@v0.1.11-0.20220410185822-5ad214d8d803/present/caption.go (about)

     1  // Copyright 2012 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.
     4  
     5  package present
     6  
     7  import "strings"
     8  
     9  func init() {
    10  	Register("caption", parseCaption)
    11  }
    12  
    13  type Caption struct {
    14  	Cmd  string // original command from present source
    15  	Text string
    16  }
    17  
    18  func (c Caption) PresentCmd() string   { return c.Cmd }
    19  func (c Caption) TemplateName() string { return "caption" }
    20  
    21  func parseCaption(_ *Context, _ string, _ int, cmd string) (Elem, error) {
    22  	text := strings.TrimSpace(strings.TrimPrefix(cmd, ".caption"))
    23  	return Caption{cmd, text}, nil
    24  }