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
e8b580c9
Commit
e8b580c9
authored
Nov 08, 2009
by
Robert Griesemer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix sentence extraction
R=rsc
http://go/go-review/1026027
parent
202ede12
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
6 deletions
+13
-6
src/cmd/godoc/godoc.go
src/cmd/godoc/godoc.go
+13
-6
No files found.
src/cmd/godoc/godoc.go
View file @
e8b580c9
...
...
@@ -137,14 +137,21 @@ func htmlEscape(s string) string {
func
firstSentence
(
s
string
)
string
{
i
:=
strings
.
Index
(
s
,
". "
);
if
i
<
0
{
i
=
strings
.
Index
(
s
,
"."
);
if
i
<
0
{
i
=
len
(
s
)
-
1
;
// compensate for i+1 below
// find first period followed by whitespace, or just the first period
i
:=
-
1
;
for
j
,
ch
:=
range
s
{
if
ch
==
'.'
{
i
=
j
+
1
;
// include period
if
i
<
len
(
s
)
&&
s
[
i
]
<=
' '
{
break
;
}
}
return
s
[
0
:
i
+
1
];
// include ".", if any
}
if
i
<
0
{
// no period found, use the enire string
i
=
len
(
s
);
}
return
s
[
0
:
i
];
}
...
...
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