jwalton512 / vim-blade

Vim syntax highlighting for Blade templates.
226 stars 37 forks source link

Highlighting within HTML tags #15

Closed tremby closed 10 years ago

tremby commented 10 years ago

Here's a tricky one:

<p>
    {{ $address }}{{-- Double braces on purpose: already escaped --}}
    @if ($address && $document->getMyText('phone'))
        <br/>
    @endif
    @if ($document->getMyText('phone'))
        T: <a href="tel:{{{ $document->getMyText('phone') }}}">Phone {{{ $document->getMyText('phone') }}}</a>
    @endif
    @if ($document->getMyText('phone') && $document->getMyText('email'))
        or
    @endif
    @if ($document->getMyText('email'))
        E: <a href="mailto:{{{ $document->getMyText('email') }}}">Email {{{ $document->getMyText('email') }}}</a>
    @endif
</p>
<em>
    {{ $address }}{{-- Double braces on purpose: already escaped --}}
    @if ($address && $document->getMyText('phone'))
        <br/>
    @endif
    @if ($document->getMyText('phone'))
        T: <a href="tel:{{{ $document->getMyText('phone') }}}">Phone {{{ $document->getMyText('phone') }}}</a>
    @endif
    @if ($document->getMyText('phone') && $document->getMyText('email'))
        or
    @endif
    @if ($document->getMyText('email'))
        E: <a href="mailto:{{{ $document->getMyText('email') }}}">Email {{{ $document->getMyText('email') }}}</a>
    @endif
</em>
<strong>
    {{ $address }}{{-- Double braces on purpose: already escaped --}}
    @if ($address && $document->getMyText('phone'))
        <br/>
    @endif
    @if ($document->getMyText('phone'))
        T: <a href="tel:{{{ $document->getMyText('phone') }}}">Phone {{{ $document->getMyText('phone') }}}</a>
    @endif
    @if ($document->getMyText('phone') && $document->getMyText('email'))
        or
    @endif
    @if ($document->getMyText('email'))
        E: <a href="mailto:{{{ $document->getMyText('email') }}}">Email {{{ $document->getMyText('email') }}}</a>
    @endif
</strong>
<a href="http://example.com">
    {{ $address }}{{-- Double braces on purpose: already escaped --}}
    @if ($address && $document->getMyText('phone'))
        <br/>
    @endif
    @if ($document->getMyText('phone'))
        T: <span class="tel:{{{ $document->getMyText('phone') }}}">Phone {{{ $document->getMyText('phone') }}}</span>
    @endif
    @if ($document->getMyText('phone') && $document->getMyText('email'))
        or
    @endif
    @if ($document->getMyText('email'))
        E: <span class="mailto:{{{ $document->getMyText('email') }}}">Email {{{ $document->getMyText('email') }}}</span>
    @endif
</a>

screen shot 2014-03-11 at 11 33 43 am

jwalton512 commented 10 years ago

it's something weird about how the html syntax highlights the em and strong -- let me see if i can tweak around it (for the first couple issues)

jwalton512 commented 10 years ago

hey man -- would you be able to test another branch? -- my html syntax highlighting doesn't seem to be as elegant as yours (no underlined links, italics, etc). think i have resolved the new issues

tremby commented 10 years ago

Perfect, as far as I can see!

screen shot 2014-03-11 at 12 59 39 pm

Please merge it in to master. You could save the test case too.