github.com/linchen2chris/hugo@v0.0.0-20230307053224-cec209389705/markup/asciidocext/asciidocext_config/config.go (about)

     1  // Copyright 2020 The Hugo Authors. All rights reserved.
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  // http://www.apache.org/licenses/LICENSE-2.0
     7  //
     8  // Unless required by applicable law or agreed to in writing, software
     9  // distributed under the License is distributed on an "AS IS" BASIS,
    10  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    11  // See the License for the specific language governing permissions and
    12  // limitations under the License.
    13  
    14  // Package asciidoc_config holds asciidoc related configuration.
    15  package asciidocext_config
    16  
    17  var (
    18  	// Default holds Hugo's default asciidoc configuration.
    19  	Default = Config{
    20  		Backend:              "html5",
    21  		Extensions:           []string{},
    22  		Attributes:           map[string]string{},
    23  		NoHeaderOrFooter:     true,
    24  		SafeMode:             "unsafe",
    25  		SectionNumbers:       false,
    26  		Verbose:              false,
    27  		Trace:                false,
    28  		FailureLevel:         "fatal",
    29  		WorkingFolderCurrent: false,
    30  		PreserveTOC:          false,
    31  	}
    32  
    33  	// CliDefault holds Asciidoctor CLI defaults (see https://asciidoctor.org/docs/user-manual/)
    34  	CliDefault = Config{
    35  		Backend:      "html5",
    36  		SafeMode:     "unsafe",
    37  		FailureLevel: "fatal",
    38  	}
    39  
    40  	AllowedSafeMode = map[string]bool{
    41  		"unsafe": true,
    42  		"safe":   true,
    43  		"server": true,
    44  		"secure": true,
    45  	}
    46  
    47  	AllowedFailureLevel = map[string]bool{
    48  		"fatal": true,
    49  		"warn":  true,
    50  	}
    51  
    52  	AllowedBackend = map[string]bool{
    53  		"html5":     true,
    54  		"html5s":    true,
    55  		"xhtml5":    true,
    56  		"docbook5":  true,
    57  		"docbook45": true,
    58  		"manpage":   true,
    59  	}
    60  
    61  	DisallowedAttributes = map[string]bool{
    62  		"outdir": true,
    63  	}
    64  )
    65  
    66  // Config configures asciidoc.
    67  type Config struct {
    68  	Backend              string
    69  	Extensions           []string
    70  	Attributes           map[string]string
    71  	NoHeaderOrFooter     bool
    72  	SafeMode             string
    73  	SectionNumbers       bool
    74  	Verbose              bool
    75  	Trace                bool
    76  	FailureLevel         string
    77  	WorkingFolderCurrent bool
    78  	PreserveTOC          bool
    79  }