Fix parsing bug
This commit is contained in:
parent
3728b9b14f
commit
51323ad5a7
20
project.go
20
project.go
@ -29,12 +29,10 @@ func ParseProject(text string) (*Project, error) {
|
|||||||
//parts := strings.Fields(project.Original)
|
//parts := strings.Fields(project.Original)
|
||||||
var pIdx int
|
var pIdx int
|
||||||
for pIdx = range parts {
|
for pIdx = range parts {
|
||||||
if len(parts[pIdx]) > 0 {
|
if partIsSpecial(parts[pIdx]) {
|
||||||
if parts[pIdx][0] == '^' {
|
break
|
||||||
break
|
|
||||||
}
|
|
||||||
project.Name = project.Name + " " + parts[pIdx]
|
|
||||||
}
|
}
|
||||||
|
project.Name = project.Name + " " + parts[pIdx]
|
||||||
}
|
}
|
||||||
project.Name = strings.TrimSpace(project.Name)
|
project.Name = strings.TrimSpace(project.Name)
|
||||||
parts = parts[pIdx:]
|
parts = parts[pIdx:]
|
||||||
@ -81,6 +79,18 @@ func ParseProject(text string) (*Project, error) {
|
|||||||
return &project, err
|
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.
|
// 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
|
// By default it splits on spaces, the only exception is if we find a double-quote
|
||||||
func getParts(text string) []string {
|
func getParts(text string) []string {
|
||||||
|
Loading…
Reference in New Issue
Block a user