template.lua (411B)
1 -- @module template 2 local template = {} 3 -- 4 local lume = require 'satelito.lib.lume.lume' 5 6 -- Find the path to a template file from his name 7 function template.find(templates, templatename) 8 local _template = lume.match( 9 templates, 10 function(tpl) 11 -- Try to find a match 12 return string.gsub(tpl, '(.*/)(.*)', '%2') == templatename .. '.html' 13 end 14 ) 15 16 return _template 17 end 18 19 return template