github.com/shogo82148/std@v1.22.1-0.20240327122250-4e474527810c/text/template/option.go (about) 1 // Copyright 2015 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 // This file contains the code to handle template options. 6 7 package template 8 9 // Optionはテンプレートのオプションを設定します。オプションは 10 // 文字列によって記述され、単純な文字列または "key=value" の形式を取ります。 11 // オプション文字列には最大で一つの等号が含まれていることができます。 12 // オプション文字列が認識できないものや無効なものである場合、Optionはパニックを起こします。 13 // 14 // Known options: 15 // 16 // missingkey: Control the behavior during execution if a map is 17 // indexed with a key that is not present in the map. 18 // 19 // "missingkey=default" or "missingkey=invalid" 20 // The default behavior: Do nothing and continue execution. 21 // If printed, the result of the index operation is the string 22 // "<no value>". 23 // "missingkey=zero" 24 // The operation returns the zero value for the map type's element. 25 // "missingkey=error" 26 // Execution stops immediately with an error. 27 func (t *Template) Option(opt ...string) *Template