From 4204f610a0c998b9a21b09d9e576cf853919ab2f Mon Sep 17 00:00:00 2001 From: Dan Ballard Date: Mon, 21 May 2018 14:13:21 -0700 Subject: [PATCH] fix repTask parsing error and printing error with leading space --- mdbj-migrate/migrate.go | 2 +- mdbj-summary/2018-05-07-TEST.md | 4 +++- mdbj-summary/summary.go | 2 +- mdbj-summary/summary_test.go | 3 ++- process/process.go | 2 +- 5 files changed, 8 insertions(+), 5 deletions(-) diff --git a/mdbj-migrate/migrate.go b/mdbj-migrate/migrate.go index 5958218..6075d36 100644 --- a/mdbj-migrate/migrate.go +++ b/mdbj-migrate/migrate.go @@ -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) } diff --git a/mdbj-summary/2018-05-07-TEST.md b/mdbj-summary/2018-05-07-TEST.md index aec9472..73cb543 100644 --- a/mdbj-summary/2018-05-07-TEST.md +++ b/mdbj-summary/2018-05-07-TEST.md @@ -39,4 +39,6 @@ # Repetition - [x] 5x5 things -- [ ] 0x2 other things \ No newline at end of file +- [ ] 0x2 other things +- category + - [x] 2x10 nested rep \ No newline at end of file diff --git a/mdbj-summary/summary.go b/mdbj-summary/summary.go index 0653639..23befb2 100644 --- a/mdbj-summary/summary.go +++ b/mdbj-summary/summary.go @@ -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 } diff --git a/mdbj-summary/summary_test.go b/mdbj-summary/summary_test.go index bf75f59..15c4cba 100644 --- a/mdbj-summary/summary_test.go +++ b/mdbj-summary/summary_test.go @@ -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) { diff --git a/process/process.go b/process/process.go index 015099d..be735c7 100644 --- a/process/process.go +++ b/process/process.go @@ -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