fix repTask parsing error and printing error with leading space
This commit is contained in:
parent
08624d672c
commit
4204f610a0
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -40,3 +40,5 @@
|
|||
|
||||
- [x] 5x5 things
|
||||
- [ ] 0x2 other things
|
||||
- category
|
||||
- [x] 2x10 nested rep
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue