Skip to content

Commit

Permalink
Added LaTeX comments deletion for strat of line comments
Browse files Browse the repository at this point in the history
  • Loading branch information
janmerhar committed Jul 28, 2021
1 parent 48f452d commit 786cc01
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions execs/manipulator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ if (path.extname(manipulatorManCommander.opts().input) == ".tex") {
tex.removeSections()
tex.removeLaTeX()
tex.removeDoubleEmptyLines()
tex.removeLaTeXComments()

// mogoče je še prezgodaj
// in to raje naredim v MDManipulator
Expand Down
7 changes: 7 additions & 0 deletions manipulator/LaTeXManipulator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,13 @@ class LaTeXManipulator {
// fileText = this.replaceMathExpression(fileText, true)
}

removeLaTeXComments() {
this.fileText = this.fileText
.split(/(\r*\n)*\s*%.*\r*\n/)
.join(" ")
.trim()
}

writeToFile(writePath = this.fileName, writeExtension = "md") {
let writtenFile = "LOG_" + writePath + "." + writeExtension
fs.writeFileSync(writtenFile, this.fileText)
Expand Down

0 comments on commit 786cc01

Please sign in to comment.