aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authors-ol <s-ol@users.noreply.github.com>2019-12-29 14:49:40 +0000
committers-ol <s-ol@users.noreply.github.com>2019-12-29 14:49:40 +0000
commita67038a74ed94fd536db39a4a900bb2966886162 (patch)
tree4e9aa7d2c2c69198a9c96b7eedef4d5f04357dbf
parentprint CSS (diff)
downloadmmm-a67038a74ed94fd536db39a4a900bb2966886162.tar.gz
mmm-a67038a74ed94fd536db39a4a900bb2966886162.zip
fix yieldable_gsub
-rw-r--r--mmm/mmmfs/plugins/init.moon9
1 files changed, 6 insertions, 3 deletions
diff --git a/mmm/mmmfs/plugins/init.moon b/mmm/mmmfs/plugins/init.moon
index 9b17b45..50bf01e 100644
--- a/mmm/mmmfs/plugins/init.moon
+++ b/mmm/mmmfs/plugins/init.moon
@@ -30,17 +30,20 @@ string.yieldable_gsub = (str, pat, f) ->
str = str\gsub '%%', '%%|'
matches = {}
- str\gsub pat, (...) ->
+ str, cnt = str\gsub pat, (...) ->
table.insert matches, { ... }
"%#{#matches}"
for match in *matches
match.replacement = f table.unpack match
- str\gsub '%%(%d+)', (i) -> matches[i].replacement
+ str = str\gsub '%%(%d+)', (i) ->
+ i = tonumber i
+ matches[i].replacement
-- unescape escaped percent signs
- str\gsub '%%|', '%%'
+ str = str\gsub '%%|', '%%'
+ str, cnt
-- list of converts, editors
-- converts each have