github.com/phsym/gomarkdoc@v0.5.4/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/phsym/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  	"import": `{{- codeBlock "go" .Import -}}
    62  
    63  `,
    64  	"index": `{{- if len .Consts -}}
    65  
    66  	{{- localHref "Constants" | link "Constants" | listEntry 0 -}}
    67  	
    68  {{- end -}}
    69  
    70  {{- if len .Vars -}}
    71  
    72  	{{- localHref "Variables" | link "Variables" | listEntry 0 -}}
    73  
    74  {{- end -}}
    75  
    76  {{- range .Funcs -}}
    77  
    78  	{{- if .Receiver -}}
    79  		{{- codeHref .Location | link (escape .Name) | printf "func \\(%s\\) %s" (escape .Receiver) | localHref | link .Signature | listEntry 0 -}}
    80  	{{- else -}}
    81  		{{- codeHref .Location | link (escape .Name) | printf "func %s" | localHref | link .Signature | listEntry 0 -}}
    82  	{{- end -}}
    83  
    84  {{- end -}}
    85  
    86  {{- range .Types -}}
    87  
    88  	{{- codeHref .Location | link (escape .Name) | printf "type %s" | localHref | link .Title | listEntry 0 -}}
    89  
    90  	{{- range .Funcs -}}
    91  		{{- if .Receiver -}}
    92  			{{- codeHref .Location | link (escape .Name) | printf "func \\(%s\\) %s" (escape .Receiver) | localHref | link .Signature | listEntry 1 -}}
    93  		{{- else -}}
    94  			{{- codeHref .Location | link (escape .Name) | printf "func %s" | localHref | link .Signature | listEntry 1 -}}
    95  		{{- end -}}
    96  	{{- end -}}
    97  
    98  	{{- range .Methods -}}
    99  		{{- if .Receiver -}}
   100  			{{- codeHref .Location | link (escape .Name) | printf "func \\(%s\\) %s" (escape .Receiver) | localHref | link .Signature | listEntry 1 -}}
   101  		{{- else -}}
   102  			{{- codeHref .Location | link (escape .Name) | printf "func %s" | localHref | link .Signature | listEntry 1 -}}
   103  		{{- end -}}
   104  	{{- end -}}
   105  
   106  {{- end -}}
   107  
   108  {{- spacer -}}
   109  `,
   110  	"package": `{{- if eq .Name "main" -}}
   111  	{{- header .Level .Dirname -}}
   112  {{- else -}}
   113  	{{- header .Level .Name -}}
   114  {{- end -}}
   115  
   116  {{- template "import" . -}}
   117  
   118  {{- template "doc" .Doc -}}
   119  
   120  {{- range .Examples -}}
   121  	{{- template "example" . -}}
   122  {{- end -}}
   123  
   124  {{- header (add .Level 1) "Index" -}}
   125  
   126  {{- template "index" . -}}
   127  
   128  {{- if len .Consts -}}
   129  
   130  	{{- header (add .Level 1) "Constants" -}}
   131  
   132  	{{- range .Consts -}}
   133  		{{- template "value" . -}}
   134  	{{- end -}}
   135  
   136  {{- end -}}
   137  
   138  {{- if len .Vars -}}
   139  
   140  	{{- header (add .Level 1) "Variables" -}}
   141  
   142  	{{- range .Vars -}}
   143  		{{- template "value" . -}}
   144  	{{- end -}}
   145  
   146  {{- end -}}
   147  
   148  {{- range .Funcs -}}
   149  	{{- template "func" . -}}
   150  {{- end -}}
   151  
   152  {{- range .Types -}}
   153  	{{- template "type" . -}}
   154  {{- end -}}
   155  `,
   156  	"type": `{{- codeHref .Location | link (escape .Name) | printf "type %s" | rawHeader .Level -}}
   157  
   158  {{- template "doc" .Doc -}}
   159  
   160  {{- codeBlock "go" .Decl -}}
   161  
   162  {{- range .Consts -}}
   163  	{{- template "value" . -}}
   164  {{- end -}}
   165  
   166  {{- range .Vars -}}
   167  	{{- template "value" . -}}
   168  {{- end -}}
   169  
   170  {{- range .Examples -}}
   171  	{{- template "example" . -}}
   172  {{- end -}}
   173  
   174  {{- range .Funcs -}}
   175  	{{- template "func" . -}}
   176  {{- end -}}
   177  
   178  {{- range .Methods -}}
   179  	{{- template "func" . -}}
   180  {{- end -}}
   181  
   182  `,
   183  	"value": `{{- template "doc" .Doc -}}
   184  
   185  {{- codeBlock "go" .Decl -}}
   186  
   187  `,
   188  }