Skip to content

Commit

Permalink
Fixed an error on superscript/subscript parenthetical phrase.
Browse files Browse the repository at this point in the history
Geez!  You guys find every little bug! I'm lovin' it! [#56 state:resolved]
  • Loading branch information
jgarber committed Sep 22, 2008
1 parent b02f629 commit 43bd86e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG
Expand Up @@ -14,6 +14,8 @@

* Fixed an error when a link was badly nested in parentheses. #55

* Fixed an error on superscript/subscript parenthetical phrase. #56


*4.0.3 (August 18, 2008)*

Expand Down
4 changes: 2 additions & 2 deletions ext/redcloth_scan/redcloth_inline.rl
Expand Up @@ -44,9 +44,9 @@
del_phrase = (( " " >A %{ STORE(beginning_space); } "-") >X C ( mtext ) >A %T :>> ( "-" end_markup_phrase )) - emdash_parenthetical_phrase_with_spaces ;
ins = "["? "+" >X mtext >A %T :> "+" "]"? ;
sup = "[^" >X mtext >A %T :> "^]" ;
sup_phrase = ( "^" when starts_phrase) >X C ( mtext ) >A %T :>> ( "^" end_markup_phrase ) ;
sup_phrase = ( "^" when starts_phrase) >X ( mtext ) >A %T :>> ( "^" end_markup_phrase ) ;
sub = "[~" >X mtext >A %T :> "~]" ;
sub_phrase = ( "~" when starts_phrase) >X C ( mtext ) >A %T :>> ( "~" end_markup_phrase ) ;
sub_phrase = ( "~" when starts_phrase) >X ( mtext ) >A %T :>> ( "~" end_markup_phrase ) ;
span = "[%" >X mtext >A %T :> "%]" ;
span_phrase = (("%" when starts_phrase) >X ( mtext ) >A %T :>> ( "%" end_markup_phrase )) ;
cite = "["? "??" >X mtext >A %T :> "??" "]"? ;
Expand Down
8 changes: 8 additions & 0 deletions test/basic.yml
Expand Up @@ -264,12 +264,20 @@ name: superscript
desc: To superscript a phrase, surround with carets.
in: a ^2^ + b ^2^ = c ^2^
html: <p>a <sup>2</sup> + b <sup>2</sup> = c <sup>2</sup></p>
---
name: parenthetical superscript phrase
in: '^(image courtesy NASA)^'
html: '<p><sup>(image courtesy <span class="caps">NASA</span>)</sup></p>'
---
name: subscript
desc: To subscript, surround with tildes.
in: log ~2~ x
html: <p>log <sub>2</sub> x</p>
---
name: parenthetical subscript phrase
in: '~(image courtesy NASA)~'
html: '<p><sub>(image courtesy <span class="caps">NASA</span>)</sub></p>'
---
name: tight superscript and subscript
desc: if you want your superscript or subscript to not be surrounded by spaces, you must use square brackets
in: f(x, n) = log[~4~]x[^n^]
Expand Down

0 comments on commit 43bd86e

Please sign in to comment.