mattkenefick / twigtovuejs

JavaScript implementation of TwigToVue (PHP)
0 stars 0 forks source link

Double quotes within attributes fail to convert #3

Open mattkenefick opened 3 years ago

mattkenefick commented 3 years ago

This is fine.

     <li class="menu-item" ref="billing">
        <a href="{{ pageUrl('/page/pricing') }}" title="{{ twigNavigateCaption('account.billing') }}">
            {{ svg("icon/icon-account-billing.svg") }}
            <span>{{ trans("account.billing") }}</span>
        </a>
    </li>

This is bad.

    <li class="menu-item" ref="billing">
        <a href="{{ pageUrl("/page/pricing") }}" title="{{ twigNavigateCaption('account.billing') }}">
            {{ svg("icon/icon-account-billing.svg") }}
            <span>{{ trans("account.billing") }}</span>
        </a>
    </li>

It converts to something like:

    <li class="menu-item" ref="settings">
        <a :href="pageUrl('/account/settings')" :title="twigNavigateCaption('account.settings')">
            {{ svg("icon/icon-account-settings.svg") }}
            <span>{{ trans("account.settings") }}</span>
        </a>
    </li>
    <li class="menu-item" ref="billing">
        <a page="" pricing")="" }}"="" :href="pageUrl('" :title="twigNavigateCaption('account.billing')">
            {{ svg("icon/icon-account-billing.svg") }}
            <span>{{ trans("account.billing") }}</span>
        </a>
    </li>
mattkenefick commented 3 years ago

This is happening because of the double quotes in the attributes; we should check for quotes within quotes and convert them to the opposite type.