decred.org/dcrdex@v1.0.5/client/webserver/locales/parse.go (about)

     1  package locales
     2  
     3  import "regexp"
     4  
     5  var keyRegExp = regexp.MustCompile(`\[\[\[([a-zA-Z0-9 _.\-:]+)\]\]\]`)
     6  
     7  // Tokens returns a slice of tuples (token, key), where token is just key with
     8  // triple square brackets, and could also be constructed simply as
     9  // "[[[" + key + "]]]"". The key is the lookup key for the Locales map. The
    10  // token is what must be replaced in the raw template.
    11  func Tokens(tmpl []byte) [][][]byte {
    12  	return keyRegExp.FindAllSubmatch(tmpl, -1)
    13  }