Skip to content

Commit

Permalink
Merge pull request #2053 from Hannah-Sten/quoted-custom-arguments
Browse files Browse the repository at this point in the history
Quoted custom arguments
  • Loading branch information
PHPirates authored Aug 30, 2021
2 parents e5c3e5e + 3e03ba5 commit caf5fa0
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ plugins {
}

group = "nl.hannahsten"
version = "0.7.9"
version = "0.7.10-alpha.2"

repositories {
mavenCentral()
Expand Down
3 changes: 2 additions & 1 deletion src/nl/hannahsten/texifyidea/run/compiler/BiberCompiler.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package nl.hannahsten.texifyidea.run.compiler

import com.intellij.openapi.project.Project
import com.intellij.util.execution.ParametersListUtil
import nl.hannahsten.texifyidea.run.bibtex.BibtexRunConfiguration

/**
Expand All @@ -19,7 +20,7 @@ internal object BiberCompiler : Compiler<BibtexRunConfiguration> {
// The extra directory added is the directory from which the path to the .bib resource file is searched as specified in the .bcf file.
add("--input-directory=${runConfig.mainFile?.parent?.path ?: ""}")

runConfig.compilerArguments?.let { addAll(it.split("""\s+""".toRegex())) }
runConfig.compilerArguments?.let { addAll(ParametersListUtil.parse(it)) }

add(runConfig.mainFile?.nameWithoutExtension ?: return null)
}
Expand Down
3 changes: 2 additions & 1 deletion src/nl/hannahsten/texifyidea/run/compiler/BibtexCompiler.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package nl.hannahsten.texifyidea.run.compiler

import com.intellij.openapi.project.Project
import com.intellij.openapi.roots.ProjectRootManager
import com.intellij.util.execution.ParametersListUtil
import nl.hannahsten.texifyidea.run.bibtex.BibtexRunConfiguration
import nl.hannahsten.texifyidea.settings.sdk.LatexSdkUtil

Expand All @@ -21,7 +22,7 @@ internal object BibtexCompiler : Compiler<BibtexRunConfiguration> {
command.apply {
add(runConfig.compilerPath ?: executableName)

runConfig.compilerArguments?.let { addAll(it.split("""\s+""".toRegex())) }
runConfig.compilerArguments?.let { addAll(ParametersListUtil.parse(it)) }

// Include files from auxiliary directory on Windows
if (LatexSdkUtil.isMiktexAvailable) {
Expand Down
5 changes: 2 additions & 3 deletions src/nl/hannahsten/texifyidea/run/compiler/LatexCompiler.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import com.intellij.execution.configurations.GeneralCommandLine
import com.intellij.openapi.project.Project
import com.intellij.openapi.roots.ProjectRootManager
import com.intellij.openapi.vfs.VirtualFile
import com.intellij.util.execution.ParametersListUtil
import nl.hannahsten.texifyidea.run.latex.LatexDistributionType
import nl.hannahsten.texifyidea.run.latex.LatexRunConfiguration
import nl.hannahsten.texifyidea.settings.sdk.LatexSdkUtil
import nl.hannahsten.texifyidea.util.LatexmkRcFileFinder
import nl.hannahsten.texifyidea.util.runCommand
import nl.hannahsten.texifyidea.util.splitWhitespace

/**
* @author Hannah Schellekens, Sten Wessel
Expand Down Expand Up @@ -285,8 +285,7 @@ enum class LatexCompiler(private val displayName: String, val executableName: St

// Custom compiler arguments specified by the user
runConfig.compilerArguments?.let { arguments ->
arguments.splitWhitespace()
.dropLastWhile { it.isEmpty() }
ParametersListUtil.parse(arguments)
.forEach { command.add(it) }
}

Expand Down

0 comments on commit caf5fa0

Please sign in to comment.