0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-24 16:22:44 +00:00

Replace Regex Lookbehind with obnoxious workaround so Safari doesn't break

This commit is contained in:
Trevor Buckner
2021-08-10 23:42:46 -04:00
parent 3cf5dc74bb
commit a48c74b2e7

View File

@@ -384,8 +384,10 @@ const splitCells = (tableRow, count, prevRow = [])=>{
return ` ${p1}`;
}
});
tableRow = ` ${tableRow}`;
const cells = tableRow.split(/(?: \||(?<=\|)\|)(?=[^\|]|$)/g);
// Split into cells. Contents are: no pipes unless escaped. Add any ending pipes; if not don't include ending space
const cells = [...tableRow.matchAll(/(?:[^\|]+(?:\\\|)*)+(?:\|+(?=\|)|(?= \|))/g)].map((x)=>x[0]);
let i = 0;
// First/last cell in a row cannot be empty if it has no leading/trailing pipe