From 43bd86e640240d2f10f3b92a055e44d95148abb4 Mon Sep 17 00:00:00 2001 From: Jason Garber Date: Mon, 22 Sep 2008 15:21:14 -0400 Subject: [PATCH] Fixed an error on superscript/subscript parenthetical phrase. Geez! You guys find every little bug! I'm lovin' it! [#56 state:resolved] --- CHANGELOG | 2 ++ ext/redcloth_scan/redcloth_inline.rl | 4 ++-- test/basic.yml | 8 ++++++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index eb526b35..3f3debd5 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -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)* diff --git a/ext/redcloth_scan/redcloth_inline.rl b/ext/redcloth_scan/redcloth_inline.rl index 018b8347..df3e3552 100644 --- a/ext/redcloth_scan/redcloth_inline.rl +++ b/ext/redcloth_scan/redcloth_inline.rl @@ -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 :> "??" "]"? ; diff --git a/test/basic.yml b/test/basic.yml index f4d905ef..f16c1651 100644 --- a/test/basic.yml +++ b/test/basic.yml @@ -264,12 +264,20 @@ name: superscript desc: To superscript a phrase, surround with carets. in: a ^2^ + b ^2^ = c ^2^ html:

a 2 + b 2 = c 2

+--- +name: parenthetical superscript phrase +in: '^(image courtesy NASA)^' +html: '

(image courtesy NASA)

' --- name: subscript desc: To subscript, surround with tildes. in: log ~2~ x html:

log 2 x

--- +name: parenthetical subscript phrase +in: '~(image courtesy NASA)~' +html: '

(image courtesy NASA)

' +--- 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^]