@@ -322,12 +322,24 @@ module Interscript
322322 text = @scanner . scan ( /[^\n ]+/ ) . to_s
323323 @out << text . gsub ( '"' , '\\"' )
324324 # Consume continuation lines: any subsequent line indented deeper
325- # than the `- ` marker is part of the same note.
326- while @scanner . check ( /\n [ \t ]{#{ note_indent . length + 1 } ,}\S / )
327- @scanner . scan ( /\n ([ \t ]+)/ )
328- @out << "\\ n" + @scanner [ 1 ] . strip + " "
329- cont = @scanner . scan ( /[^\n ]+/ ) . to_s
330- @out << cont . gsub ( '"' , '\\"' )
325+ # than the `- ` marker is part of the same note. Blank lines between
326+ # continuations are preserved as \n.
327+ loop do
328+ if @scanner . check ( /\n [ \t ]{#{ note_indent . length + 1 } ,}\S / )
329+ # Indented continuation
330+ @scanner . scan ( /\n ([ \t ]+)/ )
331+ @out << "\\ n" + @scanner [ 1 ] . strip + " "
332+ cont = @scanner . scan ( /[^\n ]+/ ) . to_s
333+ @out << cont . gsub ( '"' , '\\"' )
334+ elsif @scanner . check ( /\n [ \t ]*\n [ \t ]{#{ note_indent . length + 1 } ,}\S / )
335+ # Blank line then indented continuation
336+ @scanner . scan ( /\n [ \t ]*\n ([ \t ]+)/ )
337+ @out << "\\ n" + @scanner [ 1 ] . strip + " "
338+ cont = @scanner . scan ( /[^\n ]+/ ) . to_s
339+ @out << cont . gsub ( '"' , '\\"' )
340+ else
341+ break
342+ end
331343 end
332344 @out << "\" "
333345 end
0 commit comments