mattkenefick / twigtovuejs

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

It's trying to parse within comments. #1

Open mattkenefick opened 3 years ago

mattkenefick commented 3 years ago

We have an include tag within comments that dirty-json is having trouble parsing. We should be ignoring anything within comments.


{#
 ┌─────────────────────────────────────────────────────────────────────────────┐
 │                                                                             │
 │  View/User/ProfileBlock                                                     │
 │                                                                             │
 │  Typically used in an article or editorial.                                 │
 │                                                                             │
 │  Options:                                                                   │
 │      `person` <ModelPerson>                                                 │
 │      Person associated with this profile                                    │
 │                                                                             │
 │      `type` <String>                                                        │
 │      Size for avatar                                                        │
 │                                                                             │
 │      `user` <ModelUser>                                                     │
 │      User associated with this profile                                      │
 │                                                                             │
 │  Example:                                                                   │
 │                                                                             │
 │      {% include "Web/View/User/ProfileBlock/ProfileBlock.twig" with {       │
 │          person: person,                                                    │
 │          user: user,                                                        │
 │      } %}                                                                   │
 │                                                                             │
 └─────────────────────────────────────────────────────────────────────────────┘
#}
mattkenefick commented 3 years ago

Also has issues with something like:


        {#
            In previous implementations, we tried using {{ svg(...) }}
            and {{ imageUrl(...) }} without success. That's because they
            are backend methods and fail through Vue (i think).

            This is worth revisiting.
        #}```
mattkenefick commented 3 years ago

Solved this for now by converting all comments to base 64, then parsing tags, then reverting our base64 conversions.