Fix parsing bug
This commit is contained in:
parent
3728b9b14f
commit
51323ad5a7
16
project.go
16
project.go
@ -29,13 +29,11 @@ func ParseProject(text string) (*Project, error) {
|
||||
//parts := strings.Fields(project.Original)
|
||||
var pIdx int
|
||||
for pIdx = range parts {
|
||||
if len(parts[pIdx]) > 0 {
|
||||
if parts[pIdx][0] == '^' {
|
||||
if partIsSpecial(parts[pIdx]) {
|
||||
break
|
||||
}
|
||||
project.Name = project.Name + " " + parts[pIdx]
|
||||
}
|
||||
}
|
||||
project.Name = strings.TrimSpace(project.Name)
|
||||
parts = parts[pIdx:]
|
||||
var notesAbs, repoAbs bool
|
||||
@ -81,6 +79,18 @@ func ParseProject(text string) (*Project, error) {
|
||||
return &project, err
|
||||
}
|
||||
|
||||
func partIsSpecial(pt string) bool {
|
||||
if len(pt) == 0 {
|
||||
return false
|
||||
}
|
||||
switch pt[0] {
|
||||
case '^', '~', '#', '@', '+':
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
// getParts parses the text from text pulling out each part.
|
||||
// By default it splits on spaces, the only exception is if we find a double-quote
|
||||
func getParts(text string) []string {
|
||||
|
Loading…
Reference in New Issue
Block a user