jwalton512/vim-blade

Issue highlighting PHP inside @if statement

tremby opened this issue · 2 comments

Input:

@section('title')
    @if ($document->get($document->getType() . '.page_title')->asText())
        {{{ $document->get($document->getType() . '.page_title')->asText() }}}
    @else
        {{{ $document->get($document->getType() . '.title')->asText() }}}
    @endif
@endsection

Highlighting as
screen shot 2014-03-04 at 3 05 03 pm

The code in the @if statement is not highlighting properly.

I've a feeling this one is related:

                        <p>
                            <em>
                                {{{ $address }}}
                                @if ($address && $document->getMyText('phone'))
                                    <br/>
                                @endif
                                @if ($document->getMyText('phone'))
                                    T: <a href="tel:{{{ $document->getMyText('phone') }}}">{{{ $document->getMyText('phone') }}}</a>
                                @endif
                                @if ($document->getMyText('phone') && $document->getMyText('email'))
                                    |
                                @endif
                                @if ($document->getMyText('email'))
                                    E: <a href="mailto:{{{ $document->getMyText('email') }}}">{{{ $document->getMyText('email') }}}</a>
                                @endif
                            </em>
                        </p>

Highlighting as
screen shot 2014-03-04 at 5 30 00 pm

Note in particular:

  • The final closing parenthesis of the first @if line is italic (look closely), so I think matching brackets aren't being detected properly
  • The @endif is highlighted incorrectly
  • The insides of the {{{ }}} sections on the line starting T: aren't highlighted, but honestly I don't know if they should be or not, given that they're mixed in to HTML attributes and such.
  • On the second @if line the highlighting stops after the first ) again, and the wrong highlighting afterwards is more obvious.

Thanks!