fix repTask parsing error and printing error with leading space

This commit is contained in:
Dan Ballard 2018-05-21 14:13:21 -07:00
parent 08624d672c
commit 4204f610a0
5 changed files with 8 additions and 5 deletions

View File

@ -44,7 +44,7 @@ func (ph *processHandler) ProcessLine(line string, indentLevel int, headerStack
// TODO: handle [x] numXnum
if !flags.Done || flags.RepTask.Is {
if flags.RepTask.Is {
ph.Writeln(strings.Repeat("\t", indentLevel) + "- [ ] 0x" + strconv.Itoa(flags.RepTask.B) + lineStack[len(lineStack)-1])
ph.Writeln(strings.Repeat("\t", indentLevel) + "- [ ] 0x" + strconv.Itoa(flags.RepTask.B) + " " + lineStack[len(lineStack)-1])
} else {
ph.Writeln(line)
}

View File

@ -40,3 +40,5 @@
- [x] 5x5 things
- [ ] 0x2 other things
- category
- [x] 2x10 nested rep

View File

@ -69,7 +69,7 @@ func (ph *processHandler) ProcessLine(line string, indentLevel int, headerStack
ph.doneCount += 1
repStr := ""
if flags.RepTask.Is {
repStr = strconv.Itoa(flags.RepTask.A * flags.RepTask.B)
repStr = strconv.Itoa(flags.RepTask.A * flags.RepTask.B) + " "
// inc todo count here since we did a thing, its done, and we dont want a higher done count than total
ph.totalCount += 1
}

View File

@ -21,7 +21,8 @@ const EXPECTED = `
a partly done thing / the one done thing
# Repetition
25 things
5 / 15
20 category / nested rep
6 / 16
`
func TestSummary(t *testing.T) {

View File

@ -148,7 +148,7 @@ func getText(str string, indentLevel int, indentPattern string) (text string, fl
flags.RepTask.A, _ = strconv.Atoi(matches[1])
flags.RepTask.B, _ = strconv.Atoi(matches[2])
loc := repTaskRegExp.FindIndex([]byte(text))
text = text[loc[1]:]
text = text[loc[1]+1:]
}
}
return