diff options
Diffstat (limited to 'support/texplate/source/main/kotlin/org/islandoftex/texplate/util')
-rw-r--r-- | support/texplate/source/main/kotlin/org/islandoftex/texplate/util/HandlerUtils.kt | 4 | ||||
-rw-r--r-- | support/texplate/source/main/kotlin/org/islandoftex/texplate/util/PathUtils.kt | 7 |
2 files changed, 9 insertions, 2 deletions
diff --git a/support/texplate/source/main/kotlin/org/islandoftex/texplate/util/HandlerUtils.kt b/support/texplate/source/main/kotlin/org/islandoftex/texplate/util/HandlerUtils.kt index 44eebb2b69..9f6c65d8e6 100644 --- a/support/texplate/source/main/kotlin/org/islandoftex/texplate/util/HandlerUtils.kt +++ b/support/texplate/source/main/kotlin/org/islandoftex/texplate/util/HandlerUtils.kt @@ -3,6 +3,7 @@ package org.islandoftex.texplate.util import org.islandoftex.texplate.model.handlers.BooleanHandler import org.islandoftex.texplate.model.handlers.CSVListHandler +import org.islandoftex.texplate.model.handlers.FileReaderHandler import org.islandoftex.texplate.model.handlers.Handler /** @@ -20,6 +21,7 @@ object HandlerUtils { @JvmStatic val handlers: Map<String, Handler> = mapOf( "to-csv-list" to CSVListHandler(), - "to-boolean" to BooleanHandler() + "to-boolean" to BooleanHandler(), + "to-string-list-from-file" to FileReaderHandler() ) } diff --git a/support/texplate/source/main/kotlin/org/islandoftex/texplate/util/PathUtils.kt b/support/texplate/source/main/kotlin/org/islandoftex/texplate/util/PathUtils.kt index 3a74603557..d0212769ec 100644 --- a/support/texplate/source/main/kotlin/org/islandoftex/texplate/util/PathUtils.kt +++ b/support/texplate/source/main/kotlin/org/islandoftex/texplate/util/PathUtils.kt @@ -39,7 +39,12 @@ object PathUtils { @JvmStatic @Throws(FileNotFoundException::class) fun getTemplatePath(name: String): Path { - // the file has to be a TOML format, so we add the extension + // if the name represents an existing TOML file, we assume the user wants this + // file + if (name.endsWith(".toml") && Files.exists(Paths.get(name))) + return Paths.get(name) + // if not, then we test for the file in texplate's search path + // it has to be in TOML format and without extension val fullName = "$name.toml" // the first reference is based on the user template path resolved with the // file name |