Skip to content

Commit

Permalink
(re)Write sections only when it is asked
Browse files Browse the repository at this point in the history
  • Loading branch information
MichelBoucey committed May 20, 2023
1 parent 3faf2ff commit 69dd11f
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import (

func main() {

version := "1.1.3"
version := "1.1.4"

var headerCounters [7]int
var mdTmpFile *os.File
Expand Down Expand Up @@ -112,23 +112,30 @@ func main() {
title := matches[3]
headerCounters[currentHeaderType]++

for headerType := 1; headerType <= 6; headerType++ {
AddSectionChunk(&section, headerCounters[headerType], currentHeaderType, headerType)
}

if *removeFlag {

rewrittenLine = header + " " + title

} else {

for headerType := 1; headerType <= 6; headerType++ {
AddSectionChunk(&section, headerCounters[headerType], currentHeaderType, headerType)
}

rewrittenLine = header + " " + section + " " + title
}

WriteTmpFile(*writeFlag, mdTmpFile, rewrittenLine, newLine)

for i := currentHeaderType + 1; i <= 6; i++ {
headerCounters[i] = 0
}
if !*removeFlag {

for i := currentHeaderType + 1; i <= 6; i++ {
headerCounters[i] = 0
}

section = ""
section = ""

}

} else {

Expand Down

0 comments on commit 69dd11f

Please sign in to comment.