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.
 
 
 

184 lines
7.9 KiB

  1. {{define "Head"}}
  2. {{template "PkgCmdHeader" $}}
  3. {{if sidebarEnabled}}
  4. <link href="{{staticPath "/-/sidebar.css"}}" rel="stylesheet">
  5. {{end}}
  6. {{end}}
  7. {{define "Body"}}
  8. {{with .pdoc}}
  9. {{if sidebarEnabled}}
  10. <div class="row">
  11. <!-- Sidebar -->
  12. <div class="gddo-sidebar col-md-3 hidden-xs hidden-sm">
  13. <ul id="sidebar-nav" class="nav" data-spy="affix" data-offset-top="70">
  14. <li class="active"><a href="#pkg-overview">Overview</a></li>
  15. <li><a href="#pkg-index">Index</a></li>
  16. {{if .Examples}}<li><a href="#pkg-examples">Examples</a></li>{{end}}
  17. {{if .Consts}}<li><a href="#pkg-constants">Constants</a></li>{{end}}
  18. {{if .Vars}}<li><a href="#pkg-variables">Variables</a></li>{{end}}
  19. {{if .Funcs}}
  20. <li>
  21. <a href="#pkg-functions">Functions</a>
  22. <ul class="nav">
  23. {{range .Funcs}}<li><a href="#{{.Name}}">{{.Name}}</a></li>{{end}}
  24. </ul>
  25. </li>
  26. {{end}}
  27. {{if .Types}}
  28. <li>
  29. <a href="#pkg-types">Types</a>
  30. <ul class="nav">
  31. {{range .Types}}<li><a href="#{{.Name}}">{{.Name}}</a></li>{{end}}
  32. </ul>
  33. </li>
  34. {{end}}
  35. {{if .Notes.BUG}}<li><a href="#pkg-note-bug">Bugs</a></li>{{end}}
  36. {{if $.pkgs}}<li><a href="#pkg-subdirectories">Directories</a></li>{{end}}
  37. </ul>
  38. </div>
  39. <!-- Content -->
  40. <div class="col-md-9">
  41. {{end}}<!-- end sidebarEnabled -->
  42. {{template "ProjectNav" $}}
  43. <h2 id="pkg-overview">package {{.Name}}</h2>
  44. <p><code>import "{{.ImportPath}}"</code>
  45. {{.Doc|comment}}
  46. {{template "Examples" .|$.pdoc.ObjExamples}}
  47. <!-- Index -->
  48. <h3 id="pkg-index" class="section-header">Index <a class="permalink" href="#pkg-index">&para;</a></h3>
  49. {{if .Truncated}}
  50. <div class="alert">The documentation displayed here is incomplete. Use the godoc command to read the complete documentation.</div>
  51. {{end}}
  52. <ul class="list-unstyled">
  53. {{if .Consts}}<li><a href="#pkg-constants">Constants</a></li>{{end}}
  54. {{if .Vars}}<li><a href="#pkg-variables">Variables</a></li>{{end}}
  55. {{range .Funcs}}<li><a href="#{{.Name}}">{{.Decl.Text}}</a></li>{{end}}
  56. {{range $t := .Types}}
  57. <li><a href="#{{.Name}}">type {{.Name}}</a></li>
  58. {{if or .Funcs .Methods}}<ul>{{end}}
  59. {{range .Funcs}}<li><a href="#{{.Name}}">{{.Decl.Text}}</a></li>{{end}}
  60. {{range .Methods}}<li><a href="#{{$t.Name}}.{{.Name}}">{{.Decl.Text}}</a></li>{{end}}
  61. {{if or .Funcs .Methods}}</ul>{{end}}
  62. {{end}}
  63. {{if .Notes.BUG}}<li><a href="#pkg-note-bug">Bugs</a></li>{{end}}
  64. </ul>
  65. <!-- Examples -->
  66. {{with .AllExamples}}
  67. <h4 id="pkg-examples">Examples <a class="permalink" href="#pkg-examples">&para;</a></h4>
  68. <ul class="list-unstyled">
  69. {{range . }}<li><a href="#example-{{.ID}}" onclick="$('#ex-{{.ID}}').addClass('in').removeClass('collapse').height('auto')">{{.Label}}</a></li>{{end}}
  70. </ul>
  71. {{else}}
  72. <span id="pkg-examples"></span>
  73. {{end}}
  74. <!-- Files -->
  75. {{template "PkgFiles" $}}
  76. <!-- Contants -->
  77. {{if .Consts}}
  78. <h3 id="pkg-constants">Constants <a class="permalink" href="#pkg-constants">&para;</a></h3>
  79. {{range .Consts}}<div class="decl" data-kind="c">{{$.pdoc.SourceLink .Pos "\u2756" false}}{{code .Decl nil}}</div>{{.Doc|comment}}{{end}}
  80. {{end}}
  81. <!-- Variables -->
  82. {{if .Vars}}
  83. <h3 id="pkg-variables">Variables <a class="permalink" href="#pkg-variables">&para;</a></h3>
  84. {{range .Vars}}<div class="decl" data-kind="v">{{$.pdoc.SourceLink .Pos "\u2756" false}}{{code .Decl nil}}</div>{{.Doc|comment}}{{end}}
  85. {{end}}
  86. <!-- Functions -->
  87. {{if sidebarEnabled}}{{if .Funcs}}
  88. <h3 id="pkg-functions" class="section-header">Functions <a class="permalink" href="#pkg-functions">&para;</a></h3>
  89. {{end}}{{end}}
  90. {{range .Funcs}}
  91. <h3 id="{{.Name}}" data-kind="f">func {{$.pdoc.SourceLink .Pos .Name true}} <a class="permalink" href="#{{.Name}}">&para;</a> {{$.pdoc.UsesLink "List Function Callers" .Name}}</h3>
  92. <div class="funcdecl decl">{{$.pdoc.SourceLink .Pos "\u2756" false}}{{code .Decl nil}}</div>{{.Doc|comment}}
  93. {{template "Examples" .|$.pdoc.ObjExamples}}
  94. {{end}}
  95. <!-- Types -->
  96. {{if sidebarEnabled}}{{if .Types}}
  97. <h3 id="pkg-types" class="section-header">Types <a class="permalink" href="#pkg-types">&para;</a></h3>
  98. {{end}}{{end}}
  99. {{range $t := .Types}}
  100. <h3 id="{{.Name}}" data-kind="t">type {{$.pdoc.SourceLink .Pos .Name true}} <a class="permalink" href="#{{.Name}}">&para;</a> {{$.pdoc.UsesLink "List Uses of This Type" .Name}}</h3>
  101. <div class="decl" data-kind="{{if isInterface $t}}m{{else}}d{{end}}">{{$.pdoc.SourceLink .Pos "\u2756" false}}{{code .Decl $t}}</div>{{.Doc|comment}}
  102. {{range .Consts}}<div class="decl" data-kind="c">{{$.pdoc.SourceLink .Pos "\u2756" false}}{{code .Decl nil}}</div>{{.Doc|comment}}{{end}}
  103. {{range .Vars}}<div class="decl" data-kind="v">{{$.pdoc.SourceLink .Pos "\u2756" false}}{{code .Decl nil}}</div>{{.Doc|comment}}{{end}}
  104. {{template "Examples" .|$.pdoc.ObjExamples}}
  105. {{range .Funcs}}
  106. <h4 id="{{.Name}}" data-kind="f">func {{$.pdoc.SourceLink .Pos .Name true}} <a class="permalink" href="#{{.Name}}">&para;</a> {{$.pdoc.UsesLink "List Function Callers" .Name}}</h4>
  107. <div class="funcdecl decl">{{$.pdoc.SourceLink .Pos "\u2756" false}}{{code .Decl nil}}</div>{{.Doc|comment}}
  108. {{template "Examples" .|$.pdoc.ObjExamples}}
  109. {{end}}
  110. {{range .Methods}}
  111. <h4 id="{{$t.Name}}.{{.Name}}" data-kind="m">func ({{.Recv}}) {{$.pdoc.SourceLink .Pos .Name true}} <a class="permalink" href="#{{$t.Name}}.{{.Name}}">&para;</a> {{$.pdoc.UsesLink "List Method Callers" .Orig .Recv .Name}}</h4>
  112. <div class="funcdecl decl">{{$.pdoc.SourceLink .Pos "\u2756" false}}{{code .Decl nil}}</div>{{.Doc|comment}}
  113. {{template "Examples" .|$.pdoc.ObjExamples}}
  114. {{end}}
  115. {{end}}
  116. {{template "PkgCmdFooter" $}}
  117. <div id="x-jump" tabindex="-1" class="modal">
  118. <div class="modal-dialog">
  119. <div class="modal-content">
  120. <div class="modal-header">
  121. <h4 class="modal-title">Jump to identifier</h4>
  122. <br class="clearfix">
  123. <input id="x-jump-filter" class="form-control" autocomplete="off" type="text">
  124. </div>
  125. <div id="x-jump-body" class="modal-body" style="height: 260px; overflow: auto;">
  126. <div id="x-jump-list" class="list-group" style="margin-bottom: 0;"></div>
  127. </div>
  128. <div class="modal-footer">
  129. <button type="button" class="btn" data-dismiss="modal">Close</button>
  130. </div>
  131. </div>
  132. </div>
  133. </div>
  134. {{if sidebarEnabled}}
  135. </div>
  136. </div>
  137. {{end}}
  138. {{end}}
  139. {{end}}
  140. {{define "Examples"}}
  141. {{if .}}
  142. <div class="panel-group">
  143. {{range .}}
  144. <div class="panel panel-default" id="example-{{.ID}}">
  145. <div class="panel-heading"><a class="accordion-toggle" data-toggle="collapse" href="#ex-{{.ID}}">Example{{with .Example.Name}} ({{.}}){{end}}</a></div>
  146. <div id="ex-{{.ID}}" class="panel-collapse collapse"><div class="panel-body">
  147. {{with .Example.Doc}}<p>{{.|comment}}{{end}}
  148. <p>Code:{{if .Play}}<span class="pull-right"><a href="?play={{.ID}}">play</a>&nbsp;</span>{{end}}
  149. {{code .Example.Code nil}}
  150. {{with .Example.Output}}<p>Output:<pre>{{.}}</pre>{{end}}
  151. </div></div>
  152. </div>
  153. {{end}}
  154. </div>
  155. {{end}}
  156. {{end}}