Skip to content

Commit

Permalink
Fix emco templates (#44)
Browse files Browse the repository at this point in the history
* Don't strip path delimiters in process template. Also do not strip pipes, as they are still needed for templating down the line
* Fix templating for EMCO and Tab names
* bump version
  • Loading branch information
demonnic authored Oct 5, 2022
1 parent adbb23f commit 1260c72
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions src/resources/emco.lua
Original file line number Diff line number Diff line change
Expand Up @@ -846,8 +846,10 @@ end
-- @param str the string to replace tokens in
-- @param tabName optional, if included will be used for |N in the templated string.
function EMCO:processTemplate(str, tabName)
str = str:gsub("|E", self.name:gsub("[<>:'\"/|\\?*]", "_"))
str = str:gsub("|N", tabName:gsub("[<>:'\"/|\\?*]", "_") or "")
local safeName = self.name:gsub("[<>:'\"?*]", "_")
local safeTabName = tabName and tabName:gsub("[<>:'\"?*]", "_") or ""
str = str:gsub("|E", safeName)
str = str:gsub("|N", safeTabName)
return str
end

Expand Down Expand Up @@ -1210,7 +1212,7 @@ function EMCO:setAllTabName(allTabName)
self.ae(funcName, "allTabName expected as string, got" .. allTabNameType)
end
if not table.contains(self.consoles, allTabName) then
self.ae(funcName, "allTabName must be the name of one of the console tabs. Valid options are: " .. table.concat(self.containers, ","))
self.ae(funcName, "allTabName must be the name of one of the console tabs. Valid options are: " .. table.concat(self.consoles, ","))
end
self.allTabName = allTabName
end
Expand Down Expand Up @@ -2143,6 +2145,7 @@ function EMCO:load()
table.load(filename, configTable)
else
debugc(string.format("Attempted to load config for EMCO named %s but the file could not be found. Filename: %s", self.name, filename))
return
end
self.timestamp = configTable.timestamp
self.blankLine = configTable.blankLine
Expand Down
2 changes: 1 addition & 1 deletion src/resources/mdkversion.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.7.1
2.7.2

0 comments on commit 1260c72

Please sign in to comment.