File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -231,6 +231,13 @@ module Interscript
231231 break
232232 end
233233 end
234+ elsif @scanner . scan ( /(?:\A |\n )([ \t ]+)notes[ \t ]*:[ \t ]*"/ )
235+ # `notes: "X"` — single quoted-string note value
236+ indent = @scanner [ 1 ]
237+ @out << "\n #{ indent } notes {\n #{ indent } note \" "
238+ # Read until matching close quote (may span multiple lines).
239+ convert_quoted_note_body
240+ @out << "\" \n #{ indent } }"
234241 elsif @scanner . scan ( /(?:\A |\n )([ \t ]+)notes[ \t ]*:[ \t ]*\| [ \t ]*\n / )
235242 # Heredoc-form notes: `notes: |` followed by indented body that's
236243 # one big multi-line note.
@@ -365,6 +372,21 @@ module Interscript
365372 @out << "\" "
366373 end
367374
375+ def convert_quoted_note_body
376+ # Read a quoted string body (already past opening quote). Continues
377+ # across newlines until matching unescaped `"`.
378+ until @scanner . eos?
379+ if @scanner . scan ( /\\ ./ )
380+ @out << @scanner . matched
381+ elsif @scanner . scan ( /"/ )
382+ return
383+ else
384+ c = @scanner . getch
385+ @out << ( c == "\n " ? "\\ n" : c )
386+ end
387+ end
388+ end
389+
368390 def read_heredoc_into_string ( indent )
369391 # Read lines that are indented deeper than `indent` (or blank). Concatenate.
370392 until @scanner . eos?
You can’t perform that action at this time.
0 commit comments