@@ -390,54 +390,39 @@ private function doParse($value, $flags)
390
390
391
391
// try to parse the value as a multi-line string as a last resort
392
392
if (0 === $ this ->currentLineNb ) {
393
- $ parseError = false ;
394
393
$ previousLineWasNewline = false ;
395
394
$ previousLineWasTerminatedWithBackslash = false ;
396
395
$ value = '' ;
397
396
398
397
foreach ($ this ->lines as $ line ) {
399
- try {
400
- if (isset ($ line [0 ]) && ('" ' === $ line [0 ] || "' " === $ line [0 ])) {
401
- $ parsedLine = $ line ;
402
- } else {
403
- $ parsedLine = Inline::parse ($ line , $ flags , $ this ->refs );
404
- }
405
-
406
- if (!is_string ($ parsedLine )) {
407
- $ parseError = true ;
408
- break ;
409
- }
410
-
411
- if ('' === trim ($ parsedLine )) {
412
- $ value .= "\n" ;
413
- } elseif (!$ previousLineWasNewline && !$ previousLineWasTerminatedWithBackslash ) {
414
- $ value .= ' ' ;
415
- }
398
+ if ('' === trim ($ line )) {
399
+ $ value .= "\n" ;
400
+ } elseif (!$ previousLineWasNewline && !$ previousLineWasTerminatedWithBackslash ) {
401
+ $ value .= ' ' ;
402
+ }
416
403
417
- if ('' !== trim ($ parsedLine ) && '\\' === substr ($ parsedLine , -1 )) {
418
- $ value .= ltrim (substr ($ parsedLine , 0 , -1 ));
419
- } elseif ('' !== trim ($ parsedLine )) {
420
- $ value .= trim ($ parsedLine );
421
- }
404
+ if ('' !== trim ($ line ) && '\\' === substr ($ line , -1 )) {
405
+ $ value .= ltrim (substr ($ line , 0 , -1 ));
406
+ } elseif ('' !== trim ($ line )) {
407
+ $ value .= trim ($ line );
408
+ }
422
409
423
- if ('' === trim ($ parsedLine )) {
424
- $ previousLineWasNewline = true ;
425
- $ previousLineWasTerminatedWithBackslash = false ;
426
- } elseif ('\\' === substr ($ parsedLine , -1 )) {
427
- $ previousLineWasNewline = false ;
428
- $ previousLineWasTerminatedWithBackslash = true ;
429
- } else {
430
- $ previousLineWasNewline = false ;
431
- $ previousLineWasTerminatedWithBackslash = false ;
432
- }
433
- } catch (ParseException $ e ) {
434
- $ parseError = true ;
435
- break ;
410
+ if ('' === trim ($ line )) {
411
+ $ previousLineWasNewline = true ;
412
+ $ previousLineWasTerminatedWithBackslash = false ;
413
+ } elseif ('\\' === substr ($ line , -1 )) {
414
+ $ previousLineWasNewline = false ;
415
+ $ previousLineWasTerminatedWithBackslash = true ;
416
+ } else {
417
+ $ previousLineWasNewline = false ;
418
+ $ previousLineWasTerminatedWithBackslash = false ;
436
419
}
437
420
}
438
421
439
- if (! $ parseError ) {
422
+ try {
440
423
return Inline::parse (trim ($ value ));
424
+ } catch (ParseException $ e ) {
425
+ // fall-through to the ParseException thrown below
441
426
}
442
427
}
443
428
0 commit comments