github.com/huner2/gomarkdoc@v0.3.6/templates.go (about)

     1  // Code generated by gentmpl.sh; DO NOT EDIT.
     2  
     3  package gomarkdoc
     4  
     5  var templates = map[string]string{
     6  	"doc": `{{- range .Blocks -}}
     7  	{{- if eq .Kind "paragraph" -}}
     8  		{{- paragraph .Text -}}
     9  	{{- else if eq .Kind "code" -}}
    10  		{{- codeBlock "" .Text -}}
    11  	{{- else if eq .Kind "header" -}}
    12  		{{- header .Level .Text -}}
    13  	{{- end -}}
    14  {{- end -}}
    15  
    16  `,
    17  	"example": `{{- accordionHeader .Title -}}
    18  
    19  {{- template "doc" .Doc -}}
    20  
    21  {{- codeBlock "go" .Code -}}
    22  
    23  {{- if .HasOutput -}}
    24  
    25  	{{- header 4 "Output" -}}
    26  
    27  	{{- codeBlock "" .Output -}}
    28      
    29  {{- end -}}
    30  
    31  {{- accordionTerminator -}}
    32  
    33  `,
    34  	"file": `<!-- Code generated by gomarkdoc. DO NOT EDIT -->
    35  
    36  {{.Header -}}
    37  
    38  {{- range .Packages -}}
    39  	{{- template "package" . -}}
    40  {{- end -}}
    41  
    42  {{- .Footer}}
    43  
    44  Generated by {{link "gomarkdoc" "https://github.com/huner2/gomarkdoc"}}
    45  `,
    46  	"func": `{{- if .Receiver -}}
    47  	{{- codeHref .Location | link (escape .Name) | printf "func \\(%s\\) %s" (escape .Receiver) | rawHeader .Level -}}
    48  {{- else -}}
    49  	{{- codeHref .Location | link (escape .Name) | printf "func %s" | rawHeader .Level -}}
    50  {{- end -}}
    51  
    52  {{- codeBlock "go" .Signature -}}
    53  
    54  {{- template "doc" .Doc -}}
    55  
    56  {{- range .Examples -}}
    57  	{{- template "example" . -}}
    58  {{- end -}}
    59  
    60  `,
    61  	"index": `{{- if len .Consts -}}
    62  
    63  	{{- localHref "Constants" | link "Constants" | listEntry 0 -}}
    64  	
    65  {{- end -}}
    66  
    67  {{- if len .Vars -}}
    68  
    69  	{{- localHref "Variables" | link "Variables" | listEntry 0 -}}
    70  
    71  {{- end -}}
    72  
    73  {{- range .Funcs -}}
    74  
    75  	{{- if .Receiver -}}
    76  		{{- codeHref .Location | link (escape .Name) | printf "func \\(%s\\) %s" (escape .Receiver) | localHref | link .Signature | listEntry 0 -}}
    77  	{{- else -}}
    78  		{{- codeHref .Location | link (escape .Name) | printf "func %s" | localHref | link .Signature | listEntry 0 -}}
    79  	{{- end -}}
    80  
    81  {{- end -}}
    82  
    83  {{- range .Types -}}
    84  
    85  	{{- codeHref .Location | link (escape .Name) | printf "type %s" | localHref | link .Title | listEntry 0 -}}
    86  
    87  	{{- range .Funcs -}}
    88  		{{- if .Receiver -}}
    89  			{{- codeHref .Location | link (escape .Name) | printf "func \\(%s\\) %s" (escape .Receiver) | localHref | link .Signature | listEntry 1 -}}
    90  		{{- else -}}
    91  			{{- codeHref .Location | link (escape .Name) | printf "func %s" | localHref | link .Signature | listEntry 1 -}}
    92  		{{- end -}}
    93  	{{- end -}}
    94  
    95  	{{- range .Methods -}}
    96  		{{- if .Receiver -}}
    97  			{{- codeHref .Location | link (escape .Name) | printf "func \\(%s\\) %s" (escape .Receiver) | localHref | link .Signature | listEntry 1 -}}
    98  		{{- else -}}
    99  			{{- codeHref .Location | link (escape .Name) | printf "func %s" | localHref | link .Signature | listEntry 1 -}}
   100  		{{- end -}}
   101  	{{- end -}}
   102  
   103  {{- end -}}
   104  
   105  {{- spacer -}}
   106  `,
   107  	"package": `{{- if eq .Name "main" -}}
   108  	{{- header .Level .Dirname -}}
   109  {{- else -}}
   110  	{{- header .Level .Name -}}
   111  {{- end -}}
   112  
   113  {{- codeBlock "go" .Import -}}
   114  
   115  {{- template "doc" .Doc -}}
   116  
   117  {{- range .Examples -}}
   118  	{{- template "example" . -}}
   119  {{- end -}}
   120  
   121  {{- header (add .Level 1) "Index" -}}
   122  
   123  {{- template "index" . -}}
   124  
   125  {{- if len .Consts -}}
   126  
   127  	{{- header (add .Level 1) "Constants" -}}
   128  
   129  	{{- range .Consts -}}
   130  		{{- template "value" . -}}
   131  	{{- end -}}
   132  
   133  {{- end -}}
   134  
   135  {{- if len .Vars -}}
   136  
   137  	{{- header (add .Level 1) "Variables" -}}
   138  
   139  	{{- range .Vars -}}
   140  		{{- template "value" . -}}
   141  	{{- end -}}
   142  
   143  {{- end -}}
   144  
   145  {{- range .Funcs -}}
   146  	{{- template "func" . -}}
   147  {{- end -}}
   148  
   149  {{- range .Types -}}
   150  	{{- template "type" . -}}
   151  {{- end -}}
   152  `,
   153  	"type": `{{- codeHref .Location | link (escape .Name) | printf "type %s" | rawHeader .Level -}}
   154  
   155  {{- template "doc" .Doc -}}
   156  
   157  {{- codeBlock "go" .Decl -}}
   158  
   159  {{- range .Consts -}}
   160  	{{- template "value" . -}}
   161  {{- end -}}
   162  
   163  {{- range .Vars -}}
   164  	{{- template "value" . -}}
   165  {{- end -}}
   166  
   167  {{- range .Examples -}}
   168  	{{- template "example" . -}}
   169  {{- end -}}
   170  
   171  {{- range .Funcs -}}
   172  	{{- template "func" . -}}
   173  {{- end -}}
   174  
   175  {{- range .Methods -}}
   176  	{{- template "func" . -}}
   177  {{- end -}}
   178  
   179  `,
   180  	"value": `{{- template "doc" .Doc -}}
   181  
   182  {{- codeBlock "go" .Decl -}}
   183  
   184  `,
   185  }