File tree Expand file tree Collapse file tree 1 file changed +14
-6
lines changed Expand file tree Collapse file tree 1 file changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -56,13 +56,9 @@ function Templates:compile(template)
56
56
content = table.concat (content , ' \n ' )
57
57
end
58
58
content = self :_compile_dates (content )
59
- content = self :_compile_prompts (content )
59
+ content = self :_compile_expansions (content )
60
60
content = self :_compile_expressions (content )
61
- for expansion , compiler in pairs (expansions ) do
62
- if content :match (vim .pesc (expansion )) then
63
- content = content :gsub (vim .pesc (expansion ), compiler ())
64
- end
65
- end
61
+ content = self :_compile_prompts (content )
66
62
return vim .split (content , ' \n ' , true )
67
63
end
68
64
@@ -80,6 +76,18 @@ function Templates:setup()
80
76
end
81
77
end
82
78
79
+ --- @param content string
80
+ --- @return string
81
+ function Templates :_compile_expansions (content , found_expansions )
82
+ found_expansions = found_expansions or expansions
83
+ for expansion , compiler in pairs (found_expansions ) do
84
+ if content :match (vim .pesc (expansion )) then
85
+ content = content :gsub (vim .pesc (expansion ), compiler ())
86
+ end
87
+ end
88
+ return content
89
+ end
90
+
83
91
--- @param content string
84
92
--- @return string
85
93
function Templates :_compile_dates (content )
You can’t perform that action at this time.
0 commit comments