From 919aaf7824d1b175bd6ca4d53af19b9bc3d9377f Mon Sep 17 00:00:00 2001 From: shadowwa Date: Fri, 27 Oct 2023 14:16:20 +0200 Subject: [PATCH 01/42] Fix elseif parameter highlight Had to add boundary for smartyMiddleTag otherwise 'else' in smartyMiddleTag was taking precedence over 'elseif' in smartySimpleTag --- syntax/smarty.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/syntax/smarty.vim b/syntax/smarty.vim index 252bd93..f52adc9 100644 --- a/syntax/smarty.vim +++ b/syntax/smarty.vim @@ -211,8 +211,8 @@ syn region smartyModifier contained matchgroup=Statement start=+||\@!+ end=+ syn region smartyParameter contained matchgroup=Statement start=+:+ end=+\ze\(}\||\)+ contains=smartyVariable, smartyDollarSign, smartyGlue, smartyInBracket, smartyStringDouble contained syn region smartySimpleTag start="{\s\{-}[a-z$]\@=" end="}" contains=smartyParameter, smartyCProperty, smartyProperty, smartyGlue, smartyModifier, smartyDollarSign, smartyInBracket, smartyStringDouble, smartyVariable, smartyString, smartySTags, smartyConstant, smartySRepeat, smartyNumber, smartyBoolean, smartyOperator, smartyTodo -syn region smartyStartTag start="{\(block\|for\|foreach\|function\|if\|literal\|nocache\|php\|section\|setfilter\|strip\|textformat\|while\)\@=" end="}" contains=smartyParameter, smartyCProperty, smartyProperty, smartyGlue, smartyModifier, smartyDollarSign, smartyInBracket, smartyStringDouble, smartyVariable, smartyString, smartyDTags, smartyConstant, smartyDRepeat, smartyNumber, smartyBoolean, smartyOperator, smartyConditional, smartyOperator -syn region smartyMiddleTag start="{\(elseif\|else\|foreachelse\|sectionelse\)" end="}" contains=smartyConditional, smartyDRepeat +syn region smartyStartTag start="{\(block\|elseif\|for\|foreach\|function\|if\|literal\|nocache\|php\|section\|setfilter\|strip\|textformat\|while\)\@=" end="}" contains=smartyParameter, smartyCProperty, smartyProperty, smartyGlue, smartyModifier, smartyDollarSign, smartyInBracket, smartyStringDouble, smartyVariable, smartyString, smartyDTags, smartyConstant, smartyDRepeat, smartyNumber, smartyBoolean, smartyOperator, smartyConditional, smartyOperator +syn region smartyMiddleTag start="{\(else\|foreachelse\|sectionelse\)\>" end="}" contains=smartyConditional, smartyDRepeat syn region smartyEndTag start="{/\(block\|for\|foreach\|function\|if\|literal\|nocache\|php\|section\|setfilter\|strip\|textformat\|while\)\@=" end="}" contains=smartyDTags, smartyConditional, smartyDRepeat syn region smartyComment matchgroup=Comment start="{\*" end="\*}" contains=smartyTodo From ef9b618c9b43e7051b57aed6bb5cc13ad3011339 Mon Sep 17 00:00:00 2001 From: shadowwa Date: Fri, 27 Oct 2023 14:21:03 +0200 Subject: [PATCH 02/42] Add forelse keyword --- syntax/smarty.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/syntax/smarty.vim b/syntax/smarty.vim index f52adc9..33648e6 100644 --- a/syntax/smarty.vim +++ b/syntax/smarty.vim @@ -23,7 +23,7 @@ unlet b:current_syntax syn keyword smartySTags contained append assign call capture config_load debug eval extends fetch html_checkboxes html_image html_options html_radios html_select_date html_select_time html_table include include_php insert mailto math ldelim rdelim syn keyword smartyDTags contained block for function literal nocache php setfilter strip textformat -syn keyword smartyConditional contained if elseif else +syn keyword smartyConditional contained if elseif else forelse syn keyword smartySRepeat contained cycle counter syn keyword smartyDRepeat contained foreach foreachelse section sectionelse while @@ -212,7 +212,7 @@ syn region smartyParameter contained matchgroup=Statement start=+:+ end=+ syn region smartySimpleTag start="{\s\{-}[a-z$]\@=" end="}" contains=smartyParameter, smartyCProperty, smartyProperty, smartyGlue, smartyModifier, smartyDollarSign, smartyInBracket, smartyStringDouble, smartyVariable, smartyString, smartySTags, smartyConstant, smartySRepeat, smartyNumber, smartyBoolean, smartyOperator, smartyTodo syn region smartyStartTag start="{\(block\|elseif\|for\|foreach\|function\|if\|literal\|nocache\|php\|section\|setfilter\|strip\|textformat\|while\)\@=" end="}" contains=smartyParameter, smartyCProperty, smartyProperty, smartyGlue, smartyModifier, smartyDollarSign, smartyInBracket, smartyStringDouble, smartyVariable, smartyString, smartyDTags, smartyConstant, smartyDRepeat, smartyNumber, smartyBoolean, smartyOperator, smartyConditional, smartyOperator -syn region smartyMiddleTag start="{\(else\|foreachelse\|sectionelse\)\>" end="}" contains=smartyConditional, smartyDRepeat +syn region smartyMiddleTag start="{\(else\|foreachelse\|forelse\|sectionelse\)\>" end="}" contains=smartyConditional, smartyDRepeat syn region smartyEndTag start="{/\(block\|for\|foreach\|function\|if\|literal\|nocache\|php\|section\|setfilter\|strip\|textformat\|while\)\@=" end="}" contains=smartyDTags, smartyConditional, smartyDRepeat syn region smartyComment matchgroup=Comment start="{\*" end="\*}" contains=smartyTodo From 6c654e39fd6a7144b25530f243deac231b6e4c2a Mon Sep 17 00:00:00 2001 From: shadowwa Date: Fri, 27 Oct 2023 14:39:00 +0200 Subject: [PATCH 03/42] capture can be a tag with opening and ending and can contain append= property --- syntax/smarty.vim | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/syntax/smarty.vim b/syntax/smarty.vim index 33648e6..6b61b86 100644 --- a/syntax/smarty.vim +++ b/syntax/smarty.vim @@ -22,7 +22,7 @@ runtime! syntax/html.vim unlet b:current_syntax syn keyword smartySTags contained append assign call capture config_load debug eval extends fetch html_checkboxes html_image html_options html_radios html_select_date html_select_time html_table include include_php insert mailto math ldelim rdelim -syn keyword smartyDTags contained block for function literal nocache php setfilter strip textformat +syn keyword smartyDTags contained block for capture function literal nocache php setfilter strip textformat syn keyword smartyConditional contained if elseif else forelse syn keyword smartySRepeat contained cycle counter syn keyword smartyDRepeat contained foreach foreachelse section sectionelse while @@ -41,6 +41,7 @@ syn match smartyProperty contained "once=" syn match smartyProperty contained "global=" syn match smartyProperty contained "scope=" syn match smartyProperty contained "script=" +syn match smartyProperty contained "append=" syn match smartyProperty contained "assign=" syn match smartyProperty contained "start=" syn match smartyProperty contained "stop=" @@ -211,9 +212,9 @@ syn region smartyModifier contained matchgroup=Statement start=+||\@!+ end=+ syn region smartyParameter contained matchgroup=Statement start=+:+ end=+\ze\(}\||\)+ contains=smartyVariable, smartyDollarSign, smartyGlue, smartyInBracket, smartyStringDouble contained syn region smartySimpleTag start="{\s\{-}[a-z$]\@=" end="}" contains=smartyParameter, smartyCProperty, smartyProperty, smartyGlue, smartyModifier, smartyDollarSign, smartyInBracket, smartyStringDouble, smartyVariable, smartyString, smartySTags, smartyConstant, smartySRepeat, smartyNumber, smartyBoolean, smartyOperator, smartyTodo -syn region smartyStartTag start="{\(block\|elseif\|for\|foreach\|function\|if\|literal\|nocache\|php\|section\|setfilter\|strip\|textformat\|while\)\@=" end="}" contains=smartyParameter, smartyCProperty, smartyProperty, smartyGlue, smartyModifier, smartyDollarSign, smartyInBracket, smartyStringDouble, smartyVariable, smartyString, smartyDTags, smartyConstant, smartyDRepeat, smartyNumber, smartyBoolean, smartyOperator, smartyConditional, smartyOperator +syn region smartyStartTag start="{\(block\|capture\|elseif\|for\|foreach\|function\|if\|literal\|nocache\|php\|section\|setfilter\|strip\|textformat\|while\)\@=" end="}" contains=smartyParameter, smartyCProperty, smartyProperty, smartyGlue, smartyModifier, smartyDollarSign, smartyInBracket, smartyStringDouble, smartyVariable, smartyString, smartyDTags, smartyConstant, smartyDRepeat, smartyNumber, smartyBoolean, smartyOperator, smartyConditional, smartyOperator syn region smartyMiddleTag start="{\(else\|foreachelse\|forelse\|sectionelse\)\>" end="}" contains=smartyConditional, smartyDRepeat -syn region smartyEndTag start="{/\(block\|for\|foreach\|function\|if\|literal\|nocache\|php\|section\|setfilter\|strip\|textformat\|while\)\@=" end="}" contains=smartyDTags, smartyConditional, smartyDRepeat +syn region smartyEndTag start="{/\(block\|capture\|for\|foreach\|function\|if\|literal\|nocache\|php\|section\|setfilter\|strip\|textformat\|while\)\@=" end="}" contains=smartyDTags, smartyConditional, smartyDRepeat syn region smartyComment matchgroup=Comment start="{\*" end="\*}" contains=smartyTodo syn cluster htmlPreproc add=smartyZone add=smartyComment add=smartySimpleTag add=smartyStartTag add=smartyMiddleTag add=smartyEndTag From 7c64dd30aab45d43549b62634b5727e00597793f Mon Sep 17 00:00:00 2001 From: shadowwa Date: Fri, 27 Oct 2023 14:50:01 +0200 Subject: [PATCH 04/42] order properties --- syntax/smarty.vim | 260 +++++++++++++++++++++++----------------------- 1 file changed, 130 insertions(+), 130 deletions(-) diff --git a/syntax/smarty.vim b/syntax/smarty.vim index 6b61b86..7ea7f54 100644 --- a/syntax/smarty.vim +++ b/syntax/smarty.vim @@ -28,158 +28,158 @@ syn keyword smartySRepeat contained cycle counter syn keyword smartyDRepeat contained foreach foreachelse section sectionelse while syn match smartyCProperty contained "[a-zA-Z0-9_]\+=" -syn match smartyProperty contained "file=" -syn match smartyProperty contained "loop=" -syn match smartyProperty contained "name=" -syn match smartyProperty contained "include=" -syn match smartyProperty contained "skip=" -syn match smartyProperty contained "section=" -syn match smartyProperty contained "from=" -syn match smartyProperty contained "item=" -syn match smartyProperty contained "key=" -syn match smartyProperty contained "once=" -syn match smartyProperty contained "global=" -syn match smartyProperty contained "scope=" -syn match smartyProperty contained "script=" +syn match smartyProperty contained "above=" +syn match smartyProperty contained "address=" +syn match smartyProperty contained "advance=" +syn match smartyProperty contained "all_extra=" +syn match smartyProperty contained "alt=" syn match smartyProperty contained "append=" syn match smartyProperty contained "assign=" -syn match smartyProperty contained "start=" -syn match smartyProperty contained "stop=" -syn match smartyProperty contained "max=" -syn match smartyProperty contained "show=" -syn match smartyProperty contained "step=" -syn match smartyProperty contained "var=" -syn match smartyProperty contained "value=" -syn match smartyProperty contained "skip=" -syn match smartyProperty contained "direction=" -syn match smartyProperty contained "print=" -syn match smartyProperty contained "advance=" -syn match smartyProperty contained "delimiter=" -syn match smartyProperty contained "reset=" -syn match smartyProperty contained "output=" -syn match smartyProperty contained "selected=" -syn match smartyProperty contained "options=" -syn match smartyProperty contained "separator=" -syn match smartyProperty contained "labels=" -syn match smartyProperty contained "height=" -syn match smartyProperty contained "width=" +syn match smartyProperty contained "autostatus=" +syn match smartyProperty contained "autostatuscap=" +syn match smartyProperty contained "background=" syn match smartyProperty contained "basedir=" -syn match smartyProperty contained "alt=" -syn match smartyProperty contained "href=" -syn match smartyProperty contained "path_prefix=" -syn match smartyProperty contained "values=" -syn match smartyProperty contained "prefix=" -syn match smartyProperty contained "time=" -syn match smartyProperty contained "start_year=" -syn match smartyProperty contained "end_year=" -syn match smartyProperty contained "display_days=" -syn match smartyProperty contained "display_months=" -syn match smartyProperty contained "display_years=" -syn match smartyProperty contained "month_format=" +syn match smartyProperty contained "bcc=" +syn match smartyProperty contained "below=" +syn match smartyProperty contained "bgbackground=" +syn match smartyProperty contained "bgcolor=" +syn match smartyProperty contained "border=" +syn match smartyProperty contained "caparray=" +syn match smartyProperty contained "capcolor=" +syn match smartyProperty contained "capicon=" +syn match smartyProperty contained "caption=" +syn match smartyProperty contained "caption=" +syn match smartyProperty contained "captionfont=" +syn match smartyProperty contained "captionsize=" +syn match smartyProperty contained "cc=" +syn match smartyProperty contained "center=" +syn match smartyProperty contained "closecolor=" +syn match smartyProperty contained "closefont=" +syn match smartyProperty contained "closesize=" +syn match smartyProperty contained "closetext=" +syn match smartyProperty contained "cols=" +syn match smartyProperty contained "day_empty=" +syn match smartyProperty contained "day_extra=" syn match smartyProperty contained "day_format=" -syn match smartyProperty contained "day_value_format=" -syn match smartyProperty contained "year_as_text=" -syn match smartyProperty contained "reverse_years=" syn match smartyProperty contained "day_size=" -syn match smartyProperty contained "month_size=" -syn match smartyProperty contained "year_size=" -syn match smartyProperty contained "day_extra=" -syn match smartyProperty contained "month_extra=" -syn match smartyProperty contained "year_extra=" -syn match smartyProperty contained "field_order=" -syn match smartyProperty contained "field_separator=" -syn match smartyProperty contained "month_value_format=" -syn match smartyProperty contained "year_empty=" -syn match smartyProperty contained "month_empty=" -syn match smartyProperty contained "day_empty=" +syn match smartyProperty contained "day_value_format=" +syn match smartyProperty contained "delay=" +syn match smartyProperty contained "delimiter=" +syn match smartyProperty contained "direction=" +syn match smartyProperty contained "display_days=" syn match smartyProperty contained "display_hours=" +syn match smartyProperty contained "display_meridian=" syn match smartyProperty contained "display_minutes=" +syn match smartyProperty contained "display_months=" syn match smartyProperty contained "display_seconds=" -syn match smartyProperty contained "minute_interval=" -syn match smartyProperty contained "second_interval=" +syn match smartyProperty contained "display_years=" +syn match smartyProperty contained "encode=" +syn match smartyProperty contained "end_year=" +syn match smartyProperty contained "equation=" +syn match smartyProperty contained "extra=" +syn match smartyProperty contained "fgbackground=" +syn match smartyProperty contained "fgcolor=" syn match smartyProperty contained "field_array=" -syn match smartyProperty contained "all_extra=" +syn match smartyProperty contained "field_order=" +syn match smartyProperty contained "field_separator=" +syn match smartyProperty contained "file=" +syn match smartyProperty contained "fixx=" +syn match smartyProperty contained "fixy=" +syn match smartyProperty contained "followupto=" +syn match smartyProperty contained "format=" +syn match smartyProperty contained "frame=" +syn match smartyProperty contained "from=" +syn match smartyProperty contained "fullhtml=" +syn match smartyProperty contained "function=" +syn match smartyProperty contained "global=" +syn match smartyProperty contained "hauto=" +syn match smartyProperty contained "hdir=" +syn match smartyProperty contained "height=" +syn match smartyProperty contained "height=" syn match smartyProperty contained "hour_extra=" -syn match smartyProperty contained "minute_extra=" -syn match smartyProperty contained "second_extra=" +syn match smartyProperty contained "href=" +syn match smartyProperty contained "inarray=" +syn match smartyProperty contained "include=" +syn match smartyProperty contained "indent=" +syn match smartyProperty contained "indent_char=" +syn match smartyProperty contained "indent_first=" +syn match smartyProperty contained "inner=" +syn match smartyProperty contained "item=" +syn match smartyProperty contained "key=" +syn match smartyProperty contained "labels=" +syn match smartyProperty contained "left=" +syn match smartyProperty contained "loop=" +syn match smartyProperty contained "max=" syn match smartyProperty contained "meridian_extra=" -syn match smartyProperty contained "display_meridian=" -syn match smartyProperty contained "use_24_hours=" -syn match smartyProperty contained "cols=" +syn match smartyProperty contained "minute_extra=" +syn match smartyProperty contained "minute_interval=" +syn match smartyProperty contained "month_empty=" +syn match smartyProperty contained "month_extra=" +syn match smartyProperty contained "month_format=" +syn match smartyProperty contained "month_size=" +syn match smartyProperty contained "month_value_format=" +syn match smartyProperty contained "name=" +syn match smartyProperty contained "newsgroups=" +syn match smartyProperty contained "noclose=" +syn match smartyProperty contained "offsetx=" +syn match smartyProperty contained "offsety=" +syn match smartyProperty contained "once=" +syn match smartyProperty contained "options=" +syn match smartyProperty contained "output=" +syn match smartyProperty contained "padx=" +syn match smartyProperty contained "pady=" +syn match smartyProperty contained "path_prefix=" +syn match smartyProperty contained "prefix=" +syn match smartyProperty contained "print=" +syn match smartyProperty contained "reset=" +syn match smartyProperty contained "reverse_years=" +syn match smartyProperty contained "right=" syn match smartyProperty contained "rows=" -syn match smartyProperty contained "inner=" -syn match smartyProperty contained "caption=" +syn match smartyProperty contained "scope=" +syn match smartyProperty contained "script=" +syn match smartyProperty contained "second_extra=" +syn match smartyProperty contained "second_interval=" +syn match smartyProperty contained "section=" +syn match smartyProperty contained "selected=" +syn match smartyProperty contained "separator=" +syn match smartyProperty contained "show=" +syn match smartyProperty contained "skip=" +syn match smartyProperty contained "skip=" +syn match smartyProperty contained "snapx=" +syn match smartyProperty contained "snapy=" +syn match smartyProperty contained "start=" +syn match smartyProperty contained "start_year=" +syn match smartyProperty contained "status=" +syn match smartyProperty contained "step=" +syn match smartyProperty contained "sticky=" +syn match smartyProperty contained "stop=" +syn match smartyProperty contained "subject=" syn match smartyProperty contained "table_attr=" -syn match smartyProperty contained "th_attr=" -syn match smartyProperty contained "tr_attr=" syn match smartyProperty contained "td_attr=" -syn match smartyProperty contained "trailpad=" -syn match smartyProperty contained "hdir=" -syn match smartyProperty contained "vdir=" -syn match smartyProperty contained "address=" syn match smartyProperty contained "text=" -syn match smartyProperty contained "encode=" -syn match smartyProperty contained "cc=" -syn match smartyProperty contained "bcc=" -syn match smartyProperty contained "subject=" -syn match smartyProperty contained "newsgroups=" -syn match smartyProperty contained "followupto=" -syn match smartyProperty contained "extra=" -syn match smartyProperty contained "equation=" -syn match smartyProperty contained "format=" -syn match smartyProperty contained "trigger=" -syn match smartyProperty contained "sticky=" -syn match smartyProperty contained "caption=" -syn match smartyProperty contained "fgcolor=" -syn match smartyProperty contained "bgcolor=" syn match smartyProperty contained "textcolor=" -syn match smartyProperty contained "capcolor=" -syn match smartyProperty contained "closecolor=" syn match smartyProperty contained "textfont=" -syn match smartyProperty contained "captionfont=" -syn match smartyProperty contained "closefont=" syn match smartyProperty contained "textsize=" -syn match smartyProperty contained "captionsize=" -syn match smartyProperty contained "closesize=" +syn match smartyProperty contained "th_attr=" +syn match smartyProperty contained "time=" +syn match smartyProperty contained "tr_attr=" +syn match smartyProperty contained "trailpad=" +syn match smartyProperty contained "trigger=" +syn match smartyProperty contained "use_24_hours=" +syn match smartyProperty contained "value=" +syn match smartyProperty contained "values=" +syn match smartyProperty contained "var=" +syn match smartyProperty contained "vauto=" +syn match smartyProperty contained "vdir=" +syn match smartyProperty contained "width=" syn match smartyProperty contained "width=" -syn match smartyProperty contained "height=" -syn match smartyProperty contained "left=" -syn match smartyProperty contained "right=" -syn match smartyProperty contained "center=" -syn match smartyProperty contained "above=" -syn match smartyProperty contained "below=" -syn match smartyProperty contained "border=" -syn match smartyProperty contained "offsetx=" -syn match smartyProperty contained "offsety=" -syn match smartyProperty contained "fgbackground=" -syn match smartyProperty contained "bgbackground=" -syn match smartyProperty contained "closetext=" -syn match smartyProperty contained "noclose=" -syn match smartyProperty contained "status=" -syn match smartyProperty contained "autostatus=" -syn match smartyProperty contained "autostatuscap=" -syn match smartyProperty contained "inarray=" -syn match smartyProperty contained "caparray=" -syn match smartyProperty contained "capicon=" -syn match smartyProperty contained "snapx=" -syn match smartyProperty contained "snapy=" -syn match smartyProperty contained "fixx=" -syn match smartyProperty contained "fixy=" -syn match smartyProperty contained "background=" -syn match smartyProperty contained "padx=" -syn match smartyProperty contained "pady=" -syn match smartyProperty contained "fullhtml=" -syn match smartyProperty contained "frame=" -syn match smartyProperty contained "function=" -syn match smartyProperty contained "delay=" -syn match smartyProperty contained "hauto=" -syn match smartyProperty contained "indent=" -syn match smartyProperty contained "indent_first=" -syn match smartyProperty contained "indent_char=" syn match smartyProperty contained "wrap=" syn match smartyProperty contained "wrap_char=" -syn match smartyProperty contained "vauto=" syn match smartyProperty contained "wrap_cut=" +syn match smartyProperty contained "year_as_text=" +syn match smartyProperty contained "year_empty=" +syn match smartyProperty contained "year_extra=" +syn match smartyProperty contained "year_size=" syn match smartyConstant contained "\$smarty" syn keyword smartyTodo contained FIXME NOTE TODO OPTIMIZE XXX From 82395d4392371154da19eea6a5fc6771dce61d6c Mon Sep 17 00:00:00 2001 From: shadowwa Date: Fri, 27 Oct 2023 14:59:47 +0200 Subject: [PATCH 05/42] remove duplicate --- syntax/smarty.vim | 3 --- 1 file changed, 3 deletions(-) diff --git a/syntax/smarty.vim b/syntax/smarty.vim index 7ea7f54..c2ca490 100644 --- a/syntax/smarty.vim +++ b/syntax/smarty.vim @@ -48,7 +48,6 @@ syn match smartyProperty contained "caparray=" syn match smartyProperty contained "capcolor=" syn match smartyProperty contained "capicon=" syn match smartyProperty contained "caption=" -syn match smartyProperty contained "caption=" syn match smartyProperty contained "captionfont=" syn match smartyProperty contained "captionsize=" syn match smartyProperty contained "cc=" @@ -95,7 +94,6 @@ syn match smartyProperty contained "global=" syn match smartyProperty contained "hauto=" syn match smartyProperty contained "hdir=" syn match smartyProperty contained "height=" -syn match smartyProperty contained "height=" syn match smartyProperty contained "hour_extra=" syn match smartyProperty contained "href=" syn match smartyProperty contained "inarray=" @@ -144,7 +142,6 @@ syn match smartyProperty contained "selected=" syn match smartyProperty contained "separator=" syn match smartyProperty contained "show=" syn match smartyProperty contained "skip=" -syn match smartyProperty contained "skip=" syn match smartyProperty contained "snapx=" syn match smartyProperty contained "snapy=" syn match smartyProperty contained "start=" From 43a38421a028fca028fc1839066a38f072de2422 Mon Sep 17 00:00:00 2001 From: shadowwa Date: Fri, 27 Oct 2023 15:55:16 +0200 Subject: [PATCH 06/42] Add missing properties # for html_checkboxes label_ids= strict= escape= # for html_select_date month_names= all_empty= all_id= day_id= month_id= year_id= # for html_select_time hour_format= hour_value_format= second_format= second_value_format= minute_format= minute_value_format= option_separator= hour_id= meridian_id= minute_id hour_empty= minute_empty= meridian_empty= --- syntax/smarty.vim | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/syntax/smarty.vim b/syntax/smarty.vim index c2ca490..47ed0a8 100644 --- a/syntax/smarty.vim +++ b/syntax/smarty.vim @@ -31,7 +31,9 @@ syn match smartyCProperty contained "[a-zA-Z0-9_]\+=" syn match smartyProperty contained "above=" syn match smartyProperty contained "address=" syn match smartyProperty contained "advance=" +syn match smartyProperty contained "all_empty=" syn match smartyProperty contained "all_extra=" +syn match smartyProperty contained "all_id=" syn match smartyProperty contained "alt=" syn match smartyProperty contained "append=" syn match smartyProperty contained "assign=" @@ -60,6 +62,7 @@ syn match smartyProperty contained "cols=" syn match smartyProperty contained "day_empty=" syn match smartyProperty contained "day_extra=" syn match smartyProperty contained "day_format=" +syn match smartyProperty contained "day_id=" syn match smartyProperty contained "day_size=" syn match smartyProperty contained "day_value_format=" syn match smartyProperty contained "delay=" @@ -75,6 +78,7 @@ syn match smartyProperty contained "display_years=" syn match smartyProperty contained "encode=" syn match smartyProperty contained "end_year=" syn match smartyProperty contained "equation=" +syn match smartyProperty contained "escape=" syn match smartyProperty contained "extra=" syn match smartyProperty contained "fgbackground=" syn match smartyProperty contained "fgcolor=" @@ -94,7 +98,11 @@ syn match smartyProperty contained "global=" syn match smartyProperty contained "hauto=" syn match smartyProperty contained "hdir=" syn match smartyProperty contained "height=" +syn match smartyProperty contained "hour_empty=" syn match smartyProperty contained "hour_extra=" +syn match smartyProperty contained "hour_format=" +syn match smartyProperty contained "hour_id=" +syn match smartyProperty contained "hour_value_format=" syn match smartyProperty contained "href=" syn match smartyProperty contained "inarray=" syn match smartyProperty contained "include=" @@ -104,16 +112,25 @@ syn match smartyProperty contained "indent_first=" syn match smartyProperty contained "inner=" syn match smartyProperty contained "item=" syn match smartyProperty contained "key=" +syn match smartyProperty contained "label_ids=" syn match smartyProperty contained "labels=" syn match smartyProperty contained "left=" syn match smartyProperty contained "loop=" syn match smartyProperty contained "max=" +syn match smartyProperty contained "meridian_empty=" syn match smartyProperty contained "meridian_extra=" +syn match smartyProperty contained "meridian_id=" +syn match smartyProperty contained "minute_empty=" syn match smartyProperty contained "minute_extra=" +syn match smartyProperty contained "minute_format=" +syn match smartyProperty contained "minute_id=" syn match smartyProperty contained "minute_interval=" +syn match smartyProperty contained "minute_value_format=" syn match smartyProperty contained "month_empty=" syn match smartyProperty contained "month_extra=" syn match smartyProperty contained "month_format=" +syn match smartyProperty contained "month_id=" +syn match smartyProperty contained "month_names=" syn match smartyProperty contained "month_size=" syn match smartyProperty contained "month_value_format=" syn match smartyProperty contained "name=" @@ -122,6 +139,7 @@ syn match smartyProperty contained "noclose=" syn match smartyProperty contained "offsetx=" syn match smartyProperty contained "offsety=" syn match smartyProperty contained "once=" +syn match smartyProperty contained "option_separator=" syn match smartyProperty contained "options=" syn match smartyProperty contained "output=" syn match smartyProperty contained "padx=" @@ -135,8 +153,12 @@ syn match smartyProperty contained "right=" syn match smartyProperty contained "rows=" syn match smartyProperty contained "scope=" syn match smartyProperty contained "script=" +syn match smartyProperty contained "second_empty=" syn match smartyProperty contained "second_extra=" +syn match smartyProperty contained "second_format=" +syn match smartyProperty contained "second_id=" syn match smartyProperty contained "second_interval=" +syn match smartyProperty contained "second_value_format=" syn match smartyProperty contained "section=" syn match smartyProperty contained "selected=" syn match smartyProperty contained "separator=" @@ -150,6 +172,8 @@ syn match smartyProperty contained "status=" syn match smartyProperty contained "step=" syn match smartyProperty contained "sticky=" syn match smartyProperty contained "stop=" +syn match smartyProperty contained "strict=" +syn match smartyProperty contained "style=" syn match smartyProperty contained "subject=" syn match smartyProperty contained "table_attr=" syn match smartyProperty contained "td_attr=" @@ -176,6 +200,7 @@ syn match smartyProperty contained "wrap_cut=" syn match smartyProperty contained "year_as_text=" syn match smartyProperty contained "year_empty=" syn match smartyProperty contained "year_extra=" +syn match smartyProperty contained "year_id=" syn match smartyProperty contained "year_size=" syn match smartyConstant contained "\$smarty" From eff0f9606df8f5dba5d6e14067952e17c82cb496 Mon Sep 17 00:00:00 2001 From: shadowwa Date: Fri, 27 Oct 2023 16:13:35 +0200 Subject: [PATCH 07/42] add missing properties # for include cache_id= cache_lifetime= compile_id= --- syntax/smarty.vim | 3 +++ 1 file changed, 3 insertions(+) diff --git a/syntax/smarty.vim b/syntax/smarty.vim index 47ed0a8..fdb0d86 100644 --- a/syntax/smarty.vim +++ b/syntax/smarty.vim @@ -46,6 +46,8 @@ syn match smartyProperty contained "below=" syn match smartyProperty contained "bgbackground=" syn match smartyProperty contained "bgcolor=" syn match smartyProperty contained "border=" +syn match smartyProperty contained "cache_id=" +syn match smartyProperty contained "cache_lifetime=" syn match smartyProperty contained "caparray=" syn match smartyProperty contained "capcolor=" syn match smartyProperty contained "capicon=" @@ -59,6 +61,7 @@ syn match smartyProperty contained "closefont=" syn match smartyProperty contained "closesize=" syn match smartyProperty contained "closetext=" syn match smartyProperty contained "cols=" +syn match smartyProperty contained "compile_id=" syn match smartyProperty contained "day_empty=" syn match smartyProperty contained "day_extra=" syn match smartyProperty contained "day_format=" From 24cb6e823e926c8135972f8b1727800c8ec431e4 Mon Sep 17 00:00:00 2001 From: shadowwa Date: Fri, 27 Oct 2023 16:44:57 +0200 Subject: [PATCH 08/42] add break and continue construct for foreach --- syntax/smarty.vim | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/syntax/smarty.vim b/syntax/smarty.vim index fdb0d86..05f89fc 100644 --- a/syntax/smarty.vim +++ b/syntax/smarty.vim @@ -26,6 +26,7 @@ syn keyword smartyDTags contained block for capture function literal nocac syn keyword smartyConditional contained if elseif else forelse syn keyword smartySRepeat contained cycle counter syn keyword smartyDRepeat contained foreach foreachelse section sectionelse while +syn keyword smartyForeachConstruct contained break continue syn match smartyCProperty contained "[a-zA-Z0-9_]\+=" syn match smartyProperty contained "above=" @@ -236,7 +237,7 @@ syn region smartyStringDouble contained matchgroup=Constant start=+"+ end=+"+ syn region smartyModifier contained matchgroup=Statement start=+||\@!+ end=+\ze:\|\>+ syn region smartyParameter contained matchgroup=Statement start=+:+ end=+\ze\(}\||\)+ contains=smartyVariable, smartyDollarSign, smartyGlue, smartyInBracket, smartyStringDouble contained -syn region smartySimpleTag start="{\s\{-}[a-z$]\@=" end="}" contains=smartyParameter, smartyCProperty, smartyProperty, smartyGlue, smartyModifier, smartyDollarSign, smartyInBracket, smartyStringDouble, smartyVariable, smartyString, smartySTags, smartyConstant, smartySRepeat, smartyNumber, smartyBoolean, smartyOperator, smartyTodo +syn region smartySimpleTag start="{\s\{-}[a-z$]\@=" end="}" contains=smartyParameter, smartyCProperty, smartyProperty, smartyGlue, smartyModifier, smartyDollarSign, smartyInBracket, smartyStringDouble, smartyVariable, smartyString, smartySTags, smartyConstant, smartySRepeat, smartyNumber, smartyBoolean, smartyOperator, smartyTodo, smartyForeachConstruct syn region smartyStartTag start="{\(block\|capture\|elseif\|for\|foreach\|function\|if\|literal\|nocache\|php\|section\|setfilter\|strip\|textformat\|while\)\@=" end="}" contains=smartyParameter, smartyCProperty, smartyProperty, smartyGlue, smartyModifier, smartyDollarSign, smartyInBracket, smartyStringDouble, smartyVariable, smartyString, smartyDTags, smartyConstant, smartyDRepeat, smartyNumber, smartyBoolean, smartyOperator, smartyConditional, smartyOperator syn region smartyMiddleTag start="{\(else\|foreachelse\|forelse\|sectionelse\)\>" end="}" contains=smartyConditional, smartyDRepeat syn region smartyEndTag start="{/\(block\|capture\|for\|foreach\|function\|if\|literal\|nocache\|php\|section\|setfilter\|strip\|textformat\|while\)\@=" end="}" contains=smartyDTags, smartyConditional, smartyDRepeat @@ -260,6 +261,7 @@ if version >= 508 || !exists("did_smarty_syn_inits") HiLink smartyComment Comment HiLink smartyConditional Keyword HiLink smartyDRepeat Keyword + HiLink smartyForeachConstruct Keyword HiLink smartyDTags Keyword HiLink smartyDollarSign Statement HiLink smartyGlue Statement From e7d499e32a3d4c68d645ac2b2302d95790d8bdb3 Mon Sep 17 00:00:00 2001 From: shadowwa Date: Fri, 27 Oct 2023 17:09:35 +0200 Subject: [PATCH 09/42] Add foreach properties --- syntax/smarty.vim | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/syntax/smarty.vim b/syntax/smarty.vim index 05f89fc..015c9dc 100644 --- a/syntax/smarty.vim +++ b/syntax/smarty.vim @@ -207,6 +207,14 @@ syn match smartyProperty contained "year_extra=" syn match smartyProperty contained "year_id=" syn match smartyProperty contained "year_size=" +syn match smartyForeachProperty contained "@first" +syn match smartyForeachProperty contained "@index" +syn match smartyForeachProperty contained "@iteration" +syn match smartyForeachProperty contained "@key" +syn match smartyForeachProperty contained "@last" +syn match smartyForeachProperty contained "@show" +syn match smartyForeachProperty contained "@total" + syn match smartyConstant contained "\$smarty" syn keyword smartyTodo contained FIXME NOTE TODO OPTIMIZE XXX @@ -226,7 +234,7 @@ syn match smartyDollarSign contained "\$" " nextgroup=smartyVariable syn match smartyMaybeDollarSign contained "\([^\\]\|\\\\\)\@<=\$" " Variable -syn match smartyVariable contained "\$\@<=\(\h\w\{-}\(\.\|\->\|\[\w\{-}\]\(\.\|\->\)\)\)*\w*" contains=smartyGlue nextgroup=smartyFunctionArgs +syn match smartyVariable contained "\$\@<=\(\h\w\{-}\(\.\|\->\|\[\w\{-}\]\(\.\|\->\)\)\)*\w*" contains=smartyGlue nextgroup=smartyForeachProperty syn match smartyMaybeVariable contained "\(\(^\|[^\\]\|\\\\\)\$\)\@<=\h\w*" syn match smartyEscapedVariable contained "\\$\h\w*" @@ -261,9 +269,10 @@ if version >= 508 || !exists("did_smarty_syn_inits") HiLink smartyComment Comment HiLink smartyConditional Keyword HiLink smartyDRepeat Keyword - HiLink smartyForeachConstruct Keyword HiLink smartyDTags Keyword HiLink smartyDollarSign Statement + HiLink smartyForeachConstruct Keyword + HiLink smartyForeachProperty Keyword HiLink smartyGlue Statement HiLink smartyInBacktick Statement HiLink smartyInBracket PreProc From 7e4c3b4e478d021ed0632834d99310bd0f343a01 Mon Sep 17 00:00:00 2001 From: shadowwa Date: Fri, 27 Oct 2023 17:49:23 +0200 Subject: [PATCH 10/42] Support {'string'|modifier} syntax --- syntax/smarty.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syntax/smarty.vim b/syntax/smarty.vim index 015c9dc..5ca4757 100644 --- a/syntax/smarty.vim +++ b/syntax/smarty.vim @@ -245,7 +245,7 @@ syn region smartyStringDouble contained matchgroup=Constant start=+"+ end=+"+ syn region smartyModifier contained matchgroup=Statement start=+||\@!+ end=+\ze:\|\>+ syn region smartyParameter contained matchgroup=Statement start=+:+ end=+\ze\(}\||\)+ contains=smartyVariable, smartyDollarSign, smartyGlue, smartyInBracket, smartyStringDouble contained -syn region smartySimpleTag start="{\s\{-}[a-z$]\@=" end="}" contains=smartyParameter, smartyCProperty, smartyProperty, smartyGlue, smartyModifier, smartyDollarSign, smartyInBracket, smartyStringDouble, smartyVariable, smartyString, smartySTags, smartyConstant, smartySRepeat, smartyNumber, smartyBoolean, smartyOperator, smartyTodo, smartyForeachConstruct +syn region smartySimpleTag start="{\s\{-}[a-z$'"]\@=" end="}" contains=smartyParameter, smartyCProperty, smartyProperty, smartyGlue, smartyModifier, smartyDollarSign, smartyInBracket, smartyStringDouble, smartyVariable, smartyString, smartySTags, smartyConstant, smartySRepeat, smartyNumber, smartyBoolean, smartyOperator, smartyTodo, smartyForeachConstruct syn region smartyStartTag start="{\(block\|capture\|elseif\|for\|foreach\|function\|if\|literal\|nocache\|php\|section\|setfilter\|strip\|textformat\|while\)\@=" end="}" contains=smartyParameter, smartyCProperty, smartyProperty, smartyGlue, smartyModifier, smartyDollarSign, smartyInBracket, smartyStringDouble, smartyVariable, smartyString, smartyDTags, smartyConstant, smartyDRepeat, smartyNumber, smartyBoolean, smartyOperator, smartyConditional, smartyOperator syn region smartyMiddleTag start="{\(else\|foreachelse\|forelse\|sectionelse\)\>" end="}" contains=smartyConditional, smartyDRepeat syn region smartyEndTag start="{/\(block\|capture\|for\|foreach\|function\|if\|literal\|nocache\|php\|section\|setfilter\|strip\|textformat\|while\)\@=" end="}" contains=smartyDTags, smartyConditional, smartyDRepeat From 901195eb4344f26f259fbeacaa1e2d1440af50d1 Mon Sep 17 00:00:00 2001 From: shadowwa Date: Fri, 27 Oct 2023 18:22:07 +0200 Subject: [PATCH 11/42] Support for variables from config file {#variableName#} --- syntax/smarty.vim | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/syntax/smarty.vim b/syntax/smarty.vim index 5ca4757..d4feb45 100644 --- a/syntax/smarty.vim +++ b/syntax/smarty.vim @@ -233,8 +233,12 @@ syn match smartyGlue contained "\.\|\->" syn match smartyDollarSign contained "\$" " nextgroup=smartyVariable syn match smartyMaybeDollarSign contained "\([^\\]\|\\\\\)\@<=\$" +" Hash +syn match smartyHashSign contained "#" + " Variable syn match smartyVariable contained "\$\@<=\(\h\w\{-}\(\.\|\->\|\[\w\{-}\]\(\.\|\->\)\)\)*\w*" contains=smartyGlue nextgroup=smartyForeachProperty +syn match smartyVariable contained "#\@<=\w\+#\@=" syn match smartyMaybeVariable contained "\(\(^\|[^\\]\|\\\\\)\$\)\@<=\h\w*" syn match smartyEscapedVariable contained "\\$\h\w*" @@ -245,8 +249,8 @@ syn region smartyStringDouble contained matchgroup=Constant start=+"+ end=+"+ syn region smartyModifier contained matchgroup=Statement start=+||\@!+ end=+\ze:\|\>+ syn region smartyParameter contained matchgroup=Statement start=+:+ end=+\ze\(}\||\)+ contains=smartyVariable, smartyDollarSign, smartyGlue, smartyInBracket, smartyStringDouble contained -syn region smartySimpleTag start="{\s\{-}[a-z$'"]\@=" end="}" contains=smartyParameter, smartyCProperty, smartyProperty, smartyGlue, smartyModifier, smartyDollarSign, smartyInBracket, smartyStringDouble, smartyVariable, smartyString, smartySTags, smartyConstant, smartySRepeat, smartyNumber, smartyBoolean, smartyOperator, smartyTodo, smartyForeachConstruct -syn region smartyStartTag start="{\(block\|capture\|elseif\|for\|foreach\|function\|if\|literal\|nocache\|php\|section\|setfilter\|strip\|textformat\|while\)\@=" end="}" contains=smartyParameter, smartyCProperty, smartyProperty, smartyGlue, smartyModifier, smartyDollarSign, smartyInBracket, smartyStringDouble, smartyVariable, smartyString, smartyDTags, smartyConstant, smartyDRepeat, smartyNumber, smartyBoolean, smartyOperator, smartyConditional, smartyOperator +syn region smartySimpleTag start="{\s\{-}[a-z$'"#]\@=" end="}" contains=smartyParameter, smartyCProperty, smartyProperty, smartyGlue, smartyModifier, smartyDollarSign, smartyHashSign, smartyInBracket, smartyStringDouble, smartyVariable, smartyString, smartySTags, smartyConstant, smartySRepeat, smartyNumber, smartyBoolean, smartyOperator, smartyTodo, smartyForeachConstruct +syn region smartyStartTag start="{\(block\|capture\|elseif\|for\|foreach\|function\|if\|literal\|nocache\|php\|section\|setfilter\|strip\|textformat\|while\)\@=" end="}" contains=smartyParameter, smartyCProperty, smartyProperty, smartyGlue, smartyModifier, smartyDollarSign, smartyHashSign, smartyInBracket, smartyStringDouble, smartyVariable, smartyString, smartyDTags, smartyConstant, smartyDRepeat, smartyNumber, smartyBoolean, smartyOperator, smartyConditional, smartyOperator syn region smartyMiddleTag start="{\(else\|foreachelse\|forelse\|sectionelse\)\>" end="}" contains=smartyConditional, smartyDRepeat syn region smartyEndTag start="{/\(block\|capture\|for\|foreach\|function\|if\|literal\|nocache\|php\|section\|setfilter\|strip\|textformat\|while\)\@=" end="}" contains=smartyDTags, smartyConditional, smartyDRepeat syn region smartyComment matchgroup=Comment start="{\*" end="\*}" contains=smartyTodo @@ -271,6 +275,7 @@ if version >= 508 || !exists("did_smarty_syn_inits") HiLink smartyDRepeat Keyword HiLink smartyDTags Keyword HiLink smartyDollarSign Statement + HiLink smartyHashSign Statement HiLink smartyForeachConstruct Keyword HiLink smartyForeachProperty Keyword HiLink smartyGlue Statement From b72f6c4c66c28bd0ed85eb6e6292ada983bdc88e Mon Sep 17 00:00:00 2001 From: shadowwa Date: Sun, 29 Oct 2023 11:44:45 +0100 Subject: [PATCH 12/42] Take into account 'is dev by' and similar operator, dont consider spaces around as part of the operator --- syntax/smarty.vim | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/syntax/smarty.vim b/syntax/smarty.vim index d4feb45..9a6ea95 100644 --- a/syntax/smarty.vim +++ b/syntax/smarty.vim @@ -226,7 +226,10 @@ syn match smartyNumber "\<0x\x\{1,8}\>" contained display syn keyword smartyBoolean contained true false " Operator -syn match smartyOperator contained "||\|&&\| neq \| gte \| lte \| not \| mod \| ne \| eq \| gt \| lt \| ge \| le \|===\|==\|!=\|>\|<\|>=\|<=\|!\|%" +syn match smartyOperator contained "||\|&&\|===\|==\|!=\|>\|<\|>=\|<=\|!\|%" +syn match smartyOperator contained " \@<=\(neq\|gte\|lte\|not\|mod\|ne\|eq\|gt\|lt\|ge\|le\) \@=" +syn match smartyOperator contained " \@<=is\( not\)\? \(even\|odd\)" +syn match smartyOperator contained " \@<=is\( not\)\? \(div by\|even by\|odd by\) \@=" syn match smartyGlue contained "\.\|\->" " Dollar From f8d0f46a7a95d2ddfe8747ebc018d72e94ea01d5 Mon Sep 17 00:00:00 2001 From: shadowwa Date: Fri, 20 Dec 2024 18:24:54 +0100 Subject: [PATCH 13/42] parameters can contain single quote --- syntax/smarty.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syntax/smarty.vim b/syntax/smarty.vim index 9a6ea95..aa3179f 100644 --- a/syntax/smarty.vim +++ b/syntax/smarty.vim @@ -250,7 +250,7 @@ syn region smartyInBacktick contained matchgroup=Constant start=+\`+ end=+\`+ syn region smartyString contained matchgroup=Constant start=+'+ end=+'+ contains=smartyMaybeVariable, smartyInBacktick, smartyMaybeDollarSign keepend syn region smartyStringDouble contained matchgroup=Constant start=+"+ end=+"+ contains=smartyMaybeVariable, smartyInBacktick, smartyMaybeDollarSign keepend syn region smartyModifier contained matchgroup=Statement start=+||\@!+ end=+\ze:\|\>+ -syn region smartyParameter contained matchgroup=Statement start=+:+ end=+\ze\(}\||\)+ contains=smartyVariable, smartyDollarSign, smartyGlue, smartyInBracket, smartyStringDouble contained +syn region smartyParameter contained matchgroup=Statement start=+:+ end=+\ze\(}\||\)+ contains=smartyVariable, smartyDollarSign, smartyGlue, smartyInBracket, smartyString, smartyStringDouble contained syn region smartySimpleTag start="{\s\{-}[a-z$'"#]\@=" end="}" contains=smartyParameter, smartyCProperty, smartyProperty, smartyGlue, smartyModifier, smartyDollarSign, smartyHashSign, smartyInBracket, smartyStringDouble, smartyVariable, smartyString, smartySTags, smartyConstant, smartySRepeat, smartyNumber, smartyBoolean, smartyOperator, smartyTodo, smartyForeachConstruct syn region smartyStartTag start="{\(block\|capture\|elseif\|for\|foreach\|function\|if\|literal\|nocache\|php\|section\|setfilter\|strip\|textformat\|while\)\@=" end="}" contains=smartyParameter, smartyCProperty, smartyProperty, smartyGlue, smartyModifier, smartyDollarSign, smartyHashSign, smartyInBracket, smartyStringDouble, smartyVariable, smartyString, smartyDTags, smartyConstant, smartyDRepeat, smartyNumber, smartyBoolean, smartyOperator, smartyConditional, smartyOperator From 75f0c0d665766896456c9d144a7c0310ff28778d Mon Sep 17 00:00:00 2001 From: shadowwa Date: Thu, 16 Jan 2025 23:42:53 +0100 Subject: [PATCH 14/42] take into account middle part of if/for/foreach/section --- ftplugin/smarty.vim | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ftplugin/smarty.vim b/ftplugin/smarty.vim index b5491ef..c4a18d8 100644 --- a/ftplugin/smarty.vim +++ b/ftplugin/smarty.vim @@ -10,6 +10,10 @@ if exists("loaded_matchit") else let b:match_words = '' endif + let b:match_words .= '{\@<=if:{\@<=elseif:{\@<=else}:{\@<=/if},' + let b:match_words .= '{\@<=foreach :{\@<=foreachelse}:{\@<=break}:{\@<=continue}:{\@<=/foreach},' + let b:match_words .= '{\@<=for :{\@<=forelse}:{\@<=/for},' + let b:match_words .= '{\@<=section :{\@<=sectionelse:{\@<=/section},' let b:match_words .= '{\@<=\([^/][^ \t}]*\)[^}]*\%(}\|$\):{\@<=/\1}' let b:match_words .= ',{:},\[:\],(:)' endif From 09142f06f8e54b58bd98184feebc212be39a3c73 Mon Sep 17 00:00:00 2001 From: shadowwa Date: Fri, 14 Feb 2025 12:50:05 +0100 Subject: [PATCH 15/42] fix indentation for elsif and add doc --- doc/smarty.txt | 73 +++++++++++++++++++++++++++++++++++++++++++++++ syntax/smarty.vim | 3 +- 2 files changed, 75 insertions(+), 1 deletion(-) create mode 100644 doc/smarty.txt diff --git a/doc/smarty.txt b/doc/smarty.txt new file mode 100644 index 0000000..dd485da --- /dev/null +++ b/doc/smarty.txt @@ -0,0 +1,73 @@ +*smarty.txt* Syntax highlighting + +This plugin provides syntax highlighting, indenting and general filetype +settings for the Smarty templating language. +https://smarty-php.github.io/. + +The following (probably incomplete) list of enhancements are provided: + + * Various improvements throughout the syntax handling. + * `{php}…{/php}` blocks are delegated to PHP syntax. + * `filetype` is set to "smarty" for `*.tpl` files. + * syntax is based on HTML filetype. + * matchit (jumping between tags via `%`) is configured for Smarty tags + (`{foo}` .. `{/foo}`), and based on the html setup. + * line endings have been converted to unix fileformat (to prevent parse + errors on Linux/Mac). + * Smarter indenting, handling PHP blocks and delegating to HTML (includes + JavaScript). + +============================================================================== +VARIABLES *smarty-variables* + +Put these variables into your vimrc. The provided examples also indicate the +default values, as long as no "Default:" section is given. + + |g:smarty_indent_block| + |g:smarty_indent_verbose| + +------------------------------------------------------------------------------ + *g:smarty_indent_block* +When this variable is set, the indentation is done on html tags and smarty +tags otherwise smarty tags are not indented + +>vim + let g:smarty_indent_block = 1 +< +>smarty +
+ + {if $test} + {$variable} + {/if} + +
+< + +>vim + let g:smarty_indent_block = 0 +< +>smarty +
+ + {if $test} + {$variable} + {/if} + +
+< +------------------------------------------------------------------------------ + *g:smarty_indent_verbose* +>vim + let g:smarty_indent_verbose = 1 +< +Verbose mode for debugging + +============================================================================== +ABOUT *smarty-about* + +Grab the latest version or report a bug on GitHub: + +https://github.com/shadowwa/smarty.vim + + vim:tw=78:et:ft=help:norl: diff --git a/syntax/smarty.vim b/syntax/smarty.vim index aa3179f..f68d032 100644 --- a/syntax/smarty.vim +++ b/syntax/smarty.vim @@ -253,7 +253,8 @@ syn region smartyModifier contained matchgroup=Statement start=+||\@!+ end=+ syn region smartyParameter contained matchgroup=Statement start=+:+ end=+\ze\(}\||\)+ contains=smartyVariable, smartyDollarSign, smartyGlue, smartyInBracket, smartyString, smartyStringDouble contained syn region smartySimpleTag start="{\s\{-}[a-z$'"#]\@=" end="}" contains=smartyParameter, smartyCProperty, smartyProperty, smartyGlue, smartyModifier, smartyDollarSign, smartyHashSign, smartyInBracket, smartyStringDouble, smartyVariable, smartyString, smartySTags, smartyConstant, smartySRepeat, smartyNumber, smartyBoolean, smartyOperator, smartyTodo, smartyForeachConstruct -syn region smartyStartTag start="{\(block\|capture\|elseif\|for\|foreach\|function\|if\|literal\|nocache\|php\|section\|setfilter\|strip\|textformat\|while\)\@=" end="}" contains=smartyParameter, smartyCProperty, smartyProperty, smartyGlue, smartyModifier, smartyDollarSign, smartyHashSign, smartyInBracket, smartyStringDouble, smartyVariable, smartyString, smartyDTags, smartyConstant, smartyDRepeat, smartyNumber, smartyBoolean, smartyOperator, smartyConditional, smartyOperator +syn region smartyStartTag start="{\(block\|capture\|for\|foreach\|function\|if\|literal\|nocache\|php\|section\|setfilter\|strip\|textformat\|while\)\@=" end="}" contains=smartyParameter, smartyCProperty, smartyProperty, smartyGlue, smartyModifier, smartyDollarSign, smartyHashSign, smartyInBracket, smartyStringDouble, smartyVariable, smartyString, smartyDTags, smartyConstant, smartyDRepeat, smartyNumber, smartyBoolean, smartyOperator, smartyConditional, smartyOperator +syn region smartyMiddleTag start="{\(elseif\)\@=" end="}" contains=smartyParameter, smartyCProperty, smartyProperty, smartyGlue, smartyModifier, smartyDollarSign, smartyHashSign, smartyInBracket, smartyStringDouble, smartyVariable, smartyString, smartyDTags, smartyConstant, smartyDRepeat, smartyNumber, smartyBoolean, smartyOperator, smartyConditional, smartyOperator syn region smartyMiddleTag start="{\(else\|foreachelse\|forelse\|sectionelse\)\>" end="}" contains=smartyConditional, smartyDRepeat syn region smartyEndTag start="{/\(block\|capture\|for\|foreach\|function\|if\|literal\|nocache\|php\|section\|setfilter\|strip\|textformat\|while\)\@=" end="}" contains=smartyDTags, smartyConditional, smartyDRepeat syn region smartyComment matchgroup=Comment start="{\*" end="\*}" contains=smartyTodo From 2ac594e41c6d2a25c3267b22613f2c68e0cb2321 Mon Sep 17 00:00:00 2001 From: shadowwa Date: Sun, 16 Feb 2025 16:39:22 +0100 Subject: [PATCH 16/42] fix indentation for line following inline tags (html or smarty) --- indent/smarty.vim | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/indent/smarty.vim b/indent/smarty.vim index 1a585e3..992633b 100644 --- a/indent/smarty.vim +++ b/indent/smarty.vim @@ -66,13 +66,17 @@ function! GetSmartyHtmlIndent(lnum) let sw = exists('*shiftwidth') ? shiftwidth() : shiftwidth() if csyn == 'smartyStartTag' - if syn == 'htmlTag' || syn == 'smartyStartTag' + if syn == 'htmlTag' + let indent = call(substitute(s:indentexprs['html'], '(\|)', '', 'g'), []) + return indent + endif + if (syn == 'smartyStartTag' || syn == 'smartyMiddleTag') && !(line =~ '{\([a-z]\+\)[^}]*}[^\n]*{\/\1}') return sw + indent(prevnonblank(v:lnum-1)) endif return indent(prevnonblank(v:lnum-1)) elseif csyn == 'smartyEndTag' || csyn == 'smartyMiddleTag' - if syn == 'smartyStartTag' + if syn == 'smartyStartTag' && !(line =~ '{\([a-z]\+\)[^}]*}[^\n]*{\/\1}') return indent(prevnonblank(v:lnum-1)) endif From 01c8fdd991e6bd6601e84be77c31ca05f8eba82c Mon Sep 17 00:00:00 2001 From: shadowwa Date: Sun, 16 Feb 2025 18:52:27 +0100 Subject: [PATCH 17/42] useless --- syntax/smarty.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syntax/smarty.vim b/syntax/smarty.vim index f68d032..c5381e2 100644 --- a/syntax/smarty.vim +++ b/syntax/smarty.vim @@ -259,7 +259,7 @@ syn region smartyMiddleTag start="{\(else\|foreachelse\|forelse\|sectionelse\)\> syn region smartyEndTag start="{/\(block\|capture\|for\|foreach\|function\|if\|literal\|nocache\|php\|section\|setfilter\|strip\|textformat\|while\)\@=" end="}" contains=smartyDTags, smartyConditional, smartyDRepeat syn region smartyComment matchgroup=Comment start="{\*" end="\*}" contains=smartyTodo -syn cluster htmlPreproc add=smartyZone add=smartyComment add=smartySimpleTag add=smartyStartTag add=smartyMiddleTag add=smartyEndTag +syn cluster htmlPreproc add=smartyComment add=smartySimpleTag add=smartyStartTag add=smartyMiddleTag add=smartyEndTag syn region htmlString contained start=+"+ end=+"+ contains=htmlSpecialChar,javaScriptExpression,@htmlPreproc syn region htmlString contained start=+'+ end=+'+ contains=htmlSpecialChar,javaScriptExpression,@htmlPreproc From c22f12172c624165373b8e51e7a390351d7ecd79 Mon Sep 17 00:00:00 2001 From: shadowwa Date: Fri, 28 Feb 2025 22:42:28 +0100 Subject: [PATCH 18/42] unit tests --- .gitignore | 25 ++++++++++++++++++ test/indent/nosmartyindent.vader | 44 ++++++++++++++++++++++++++++++++ test/init.vim | 19 ++++++++++++++ test/run-tests.sh | 43 +++++++++++++++++++++++++++++++ 4 files changed, 131 insertions(+) create mode 100644 .gitignore create mode 100644 test/indent/nosmartyindent.vader create mode 100644 test/init.vim create mode 100755 test/run-tests.sh diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..43246ce --- /dev/null +++ b/.gitignore @@ -0,0 +1,25 @@ +# test +/vader.vim +\#*\# +/.vim/ +/.vimrc +## Swap +[._]*.s[a-v][a-z] +!*.svg # comment out if you don't need vector files +[._]*.sw[a-p] +[._]s[a-rt-v][a-z] +[._]ss[a-gi-z] +[._]sw[a-p] +## Session +Session.vim +Sessionx.vim +## Temporary +.netrwhist +*~ +## Persistent undo +[._]*.un~ +## Auto-generated tag files +tags +GTAGS +GRTAGS +GPATH diff --git a/test/indent/nosmartyindent.vader b/test/indent/nosmartyindent.vader new file mode 100644 index 0000000..af94fda --- /dev/null +++ b/test/indent/nosmartyindent.vader @@ -0,0 +1,44 @@ +Execute (setup indent configuration): + set expandtab + set shiftwidth=4 + set tabstop=4 + set softtabstop=4 + let g:smarty_indent_block=0 + +Given smarty (indented smarty template): + {if $test} + black + {elseif $test2} + white + {/if} + +Do (Indent the whole buffer without smarty indent option): + gg=G + +Expect smarty (non indented result): + {if $test} + black + {elseif $test2} + white + {/if} + +############################################ + +Given smarty (non indented html content): +
+ + black + +
+ +Do (indented html content): + gg=G + +Expect smarty (non indented result): +
+ + black + +
+ +############################################ diff --git a/test/init.vim b/test/init.vim new file mode 100644 index 0000000..cdf2549 --- /dev/null +++ b/test/init.vim @@ -0,0 +1,19 @@ +" minimum vim configuration for test runner +set nocompatible +"let &packpath = expand(':p:h:h') +" Remove first and last entry from runtimepath, to prevent loading plugins from ~/.vim +" Replace first entry rom runtimepath, by current directory, preventing +" loading plugins from ~/.vim and ensure the local syntax file is loaded +" instead of the bundled one +let &runtimepath = substitute(&runtimepath, '\v^.{-},(.*),.*$', '.,\1', '') + +filetype off +set runtimepath+=vader.vim +set runtimepath+=. +set runtimepath+=after +"force loading current syntax file first +filetype plugin indent on +syntax enable +" Avoid closing up any fold since it results in some tests skipping lines and +" their output ends up diverging from what we expect them to be. +set foldlevel=99 diff --git a/test/run-tests.sh b/test/run-tests.sh new file mode 100755 index 0000000..7f83feb --- /dev/null +++ b/test/run-tests.sh @@ -0,0 +1,43 @@ +#!/bin/bash +# +# Download dependencies for tests and run full test suit +# Can use TESTVIM env variable to choose between vim and nvim (neovim) +# Optional first script argument can be path to vader file (run only one suite) +# +set -x +TEST_FILE=$1 +SCRIPT_FOLDER=$(dirname "$(readlink -f "$0")") + +# TESTVIM env variable has precedence over installed programs +# next in row is neovim and last one is vim +if [ "$TESTVIM" == "vim" ]; then + RUNVIM=vim +elif [ "$TESTVIM" == "nvim" ] || [ -x "$(command -v nvim)" ]; then + RUNVIM=nvim + VADER_OUTPUT_FILE=$(mktemp) + export VADER_OUTPUT_FILE + trap 'rm -f ${VADER_OUTPUT_FILE}' EXIT INT QUIT TERM +elif [ -x "$(command -v vim)" ]; then + RUNVIM=vim +else + echo 'Error: vim is not installed.' >&2 + exit 1 +fi + +cd "${SCRIPT_FOLDER}/.." || exit + +if [ ! -d "vader.vim" ]; then + git clone https://github.com/junegunn/vader.vim.git +fi + +if [ -z "$TEST_FILE" ]; then + TEST_SUITE='test/**/*.vader' +else + TEST_SUITE=$TEST_FILE +fi + +"${RUNVIM}" -u test/init.vim -c "Vader! ${TEST_SUITE}" +vader_exit=$? +[ -n "${VADER_OUTPUT_FILE}" ] && cat "${VADER_OUTPUT_FILE}" +exit $vader_exit + From 875db9aea4805f5a3e931353e028f3dee7be41cb Mon Sep 17 00:00:00 2001 From: shadowwa Date: Fri, 28 Feb 2025 22:47:26 +0100 Subject: [PATCH 19/42] pipelines --- .github/workflows/vader.yml | 66 +++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 .github/workflows/vader.yml diff --git a/.github/workflows/vader.yml b/.github/workflows/vader.yml new file mode 100644 index 0000000..c9c1025 --- /dev/null +++ b/.github/workflows/vader.yml @@ -0,0 +1,66 @@ +name: Tests on vim and neovim + +# Controls when the workflow will run +on: + # Triggers the workflow on push or pull request events but only for the master branch + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + lint: + name: Lint code with Vint and shellcheck + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + # There exists a vint github action but it can't install the alpha + # version. vint has not been moving since 2020 and we need to use the + # alpha release since it fixed some things wrt the latest stable release. + - uses: actions/setup-python@v5 + with: + python-version: '3.10' + - name: Install vint + run: pip install --pre vim-vint + - name: Lint vimscript files + run: vint --warning --enable-neovim ./ftdetect ./ftplugin ./indent ./syntax + - uses: lunarmodules/luacheck@v1 + - uses: ludeeus/action-shellcheck@master + + tests: + runs-on: ubuntu-latest + needs: lint + strategy: + fail-fast: false + matrix: + # bullseye: vim 8.2.2434 neovim 0.4.4 + # bookworm: vim 9.0.1378 neovim 0.7.2 + # trixie: vim 9.1.0496 neovim 0.9.5 + # jammy: vim 8.2.3995 neovim 0.6.1 <- vim version currently used by github action as vim-stable + # mantic: vim 9.0.1672 neovim 0.7.2 + # noble: vim 9.1.0016 neovim 0.9.5 + # mageia 9: vim 9.1.071 neovim 0.9.5 + # mageia cauldron: vim 9.1.1122 neovim 0.10.4 + # neovim < 0.9.0 segfaut on github action (even the one installed from apt) + editor: ["vim-v8.0.0000", "vim-stable", "vim-v9.1.1122", "nvim-v0.9.0", "nvim-v0.9.5", "nvim-v0.10.4"] + + steps: + - uses: actions/checkout@v4 + - name: get editor name + env: + EDITORVERSION: ${{matrix.editor}} + id: split + run: | + echo "SELECTEDEDITOR=${EDITORVERSION%%-*}" >> $GITHUB_ENV + echo "SELECTEDVERSION=${EDITORVERSION##*-}" >> $GITHUB_ENV + - name: Setup ${{ matrix.editor }} + uses: rhysd/action-setup-vim@v1 + id: vim + with: + neovim: ${{ env.SELECTEDEDITOR == 'nvim' }} + version: ${{ env.SELECTEDVERSION }} + - name: Run Vader unit tests + run: | + TESTVIM=${{ env.SELECTEDEDITOR }} + export TESTVIM + ./test/run-tests.sh From 45af780f2d3b6453d8b2eb7942ad24b3170a013a Mon Sep 17 00:00:00 2001 From: shadowwa Date: Fri, 28 Feb 2025 23:10:54 +0100 Subject: [PATCH 20/42] vint --- ftdetect/smarty.vim | 1 + ftplugin/smarty.vim | 26 +++++++++++++------------- indent/smarty.vim | 26 +++++++++++++------------- syntax/smarty.vim | 14 +++++++------- 4 files changed, 34 insertions(+), 33 deletions(-) diff --git a/ftdetect/smarty.vim b/ftdetect/smarty.vim index fc23556..2a13ed2 100644 --- a/ftdetect/smarty.vim +++ b/ftdetect/smarty.vim @@ -1 +1,2 @@ +" vint: -ProhibitAutocmdWithNoGroup au BufRead,BufNewFile *.tpl if &ft == '' | setfiletype smarty | endif diff --git a/ftplugin/smarty.vim b/ftplugin/smarty.vim index c4a18d8..49f931b 100644 --- a/ftplugin/smarty.vim +++ b/ftplugin/smarty.vim @@ -1,19 +1,19 @@ -if exists("b:did_ftplugin") | finish | endif +if exists('b:did_ftplugin') | finish | endif " Use HTML template ftplugins. runtime! ftplugin/html.vim " Append to b:match_words to match smarty tags ("{foo}..{/foo}") -if exists("loaded_matchit") - if exists("b:match_words") - let b:match_words .= ',' - else - let b:match_words = '' - endif - let b:match_words .= '{\@<=if:{\@<=elseif:{\@<=else}:{\@<=/if},' - let b:match_words .= '{\@<=foreach :{\@<=foreachelse}:{\@<=break}:{\@<=continue}:{\@<=/foreach},' - let b:match_words .= '{\@<=for :{\@<=forelse}:{\@<=/for},' - let b:match_words .= '{\@<=section :{\@<=sectionelse:{\@<=/section},' - let b:match_words .= '{\@<=\([^/][^ \t}]*\)[^}]*\%(}\|$\):{\@<=/\1}' - let b:match_words .= ',{:},\[:\],(:)' +if exists('loaded_matchit') + if exists('b:match_words') + let b:match_words .= ',' + else + let b:match_words = '' + endif + let b:match_words .= '{\@<=if:{\@<=elseif:{\@<=else}:{\@<=/if},' + let b:match_words .= '{\@<=foreach :{\@<=foreachelse}:{\@<=break}:{\@<=continue}:{\@<=/foreach},' + let b:match_words .= '{\@<=for :{\@<=forelse}:{\@<=/for},' + let b:match_words .= '{\@<=section :{\@<=sectionelse:{\@<=/section},' + let b:match_words .= '{\@<=\([^/][^ \t}]*\)[^}]*\%(}\|$\):{\@<=/\1}' + let b:match_words .= ',{:},\[:\],(:)' endif diff --git a/indent/smarty.vim b/indent/smarty.vim index 992633b..a5b8cf5 100644 --- a/indent/smarty.vim +++ b/indent/smarty.vim @@ -46,7 +46,7 @@ function! s:handle(lnum, ft, searchpairargs) if scriptlnum && scriptlnum != prevlnum exec 'return ' s:indentexprs[a:ft] endif - return "" + return '' endfun function! s:syn(lnum) @@ -65,18 +65,18 @@ function! GetSmartyHtmlIndent(lnum) if g:smarty_indent_block let sw = exists('*shiftwidth') ? shiftwidth() : shiftwidth() - if csyn == 'smartyStartTag' - if syn == 'htmlTag' + if csyn ==# 'smartyStartTag' + if syn ==# 'htmlTag' let indent = call(substitute(s:indentexprs['html'], '(\|)', '', 'g'), []) return indent endif - if (syn == 'smartyStartTag' || syn == 'smartyMiddleTag') && !(line =~ '{\([a-z]\+\)[^}]*}[^\n]*{\/\1}') + if (syn ==# 'smartyStartTag' || syn ==# 'smartyMiddleTag') && !(line =~? '{\([a-z]\+\)[^}]*}[^\n]*{\/\1}') return sw + indent(prevnonblank(v:lnum-1)) endif return indent(prevnonblank(v:lnum-1)) - elseif csyn == 'smartyEndTag' || csyn == 'smartyMiddleTag' - if syn == 'smartyStartTag' && !(line =~ '{\([a-z]\+\)[^}]*}[^\n]*{\/\1}') + elseif csyn ==# 'smartyEndTag' || csyn ==# 'smartyMiddleTag' + if syn ==# 'smartyStartTag' && !(line =~? '{\([a-z]\+\)[^}]*}[^\n]*{\/\1}') return indent(prevnonblank(v:lnum-1)) endif @@ -88,18 +88,18 @@ function! GetSmartyHtmlIndent(lnum) let indent = call('s:handle', [a:lnum, ft, args]) if type(indent) == type(0) if g:smarty_indent_verbose - echom "Line " . a:lnum . ": using " . ft . " indenting via " . s:indentexprs[ft] + echom 'Line ' . a:lnum . ': using ' . ft . ' indenting via ' . s:indentexprs[ft] endif if g:smarty_indent_block " Indent {php} - if cline =~ '\s*{php}\s*' + if cline =~# '\s*{php}\s*' return sw + indent(prevnonblank(v:lnum-1)) endif " Indent/unindent {/php} - if cline =~ '\s*{/php}\s*' - if line =~ '\s*{php}\s*' + if cline =~# '\s*{/php}\s*' + if line =~# '\s*{php}\s*' return indent(prevnonblank(v:lnum-1)) else return indent(prevnonblank(v:lnum-1)) - sw @@ -107,7 +107,7 @@ function! GetSmartyHtmlIndent(lnum) endif " Indent line if previous line is {php} - if line =~ '\s*{php}\s*' + if line =~# '\s*{php}\s*' return sw + indent(prevnonblank(v:lnum-1)) endif endif @@ -118,14 +118,14 @@ function! GetSmartyHtmlIndent(lnum) " Fallback to HTML if g:smarty_indent_verbose - echom "Line " . a:lnum . ": using HTML indenting via " . s:indentexprs['html'] + echom 'Line ' . a:lnum . ': using HTML indenting via ' . s:indentexprs['html'] endif let indent = call(substitute(s:indentexprs['html'], '(\|)', '', 'g'), []) if g:smarty_indent_block " Indent if previous line is a smartyStartTag but ignore inline tags - if (syn == 'smartyStartTag' || syn == 'smartyMiddleTag') && !(line =~ '{\([a-z]\+\)[^}]*}[^\n]*{\/\1}') + if (syn ==# 'smartyStartTag' || syn ==# 'smartyMiddleTag') && !(line =~? '{\([a-z]\+\)[^}]*}[^\n]*{\/\1}') return sw + indent endif endif diff --git a/syntax/smarty.vim b/syntax/smarty.vim index c5381e2..c4440d4 100644 --- a/syntax/smarty.vim +++ b/syntax/smarty.vim @@ -7,10 +7,10 @@ " For version 5.x: Clear all syntax items " For version 6.x: Quit when a syntax file was already loaded -if !exists("main_syntax") - if version < 600 +if !exists('main_syntax') + if v:version < 600 syntax clear - elseif exists("b:current_syntax") + elseif exists('b:current_syntax') finish endif let main_syntax = 'smarty' @@ -264,8 +264,8 @@ syn cluster htmlPreproc add=smartyComment add=smartySimpleTag add=smartyStartTag syn region htmlString contained start=+"+ end=+"+ contains=htmlSpecialChar,javaScriptExpression,@htmlPreproc syn region htmlString contained start=+'+ end=+'+ contains=htmlSpecialChar,javaScriptExpression,@htmlPreproc -if version >= 508 || !exists("did_smarty_syn_inits") - if version < 508 +if v:version >= 508 || !exists('did_smarty_syn_inits') + if v:version < 508 let did_smarty_syn_inits = 1 command -nargs=+ HiLink hi link else @@ -307,9 +307,9 @@ endif syn include syntax/php.vim syn region phpRegion matchgroup=Delimiter start="{php}" end="{/php}" contains=@phpClTop -let b:current_syntax = "smarty" +let b:current_syntax = 'smarty' -if main_syntax == 'smarty' +if main_syntax ==# 'smarty' unlet main_syntax endif From 62587d74983b310fb7c5c42bf5b2239728a41bef Mon Sep 17 00:00:00 2001 From: Shad Date: Fri, 28 Feb 2025 23:51:02 +0100 Subject: [PATCH 21/42] Create dependabot.yml --- .github/dependabot.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..0d08e26 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,11 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file + +version: 2 +updates: + - package-ecosystem: "github-actions" # See documentation for possible values + directory: "/" # Location of package manifests + schedule: + interval: "weekly" From baffe45795b489788463c47fa8ea445f651e1e72 Mon Sep 17 00:00:00 2001 From: shadowwa Date: Sat, 1 Mar 2025 22:20:22 +0100 Subject: [PATCH 22/42] add failing test --- test/indent/hardtab.vader | 53 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 test/indent/hardtab.vader diff --git a/test/indent/hardtab.vader b/test/indent/hardtab.vader new file mode 100644 index 0000000..1e022bb --- /dev/null +++ b/test/indent/hardtab.vader @@ -0,0 +1,53 @@ +Execute (setup indent configuration): + set noexpandtab + set shiftwidth=4 + set tabstop=4 + set softtabstop=4 + let g:smarty_indent_block=1 + +Given smarty (non indented smarty template): + {if $test} + black + {elseif $test2} + white + {/if} + +Do (Indent the whole buffer): + gg=G + +Expect smarty (hardtab indented result): + {if $test} + black + {elseif $test2} + white + {/if} + +############################################ + +Execute (setup indent configuration): + set expandtab + +Given smarty (hardtab indented smarty template): +
+ + {if $test} + black + {elseif $test2} + white + {/if} + +
+ +Do (Indent the whole buffer): + gg=G + +Expect smarty (softtab indented result): +
+ + {if $test} + black + {elseif $test2} + white + {/if} + +
From 49623ecb71e1b7d660422a2ac91e8e9a6233091c Mon Sep 17 00:00:00 2001 From: shadowwa Date: Sat, 1 Mar 2025 22:27:46 +0100 Subject: [PATCH 23/42] more test and fix case where file was not initialy indented with wanted tabs --- indent/smarty.vim | 3 ++- test/indent/hardtab.vader | 32 ++++++++++++++++++++++++++++++-- 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/indent/smarty.vim b/indent/smarty.vim index a5b8cf5..5fd3045 100644 --- a/indent/smarty.vim +++ b/indent/smarty.vim @@ -50,7 +50,8 @@ function! s:handle(lnum, ft, searchpairargs) endfun function! s:syn(lnum) - return synIDattr(synID(a:lnum,1+indent(a:lnum),1),'name') + let nonemptycol=match(getline(a:lnum), '\S')+1 + return synIDattr(synID(a:lnum,nonemptycol,1),'name') endfunction function! GetSmartyHtmlIndent(lnum) diff --git a/test/indent/hardtab.vader b/test/indent/hardtab.vader index 1e022bb..99e56a5 100644 --- a/test/indent/hardtab.vader +++ b/test/indent/hardtab.vader @@ -1,4 +1,4 @@ -Execute (setup indent configuration): +Execute (setup hardtab indent configuration): set noexpandtab set shiftwidth=4 set tabstop=4 @@ -24,7 +24,34 @@ Expect smarty (hardtab indented result): ############################################ -Execute (setup indent configuration): +Given smarty (softtab indented result): +
+ + {if $test} + black + {elseif $test2} + white + {/if} + +
+ +Do (Indent the whole buffer): + gg=G + +Expect smarty (hardtab indented smarty template): +
+ + {if $test} + black + {elseif $test2} + white + {/if} + +
+ +############################################ + +Execute (setup softtab indent configuration): set expandtab Given smarty (hardtab indented smarty template): @@ -51,3 +78,4 @@ Expect smarty (softtab indented result): {/if} + From c7d9e6b69434103bde55f262308d69d8bb761e33 Mon Sep 17 00:00:00 2001 From: shadowwa Date: Sun, 2 Mar 2025 11:30:05 +0100 Subject: [PATCH 24/42] fix indentation for multiline conditions --- indent/smarty.vim | 14 ++ test/indent/indent.vader | 329 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 343 insertions(+) create mode 100644 test/indent/indent.vader diff --git a/indent/smarty.vim b/indent/smarty.vim index 5fd3045..1a62418 100644 --- a/indent/smarty.vim +++ b/indent/smarty.vim @@ -66,6 +66,13 @@ function! GetSmartyHtmlIndent(lnum) if g:smarty_indent_block let sw = exists('*shiftwidth') ? shiftwidth() : shiftwidth() + if csyn ==# 'smartyStartTag' || csyn ==# 'smartyMiddleTag' + call cursor(a:lnum, match(getline(a:lnum), '\S')+1) + let pairline = searchpair('{', '', '}', 'bW') + if pairline > 0 + return sw + indent(pairline) + endif + endif if csyn ==# 'smartyStartTag' if syn ==# 'htmlTag' let indent = call(substitute(s:indentexprs['html'], '(\|)', '', 'g'), []) @@ -125,6 +132,13 @@ function! GetSmartyHtmlIndent(lnum) let indent = call(substitute(s:indentexprs['html'], '(\|)', '', 'g'), []) if g:smarty_indent_block + if syn ==# 'smartyStartTag' || syn ==# 'smartyMiddleTag' + call cursor(a:lnum -1, col('$')) + let pairline = searchpair('{', '', '}', 'bW') + if pairline > 0 + return sw + indent(pairline) + endif + endif " Indent if previous line is a smartyStartTag but ignore inline tags if (syn ==# 'smartyStartTag' || syn ==# 'smartyMiddleTag') && !(line =~? '{\([a-z]\+\)[^}]*}[^\n]*{\/\1}') return sw + indent diff --git a/test/indent/indent.vader b/test/indent/indent.vader new file mode 100644 index 0000000..b689ba1 --- /dev/null +++ b/test/indent/indent.vader @@ -0,0 +1,329 @@ +Execute (setup indent configuration): + set expandtab + set shiftwidth=4 + set tabstop=4 + set softtabstop=4 + let g:smarty_indent_block=1 + +Given smarty (non indented smarty template): + {if $test} + black + {elseif $test2} + white + {/if} + +Do (Indent the whole buffer): + gg=G + +Expect smarty (very basic indentation result): + {if $test} + black + {elseif $test2} + white + {/if} + +############################################ + +Given smarty (non indented smarty template): + {if $test} + {if $test} + black + {/if} + {else} + {if $test} + white + {/if} + {/if} + +Do (Indent the whole buffer): + gg=G + +Expect smarty (two levels elsif indentation result): + {if $test} + {if $test} + black + {/if} + {else} + {if $test} + white + {/if} + {/if} + +############################################ + +Given smarty (non indented smarty template): + {if $test} + {if $test} + black + {/if} + {elseif $test2} + {if $test} + white + {/if} + {/if} + +Do (Indent the whole buffer): + gg=G + +Expect smarty (two levels elsif indentation result): + {if $test} + {if $test} + black + {/if} + {elseif $test2} + {if $test} + white + {/if} + {/if} + +############################################ + +Given smarty (non indented smarty template): + {if $test}bla{/if} + {if $test}bla{/if} + {if $test}bla{/if} + {if $test}bla{/if} + {if $test}bla{/if} + {if $test}bla{/if} + +Do (Indent the whole buffer): + gg=G + +Expect smarty (several oneline tags alone): + {if $test}bla{/if} + {if $test}bla{/if} + {if $test}bla{/if} + {if $test}bla{/if} + {if $test}bla{/if} + {if $test}bla{/if} + +############################################ + +Given smarty (non indented smarty template): + bla {if $test}bla{/if} bla + bla {if $test}bla{/if} bla + bla {if $test}bla{/if} bla + bla {if $test}bla{/if} bla + +Do (Indent the whole buffer): + gg=G + +Expect smarty (several oneline tags with text before and after): + bla {if $test}bla{/if} bla + bla {if $test}bla{/if} bla + bla {if $test}bla{/if} bla + bla {if $test}bla{/if} bla + +############################################ + +Given smarty (non indented smarty template): + {if $test2} + {if $test}bla{/if} + {else} + {if $test}bla{/if} + {if $test}bla{/if} + {/if} + +Do (Indent the whole buffer): + gg=G + +Expect smarty (several oneline tags alone and nested): + {if $test2} + {if $test}bla{/if} + {else} + {if $test}bla{/if} + {if $test}bla{/if} + {/if} + +############################################ +# multiline tags + +Given smarty (non indented smarty template): + {if $test1 } +
+ + simple + +
+ {/if} + +Do (Indent the whole buffer): + gg=G + +Expect smarty (onleline starting tag + html): + {if $test1 } +
+ + simple + +
+ {/if} + +############################################ + +Given smarty (non indented smarty template): + {if + $test1 + } +
+ + multi 1 condition + +
+ {/if} + +Do (Indent the whole buffer): + gg=G + +Expect smarty (multiline starting tag one condition): + {if + $test1 + } +
+ + multi 1 condition + +
+ {/if} + +############################################ + +Given smarty (non indented smarty template): + {if $test1 && + $test2 || + $test3} +
+ + multi several conditions + +
+ {/if} + +Do (Indent the whole buffer): + gg=G + +Expect smarty (multiline starting tag several simple conditions): + {if $test1 && + $test2 || + $test3} +
+ + multi several conditions + +
+ {/if} + +############################################ + +Given smarty (non indented smarty template): + {if $test1 && + $test2 || + $test3 + } +
+ + multi several conditions + +
+ {/if} + +Do (Indent the whole buffer): + gg=G + +Expect smarty (multiline starting tag several simple conditions end bracket alone): + {if $test1 && + $test2 || + $test3 + } +
+ + multi several conditions + +
+ {/if} + +############################################ + +Given smarty (non indented smarty template): + {if {plugin $test1} && + {$test2} || + {$test3}} +
+ + multi several conditions and nested + +
+ {/if} + +Do (Indent the whole buffer): + gg=G + +Expect smarty (multiline starting tag several conditions inside nested tags): + {if {plugin $test1} && + {$test2} || + {$test3}} +
+ + multi several conditions and nested + +
+ {/if} + +############################################ + +Given smarty (non indented smarty template): + {if + {$test1} && + {$test2} || + {$test3}} +
+ + multi several conditions and nested + +
+ {/if} + +Do (Indent the whole buffer): + gg=G + +Expect smarty (multiline starting tag several conditions inside nested tags bracket and if on separate tag): + {if + {$test1} && + {$test2} || + {$test3}} +
+ + multi several conditions and nested + +
+ {/if} + +############################################ + +Given smarty (non indented smarty template): + {if + ($test1) && + ($test2) || + ($test3)} +
+ + multi several conditions with parentheses + +
+ {/if} +Do (Indent the whole buffer): + gg=G + +Expect smarty (multiline starting tag several conditions with parentheses): + {if + ($test1) && + ($test2) || + ($test3)} +
+ + multi several conditions with parentheses + +
+ {/if} + +############################################ From 8543646c4328e942b7900c6e57ac0c1896c41686 Mon Sep 17 00:00:00 2001 From: shadowwa Date: Sun, 2 Mar 2025 15:13:30 +0100 Subject: [PATCH 25/42] syntax and indent for smarty tags in + +Do (Indent the whole buffer): + gg=G + +Expect smarty (indented smarty in + +############################################ + +Given smarty (indented smarty in + +Do (Indent the whole buffer): + gg=G + +Expect smarty (indented smarty in From d289c53310d6c83a69318fe9c5a3f47b201900c8 Mon Sep 17 00:00:00 2001 From: shadowwa Date: Sun, 2 Mar 2025 15:59:31 +0100 Subject: [PATCH 26/42] update tests matrix --- .github/workflows/vader.yml | 6 +++--- test/indent/smartyinjs.vader | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/vader.yml b/.github/workflows/vader.yml index c9c1025..cbb3ab6 100644 --- a/.github/workflows/vader.yml +++ b/.github/workflows/vader.yml @@ -36,13 +36,13 @@ jobs: # bullseye: vim 8.2.2434 neovim 0.4.4 # bookworm: vim 9.0.1378 neovim 0.7.2 # trixie: vim 9.1.0496 neovim 0.9.5 - # jammy: vim 8.2.3995 neovim 0.6.1 <- vim version currently used by github action as vim-stable + # jammy: vim 8.2.3995 neovim 0.6.1 # mantic: vim 9.0.1672 neovim 0.7.2 - # noble: vim 9.1.0016 neovim 0.9.5 + # noble: vim 9.1.0016 neovim 0.9.5 <- vim version currently used by github action as vim-stable # mageia 9: vim 9.1.071 neovim 0.9.5 # mageia cauldron: vim 9.1.1122 neovim 0.10.4 # neovim < 0.9.0 segfaut on github action (even the one installed from apt) - editor: ["vim-v8.0.0000", "vim-stable", "vim-v9.1.1122", "nvim-v0.9.0", "nvim-v0.9.5", "nvim-v0.10.4"] + editor: ["vim-v8.0.0000", "vim-v8.2.2434", "vim-v9.1.1122", "nvim-v0.9.0", "nvim-v0.9.5", "nvim-v0.10.4"] steps: - uses: actions/checkout@v4 diff --git a/test/indent/smartyinjs.vader b/test/indent/smartyinjs.vader index 1f088b3..61ad9da 100644 --- a/test/indent/smartyinjs.vader +++ b/test/indent/smartyinjs.vader @@ -19,7 +19,8 @@ Given smarty (indented smarty in -Do (Indent the whole buffer): +# does not work in vim 8, maybe bug in syntax/html.vim +Do (TODO: Indent the whole buffer): gg=G Expect smarty (indented smarty in + +Execute (commented code detected as comment): + AssertEqual 'smartyComment', SyntaxOf("commented") + AssertEqual 'smartyComment', SyntaxOf("jsvar") + AssertNotEqual 'smartyComment', SyntaxOf("outside") From 28fa32c14890c82e6389b339c29ec6121c5be358 Mon Sep 17 00:00:00 2001 From: shadowwa Date: Thu, 6 Mar 2025 10:05:08 +0100 Subject: [PATCH 30/42] prevent smarty tags highlighting in smarty comments --- syntax/smarty.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/syntax/smarty.vim b/syntax/smarty.vim index 3ab3b58..e3bd4ae 100644 --- a/syntax/smarty.vim +++ b/syntax/smarty.vim @@ -260,9 +260,9 @@ syn region smartyStartTag start="{\(block\|capture\|for\|foreach\|function\|if\ syn region smartyMiddleTag start="{\(elseif\)\@=" end="}" contains=smartyParameter, smartyCProperty, smartyProperty, smartyGlue, smartyModifier, smartyDollarSign, smartyHashSign, smartyInBracket, smartyStringDouble, smartyVariable, smartyString, smartyDTags, smartyConstant, smartyDRepeat, smartyNumber, smartyBoolean, smartyOperator, smartyConditional, smartyOperator containedin=@htmlJavaScript syn region smartyMiddleTag start="{\(else\|foreachelse\|forelse\|sectionelse\)\>" end="}" contains=smartyConditional, smartyDRepeat containedin=@htmlJavaScript syn region smartyEndTag start="{/\(block\|capture\|for\|foreach\|function\|if\|literal\|nocache\|php\|section\|setfilter\|strip\|textformat\|while\)\@=" end="}" contains=smartyDTags, smartyConditional, smartyDRepeat containedin=@htmlJavaScript -syn region smartyComment matchgroup=Comment start="{\*" end="\*}" contains=smartyTodo +syn region smartyComment matchgroup=Comment start="{\*" end="\*}" contains=smartyTodo containedin=htmlString -syn cluster htmlPreproc add=smartyComment add=smartySimpleTag add=smartyStartTag add=smartyMiddleTag add=smartyEndTag +syn cluster htmlPreproc add=smartySimpleTag add=smartyStartTag add=smartyMiddleTag add=smartyEndTag syn region htmlString contained start=+"+ end=+"+ contains=htmlSpecialChar,javaScriptExpression,@htmlPreproc syn region htmlString contained start=+'+ end=+'+ contains=htmlSpecialChar,javaScriptExpression,@htmlPreproc From 89c47b8a21bc3f98b861be3590a192ba44a4196f Mon Sep 17 00:00:00 2001 From: shadowwa Date: Thu, 6 Mar 2025 10:06:01 +0100 Subject: [PATCH 31/42] Allow smarty comment in script html tags --- syntax/smarty.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syntax/smarty.vim b/syntax/smarty.vim index e3bd4ae..03fef6f 100644 --- a/syntax/smarty.vim +++ b/syntax/smarty.vim @@ -260,7 +260,7 @@ syn region smartyStartTag start="{\(block\|capture\|for\|foreach\|function\|if\ syn region smartyMiddleTag start="{\(elseif\)\@=" end="}" contains=smartyParameter, smartyCProperty, smartyProperty, smartyGlue, smartyModifier, smartyDollarSign, smartyHashSign, smartyInBracket, smartyStringDouble, smartyVariable, smartyString, smartyDTags, smartyConstant, smartyDRepeat, smartyNumber, smartyBoolean, smartyOperator, smartyConditional, smartyOperator containedin=@htmlJavaScript syn region smartyMiddleTag start="{\(else\|foreachelse\|forelse\|sectionelse\)\>" end="}" contains=smartyConditional, smartyDRepeat containedin=@htmlJavaScript syn region smartyEndTag start="{/\(block\|capture\|for\|foreach\|function\|if\|literal\|nocache\|php\|section\|setfilter\|strip\|textformat\|while\)\@=" end="}" contains=smartyDTags, smartyConditional, smartyDRepeat containedin=@htmlJavaScript -syn region smartyComment matchgroup=Comment start="{\*" end="\*}" contains=smartyTodo containedin=htmlString +syn region smartyComment matchgroup=Comment start="{\*" end="\*}" contains=smartyTodo containedin=htmlString,@htmlJavaScript syn cluster htmlPreproc add=smartySimpleTag add=smartyStartTag add=smartyMiddleTag add=smartyEndTag From c289e7ade86debe105161c6bf3dfb732d730aab6 Mon Sep 17 00:00:00 2001 From: shadowwa Date: Thu, 6 Mar 2025 10:08:45 +0100 Subject: [PATCH 32/42] document additional useful plugins --- README.markdown | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/README.markdown b/README.markdown index edc687d..74ffb10 100644 --- a/README.markdown +++ b/README.markdown @@ -109,6 +109,21 @@ folder. [Pull requests](https://github.com/shadowwa/smarty.vim) are welcome, of course. +## Additional useful plugins + +* [vim-textobj-smarty](https://github.com/kana/vim-textobj-smarty/) add textobj + for smarty, allowing to work on loop and conditional code with `*ak` and on + content only with `*ik` ([vim-textobj-user](https://github.com/kana/vim-textobj-user) + is also required) +* [vim-snippets](https://github.com/honza/vim-snippets) is a library of + snippets for multiple languages, including Smarty. Works with: + * [snipmate](https://github.com/garbas/vim-snipmate), + * [ultisnips](https://github.com/SirVer/ultisnips) or + * [coc-snippets](https://github.com/neoclide/coc-snippets) if you are using [coc](https://github.com/neoclide/coc.nvim) +* [coc-smarty](https://github.com/shadowwa/coc-smarty) is an extension for [coc](https://github.com/neoclide/coc.nvim), + a test of using [coc-html](https://github.com/neoclide/coc-html) with code + from [vscode-smarty](https://github.com/ssigwart/vscode-smarty) + ## Original README This is a mirror of From aa09c12154fee40c7c030abd01da23ebdbaa9f0f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 19 May 2025 03:25:22 +0000 Subject: [PATCH 33/42] Bump DavidAnson/markdownlint-cli2-action from 19 to 20 Bumps [DavidAnson/markdownlint-cli2-action](https://github.com/davidanson/markdownlint-cli2-action) from 19 to 20. - [Release notes](https://github.com/davidanson/markdownlint-cli2-action/releases) - [Commits](https://github.com/davidanson/markdownlint-cli2-action/compare/v19...v20) --- updated-dependencies: - dependency-name: DavidAnson/markdownlint-cli2-action dependency-version: '20' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/vader.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/vader.yml b/.github/workflows/vader.yml index 324ed26..90d814d 100644 --- a/.github/workflows/vader.yml +++ b/.github/workflows/vader.yml @@ -28,7 +28,7 @@ jobs: - name: Lint shell scripts uses: ludeeus/action-shellcheck@master - name: Lint Markdown files - uses: DavidAnson/markdownlint-cli2-action@v19 + uses: DavidAnson/markdownlint-cli2-action@v20 tests: runs-on: ubuntu-latest From 94de25c155b79ddcf9a23deda6e932ff69a71191 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 8 Sep 2025 03:36:40 +0000 Subject: [PATCH 34/42] Bump actions/setup-python from 5 to 6 Bumps [actions/setup-python](https://github.com/actions/setup-python) from 5 to 6. - [Release notes](https://github.com/actions/setup-python/releases) - [Commits](https://github.com/actions/setup-python/compare/v5...v6) --- updated-dependencies: - dependency-name: actions/setup-python dependency-version: '6' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/vader.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/vader.yml b/.github/workflows/vader.yml index 324ed26..b281043 100644 --- a/.github/workflows/vader.yml +++ b/.github/workflows/vader.yml @@ -17,7 +17,7 @@ jobs: # There exists a vint github action but it can't install the alpha # version. vint has not been moving since 2020 and we need to use the # alpha release since it fixed some things wrt the latest stable release. - - uses: actions/setup-python@v5 + - uses: actions/setup-python@v6 with: python-version: '3.10' - name: Install vint From cdd1b93d2f2057699bda0c0349678c5632f7f8d1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 24 Nov 2025 03:28:59 +0000 Subject: [PATCH 35/42] Bump actions/checkout from 4 to 6 Bumps [actions/checkout](https://github.com/actions/checkout) from 4 to 6. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v4...v6) --- updated-dependencies: - dependency-name: actions/checkout dependency-version: '6' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/vader.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/vader.yml b/.github/workflows/vader.yml index 90d814d..5cfb476 100644 --- a/.github/workflows/vader.yml +++ b/.github/workflows/vader.yml @@ -13,7 +13,7 @@ jobs: name: Lint code with Vint and shellcheck runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 # There exists a vint github action but it can't install the alpha # version. vint has not been moving since 2020 and we need to use the # alpha release since it fixed some things wrt the latest stable release. @@ -48,7 +48,7 @@ jobs: editor: ["vim-v8.0.0000", "vim-v8.2.2434", "vim-v9.1.1122", "nvim-v0.9.0", "nvim-v0.9.5", "nvim-v0.10.4"] steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: get editor name env: EDITORVERSION: ${{matrix.editor}} From dc47fa275dda0d3914658eb3f4c270e8b2d6e6f8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 24 Nov 2025 03:29:01 +0000 Subject: [PATCH 36/42] Bump DavidAnson/markdownlint-cli2-action from 20 to 21 Bumps [DavidAnson/markdownlint-cli2-action](https://github.com/davidanson/markdownlint-cli2-action) from 20 to 21. - [Release notes](https://github.com/davidanson/markdownlint-cli2-action/releases) - [Commits](https://github.com/davidanson/markdownlint-cli2-action/compare/v20...v21) --- updated-dependencies: - dependency-name: DavidAnson/markdownlint-cli2-action dependency-version: '21' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/vader.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/vader.yml b/.github/workflows/vader.yml index 90d814d..1290a78 100644 --- a/.github/workflows/vader.yml +++ b/.github/workflows/vader.yml @@ -28,7 +28,7 @@ jobs: - name: Lint shell scripts uses: ludeeus/action-shellcheck@master - name: Lint Markdown files - uses: DavidAnson/markdownlint-cli2-action@v20 + uses: DavidAnson/markdownlint-cli2-action@v21 tests: runs-on: ubuntu-latest From 9e7fb0401213826b921927d8cfc87d42deb174a3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 15 Dec 2025 03:13:21 +0000 Subject: [PATCH 37/42] Bump DavidAnson/markdownlint-cli2-action from 21 to 22 Bumps [DavidAnson/markdownlint-cli2-action](https://github.com/davidanson/markdownlint-cli2-action) from 21 to 22. - [Release notes](https://github.com/davidanson/markdownlint-cli2-action/releases) - [Commits](https://github.com/davidanson/markdownlint-cli2-action/compare/v21...v22) --- updated-dependencies: - dependency-name: DavidAnson/markdownlint-cli2-action dependency-version: '22' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/vader.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/vader.yml b/.github/workflows/vader.yml index c4bfed6..d10cca5 100644 --- a/.github/workflows/vader.yml +++ b/.github/workflows/vader.yml @@ -28,7 +28,7 @@ jobs: - name: Lint shell scripts uses: ludeeus/action-shellcheck@master - name: Lint Markdown files - uses: DavidAnson/markdownlint-cli2-action@v21 + uses: DavidAnson/markdownlint-cli2-action@v22 tests: runs-on: ubuntu-latest From 70528d1406ee85144f8a47eba9bb91f209bb3ec1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 30 Mar 2026 03:45:01 +0000 Subject: [PATCH 38/42] Bump DavidAnson/markdownlint-cli2-action from 22 to 23 Bumps [DavidAnson/markdownlint-cli2-action](https://github.com/davidanson/markdownlint-cli2-action) from 22 to 23. - [Release notes](https://github.com/davidanson/markdownlint-cli2-action/releases) - [Commits](https://github.com/davidanson/markdownlint-cli2-action/compare/v22...v23) --- updated-dependencies: - dependency-name: DavidAnson/markdownlint-cli2-action dependency-version: '23' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/vader.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/vader.yml b/.github/workflows/vader.yml index d10cca5..f4c1e1d 100644 --- a/.github/workflows/vader.yml +++ b/.github/workflows/vader.yml @@ -28,7 +28,7 @@ jobs: - name: Lint shell scripts uses: ludeeus/action-shellcheck@master - name: Lint Markdown files - uses: DavidAnson/markdownlint-cli2-action@v22 + uses: DavidAnson/markdownlint-cli2-action@v23 tests: runs-on: ubuntu-latest From 4ba0887c54ce2276094dba9996f357557c855132 Mon Sep 17 00:00:00 2001 From: shadowwa Date: Thu, 7 May 2026 16:54:58 +0200 Subject: [PATCH 39/42] support for matches operator for smarty 5.8.0 --- syntax/smarty.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syntax/smarty.vim b/syntax/smarty.vim index 03fef6f..dbb593a 100644 --- a/syntax/smarty.vim +++ b/syntax/smarty.vim @@ -230,7 +230,7 @@ syn keyword smartyBoolean contained true false " Operator syn match smartyOperator contained "||\|&&\|===\|==\|!=\|>\|<\|>=\|<=\|!\|%" -syn match smartyOperator contained " \@<=\(neq\|gte\|lte\|not\|mod\|ne\|eq\|gt\|lt\|ge\|le\) \@=" +syn match smartyOperator contained " \@<=\(neq\|gte\|lte\|not\|mod\|ne\|eq\|gt\|lt\|ge\|le\|matches\) \@=" syn match smartyOperator contained " \@<=is\( not\)\? \(even\|odd\)" syn match smartyOperator contained " \@<=is\( not\)\? \(div by\|even by\|odd by\) \@=" syn match smartyGlue contained "\.\|\->" From 99001b44c811df2ae0e6b8599596b475d66e8ba9 Mon Sep 17 00:00:00 2001 From: shadowwa Date: Tue, 16 Jun 2026 10:24:49 +0200 Subject: [PATCH 40/42] attribute can contain escaped quotes --- syntax/smarty.vim | 4 ++-- test/syntax/quote.vader | 31 +++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 test/syntax/quote.vader diff --git a/syntax/smarty.vim b/syntax/smarty.vim index dbb593a..afe68e9 100644 --- a/syntax/smarty.vim +++ b/syntax/smarty.vim @@ -250,8 +250,8 @@ syn match smartyEscapedVariable contained "\\$\h\w*" syn region smartyInBracket contained matchgroup=Constant start=+\[+ end=+\]+ contains=smartyVariable syn region smartyInBacktick contained matchgroup=Constant start=+\`+ end=+\`+ contains=smartyVariable -syn region smartyString contained matchgroup=Constant start=+'+ end=+'+ contains=smartyMaybeVariable, smartyInBacktick, smartyMaybeDollarSign keepend -syn region smartyStringDouble contained matchgroup=Constant start=+"+ end=+"+ contains=smartyMaybeVariable, smartyInBacktick, smartyMaybeDollarSign keepend +syn region smartyString contained matchgroup=Constant start=+'+ end=+'+ skip=+\\'+ contains=smartyMaybeVariable, smartyInBacktick, smartyMaybeDollarSign keepend +syn region smartyStringDouble contained matchgroup=Constant start=+"+ end=+"+ skip=+\\"+ contains=smartyMaybeVariable, smartyInBacktick, smartyMaybeDollarSign keepend syn region smartyModifier contained matchgroup=Statement start=+||\@!+ end=+\ze:\|\>+ syn region smartyParameter contained matchgroup=Statement start=+:+ end=+\ze\(}\||\)+ contains=smartyVariable, smartyDollarSign, smartyGlue, smartyInBracket, smartyString, smartyStringDouble contained diff --git a/test/syntax/quote.vader b/test/syntax/quote.vader new file mode 100644 index 0000000..886a9a0 --- /dev/null +++ b/test/syntax/quote.vader @@ -0,0 +1,31 @@ +Given smarty (simple quote): + {tag attribute='simple quote'} + +Execute (string in simple quote): + AssertEqual 'smartyString', SyntaxOf("simple") + +############################################ + +Given smarty (double quote): + {tag attribute="double quote"} + +Execute (string in double quote): + AssertEqual 'smartyStringDouble', SyntaxOf("double") + +############################################ + +Given smarty (simple escaped quote): + {tag attribute='simple quote \'escaped'} + +Execute (string in simple quote): + AssertEqual 'smartyString', SyntaxOf("escaped") + +############################################ + +Given smarty (double escaped quote): + {tag attribute="double quote \"escaped"} + +Execute (string in double quote): + AssertEqual 'smartyStringDouble', SyntaxOf("escaped") + +############################################ From 878d42b0faa1e9c8a7b17dc2629bf0ac2775668e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 22 Jun 2026 03:43:18 +0000 Subject: [PATCH 41/42] Bump actions/checkout from 6 to 7 Bumps [actions/checkout](https://github.com/actions/checkout) from 6 to 7. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v6...v7) --- updated-dependencies: - dependency-name: actions/checkout dependency-version: '7' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/vader.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/vader.yml b/.github/workflows/vader.yml index f4c1e1d..124b6a5 100644 --- a/.github/workflows/vader.yml +++ b/.github/workflows/vader.yml @@ -13,7 +13,7 @@ jobs: name: Lint code with Vint and shellcheck runs-on: ubuntu-latest steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@v7 # There exists a vint github action but it can't install the alpha # version. vint has not been moving since 2020 and we need to use the # alpha release since it fixed some things wrt the latest stable release. @@ -48,7 +48,7 @@ jobs: editor: ["vim-v8.0.0000", "vim-v8.2.2434", "vim-v9.1.1122", "nvim-v0.9.0", "nvim-v0.9.5", "nvim-v0.10.4"] steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@v7 - name: get editor name env: EDITORVERSION: ${{matrix.editor}} From a88f97422767c317bbca9109c97d97a23244f15b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 6 Jul 2026 03:43:23 +0000 Subject: [PATCH 42/42] Bump DavidAnson/markdownlint-cli2-action from 23 to 24 Bumps [DavidAnson/markdownlint-cli2-action](https://github.com/davidanson/markdownlint-cli2-action) from 23 to 24. - [Release notes](https://github.com/davidanson/markdownlint-cli2-action/releases) - [Commits](https://github.com/davidanson/markdownlint-cli2-action/compare/v23...v24) --- updated-dependencies: - dependency-name: DavidAnson/markdownlint-cli2-action dependency-version: '24' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/vader.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/vader.yml b/.github/workflows/vader.yml index 124b6a5..3c8215a 100644 --- a/.github/workflows/vader.yml +++ b/.github/workflows/vader.yml @@ -28,7 +28,7 @@ jobs: - name: Lint shell scripts uses: ludeeus/action-shellcheck@master - name: Lint Markdown files - uses: DavidAnson/markdownlint-cli2-action@v23 + uses: DavidAnson/markdownlint-cli2-action@v24 tests: runs-on: ubuntu-latest