Skip to content

Commit

Permalink
Add (Blade Extensions) Missing Directives
Browse files Browse the repository at this point in the history
unset breakpoint embed endembed macrodef endmacro macro markdown endmarkdown minify
  • Loading branch information
zaynali53 committed Jul 1, 2016
1 parent 9cd4265 commit f800fb0
Show file tree
Hide file tree
Showing 3 changed files with 164 additions and 6 deletions.
4 changes: 2 additions & 2 deletions blade.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ contexts:
pop: true
- include: 'scope:source.php'

- match: '(\s{0}|^)(\@)\b(debug|set|if|elseif|forelse|foreach|for|while|extends|unless|each|yield|lang|choice|section|include|render|block|can|inject|partial|hasSection|elsecan|elsecannot|stack|push|layout|continue|break)\b(?=(|\s*|)\()'
- match: '(\s{0}|^)(\@)\b(debug|embed|macrodef|set|unset|if|elseif|forelse|foreach|for|while|extends|unless|each|yield|lang|choice|section|include|render|block|can|inject|partial|hasSection|elsecan|elsecannot|stack|push|layout|continue|break|minify|macro)\b(?=(|\s*|)\()'
captures:
0: entity.name.tag.block.any.html
1: constant.other.inline-data.html
Expand All @@ -47,7 +47,7 @@ contexts:
pop: true
- include: 'scope:source.php'

- match: '(\s{0}|^)(\@)\b(empty|endif|endforelse|endforeach|endfor|endwhile|else|endunless|show|stop|endblock|endpartial|continue|break|endsection|parent|overwrite|endcan|append|endpush)\b'
- match: '(\s{0}|^)(\@)\b(breakpoint|endmacro|endembed|empty|endif|endforelse|endforeach|endfor|endwhile|else|endunless|show|stop|endblock|endpartial|continue|break|endsection|parent|overwrite|endcan|append|endpush|markdown|endmarkdown|endminify)\b'
scope: custom.compiler.blade.php
captures:
0: entity.name.tag.block.any.html
Expand Down
83 changes: 81 additions & 2 deletions test.blade
Original file line number Diff line number Diff line change
Expand Up @@ -170,12 +170,91 @@ This comment will not be in the rendered HTML

@endforeach

@set($now, new DateTime('now'))
@set('newvar', 'value')
{{ $newvar }}
@set('newvar', 'value')
@set($now, new DateTime('now'))
@set('myArr', ['my' => 'arr'])
@set('myArr2', array('my' => 'arr'))

@unset('newvar')
@unset($newvar)

@debug($somearr)

// xdebug_break breakpoints (configurable) to debug compiled views. Sweet? YES!
@breakpoint

@markdown
# Some markdown code
** with some bold text too **
@endmarkdown

@section('content')
@embed('components.panel', ['type' => 'danger', 'items' => ['first', 'second', 'third'] ])
@section('content')
<p>Hello World!</p>
@stop
@endembed
@stop

@macrodef('divider', $class = 'divider', $role = 'seperator')
<?php return "<li role='{$role}' class='{$class}'></li>"; ?>
@endmacro

<div class="container">
<h1>Title</h1>

@macro("divider")

<p>Paragraph</p>
</div>

@embed('blade-ext::dropdown', ['button' => true ])
@section('label', 'Choose')
@section('items')
@macro('item', 'Action')
@macro('item', 'Another Action')
@macro('item', 'Something else here')
@macro('item', 'Separated link')
@stop
@endembed

<script>
@minify('js')
var exampleJavascript = {
this: 'that',
foo: 'bar',
doit: function(){
console.log('yesss');
}
};
@endminify
</script>

<style type="text/css">
@minify('css')
a.bg-primary:hover,
a.bg-primary:focus {
background-color: #286090;
}
.bg-success {
background-color: #dff0d8;
}
a.bg-success:hover,
a.bg-success:focus {
background-color: #c1e2b3;
}
@endminify
</style>

{{----------------------------------------}}

@can('permission', $entity)
You have permission!
@endcan
Expand Down
83 changes: 81 additions & 2 deletions test.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,12 +170,91 @@

@endforeach

@set($now, new DateTime('now'))
@set('newvar', 'value')
{{ $newvar }}
@set('newvar', 'value')
@set($now, new DateTime('now'))
@set('myArr', ['my' => 'arr'])
@set('myArr2', array('my' => 'arr'))

@unset('newvar')
@unset($newvar)

@debug($somearr)

// xdebug_break breakpoints (configurable) to debug compiled views. Sweet? YES!
@breakpoint

@markdown
# Some markdown code
** with some bold text too **
@endmarkdown

@section('content')
@embed('components.panel', ['type' => 'danger', 'items' => ['first', 'second', 'third'] ])
@section('content')
<p>Hello World!</p>
@stop
@endembed
@stop

@macrodef('divider', $class = 'divider', $role = 'seperator')
<?php return "<li role='{$role}' class='{$class}'></li>"; ?>
@endmacro

<div class="container">
<h1>Title</h1>

@macro("divider")

<p>Paragraph</p>
</div>

@embed('blade-ext::dropdown', ['button' => true ])
@section('label', 'Choose')
@section('items')
@macro('item', 'Action')
@macro('item', 'Another Action')
@macro('item', 'Something else here')
@macro('item', 'Separated link')
@stop
@endembed

<script>
@minify('js')
var exampleJavascript = {
this: 'that',
foo: 'bar',
doit: function(){
console.log('yesss');
}
};
@endminify
</script>

<style type="text/css">
@minify('css')
a.bg-primary:hover,
a.bg-primary:focus {
background-color: #286090;
}
.bg-success {
background-color: #dff0d8;
}
a.bg-success:hover,
a.bg-success:focus {
background-color: #c1e2b3;
}
@endminify
</style>

{{----------------------------------------}}

@can('permission', $entity)
You have permission!
@endcan
Expand Down

0 comments on commit f800fb0

Please sign in to comment.