Permalink
Browse files

Blockquotes only require a ">" on the first line

  • Loading branch information...
mdiep committed May 3, 2012
1 parent 5775936 commit 00be2735b5c18e803a77e7bd3bc4eb243eff1f95
Showing with 10 additions and 7 deletions.
  1. +10 −5 Source/MMParser.m
  2. +0 −2 Tests/MMBlockTests.m
View
@@ -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
@@ -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
{

0 comments on commit 00be273

Please sign in to comment.