Skip to content

Commit

Permalink
Fixed parsing sentences that had two em dashes surrounded by spaces f…
Browse files Browse the repository at this point in the history
…rom becoming del phrases. [jgarber#19 state:resolved]
  • Loading branch information
jgarber committed Jul 23, 2008
1 parent e2d2c91 commit 8f767de
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG
@@ -1,5 +1,6 @@
= Edge

* Fixed parsing sentences that had two em dashes surrounded by spaces from becoming del phrases. #19
* Fixed links including prior quoted phrases. #17


Expand Down
3 changes: 2 additions & 1 deletion ext/redcloth_scan/redcloth_inline.rl
Expand Up @@ -39,7 +39,8 @@
em = "["? "_" >X mtext >A %T :> "_" "]"? ;
i = "["? "__" >X mtext >A %T :> "__" "]"? ;
del = "[-" >X C ( mtext ) >A %T :>> "-]" ;
del_phrase = (" -") >X C ( mtext ) >A %T :>> ( "-" (" " | PUNCT) @{ fhold; } ) ;
emdash_parenthetical_phrase_with_spaces = " -- " mtext " -- " ;
del_phrase = ((" -") >X C ( mtext ) >A %T :>> ( "-" (" " | PUNCT) @{ fhold; } )) - emdash_parenthetical_phrase_with_spaces ;
ins = "["? "+" >X mtext >A %T :> "+" "]"? ;
sup = "["? "^" >X mtext >A %T :> "^" "]"? ;
sub = "["? "~" >X mtext >A %T :> "~" "]"? ;
Expand Down
12 changes: 12 additions & 0 deletions test/basic.yml
Expand Up @@ -123,6 +123,18 @@ in: Observe -- very nice!
html: <p>Observe &#8212; very nice!</p>
latex: "Observe --- very nice!\n\n"
---
name: parenthetical phrase set off with em dashes
desc: Sentences with two em dashes should not turn them into strikethroughs
in: An emdash indicates a parenthetical thought--like this one--which is set apart from the rest of a sentence.
html: "<p>An emdash indicates a parenthetical thought&#8212;like this one&#8212;which is set apart from the rest of a sentence.</p>"
latex: "An emdash indicates a parenthetical thought---like this one---which is set apart from the rest of a sentence.\n\n"
---
name: parenthetical phrase set off with em dashes surrounded by spaces
desc: Sentences with two em dashes should not turn them into strikethroughs
in: An emdash indicates a parenthetical thought -- like this one -- which is set apart from the rest of a sentence.
html: "<p>An emdash indicates a parenthetical thought &#8212; like this one &#8212; which is set apart from the rest of a sentence.</p>"
latex: "An emdash indicates a parenthetical thought --- like this one --- which is set apart from the rest of a sentence.\n\n"
---
name: single hyphens with spaces
desc: Single hyphens are replaced with en-dashes if they are surrounded by spaces.
in: Observe - tiny and brief.
Expand Down

0 comments on commit 8f767de

Please sign in to comment.