github.com/graybobo/golang.org-package-offline-cache@v0.0.0-20200626051047-6608995c132f/x/tools/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  	Text string
    15  }
    16  
    17  func (c Caption) TemplateName() string { return "caption" }
    18  
    19  func parseCaption(_ *Context, _ string, _ int, text string) (Elem, error) {
    20  	text = strings.TrimSpace(strings.TrimPrefix(text, ".caption"))
    21  	return Caption{text}, nil
    22  }