Closed Bug 268168 Opened 20 years ago Closed 20 years ago

[mozTXTToHTMLConv] "x^2" text to html conversion is broken for non-integer powers and is not implemented for negative powers

Categories

(Core :: Networking, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: engel, Assigned: engel)

Details

Attachments

(1 file)

When a text/plain message is displayed, "^" is interpreted as "power" and is
displayed as "<sup>..</sup>" where appropriate.  The current implementation is
somewhat incomplete/broken.

a) O.k.: "x^2" is displayed as "x<sup>2</sup>".

b) Broken: "x^0.5" is displayed as "x<sup>0</sup>.5", however "x<sup>0.5</sup>"
would be correct.

c) Not implemented: "x^-2" is displayed as is, while ""x<sup>-2</sup>" would be
nicer.


To test this behavior, compose the following message and save it as Draft (as
text/plain; if text/html is your default message format hold "Shift" while
pressing the "Compose" button).
   Use <sup> for x^2, x^-2, x^0.5; use "<sup>2</sup>" for x^2-1 and x^2.
   Do not use <sup> for x^b, x^2y etc.
Also converts [f(x)+y]^2, {f[g(x)]+y}^2  [not only (x+y)^2] to
"...<sup>2</sup>".
Attachment #164966 - Flags: superreview?(darin)
Attachment #164966 - Flags: review?(cbiesinger)
Attachment #164966 - Flags: review?(cbiesinger) → review?(ben.bucksch)
Comment on attachment 164966 [details] [diff] [review]
Proposed patch, fixes cases b) and c)

please re-request sr from me once you have a r+ from ben (or some other
qualified reviewer)
Attachment #164966 - Flags: superreview?(darin)
Comment on attachment 164966 [details] [diff] [review]
Proposed patch, fixes cases b) and c)

r=BenB

thanks for the well-written patch
Attachment #164966 - Flags: review?(ben.bucksch) → review+
Attachment #164966 - Flags: superreview?(darin)
Comment on attachment 164966 [details] [diff] [review]
Proposed patch, fixes cases b) and c)

sr=darin
Attachment #164966 - Flags: superreview?(darin) → superreview+
Thank you for the efficient reviewing process!

I do not have CVS write access, so everyone should feel free to checkin this patch. 
timeless just landed this fix: Bug 268168 [mozTXTToHTMLConv] "x^2" text to html
conversion is broken for non-integer powers and is not implemented for negative
powers
patch by Hans-A.Engel@unibas.ch r=benb sr=darin
Status: ASSIGNED → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: