Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
golang
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
golang
Commits
e8b580c9
Commit
e8b580c9
authored
Nov 09, 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
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
6 deletions
+13
-6
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 {
...
@@ -137,14 +137,21 @@ func htmlEscape(s string) string {
func
firstSentence
(
s
string
)
string
{
func
firstSentence
(
s
string
)
string
{
i
:=
strings
.
Index
(
s
,
". "
);
// find first period followed by whitespace, or just the first period
if
i
<
0
{
i
:=
-
1
;
i
=
strings
.
Index
(
s
,
"."
);
for
j
,
ch
:=
range
s
{
if
i
<
0
{
if
ch
==
'.'
{
i
=
len
(
s
)
-
1
;
// compensate for i+1 below
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