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
|
// TODO: handle [x] numXnum
|
||||||
if !flags.Done || flags.RepTask.Is {
|
if !flags.Done || flags.RepTask.Is {
|
||||||
if 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 {
|
} else {
|
||||||
ph.Writeln(line)
|
ph.Writeln(line)
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,3 +40,5 @@
|
||||||
|
|
||||||
- [x] 5x5 things
|
- [x] 5x5 things
|
||||||
- [ ] 0x2 other 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
|
ph.doneCount += 1
|
||||||
repStr := ""
|
repStr := ""
|
||||||
if flags.RepTask.Is {
|
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
|
// inc todo count here since we did a thing, its done, and we dont want a higher done count than total
|
||||||
ph.totalCount += 1
|
ph.totalCount += 1
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,8 @@ const EXPECTED = `
|
||||||
a partly done thing / the one done thing
|
a partly done thing / the one done thing
|
||||||
# Repetition
|
# Repetition
|
||||||
25 things
|
25 things
|
||||||
5 / 15
|
20 category / nested rep
|
||||||
|
6 / 16
|
||||||
`
|
`
|
||||||
|
|
||||||
func TestSummary(t *testing.T) {
|
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.A, _ = strconv.Atoi(matches[1])
|
||||||
flags.RepTask.B, _ = strconv.Atoi(matches[2])
|
flags.RepTask.B, _ = strconv.Atoi(matches[2])
|
||||||
loc := repTaskRegExp.FindIndex([]byte(text))
|
loc := repTaskRegExp.FindIndex([]byte(text))
|
||||||
text = text[loc[1]:]
|
text = text[loc[1]+1:]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in New Issue