Skip to content

Commit

Permalink
kotoriの更新。
Browse files Browse the repository at this point in the history
  • Loading branch information
Tatakinov committed Jan 7, 2023
1 parent a28edc9 commit 45347ca
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
5 changes: 5 additions & 0 deletions ghost/master/corelib/path/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ function M.join(...)
return table.concat(t, SEP)
end

function M.basename(path)
local match = string.match(path, [[.+[/\](.-)$]])
return match or path
end

function M.normalize(path)
-- TODO stub
return path
Expand Down
9 changes: 6 additions & 3 deletions ghost/master/shiori/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ function M:load(path)

--トーク読み込み
Path.dirWalk(path .. "talk", function(file_path)
if string.sub(file_path, 1, 1) == "_" or string.sub(file_path, -4, -1) ~= ".lua" then
local file_name = Path.basename(file_path)
if string.sub(file_name, 1, 1) == "_" or string.sub(file_name, -4, -1) ~= ".lua" then
return
end
local t, err = (function()
Expand Down Expand Up @@ -267,8 +268,10 @@ function M:autoReplace(x)
end

function M:autoReplaceVars(str)
local str = string.gsub(str, "%${([^}]+)}", function(s)
--print("replace: " .. s)
local str = str:gsub("(\\?)%${([^}]+)}", function(escape, s)
if escape == "\\" then
return string.format("${%s}", s)
end
return tostring(self.var(s))
end)
return str
Expand Down

0 comments on commit 45347ca

Please sign in to comment.