github.com/rmarku/gomarkdoc@v0.0.0-20230517164305-78688ebe4325/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 (iter .Blocks) -}} 7 {{- if eq .Entry.Kind "paragraph" -}} 8 {{- template "text" .Entry.Spans -}} 9 {{- else if eq .Entry.Kind "code" -}} 10 {{- codeBlock "" (include "text" .Entry.Spans) -}} 11 {{- else if eq .Entry.Kind "header" -}} 12 {{- header .Entry.Level (include "text" .Entry.Spans) -}} 13 {{- else if eq .Entry.Kind "list" -}} 14 {{- template "list" .Entry.List -}} 15 {{- end -}} 16 {{- if (not .Last) -}}{{- spacer -}}{{- end -}} 17 {{- end -}} 18 `, 19 "example": `{{- accordionHeader .Title -}} 20 {{- spacer -}} 21 22 {{- template "doc" .Doc -}} 23 {{- spacer -}} 24 25 {{- codeBlock "go" .Code -}} 26 {{- spacer -}} 27 28 {{- if .HasOutput -}} 29 30 {{- header 4 "Output" -}} 31 {{- spacer -}} 32 33 {{- codeBlock "" .Output -}} 34 {{- spacer -}} 35 36 {{- end -}} 37 38 {{- accordionTerminator -}} 39 40 `, 41 "file": `<!-- Code generated by gomarkdoc. DO NOT EDIT --> 42 43 {{if .Header -}} 44 {{- .Header -}} 45 {{- spacer -}} 46 {{- end -}} 47 48 {{- range .Packages -}} 49 {{- template "package" . -}} 50 {{- spacer -}} 51 {{- end -}} 52 53 {{- if .Footer -}} 54 {{- .Footer -}} 55 {{- spacer -}} 56 {{- end -}} 57 58 Generated by {{link "gomarkdoc" "https://github.com/rmarku/gomarkdoc"}} 59 `, 60 "func": `{{- if .Receiver -}} 61 {{- rawAnchorHeader .Level (codeHref .Location | link (escape .Name) | printf "func \\(%s\\) %s" (escape .Receiver)) .Anchor -}} 62 {{- else -}} 63 {{- rawAnchorHeader .Level (codeHref .Location | link (escape .Name) | printf "func %s") .Anchor -}} 64 {{- end -}} 65 {{- spacer -}} 66 67 {{- codeBlock "go" .Signature -}} 68 {{- spacer -}} 69 70 {{- template "doc" .Doc -}} 71 72 {{- if len .Examples -}} 73 {{- spacer -}} 74 75 {{- range (iter .Examples) -}} 76 {{- template "example" .Entry -}} 77 {{- if (not .Last) -}}{{- spacer -}}{{- end -}} 78 {{- end -}} 79 {{- end -}} 80 81 `, 82 "import": `{{- codeBlock "go" .Import -}}`, 83 "index": `{{- if len .Consts -}} 84 85 {{- localHref "Constants" | link "Constants" | listEntry 0 -}} 86 {{- inlineSpacer -}} 87 88 {{- end -}} 89 90 {{- if len .Vars -}} 91 92 {{- localHref "Variables" | link "Variables" | listEntry 0 -}} 93 {{- inlineSpacer -}} 94 95 {{- end -}} 96 97 {{- range .Funcs -}} 98 99 {{- (link .Signature (rawLocalHref .Anchor)) | listEntry 0 -}} 100 {{- inlineSpacer -}} 101 102 {{- end -}} 103 104 {{- range .Types -}} 105 106 {{- (link .Title (rawLocalHref .Anchor)) | listEntry 0 -}} 107 {{- inlineSpacer -}} 108 109 {{- range .Funcs -}} 110 {{- (link .Signature (rawLocalHref .Anchor)) | listEntry 1 -}} 111 {{- inlineSpacer -}} 112 {{- end -}} 113 114 {{- range .Methods -}} 115 {{- (link .Signature (rawLocalHref .Anchor)) | listEntry 1 -}} 116 {{- inlineSpacer -}} 117 {{- end -}} 118 119 {{- end -}} 120 `, 121 "list": `{{- range (iter .Items) -}} 122 {{- if eq .Entry.Kind "ordered" -}} 123 {{- .Entry.Number -}}. {{ hangingIndent (include "doc" .Entry) 2 -}} 124 {{- else -}} 125 - {{ hangingIndent (include "doc" .Entry) 2 -}} 126 {{- end -}} 127 128 {{- if (not .Last) -}} 129 {{- if $.BlankBetween -}} 130 {{- spacer -}} 131 {{- else -}} 132 {{- inlineSpacer -}} 133 {{- end -}} 134 {{- end -}} 135 136 {{- end -}}`, 137 "package": `{{- if eq .Name "main" -}} 138 {{- header .Level .Dirname -}} 139 {{- else -}} 140 {{- header .Level .Name -}} 141 {{- end -}} 142 {{- spacer -}} 143 144 {{- template "import" . -}} 145 {{- spacer -}} 146 147 {{- if len .Doc.Blocks -}} 148 {{- template "doc" .Doc -}} 149 {{- spacer -}} 150 {{- end -}} 151 152 {{- range (iter .Examples) -}} 153 {{- template "example" .Entry -}} 154 {{- spacer -}} 155 {{- end -}} 156 157 {{- header (add .Level 1) "Index" -}} 158 {{- spacer -}} 159 160 {{- template "index" . -}} 161 162 {{- if len .Consts -}} 163 {{- spacer -}} 164 165 {{- header (add .Level 1) "Constants" -}} 166 {{- spacer -}} 167 168 {{- range (iter .Consts) -}} 169 {{- template "value" .Entry -}} 170 {{- if (not .Last) -}}{{- spacer -}}{{- end -}} 171 {{- end -}} 172 173 {{- end -}} 174 175 {{- if len .Vars -}} 176 {{- spacer -}} 177 178 {{- header (add .Level 1) "Variables" -}} 179 {{- spacer -}} 180 181 {{- range (iter .Vars) -}} 182 {{- template "value" .Entry -}} 183 {{- if (not .Last) -}}{{- spacer -}}{{- end -}} 184 {{- end -}} 185 186 {{- end -}} 187 188 {{- if len .Funcs -}} 189 {{- spacer -}} 190 191 {{- range (iter .Funcs) -}} 192 {{- template "func" .Entry -}} 193 {{- if (not .Last) -}}{{- spacer -}}{{- end -}} 194 {{- end -}} 195 {{- end -}} 196 197 {{- if len .Types -}} 198 {{- spacer -}} 199 200 {{- range (iter .Types) -}} 201 {{- template "type" .Entry -}} 202 {{- if (not .Last) -}}{{- spacer -}}{{- end -}} 203 {{- end -}} 204 {{- end -}} 205 `, 206 "text": `{{- range . -}} 207 {{- if eq .Kind "text" -}} 208 {{- escape .Text -}} 209 {{- else if eq .Kind "rawText" -}} 210 {{- .Text -}} 211 {{- else if eq .Kind "autolink" -}} 212 {{- .Text -}} 213 {{- else if eq .Kind "link" -}} 214 {{- link (escape .Text) .URL -}} 215 {{- end -}} 216 {{- end -}}`, 217 "type": `{{- rawAnchorHeader .Level (codeHref .Location | link (escape .Name) | printf "type %s") .Anchor -}} 218 {{- spacer -}} 219 220 {{- template "doc" .Doc -}} 221 {{- spacer -}} 222 223 {{- codeBlock "go" .Decl -}} 224 225 {{- if len .Consts -}} 226 {{- spacer -}} 227 228 {{- range (iter .Consts) -}} 229 {{- template "value" .Entry -}} 230 {{- if (not .Last) -}}{{- spacer -}}{{- end -}} 231 {{- end -}} 232 {{- end -}} 233 234 {{- if len .Vars -}} 235 {{- spacer -}} 236 237 {{- range (iter .Vars) -}} 238 {{- template "value" .Entry -}} 239 {{- if (not .Last) -}}{{- spacer -}}{{- end -}} 240 {{- end -}} 241 {{- end -}} 242 243 {{- if len .Examples -}} 244 {{- spacer -}} 245 246 {{- range (iter .Examples) -}} 247 {{- template "example" .Entry -}} 248 {{- if (not .Last) -}}{{- spacer -}}{{- end -}} 249 {{- end -}} 250 {{- end -}} 251 252 {{- if len .Funcs -}} 253 {{- spacer -}} 254 255 {{- range (iter .Funcs) -}} 256 {{- template "func" .Entry -}} 257 {{- if (not .Last) -}}{{- spacer -}}{{- end -}} 258 {{- end -}} 259 {{- end -}} 260 261 {{- if len .Methods -}} 262 {{- spacer -}} 263 264 {{- range (iter .Methods) -}} 265 {{- template "func" .Entry -}} 266 {{- if (not .Last) -}}{{- spacer -}}{{- end -}} 267 {{- end -}} 268 {{- end -}} 269 270 `, 271 "value": `{{- anchor .Anchor -}} 272 {{- template "doc" .Doc -}} 273 {{- spacer -}} 274 275 {{- codeBlock "go" .Decl -}} 276 277 `, 278 }