diff --git a/lib/index.cjs b/lib/index.cjs index 1fe9ba5..2bb6180 100644 --- a/lib/index.cjs +++ b/lib/index.cjs @@ -160,6 +160,18 @@ const lookupVar = function(label, index) { index--; } + // Normal lookup has failed, attempt to resolve multiple labels into individuals + if(label?.trim().indexOf(' ') > 0){ + const labels = label.split(' '); + const outputStrings = labels.map((string)=>{ + return lookupVar(string, index)?.content || string; + }); + return { + content : outputStrings.join(' '), + resolved : true + }; + } + return undefined; }; diff --git a/lib/index.umd.js b/lib/index.umd.js index c7fa33c..1b21ada 100644 --- a/lib/index.umd.js +++ b/lib/index.umd.js @@ -160,6 +160,18 @@ index--; } + // Normal lookup has failed, attempt to resolve multiple labels into individuals + if(label?.trim().indexOf(' ') > 0){ + const labels = label.split(' '); + const outputStrings = labels.map((string)=>{ + return lookupVar(string, index)?.content || string; + }); + return { + content : outputStrings.join(' '), + resolved : true + }; + } + return undefined; }; diff --git a/spec/__snapshots__/index.test.js.snap b/spec/__snapshots__/index.test.js.snap index eb8da88..82cfa8f 100644 --- a/spec/__snapshots__/index.test.js.snap +++ b/spec/__snapshots__/index.test.js.snap @@ -102,6 +102,8 @@ exports[`Math function parameter handling allows two variables in two-parameter exports[`Math function parameter handling allows variables in single-parameter functions 1`] = `"
4
"`; +exports[`Multiple variable names at once output multiple variables at once 1`] = `"first second ef
"`; + exports[`Normal Links and Images Applies curly injectors to images 1`] = `"{width:100px}