github.com/coveo/gotemplate@v2.7.7+incompatible/render-doc (about) 1 #! /usr/bin/env bash 2 3 for file in docs/doc_test/*.md 4 do 5 gotemplate -dP $file > ${file%.*}.razor 6 gotemplate -P $file > ${file%.*}.rendered --accept-no-value 7 done 8 9 DOC_FOLDER="docs" 10 export COLUMNS=1024 11 12 mkdir -p $DOC_FOLDER 13 14 # Generate function info 15 gotemplate '```text@<exec("gotemplate list --no-extension -c")```' > $DOC_FOLDER/_functions.md 16 17 # Generate usage info 18 COLUMNS=255 gotemplate '```text@<trim(exec("gotemplate --help-long"))@<;```' --nv > $DOC_FOLDER/_usage.md 19 20 # Generate methods on String objects 21 gotemplate '```go@<getMethods(String(""))@<;```' > $DOC_FOLDER/_string_methods.md 22 23 # Generate methods on StringArray objects 24 gotemplate '```go@<getMethods(String("").Split(""))@<;```' > $DOC_FOLDER/_string_array_methods.md 25 26 # Generate methods on List objects 27 gotemplate '```go@<@getMethods(list())@<;```' > $DOC_FOLDER/_list_methods.md 28 29 # Generate methods on Dictionary objects 30 gotemplate '```go@<@getMethods(dict())@<;```' > $DOC_FOLDER/_dict_methods.md 31 32 # Generate detailed function info 33 gotemplate --no-extension '{% include navigation.html %} 34 35 ## Functions@<; 36 37 | @foreach ($category := categories()) 38 @<;[@(String($category.Name).Split(",")[0])](#@(String($category.Name).Replace(" ", "-").ToLower());) | 39 @-end foreach 40 41 @foreach ($category := categories()) 42 @-// We have to make a trick here by adding {{ "" }} otherwise, the entire line will be considered as a comment 43 ### {{ "" }}@($category.Name) 44 @-foreach ($func := $category.Functions()) 45 @{func} := function($func) 46 @-if (!$func.IsAlias) 47 @<;@<;```go 48 @-if ($func.Description) 49 @<;// @(String($func.Description).Lines.Join("\n// ")) 50 @-endif 51 @-if ($func.Aliases) 52 @<;// Aliases: @join(", ", $func.Aliases) 53 @-endif 54 @<;func @($func.Signature) 55 @<;``` 56 @-endif 57 @-end foreach 58 @-end foreach 59 ' > $DOC_FOLDER/functions_long.md