mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-02 12:52:38 +00:00
Merge pull request #3314 from naturalcrit/ForceVarMathTo$
Variable math requires `$` prefix
This commit is contained in:
@@ -342,7 +342,7 @@ const replaceVar = function(input, hoist=false, allowUnresolved=false) {
|
|||||||
|
|
||||||
let replacedLabel = label;
|
let replacedLabel = label;
|
||||||
|
|
||||||
if(mathVars?.[0] !== label.trim()) {// If there was mathy stuff not captured, let's do math!
|
if(prefix[0] == '$' && mathVars?.[0] !== label.trim()) {// If there was mathy stuff not captured, let's do math!
|
||||||
mathVars?.forEach((variable)=>{
|
mathVars?.forEach((variable)=>{
|
||||||
const foundVar = lookupVar(variable, globalPageNumber, hoist);
|
const foundVar = lookupVar(variable, globalPageNumber, hoist);
|
||||||
if(foundVar && foundVar.resolved && foundVar.content && !isNaN(foundVar.content)) // Only subsitute math values if fully resolved, not empty strings, and numbers
|
if(foundVar && foundVar.resolved && foundVar.content && !isNaN(foundVar.content)) // Only subsitute math values if fully resolved, not empty strings, and numbers
|
||||||
|
|||||||
Reference in New Issue
Block a user