You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

116 lines
2.9 KiB

  1. {{$info := .}}{{$filtered := .IsFiltered}}{{/*
  2. ---------------------------------------
  3. */}}{{if $filtered}}{{range .PAst}}{{range .Decls}}{{node $info .}}
  4. {{end}}{{end}}{{else}}{{with .PAst}}{{range $filename, $ast := .}}{{$filename}}:
  5. {{node $ $ast}}{{end}}{{end}}{{end}}{{/*
  6. ---------------------------------------
  7. */}}{{if and $filtered (not (or .PDoc .PAst))}}No match found.
  8. {{end}}{{with .PDoc}}{{if $.IsMain}}COMMAND DOCUMENTATION
  9. {{comment_text .Doc " " "\t"}}
  10. {{else}}{{if not $filtered}}PACKAGE DOCUMENTATION
  11. package {{.Name}}
  12. import "{{.ImportPath}}"
  13. {{comment_text .Doc " " "\t"}}
  14. {{example_text $ "" " "}}{{end}}{{/*
  15. ---------------------------------------
  16. */}}{{with .Consts}}{{if not $filtered}}CONSTANTS
  17. {{end}}{{range .}}{{node $ .Decl}}
  18. {{comment_text .Doc " " "\t"}}
  19. {{end}}{{end}}{{/*
  20. ---------------------------------------
  21. */}}{{with .Vars}}{{if not $filtered}}VARIABLES
  22. {{end}}{{range .}}{{node $ .Decl}}
  23. {{comment_text .Doc " " "\t"}}
  24. {{end}}{{end}}{{/*
  25. ---------------------------------------
  26. */}}{{with .Funcs}}{{if not $filtered}}FUNCTIONS
  27. {{end}}{{range .}}{{node $ .Decl}}
  28. {{comment_text .Doc " " "\t"}}
  29. {{example_text $ .Name " "}}{{end}}{{end}}{{/*
  30. ---------------------------------------
  31. */}}{{with .Types}}{{if not $filtered}}TYPES
  32. {{end}}{{range .}}{{$tname := .Name}}{{node $ .Decl}}
  33. {{comment_text .Doc " " "\t"}}
  34. {{/*
  35. ---------------------------------------
  36. */}}{{if .Consts}}{{range .Consts}}{{node $ .Decl}}
  37. {{comment_text .Doc " " "\t"}}
  38. {{end}}{{end}}{{/*
  39. ---------------------------------------
  40. */}}{{if .Vars}}{{range .Vars}}{{node $ .Decl}}
  41. {{comment_text .Doc " " "\t"}}
  42. {{range $name := .Names}}{{example_text $ $name " "}}{{end}}{{end}}{{end}}{{/*
  43. ---------------------------------------
  44. */}}{{if .Funcs}}{{range .Funcs}}{{node $ .Decl}}
  45. {{comment_text .Doc " " "\t"}}
  46. {{example_text $ .Name " "}}{{end}}{{end}}{{/*
  47. ---------------------------------------
  48. */}}{{if .Methods}}{{range .Methods}}{{node $ .Decl}}
  49. {{comment_text .Doc " " "\t"}}
  50. {{$name := printf "%s_%s" $tname .Name}}{{example_text $ $name " "}}{{end}}{{end}}{{/*
  51. ---------------------------------------
  52. */}}{{end}}{{end}}{{/*
  53. ---------------------------------------
  54. */}}{{if and $filtered (not (or .Consts (or .Vars (or .Funcs .Types))))}}No match found.
  55. {{end}}{{/*
  56. ---------------------------------------
  57. */}}{{end}}{{/*
  58. ---------------------------------------
  59. */}}{{with $.Notes}}
  60. {{range $marker, $content := .}}
  61. {{$marker}}S
  62. {{range $content}}{{comment_text .Body " " "\t"}}
  63. {{end}}{{end}}{{end}}{{end}}{{/*
  64. ---------------------------------------
  65. */}}{{if not $filtered}}{{with .Dirs}}SUBDIRECTORIES
  66. {{if $.DirFlat}}{{range .List}}{{if .HasPkg}}
  67. {{.Path}}{{end}}{{end}}
  68. {{else}}{{range .List}}
  69. {{repeat `. ` .Depth}}{{.Name}}{{end}}
  70. {{end}}{{end}}{{/*
  71. ---------------------------------------
  72. */}}{{end}}{{/*
  73. Make sure there is no newline at the end of this file.
  74. perl -i -pe 'chomp if eof' package.txt
  75. */}}