Skip to content

Commit

Permalink
add fragment in issue
Browse files Browse the repository at this point in the history
  • Loading branch information
takashi committed May 8, 2014
1 parent 457d444 commit 79732f6
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
1 change: 1 addition & 0 deletions issue.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ type Issue struct {
Title string
FileName string
FilePath string
Fragment string
Label string
Line int
Md5 string
Expand Down
22 changes: 21 additions & 1 deletion parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,27 @@ func ParseIssuesByLang(lang *language.Lang, path string, info os.FileInfo) error
one := re.Find([]byte(scanner.Text()))
if one != nil {
title := strings.TrimPrefix(string(commnentLabelRe.ReplaceAll(one, []byte(""))), " ")
issue := &Issue{Title: title, FileName: info.Name(), Label: config.Label, Line: line, FilePath: path}
frag := scanner.Text() + "\n"

// copy scanner instance
s := *scanner
i := 0
// get 10 line under the todo.
for s.Scan() {
if i > 10 {
break
}
frag += (s.Text() + "\n")
i++
}

issue := &Issue{
Title: title,
FileName: info.Name(),
Label: config.Label,
Line: line,
FilePath: path,
Fragment: frag}
IssueList = append(IssueList, issue)
}
line += 1
Expand Down

0 comments on commit 79732f6

Please sign in to comment.