@@ -198,6 +198,7 @@ const printExpression = (node) => {
198198
199199 return builders . group (
200200 [
201+ node . preNewLines > 1 ? hardline : "" ,
201202 concat ( [
202203 [ openingErb , " " ] ,
203204 ...lines . map ( ( line , i ) => [
@@ -214,6 +215,7 @@ const printExpression = (node) => {
214215
215216 return builders . group (
216217 [
218+ node . preNewLines > 1 ? hardline : "" ,
217219 builders . join ( " " , [
218220 openingErb ,
219221 builders . indent ( node . content ) ,
@@ -236,21 +238,27 @@ const printStatement = (node) => {
236238 const templateIndicatorSpace = " " . repeat ( ( openingErb + " " ) . length ) ;
237239
238240 return builders . group (
239- concat ( [
240- [ openingErb , " " ] ,
241- ...lines . map ( ( line , i ) => [
242- i !== 0 ? templateIndicatorSpace : "" ,
243- line ,
244- i !== lines . length - 1 ? hardline : "" ,
241+ [
242+ node . preNewLines > 1 ? hardline : "" ,
243+ concat ( [
244+ [ openingErb , " " ] ,
245+ ...lines . map ( ( line , i ) => [
246+ i !== 0 ? templateIndicatorSpace : "" ,
247+ line ,
248+ i !== lines . length - 1 ? hardline : "" ,
249+ ] ) ,
250+ [ " " , closingErb ] ,
245251 ] ) ,
246- [ " " , closingErb ] ,
247- ] ) ,
252+ ] ,
248253 { shouldBreak : node . preNewLines > 0 } ,
249254 ) ;
250255 }
251256
252257 const statement = builders . group (
253- builders . join ( " " , [ openingErb , node . content , closingErb ] ) ,
258+ [
259+ node . preNewLines > 1 ? hardline : "" ,
260+ builders . join ( " " , [ openingErb , node . content , closingErb ] ) ,
261+ ] ,
254262 { shouldBreak : node . preNewLines > 0 } ,
255263 ) ;
256264
0 commit comments