aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/src/main/kotlin/Locations/Location.kt4
1 files changed, 3 insertions, 1 deletions
diff --git a/core/src/main/kotlin/Locations/Location.kt b/core/src/main/kotlin/Locations/Location.kt
index 63c9b913..2ad6b652 100644
--- a/core/src/main/kotlin/Locations/Location.kt
+++ b/core/src/main/kotlin/Locations/Location.kt
@@ -57,11 +57,13 @@ fun relativePathToNode(node: DocumentationNode): String {
}
+private val reservedFilenames = setOf("index", "con", "aux", "lst", "prn", "nul", "eof", "inp", "out")
+
fun identifierToFilename(path: String): String {
if (path.isEmpty()) return "--root--"
val escaped = path.replace('<', '-').replace('>', '-')
val lowercase = escaped.replace("[A-Z]".toRegex()) { matchResult -> "-" + matchResult.value.toLowerCase() }
- return if (lowercase == "index") "--index--" else lowercase
+ return if (lowercase in reservedFilenames) "--$lowercase--" else lowercase
}
fun NodeLocationAwareGenerator.relativePathToLocation(owner: DocumentationNode, node: DocumentationNode): String {