Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: mj-raw cannot be used inside mj-list #12

Open
hitautodestruct opened this issue May 17, 2023 · 0 comments
Open

bug: mj-raw cannot be used inside mj-list #12

hitautodestruct opened this issue May 17, 2023 · 0 comments
Labels
Type: Bug Problems in the program which will cause issues for users or implementors.

Comments

@hitautodestruct
Copy link

hitautodestruct commented May 17, 2023

MJML Bullet List version

1.2.2

MJML version

4.13.0

What operating system are you using?

Mac

Node version

19.7.0

npm or yarn version

7.18.0 (pnpm)

Current behavior

When placing a <mj-raw> tag under <mj-list> the mjml parser throws the following error:

Line 3 of undefined, included at line 143 of file /test.mjml (mj-raw) — mj-raw cannot be used inside mj-list, only inside: mj-column, mjml, mj-accordion, mj-accordion-element, mj-attributes, mj-body, mj-group, mj-head, mj-hero, mj-navbar, mj-section, mj-social, mj-wrapper

The <mj-raw> tag is necessary as we are implementing jinja2 templating syntax which dissapears after rendering the mjml to html.

Example:

<mj-raw>{% if filters|length > 0 %}</mj-raw> <!-- This works fine -->
<mj-list>
  {% for key, value in filters.items() %}              <!-- This does not render in html and therefore requires an mj-raw -->
  <mj-li bullet-color="#8aabff" color="#2a2a2a" padding-left="7px">
    {{ key }}
  </mj-li>
  {% endfor %}
</mj-list>

Notice the missing {% for key, value in filters.items() %} in the rendered output

<table border="0" cellpadding="0" cellspacing="0" role="presentation" style="vertical-align:top;" width="100%">
  <tbody> {% if filters|length > 0 %} <tr>
      <td vertical-align="top" style="font-size:0px;padding-left:25px;word-break:break-word;">
        <div class="mj-column-px-NaN mj-outlook-group-fix list" style="font-size:0px;text-align:left;direction:ltr;display:inline-block;vertical-align:top;width:100%;">
          <table border="0" cellpadding="0" cellspacing="0" role="presentation" width="100%">
            <tbody>
              <tr>
                <td style="vertical-align:top;padding-left:25px;">
                  <table border="0" cellpadding="0" cellspacing="0" role="presentation" style="" width="100%">
                    <tbody>
                      <tr>
                        <td vertical-align="top" style="font-size:0px;padding-left:7px;word-break:break-word;">
                          <ul role="presentation" class="list-item-wrap" align="left" type="disc" style="color:#2a2a2a;font-family:Open Sans, Helvetica, Arial, sans-serif;font-size:13px;mso-line-height-rule:exactly;margin-top:0;margin-left:7px;margin-bottom:0;padding:0;">
                            <li role="list-item" class="list-item" style="color:#8aabff;margin:0;padding:0;padding-left:3px;">
                              <span class="list-item__text" style="color:#2a2a2a;text-align:left;">
                                {{ key }}
                              </span>
                            </li>
                          </ul>
                        </td>
                      </tr>
                    </tbody>
                  </table>
                </td>
              </tr>
            </tbody>
          </table>
        </div>
      </td>
    </tr>
  </tbody>
</table>

Expected behavior

<mj-list> should be able to include an <mj-raw> tag and render the markup unprocessed.

Steps to reproduce

Include an <mj-raw> tag inside of an <mj-list> tag.

Relevant log output

No response

Related code

No response

Preferred solution

No response

Other information

No response

@hitautodestruct hitautodestruct added the Type: Bug Problems in the program which will cause issues for users or implementors. label May 17, 2023
BluePsyduck added a commit to BluePsyduck/mjml-bullet-list that referenced this issue Jul 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Problems in the program which will cause issues for users or implementors.
Projects
None yet
Development

No branches or pull requests

1 participant