Added MIME type
Created attachment 2029 [details] Mathematica notebook
The patch looks good, but I don't really like the magic patterns, I'm afraid of false postives, isn't it possible to get more specific patterns ?
I don't really think these magics would produce many false positives. If I understand it right, both magics have to match, right? I sampled few notebooks I could find and they start like this: for version 3.0: (*********************************************************************** Mathematica-Compatible Notebook This notebook can be used on any computer system with Mathematica 3.0, MathReader 3.0, or any compatible application. The data for the notebook starts with the line of stars above. for Version 4.0: (*********************************************************************** Mathematica-Compatible Notebook This notebook can be used on any computer system with Mathematica 4.0, MathReader 4.0, or any compatible application. The data for the notebook starts with the line containing stars above. I don't know what this is: (************** Content-type: application/mathematica ************** Mathematica-Compatible Notebook This notebook can be used with any Mathematica-compatible application, such as Mathematica, MathReader or Publicon. The data for the notebook starts with the line containing stars above. Version 5.0: (************** Content-type: application/mathematica ************** CreatedBy='Mathematica 5.0' Mathematica-Compatible Notebook This notebook can be used with any Mathematica-compatible application, such as Mathematica, MathReader or Publicon. The data for the notebook starts with the line containing stars above. So maybe we could make the star pattern a bit longer and change Mathematica to "Mathematica-Compatible Notebook": <magic priority="50"> <match value="(************" type="string" offset="0" /> <match value="Mathematica-Compatible Notebook" type="string" offset="0:256" /> </magic> Is that better?
As it is written currently, if either of those patterns match then it will be considered as a mathematica notebook. If you want to match both patterns before it's detected as a mathematica notebook, you need to do: <magic priority="50"> <match value="(*******" type="string" offset="0"> <match value="Mathematica" type="string" offset="0:256" /> </match> </magic> (this is done for eps files for example) And it's ok with me with the Mathematica-Compatible Notebook string, this one alone is probably enough I guess, but matching for the * can't hurt I'll commit that, thanks
Ok, committed to CVS.
Created attachment 2436 [details] Second try at a Mathematica magic Stupid me... one matching magic suffices :-( The attached file should produce less false positives. It can also detect Mathematica 2.0 notebooks now.
Oh, thanks for the explanation. I think the version I posted about a minute ago is even better.
Committed your magic to cvs, thanks.
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.