File tree Expand file tree Collapse file tree
test/cases/block_with_val_3 Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5,6 +5,8 @@ const PLACEHOLDER = {
55 end : "~#" ,
66} ;
77
8+ const BLOCK_REGEX = / d o (?: \| [ \w _ , ( ) ] + \| ) ? $ / ;
9+
810const placeholderGenerator = ( text ) => {
911 let id = 0 ;
1012
@@ -93,7 +95,7 @@ export const parse = (text) => {
9395 } ,
9496 } ;
9597
96- const expressionIsBlock = expression . match ( / d o ( \| [ \w _ , ] + \| ) ? $ / ) != null ;
98+ const expressionIsBlock = expression . match ( BLOCK_REGEX ) != null ;
9799 if ( expressionIsBlock ) {
98100 // If a expression is opening a block, we'll treat that expression as a statement to
99101 // simplify the logic of blocks
@@ -129,7 +131,7 @@ export const parse = (text) => {
129131 const hasValidKeyword = [ "if" , "unless" , "case" ] . includes (
130132 start . keyword ,
131133 ) ;
132- const hasBlock = start . content . match ( / d o ( \| [ \w _ , ] + \| ) ? $ / ) != null ;
134+ const hasBlock = start . content . match ( BLOCK_REGEX ) != null ;
133135 // If the statement is not matching, replace the content with the placeholder
134136 if ( ! hasValidKeyword && ! hasBlock ) {
135137 root . content = replaceAt (
Original file line number Diff line number Diff line change 1+ < ul >
2+ < % @values.each.with_index do |(a, b), i| %>
3+ < li > < %= i %> : < %= a %> < %= b %> </ li >
4+ < % end %>
5+ </ ul >
Original file line number Diff line number Diff line change 1+ < ul >
2+ < % @values.each.with_index do |(a, b), i| %>
3+ < li > < %= i %> : < %= a %> < %= b %> </ li >
4+ < % end %>
5+ </ ul >
You can’t perform that action at this time.
0 commit comments