carboneio / carbone

Fast and simple report generator, from JSON to pdf, xslx, docx, odt...
https://carbone.io
Other
1.3k stars 190 forks source link

[Bug Report]: Conditional breaks when string contains parenthesis #137

Open handhikadj opened 3 years ago

handhikadj commented 3 years ago

Environment Carbone Version: 3.2.3 Node Version: v14.17.3 Browsers: Chrome 92.0.4515.159 Desktop OS: Mac M1

Expected Behaviour The conditional works fine

Actual Behaviour In the converted PDF, the conditional breaks. Result in ‘NOT(E-FILE I believe there's a bug when handling parenthesis inside conditional(s)

Steps to reproduce Steps to reproduce the bug:

  1. create a docx file with this text: {d.filingType:ifEQ(1):show(‘E-FILE (FILE)’):elseShow(‘NOT (E-FILE)’)}
  2. generate the PDF with the docx file
const dataToRender = {
    data: { filingType: 1 },
    convertTo: "pdf",
};

try {
    const { content } = await carbone.renderPromise(publicPath, dataToRender);
    // ...
steevepay commented 3 years ago

Hello @handhikadj, thank you for reporting the issue. I reproduced the error, and I come back to you when the fix is available. Have a great day!