summaryrefslogtreecommitdiff
path: root/support/texplate/source/main/kotlin/org/islandoftex/texplate/util
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2020-08-10 03:03:10 +0000
committerNorbert Preining <norbert@preining.info>2020-08-10 03:03:10 +0000
commit37ce19e9251a5b38afadffc633acc6b03f03cc48 (patch)
tree84d132ceef053e85a0fe70c7ad65bcea0e38c7ca /support/texplate/source/main/kotlin/org/islandoftex/texplate/util
parent68df63effba2e77fb0218b91a6722821355885cd (diff)
CTAN sync 202008100303
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.kt4
-rw-r--r--support/texplate/source/main/kotlin/org/islandoftex/texplate/util/PathUtils.kt7
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