Open Bug 1277701 Opened 8 years ago Updated 2 years ago

Copy/paste MathML in a human-readable plain text form

Categories

(Core :: MathML, defect, P5)

45 Branch
defect

Tracking

()

UNCONFIRMED

People

(Reporter: benjaminmoody, Unassigned)

Details

(Whiteboard: btpp-backlog)

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0
Build ID: 20160426151136

Steps to reproduce:

Open a web page containing MathML equations.  Select an equation, copy
it, and paste into a text editor (or other program that accepts only
plain text.)


Actual results:

Only the text that appears as character data in the MathML source is
copied (i.e., all traces of the MathML tags disappear.)


Expected results:

The result in this case, or when you use Firefox to save the page as
plain text, should be something human-readable that conveys the
meaning of the original equation.  For example:

<mfrac><mrow><mi>x</mi><mo>+</mo><mi>y</mi></mrow><mn>2</mn></mfrac>

will currently be represented by Firefox as "x+y2".  It should instead
be represented as something like "(x+y)/2".

Some constructs will be impossible to reasonably encode as plain text,
in which case it might be appropriate to include MathML tags in the
output.  Alternatively, something like TeX syntax could be used.
Either would be better than throwing the tags away and losing
information.

I've long thought it was a mistake that MathML source code doesn't
have the option of including extra "decorative" characters (such as
the parentheses and slash in the above example.)  Similar to the <rp>
tag, this would permit you to write MathML in a way that would fall
back gracefully for browsers that don't understand it.  However, given
that the MathML spec forbids this, Firefox itself should add these
"decorative" characters when converting MathML to plain text.
Component: Untriaged → Serializers
Product: Firefox → Core
Karl, you know about MathML, right?
Flags: needinfo?(karlt)
Whiteboard: btpp-backlog
Moving to MathML, because the behavior proposed here would require very MathML-specific processing.

I don't know whether this is worthwhile as trying to transfer mathml to an editor that doesn't understand mathml is going to be problematic without a reasonable serialization.  MathML is the sensible choice for the serialization.

Still there may be some value in a best effort approach.
Component: Serializers → MathML
Flags: needinfo?(karlt)
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.