Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Blockquotes only require a ">" on the first line

  • Loading branch information...
commit 00be2735b5c18e803a77e7bd3bc4eb243eff1f95 1 parent 5775936
@mdiep authored
Showing with 10 additions and 7 deletions.
  1. +10 −5 Source/MMParser.m
  2. +0 −2  Tests/MMBlockTests.m
View
15 Source/MMParser.m
@@ -438,20 +438,25 @@ - (MMElement *) _parseBlockquoteWithScanner:(MMScanner *)scanner
// Parse each remaining line
NSCharacterSet *whitespaceSet = [NSCharacterSet whitespaceCharacterSet];
- while (![scanner atEndOfLine])
+ while (![scanner atEndOfString])
{
[scanner beginTransaction];
[scanner skipCharactersFromSet:whitespaceSet];
- // It's a continuation of the blockquote if there's a >
- if ([scanner nextCharacter] != '>')
+ // It's a continuation of the blockquote unless it's a blank line
+ if ([scanner atEndOfLine])
{
[scanner commitTransaction:NO];
break;
}
- [scanner advance]; // skip the >
- [scanner skipCharactersFromSet:whitespaceSet max:1];
+ // If there's a >, then skip it and an optional space
+ if ([scanner nextCharacter] == '>')
+ {
+ [scanner advance];
+ [scanner skipCharactersFromSet:whitespaceSet max:1];
+ }
+
[element addInnerRange:scanner.currentRange];
[scanner commitTransaction:YES];
View
2  Tests/MMBlockTests.m
@@ -43,13 +43,11 @@ - (void) testBasicBlockquote
@"<blockquote>\n <p>A quotation.</p>\n</blockquote>");
}
-#if RUN_KNOWN_FAILURES
- (void) testBlockquoteWithAngleOnOnlyTheFirstLine
{
MMAssertMarkdownEqualsHTML(@"> A quotation\nthat spans 2 lines.",
@"<blockquote>\n <p>A quotation\nthat spans 2 lines.</p>\n</blockquote>");
}
-#endif
- (void) testBlockquoteWithMultipleParagraphs
{
Please sign in to comment.
Something went wrong with that request. Please try again.