Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go
Commits
79682199
Commit
79682199
authored
Apr 02, 2013
by
Robert Griesemer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmd/godoc: don't linkify index entries
Fixes #5186. R=bradfitz CC=golang-dev
https://golang.org/cl/8267044
parent
3a012c02
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
17 deletions
+15
-17
lib/godoc/package.html
lib/godoc/package.html
+12
-12
src/cmd/godoc/godoc.go
src/cmd/godoc/godoc.go
+3
-5
No files found.
lib/godoc/package.html
View file @
79682199
...
...
@@ -60,18 +60,18 @@
{{end}}
{{range .Funcs}}
{{$name_html := html .Name}}
<dd><a
href=
"#{{$name_html}}"
>
{{node_html $ .Decl}}
</a></dd>
<dd><a
href=
"#{{$name_html}}"
>
{{node_html $ .Decl
false
}}
</a></dd>
{{end}}
{{range .Types}}
{{$tname_html := html .Name}}
<dd><a
href=
"#{{$tname_html}}"
>
type {{$tname_html}}
</a></dd>
{{range .Funcs}}
{{$name_html := html .Name}}
<dd>
<a
href=
"#{{$name_html}}"
>
{{node_html $ .Decl}}
</a></dd>
<dd>
<a
href=
"#{{$name_html}}"
>
{{node_html $ .Decl
false
}}
</a></dd>
{{end}}
{{range .Methods}}
{{$name_html := html .Name}}
<dd>
<a
href=
"#{{$tname_html}}.{{$name_html}}"
>
{{node_html $ .Decl}}
</a></dd>
<dd>
<a
href=
"#{{$tname_html}}.{{$name_html}}"
>
{{node_html $ .Decl
false
}}
</a></dd>
{{end}}
{{end}}
{{if $.Notes}}
...
...
@@ -109,14 +109,14 @@
{{with .Consts}}
<h2
id=
"pkg-constants"
>
Constants
</h2>
{{range .}}
<pre>
{{node_html $ .Decl}}
</pre>
<pre>
{{node_html $ .Decl
true
}}
</pre>
{{comment_html .Doc}}
{{end}}
{{end}}
{{with .Vars}}
<h2
id=
"pkg-variables"
>
Variables
</h2>
{{range .}}
<pre>
{{node_html $ .Decl}}
</pre>
<pre>
{{node_html $ .Decl
true
}}
</pre>
{{comment_html .Doc}}
{{end}}
{{end}}
...
...
@@ -124,7 +124,7 @@
{{/* Name is a string - no need for FSet */}}
{{$name_html := html .Name}}
<h2
id=
"{{$name_html}}"
>
func
<a
href=
"{{posLink_url $ .Decl}}"
>
{{$name_html}}
</a></h2>
<pre>
{{node_html $ .Decl}}
</pre>
<pre>
{{node_html $ .Decl
true
}}
</pre>
{{comment_html .Doc}}
{{example_html $ .Name}}
{{end}}
...
...
@@ -132,16 +132,16 @@
{{$tname := .Name}}
{{$tname_html := html .Name}}
<h2
id=
"{{$tname_html}}"
>
type
<a
href=
"{{posLink_url $ .Decl}}"
>
{{$tname_html}}
</a></h2>
<pre>
{{node_html $ .Decl}}
</pre>
<pre>
{{node_html $ .Decl
true
}}
</pre>
{{comment_html .Doc}}
{{range .Consts}}
<pre>
{{node_html $ .Decl}}
</pre>
<pre>
{{node_html $ .Decl
true
}}
</pre>
{{comment_html .Doc}}
{{end}}
{{range .Vars}}
<pre>
{{node_html $ .Decl}}
</pre>
<pre>
{{node_html $ .Decl
true
}}
</pre>
{{comment_html .Doc}}
{{end}}
...
...
@@ -150,7 +150,7 @@
{{range .Funcs}}
{{$name_html := html .Name}}
<h3
id=
"{{$name_html}}"
>
func
<a
href=
"{{posLink_url $ .Decl}}"
>
{{$name_html}}
</a></h3>
<pre>
{{node_html $ .Decl}}
</pre>
<pre>
{{node_html $ .Decl
true
}}
</pre>
{{comment_html .Doc}}
{{example_html $ .Name}}
{{end}}
...
...
@@ -158,7 +158,7 @@
{{range .Methods}}
{{$name_html := html .Name}}
<h3
id=
"{{$tname_html}}.{{$name_html}}"
>
func ({{html .Recv}})
<a
href=
"{{posLink_url $ .Decl}}"
>
{{$name_html}}
</a></h3>
<pre>
{{node_html $ .Decl}}
</pre>
<pre>
{{node_html $ .Decl
true
}}
</pre>
{{comment_html .Doc}}
{{$name := printf "%s_%s" $tname .Name}}
{{example_html $ $name}}
...
...
@@ -179,7 +179,7 @@
{{end}}
{{with .PAst}}
<pre>
{{node_html $ .}}
</pre>
<pre>
{{node_html $ .
false
}}
</pre>
{{end}}
{{with .Dirs}}
...
...
src/cmd/godoc/godoc.go
View file @
79682199
...
...
@@ -279,14 +279,12 @@ func nodeFunc(info *PageInfo, node interface{}) string {
return
buf
.
String
()
}
func
node_htmlFunc
(
info
*
PageInfo
,
node
interface
{})
string
{
func
node_htmlFunc
(
info
*
PageInfo
,
node
interface
{}
,
linkify
bool
)
string
{
var
buf1
bytes
.
Buffer
writeNode
(
&
buf1
,
info
.
FSet
,
node
)
var
buf2
bytes
.
Buffer
// Don't linkify full source text (info.PAst != nil) - identifier
// resolution is not strong enough without full type checking.
if
n
,
_
:=
node
.
(
ast
.
Node
);
n
!=
nil
&&
*
declLinks
&&
info
.
PAst
==
nil
{
if
n
,
_
:=
node
.
(
ast
.
Node
);
n
!=
nil
&&
linkify
&&
*
declLinks
{
LinkifyText
(
&
buf2
,
buf1
.
Bytes
(),
n
)
}
else
{
FormatText
(
&
buf2
,
buf1
.
Bytes
(),
-
1
,
true
,
""
,
nil
)
...
...
@@ -394,7 +392,7 @@ func example_htmlFunc(info *PageInfo, funcName string) string {
// print code
cnode
:=
&
printer
.
CommentedNode
{
Node
:
eg
.
Code
,
Comments
:
eg
.
Comments
}
code
:=
node_htmlFunc
(
info
,
cnode
)
code
:=
node_htmlFunc
(
info
,
cnode
,
true
)
out
:=
eg
.
Output
wholeFile
:=
true
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment