Skip to content

Commit 83f437b

Browse files
Shadlpil
authored andcommitted
convert to UltiSnips format + remove trivial placeholder
1 parent 835a7cf commit 83f437b

File tree

1 file changed

+96
-71
lines changed

1 file changed

+96
-71
lines changed

snippets/smarty.snippets renamed to UltiSnips/smarty.snippets

Lines changed: 96 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -6,139 +6,164 @@ extends css
66

77
# https://www.smarty.net/docs/en/language.function.if.tpl
88
snippet if "{if cond} ... {/if}"
9-
{if ${1}}
10-
${0:${VISUAL}}
11-
{/if}
9+
{if ${1}}
10+
${0:${VISUAL}}
11+
{/if}
12+
endsnippet
1213

1314
snippet ifn "{if !cond} ... {/if}"
14-
{if ${1}}
15-
${0:${VISUAL}}
16-
{/if}
15+
{if ${1}}
16+
${0:${VISUAL}}
17+
{/if}
18+
endsnippet
1719

1820
snippet ife "{if cond} ... {else} ... {/if}"
19-
{if ${1}}
20-
${0:${VISUAL}}
21-
{else}
22-
${2}
23-
{/if}
21+
{if ${1}}
22+
${0:${VISUAL}}
23+
{else}
24+
${2}
25+
{/if}
26+
endsnippet
2427

2528
snippet eif "{elseif cond} ... {/if}"
26-
{elseif ${1}}
27-
${0:${VISUAL}}
28-
{/if}
29+
{elseif ${1}}
30+
${0:${VISUAL}}
31+
{/if}
32+
endsnippet
2933

3034
snippet el "{else} ... {/if}"
31-
{else}
32-
${1}
33-
{/if}
35+
{else}
36+
${1}
37+
{/if}
38+
endsnippet
3439

3540
# https://www.smarty.net/docs/en/language.function.for.tpl
3641
snippet for "The {for} tag is used to create simple loops."
37-
{for $${1:var}=${2:start} to ${3:end}${4: step ${5}}${6: max ${7}}}
38-
${0:${VISUAL}}
39-
{/for}
42+
{for $${1:var}=${2:start} to ${3:end}${4: step ${5}}${6: max=${7}}}
43+
${0:${VISUAL}}
44+
{/for}
45+
endsnippet
4046

4147
snippet forelse "The {for}{forelse} tag is used to create simple loops."
42-
{for $${1:var}=${2:start} to ${3:end}${4: step ${5}}${6: max ${7}}}
43-
${0:${VISUAL}}
44-
{forelse}
45-
${7}
46-
{/for}
48+
{for $${1:var}=${2:start} to ${3:end}${4: step ${5}}${6: max=${7}}}
49+
${0:${VISUAL}}
50+
{forelse}
51+
${8}
52+
{/for}
53+
endsnippet
4754

4855
# https://www.smarty.net/docs/en/language.function.foreach.tpl
4956
snippet foreach "{foreach} is used for looping over arrays of data."
50-
{foreach $${1:array_variable} as $${2:var_or_key}${3: => $${4:itemvar}}}
51-
${0:${VISUAL}}
52-
{/foreach}
57+
{foreach $${1:array_variable} as $${2:var_or_key}${3: => $${4:itemvar}}}
58+
${0:${VISUAL}}
59+
{/foreach}
60+
endsnippet
5361

5462
snippet foreach2 "[Smarty2] {foreach} is used for looping over arrays of data."
55-
{foreach from='$${1:collection} item='${2}'${3: key='${4}'}${5: name='${6}'}}
56-
${0:${VISUAL}}
57-
{/foreach}
63+
{foreach from='$${1:collection} item='${2}'${3: key='${4}'}${5: name='${6}'}}
64+
${0:${VISUAL}}
65+
{/foreach}
66+
endsnippet
5867

5968
snippet foreachelse "{foreach} is used for looping over arrays of data."
60-
{foreach $${1:array_variable} as $${2:var_or_key}${3: => $${4:itemvar}}}
61-
${0:${VISUAL}}
62-
{foreachelse}
63-
${5}
64-
{/foreach}
69+
{foreach $${1:array_variable} as $${2:var_or_key}${3: => $${4:itemvar}}}
70+
${0:${VISUAL}}
71+
{foreachelse}
72+
${5}
73+
{/foreach}
74+
endsnippet
6575

6676
snippet wh "{while} loops in Smarty have much the same flexibility as PHP while statements, with a few added features for the template engine. Every {while} must be paired with a matching {/while}. All PHP conditionals and functions are recognized, such as ||, or, &&, and, is_array(), etc."
67-
{while ${1} }
68-
${0:${VISUAL}}
69-
{/while}
77+
{while ${1} }
78+
${0:${VISUAL}}
79+
{/while}
80+
endsnippet
81+
7082

7183

7284

7385
# https://www.smarty.net/docs/en/language.function.append.tpl
7486
snippet append "{append} is used for creating or appending template variable arrays during the execution of a template."
75-
{append var='${1}' value='${2}'${3: index='${4:first|last}'}${5: scope='${6:parent|root|global}'}}
87+
{append var='${1}' value='${2}'${3: index='${4|first,last|}'}${5: scope='${6|parent,root,global|}'}}
88+
endsnippet
7689

7790
# https://www.smarty.net/docs/en/language.function.assign.tpl
7891
snippet assign "{assign} is used for assigning template variables during the execution of a template."
79-
{assign var='${1}' value='${2}'${3: scope='${4:parent|root|global}'}}
92+
{assign var='${1}' value='${2}'${3: scope='${4|parent,root,global|}'}}
93+
endsnippet
8094

8195
# https://www.smarty.net/docs/en/language.function.block.tpl
8296
snippet block "{block} is used to define a named area of template source for template inheritance."
83-
{block name='${1:name}'}
84-
${0:${VISUAL}}
85-
{/block}
97+
{block name='${1}'}
98+
${0:${VISUAL}}
99+
{/block}
100+
endsnippet
86101

87102
# https://www.smarty.net/docs/en/language.function.call.tpl
88103
snippet call "{call} is used to call a template function defined by the {function} tag just like a plugin function."
89-
{call name=${1:name}${2: assign=${3}} ${0}}
104+
{call name=${1}${2: assign=${3}}${4: variables}}
105+
endsnippet
90106

91107
# https://www.smarty.net/docs/en/language.function.capture.tpl
92108
snippet capture "{capture} is used to collect the output of the template between the tags into a variable instead of displaying it. Any content between {capture name='foo'} and {/capture} is collected into the variable specified in the name attribute. "
93-
{capture name='${1}'${2: assign='${3:variable}' }${4: append='${5:array_variable}'}}
94-
${0:${VISUAL}}
95-
{/capture}
109+
{capture name='${1}'${2: assign='${3}' }${4: append='${5:array_variable}'}}
110+
${0:${VISUAL}}
111+
{/capture}
112+
endsnippet
96113

97114
# https://www.smarty.net/docs/en/language.function.config.load.tpl
98115
snippet config_load "config_load"
99-
{config_load file='${1}'${2: section='${3}'}${4: scope='${5:local|parent|global}'}]
116+
{config_load file='${1}'${2: section='${3}'}${4: scope='${5|local,parent,global|}'}]
117+
endsnippet
100118

101119
# https://www.smarty.net/docs/en/language.function.extends.tpl
102120
snippet extends "{extends} tags are used in child templates in template inheritance for extending parent templates."
103-
{extends file='${1}'}
121+
{extends file='${1}'}
122+
endsnippet
104123

105124
# https://www.smarty.net/docs/en/language.function.function.tpl
106125
snippet function "{function} is used to create functions within a template and call them just like a plugin function. Instead of writing a plugin that generates presentational content, keeping it in the template is often a more manageable choice. It also simplifies data traversal, such as deeply nested menus."
107-
{function name='${1}' ${2:variables}}
108-
${0:${VISUAL}}
109-
{/function}
126+
{function name='${1}' ${2:variables}}
127+
${0:${VISUAL}}
128+
{/function}
129+
endsnippet
110130

131+
# https://www.smarty.net/docs/en/language.function.include.tpl
111132
snippet include "{include} tags are used for including other templates in the current template. Any variables available in the current template are also available within the included template."
112-
{include file='${1}'${2: assign='${3:name}'}${4: cache_lifetime=${5}}${6: compile_id='${7}'}${8: cache_id='${9}'}${10: scope='${11:parent|root|global}'}${12: variables}}
133+
{include file='${1}'${2: assign='${3}'}${4: cache_lifetime=${5}}${6: compile_id='${7}'}${8: cache_id='${9}'}${10: scope='${11|parent,root,global|}'}${12: variables}}
134+
endsnippet
113135

114136
# https://www.smarty.net/docs/en/language.function.literal.tpl
115137
snippet literal "{literal} tags allow a block of data to be taken literally. This is typically used around Javascript or stylesheet blocks where {curly braces} would interfere with the template delimiter syntax"
116-
{literal}
117-
${0:${VISUAL}}
118-
{/literal}
138+
{literal}
139+
${0:${VISUAL}}
140+
{/literal}
141+
endsnippet
119142

120143
# https://www.smarty.net/docs/en/language.function.nocache.tpl
121144
snippet nocache "{nocache} is used to disable caching of a template section. Every {nocache} must be paired with a matching {/nocache}."
122-
{nocache}
123-
${0:${VISUAL}}
124-
{/nocache}
145+
{nocache}
146+
${0:${VISUAL}}
147+
{/nocache}
148+
endsnippet
125149

126150
# https://www.smarty.net/docs/en/language.function.section.tpl
127151
snippet section "A {section} is for looping over sequentially indexed arrays of data, unlike {foreach} which is used to loop over a single associative array. Every {section} tag must be paired with a closing {/section} tag."
128-
{section name='${1}'${2: loop='${3}'}${4: start=${5}}${6: step=${7}}${8: max=${9}}${10: show=${11}}}
129-
${0:${VISUAL}}
130-
{/section}
152+
{section name='${1}'${2: loop='${3}'}${4: start=${5}}${6: step=${7}}${8: max=${9}}${10: show=${11}}}
153+
${0:${VISUAL}}
154+
{/section}
155+
endsnippet
131156

132157
# https://www.smarty.net/docs/en/language.function.setfilter.tpl
133158
snippet setfilter "The {setfilter}...{/setfilter} block tag allows the definition of template instance's variable filters."
134-
{setfilter ${1:filters}}
135-
${0:${VISUAL}}
136-
{/setfilter}
159+
{setfilter ${1:filters}}
160+
${0:${VISUAL}}
161+
{/setfilter}
162+
endsnippet
137163

138164
# https://www.smarty.net/docs/en/language.function.strip.tpl
139165
snippet strip "Anything within {strip}{/strip} tags are stripped of the extra spaces or carriage returns at the beginnings and ends of the lines before they are displayed. This way you can keep your templates readable, and not worry about extra white space causing problems."
140-
{strip}
141-
${0:${VISUAL}}
142-
{/strip}
143-
144-
166+
{strip}
167+
${0:${VISUAL}}
168+
{/strip}
169+
endsnippet

0 commit comments

Comments
 (0)