Add a mime type for Graphviz dot scripts.
Created attachment 15697 [details] [review] patch
I'd rather text/x-graphviz, and the patch is missing a test case, and being added to the tests/list
Created attachment 15737 [details] [review] same patch + testcase Same patch with testcase added. I think text/x-dot is better than x-graphviz: graphviz is a collection of tools, but there are also other tools that deal with dot files and the documentaion at http://www.graphviz.org/doc/info/lang.html explicitely refers to the syntax as "the DOT language". That said, I'll also attach another patch using x-graphviz and let you pick the one you prefer.
Created attachment 15738 [details] [review] alternative patch
Could you add some magic to the matchlet as well? From the URL you gave, the file should start with: "strict graph " "graph " "strict digraph " "digraph "
*** Bug 12677 has been marked as a duplicate of this bug. ***
Please note that .dot files are also msword templates, we need a mimetype for that one too, with *.dot as a pattern, and magic to differenciate it from graphviz files (well I guess it could just inherit application/x-ole-storage).
(In reply to comment #7) > Please note that .dot files are also msword templates, we need a > mimetype for that one too, with *.dot as a pattern, and magic to differenciate > it from graphviz files (well I guess it could just inherit > application/x-ole-storage). Made it a sub-class of application/msword instead. Added to the test suite.
With your last change, graphviz dot files are now detected as MS files :( Shouldn't the test suite also check that the dot file I attched is *not* detected as a MS dot file? (and vice versa, that MS test file is not detected as graphiz dot file) As for the magic pattern for graphviz dot files, I have no clue how it should be done... is something like this enough? <match type="string" value="graph" offset="0"/> <match type="string" value="digraph" offset="0"/> It really sounds wrong to me since like all source files, most of the time the file starts with comments...
(In reply to comment #9) > With your last change, graphviz dot files are now detected as MS files :( Obviously, since I didn't commit your patch! > Shouldn't the test suite also check that the dot file I attched is *not* > detected as a MS dot file? (and vice versa, that MS test file is not detected > as graphiz dot file) Yes, once we have added your patch. > As for the magic pattern for graphviz dot files, I have no clue how it should > be done... > > is something like this enough? > > <match type="string" value="graph" offset="0"/> > <match type="string" value="digraph" offset="0"/> > > > It really sounds wrong to me since like all source files, most of the time the > file starts with comments... Then look for it in 0:256, or something like that. And please provide a representative .dot file then.
>> With your last change, graphviz dot files are now detected as MS files :( >Obviously, since I didn't commit your patch! mmm... I thought that for binary files *not* matching the magic regex would prevail over a matching glob, otherwise simply renaming junk to .doc etc would make it detected as MS file, no?
(In reply to comment #11) > >> With your last change, graphviz dot files are now detected as MS files :( > > >Obviously, since I didn't commit your patch! > > mmm... I thought that for binary files *not* matching the magic regex would > prevail over a matching glob, otherwise simply renaming junk to .doc etc would > make it detected as MS file, no? Which is what it does. Read the shared-mime spec for more information about the detection algorithms.
Any news on this?
(In reply to comment #13) > Any news on this? I'm still waiting on a patch with decent magic.
In fact this mimetype has been registered to IANA recently (July 2008), under the name text/vnd.graphviz. Good thing we didn't have it in freedesktop.org yet, so we can use the right name for it now ;) I just committed the definition of text/vnd.graphviz, with globs from IANA (*.gv, *.dot), magic (determined using the dot files I had around), and test (from Paolo Borelli).
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.