Skip to content

Commit

Permalink
Remove redundant file content check when writing TOC
Browse files Browse the repository at this point in the history
  • Loading branch information
thumannw committed Feb 3, 2022
1 parent ce3d73e commit e9e775d
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/Knit.kt
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ fun KnitContext.knit(inputFile: File): Boolean {
}
addAll(markdown.postTocText)
}
if (newLines != markdown.inText) writeLinesIfNeeded(inputFile, newLines)
writeLinesIfNeeded(inputFile, newLines)
// check apiRefs
for (apiRef in allApiRefs) {
if (apiRef.name in remainingApiRefNames) {
Expand Down Expand Up @@ -605,7 +605,6 @@ class ApiRef(val line: Int, val name: String)
enum class InputTextPart { PRE_TOC, TOC, POST_TOC }

class InputTextReader(val inputFileType: InputFileType, r: Reader) : LineNumberReader(r) {
val inText = arrayListOf<String>()
val preTocText = arrayListOf<String>()
val postTocText = arrayListOf<String>()
var inputTextPart: InputTextPart = InputTextPart.PRE_TOC
Expand All @@ -624,7 +623,6 @@ class InputTextReader(val inputFileType: InputFileType, r: Reader) : LineNumberR
return it
}
val line = super.readLine() ?: return null
inText += line
if (!skip && inputTextPart != InputTextPart.TOC)
outText += line
return line
Expand Down

0 comments on commit e9e775d

Please sign in to comment.