diff -r 104724bda57c -r 5ffb711cddcf MIMETypes.st --- a/MIMETypes.st Thu Mar 01 18:46:05 2018 +0100 +++ b/MIMETypes.st Thu Mar 01 19:26:01 2018 +0100 @@ -72,14 +72,14 @@ examples " [exBegin] - MIMETypes mimeTypeFromString:'text/plain' + MIMETypes mimeTypeFromString:'text/plain' [exEnd] [exBegin] - MIMETypes mimeTypeFromString:'application/x-expecco-testsuite' + MIMETypes mimeTypeFromString:'application/x-expecco-testsuite' [exEnd] [exBegin] - MIMETypes mimeTypeForSuffix:'gif' + MIMETypes mimeTypeForSuffix:'gif' MIMETypes mimeTypeForSuffix:'ets' MIMETypes mimeTypeForSuffix:'xlsx' [exEnd] @@ -92,12 +92,12 @@ application mime file extentsions - powerpoint application/ms-powerpoint .pot, .ppz, .ppt, .pps, - application/mspowerpoint - application/vnd.ms-powerpoint + powerpoint application/ms-powerpoint .pot, .ppz, .ppt, .pps, + application/mspowerpoint + application/vnd.ms-powerpoint application/x-mspowerpoint - shockwave application/x-shockwave-flash .swf + shockwave application/x-shockwave-flash .swf futuresplash application/futuresplash .spl " @@ -107,25 +107,27 @@ addMimeTypeDetector:aMimeTypeFromContentsDetectorBlock "any class (especially: image readers) may add a block - which detects the mime-type from a givel contents. + that detects the MIME type from a given content. The block is called with two arguments, some data (usually the first few kilobytes of a file) and the suffix of the file, or nil if unknown. - The block should return the mimeType or nil." - - TypeFromContentsDetectors isNil ifTrue:[ TypeFromContentsDetectors := OrderedCollection new ]. + The block should return the MIME type or nil." + + TypeFromContentsDetectors isNil ifTrue:[ TypeFromContentsDetectors := OrderedCollection new ]. TypeFromContentsDetectors add:aMimeTypeFromContentsDetectorBlock. + + "Modified (comment): / 01-03-2018 / 19:06:46 / mawalch" ! initialize "initialize wellKnown facts" - + MIMEType initialize. "must be initialized first" LastSuffix := LastType := nil. self initializeFileNameToMimeTypeMapping. self initializeImageReaderMappings. self initializeCommentStringMappings. self initializeParenthesisSpecMappings. - + " self initialize " @@ -140,92 +142,92 @@ TypeToCommentStringMapping := Dictionary new. SuffixToCommentStringMapping := Dictionary new. - TypeToCommentStringMapping + TypeToCommentStringMapping at:'application/x-make' put:#('#' (nil nil)). "/ '#' EOL comments only - TypeToCommentStringMapping + TypeToCommentStringMapping at:'application/x-sh' put:#('#' (nil nil)). "/ '#' EOL comments only - #('text/html' 'text/xml' - 'application/xml' + #('text/html' 'text/xml' + 'application/xml' 'application/x-expecco-testsuite' 'application/x-expecco-logfile' ) do:[:eachXMLType | - TypeToCommentStringMapping + TypeToCommentStringMapping at:eachXMLType put:#(nil ('')). "/ '' delimited comments only ]. - TypeToCommentStringMapping + TypeToCommentStringMapping at:'text/css' - put:#('//' ('/*' '*/')). + put:#('//' ('/*' '*/')). - TypeToCommentStringMapping + TypeToCommentStringMapping at:'application/x-batch-script' put:#('@REM ' '@rem ' 'REM ' 'rem ' (nil nil)). "/ 'rem ' for EOL comments only "/ the following is ST/X specific - TypeToCommentStringMapping + TypeToCommentStringMapping at:'application/x-smalltalk-source' put:#('"/' ('"' '"')). "/ '"/ ' for EOL; ".." for delimited comments "/ this is for standard smalltalk -"/ TypeToCommentStringMapping +"/ TypeToCommentStringMapping "/ at:'application/x-smalltalk-source' "/ put:#(nil ('"' '"')). "/ ".." for delimited comments only - TypeToCommentStringMapping + TypeToCommentStringMapping at:'application/x-pascal-source' put:#(nil ('{' '}')). "/ '{'..'}' for delimited comments "/ this is ANSI-c - TypeToCommentStringMapping + TypeToCommentStringMapping at:'application/x-c-source' - put:#('//' ('/*' '*/')). + put:#('//' ('/*' '*/')). - TypeToCommentStringMapping + TypeToCommentStringMapping at:'application/x-cpp-source' - put:#('//' ('/*' '*/')). + put:#('//' ('/*' '*/')). - TypeToCommentStringMapping + TypeToCommentStringMapping at:'application/x-csharp-source' - put:#('//' ('/*' '*/')). + put:#('//' ('/*' '*/')). - TypeToCommentStringMapping + TypeToCommentStringMapping at:'application/x-java-source' - put:#('//' ('/*' '*/')). + put:#('//' ('/*' '*/')). - TypeToCommentStringMapping + TypeToCommentStringMapping at:'application/x-javascript' - put:#('//' ('/*' '*/')). + put:#('//' ('/*' '*/')). - TypeToCommentStringMapping + TypeToCommentStringMapping at:'application/x-scheme-source' put:#(';' ('#| ' ' |#')). "/ ';' for EOL comments only - TypeToCommentStringMapping + TypeToCommentStringMapping at:'application/x-lisp-source' put:#(';' (nil nil)). "/ ';' for EOL comments only - TypeToCommentStringMapping + TypeToCommentStringMapping at:'application/x-python-source' put:#('#' (nil nil)). "/ '#' for EOL comments only - TypeToCommentStringMapping + TypeToCommentStringMapping at:'application/x-asn1-source' - put:#('--' ('--' '--')). + put:#('--' ('--' '--')). "/ st/x support files - SuffixToCommentStringMapping + SuffixToCommentStringMapping at:'style' - put:#(';' (nil nil)). + put:#(';' (nil nil)). - SuffixToCommentStringMapping + SuffixToCommentStringMapping at:'rs' put:#(';' (nil nil)). @@ -247,15 +249,15 @@ OperatingSystem isMSWINDOWSlike ifFalse:[ |cmd| OperatingSystem isOSXlike ifTrue:[ - unixCommands at:'text/html' put:('open -a Safari "%1"'). - unixCommands at:'application/pdf' put:('open -a Preview "%1"'). + unixCommands at:'text/html' put:('open -a Safari "%1"'). + unixCommands at:'application/pdf' put:('open -a Preview "%1"'). ] ifFalse:[ listToTry := #('firefox' 'chrome' 'chromium' 'konqueror' 'opera'). cmd := listToTry detect:[:aCmd| (OperatingSystem pathOfCommand:aCmd) notEmptyOrNil ] ifNone:nil. cmd notNil ifTrue:[ - unixCommands at:'text/html' put:(cmd, ' "%1"') + unixCommands at:'text/html' put:(cmd, ' "%1"') ]. listToTry := #('acroread' 'okular' 'evince' 'kpdf' 'xpdf'). @@ -263,7 +265,7 @@ detect:[:aCmd| (OperatingSystem pathOfCommand:aCmd) notEmptyOrNil ] ifNone:nil. cmd notNil ifTrue:[ - unixCommands at:'application/pdf' put:(cmd, ' "%1"') + unixCommands at:'application/pdf' put:(cmd, ' "%1"') ]. listToTry := #('xdg-open'). @@ -271,7 +273,7 @@ detect:[:aCmd| (OperatingSystem pathOfCommand:aCmd) notEmptyOrNil ] ifNone:nil. cmd notNil ifTrue:[ - unixCommands at:'text/plain' put:(cmd , ' "%1"') + unixCommands at:'text/plain' put:(cmd , ' "%1"') ]. ]. @@ -381,7 +383,7 @@ ! initializeImageReaderMappings - "these are used so select an image reader, based on a bitmap image's mime type" + "these are used so select an image reader, based on a bitmap image's MIME type" |rdr| @@ -525,13 +527,13 @@ ! initializeParenthesisSpecMappings - "these are used by the editors to mark matching parenthesis" + "these are used by the editors to mark matching parentheses" |spec| TypeToParenthesisSpecMapping := Dictionary new. SuffixToParenthesisSpecMapping := Dictionary new. - + "/ ST/X spec spec := IdentityDictionary new. spec at:#open put:#( $( $[ ${ ). @@ -539,17 +541,17 @@ spec at:#ignore put:#( $' $" '$[' '$]' '${' '$)' ). spec at:#eolComment put:'"/'. TypeToParenthesisSpecMapping at:'application/x-smalltalk-source' put:spec. - + "/ XML & HTML spec := IdentityDictionary new. spec at:#open put:#( $< ). spec at:#close put:#( $> ). spec at:#ignore put:#( $' $" '$[' '$]' '${' '$)' ). - #( 'text/html' 'text/xml' 'application/xml' ) do:[:eachXMLType | + #( 'text/html' 'text/xml' 'application/xml' ) do:[:eachXMLType | TypeToParenthesisSpecMapping at:eachXMLType put:spec ]. - - "/ ANSI-c, Java, C# + + "/ ANSI-c, Java, C# spec := IdentityDictionary new. spec at:#open put:#( $( $[ ${ ). spec at:#close put:#( $) $] $} ). @@ -561,8 +563,8 @@ TypeToParenthesisSpecMapping at:'application/x-java-source' put:spec. TypeToParenthesisSpecMapping at:'application/x-javascript' put:spec. TypeToParenthesisSpecMapping at:'application/x-python-source' put:spec. - - "/ Lisp / Scheme + + "/ Lisp / Scheme spec := IdentityDictionary new. spec at:#open put:#( $( $[ ). spec at:#close put:#( $) $] ). @@ -572,6 +574,7 @@ TypeToParenthesisSpecMapping at:'application/x-scheme-source' put:spec. "Created: / 10-04-2007 / 15:16:37 / cg" + "Modified (format): / 01-03-2018 / 19:02:39 / mawalch" ! ! !MIMETypes class methodsFor:'initialization-lists'! @@ -580,8 +583,8 @@ "compressor applications" ^ #( - "/ the first column is a list of extensions, the second the more-or-less official mimetype - + "/ the first column is a list of extensions, the second the more-or-less official MIME type + 'tar' 'application/x-tar' 'gtar' 'application/x-gtar' ('tgz' 'tar.gz') 'application/x-tar-gzip-compressed' "/ 'application/x-tar-compressed' @@ -601,13 +604,14 @@ ) "Modified (format): / 05-02-2017 / 19:37:10 / cg" + "Modified (comment): / 01-03-2018 / 19:07:27 / mawalch" ! applicationMiscTypeList "misc applications" ^ #( - "/ the first column is a list of extensions, the second the more-or-less official mimetype + "/ the first column is a list of extensions, the second the more-or-less official MIME type ('a' 'o' 'obj' ) 'application/binary' 'lic' 'application/license' @@ -623,13 +627,14 @@ "Modified: / 03-11-2011 / 10:42:28 / sr" "Modified (format): / 05-02-2017 / 19:37:05 / cg" "Modified: / 09-02-2017 / 14:31:45 / stefan" + "Modified (comment): / 01-03-2018 / 19:07:37 / mawalch" ! applicationProgLangTypeList "applications for programming languages" ^ #( - "/ the first column is a list of extensions, the second the more-or-less official mimetype + "/ the first column is a list of extensions, the second the more-or-less official MIME type ('st' 'cls' 'rc') 'application/x-smalltalk-source' 'sif' 'application/x-smalltalk-source-sif' @@ -657,7 +662,7 @@ 'arc' 'brg' 'rkt') 'application/x-scheme-source' ('lisp' 'lsp' 'cl' ) 'application/x-lisp-source' - + 'py' 'application/x-python-source' ('pyc' 'pyo' ) 'application/x-python-compiled-bytecode' 'pyd' 'application/x-python-compiled-code' @@ -665,13 +670,14 @@ ) "Modified: / 23-06-2017 / 13:34:37 / cg" + "Modified (comment): / 01-03-2018 / 19:07:43 / mawalch" ! applicationTextTypeList "text applications" ^ #( - "/ the first column is a list of extensions, the second the more-or-less official mimetype + "/ the first column is a list of extensions, the second the more-or-less official MIME type ('ps' 'eps') 'application/postscript' "/ 'ai' 'application/postscript' @@ -683,7 +689,7 @@ "/ 'doc' 'application/winword' 'swf' 'application/x-shockwave-flash' ('ppt' 'ppz' 'pot' 'pps') 'application/mspowerpoint' - 'xls' 'application/x-excel' + 'xls' 'application/x-excel' 'slk' 'application/vnd.ms-excel' 'txt' 'text/plain' 'xlsx' 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' @@ -704,12 +710,13 @@ "Modified: / 26-05-2012 / 15:27:30 / cg" "Modified: / 18-05-2015 / 09:46:47 / sr" "Modified (format): / 05-02-2017 / 19:37:20 / cg" + "Modified (comment): / 01-03-2018 / 19:07:51 / mawalch" ! applicationTypeList "applications" - |typeList| + |typeList| typeList := OrderedCollection new. typeList addAll:self applicationProgLangTypeList. @@ -724,7 +731,7 @@ "audio formats ..." ^ #( - "/ the first column is a list of extensions, the second the more-or-less official mimetype + "/ the first column is a list of extensions, the second the more-or-less official MIME type ('au' 'snd') 'audio/basic' 'ra' 'audio/x-realaudio' @@ -742,14 +749,15 @@ "Modified: / 26-05-2012 / 15:23:45 / cg" "Modified (comment): / 05-02-2017 / 19:37:48 / cg" "Modified: / 09-02-2017 / 14:29:59 / stefan" + "Modified (comment): / 01-03-2018 / 19:07:54 / mawalch" ! imageTypeList "/ wellknown image formats ... ^ #( - "/ the first column is a list of extensions, the second the more-or-less official mimetype - + "/ the first column is a list of extensions, the second the more-or-less official MIME type + ('jpg' 'jpeg') 'image/jpeg' 'gif' 'image/gif' ('tif' 'tiff') 'image/tiff' @@ -767,18 +775,19 @@ 'ras' 'image/x-cmu-raster' 'tga' 'image/x-targa' 'ico' 'image/x-icon' - 'icns' 'image/icns' + 'icns' 'image/icns' 'dng' 'image/x-adobe-dng' ) "Modified: / 13-09-2017 / 09:05:15 / cg" + "Modified (comment): / 01-03-2018 / 19:08:18 / mawalch" ! miscFilenameList "other formats (not by suffix, but by fileName instead) ..." ^ #( - "/ the first column is a list of extensions, the second the more-or-less official mimetype + "/ the first column is a list of extensions, the second the more-or-less official MIME type ('makefile' 'make.proto' 'make.spec' 'nt.mak') 'application/x-make' ('exe' 'bin' 'com') 'application/octet-stream' @@ -787,6 +796,7 @@ ) "Modified (comment): / 05-02-2017 / 19:38:00 / cg" + "Modified (comment): / 01-03-2018 / 19:09:17 / mawalch" ! osSpecificTypeList @@ -804,7 +814,7 @@ "/ misc text ... ^ #( - "/ the first column is a list of extensions, the second the more-or-less official mimetype + "/ the first column is a list of extensions, the second the more-or-less official MIME type ('html' 'htm' 'shtml') 'text/html' ('txt' 'text') 'text/plain' @@ -816,12 +826,13 @@ ) "Modified: / 05-02-2017 / 19:38:12 / cg" + "Modified (comment): / 01-03-2018 / 19:09:34 / mawalch" ! unixSpecificTypeList ^ #( - "/ the first column is a list of extensions, the second the more-or-less official mimetype + "/ the first column is a list of extensions, the second the more-or-less official MIME type "/ cg: RPM is 'audio/x-pn-realaudio-plugin' for WIN32 "/ and 'application/x-rpm' for Unix @@ -829,6 +840,7 @@ ) "Modified (comment): / 05-02-2017 / 19:38:23 / cg" + "Modified (comment): / 01-03-2018 / 19:09:37 / mawalch" ! videoTypeList @@ -854,7 +866,7 @@ windowsSpecificTypeList ^ #( - "/ the first column is a list of extensions, the second the more-or-less official mimetype + "/ the first column is a list of extensions, the second the more-or-less official MIME type "/ cg: RPM is 'audio/x-pn-realaudio-plugin' for WIN32 "/ and 'application/x-rpm' for Unix @@ -862,6 +874,7 @@ ) "Modified (comment): / 05-02-2017 / 19:38:42 / cg" + "Modified (comment): / 01-03-2018 / 19:09:41 / mawalch" ! ! !MIMETypes class methodsFor:'obsolete'! @@ -873,7 +886,7 @@ ^ self defaultCommandTemplateToOpenMimeType:mimeType " - MIMETypes defaultCommandTemplateToOpenMimeType:'application/pdf' + MIMETypes defaultCommandTemplateToOpenMimeType:'application/pdf' " "Created: / 12-05-2004 / 11:09:22 / cg" @@ -888,8 +901,8 @@ ^ FontDescription fontNamePatternForCharset:aCharSetName. " - MIMETypes fontForCharset:'iso2022-jp' - MIMETypes fontForCharset:'euc-jp' + MIMETypes fontForCharset:'iso2022-jp' + MIMETypes fontForCharset:'euc-jp' " "Modified: / 1.8.1998 / 17:00:57 / cg" @@ -919,7 +932,7 @@ (aSuffix notNil and:[mimeType notNil]) ifTrue:[ self mimeTypeForSuffix:aSuffix put:mimeType ]. - + (info notNil and:[mimeType notNil]) ifTrue:[ self typeToInfoMapping at:mimeType put:info. ]. @@ -936,8 +949,8 @@ ^ self typeToInfoMapping at:mimeType ifAbsent:nil " - self fileInfoForMimeType:(MIMEType fromString:'text/html') - self fileInfoForMimeType:(MIMEType fromString:'image/gif') + self fileInfoForMimeType:(MIMEType fromString:'text/html') + self fileInfoForMimeType:(MIMEType fromString:'image/gif') " "Modified (comment): / 27-08-2017 / 14:31:33 / cg" @@ -962,7 +975,7 @@ ! mimeTypeForFilename:filenameOrString - "given a filename, return the mime-type or nil, if unknown" + "given a filename, return the MIME type or nil if unknown" |type filename lcFilename suff suff2| @@ -1007,34 +1020,36 @@ ^ type " - MIMETypes mimeTypeForFilename:'typeinst.dvi' + MIMETypes mimeTypeForFilename:'typeinst.dvi' MIMETypes mimeTypeForFilename:'foo.tar' MIMETypes mimeTypeForFilename:'foo.tgz' MIMETypes mimeTypeForFilename:'foo.tar.gz' - MIMETypes mimeTypeForFilename:'foo.txt' - MIMETypes mimeTypeForFilename:'foo.pkg' - MIMETypes mimeTypeForFilename:'foo.sm' + MIMETypes mimeTypeForFilename:'foo.txt' + MIMETypes mimeTypeForFilename:'foo.pkg' + MIMETypes mimeTypeForFilename:'foo.sm' MIMETypes mimeTypeForFilename:'/Users/cg/work/stx/goodies/bitmaps/tiffimages/moreSamples/multi-channel.ome.tif' MIMETypes mimeTypeForFilename:'multi-channel.ome.tif' MIMETypes mimeTypeForFilename:'multi-channel.tif' -' " "Modified (format): / 27-06-2017 / 16:25:40 / stefan" "Modified: / 27-08-2017 / 16:35:37 / cg" + "Modified (comment): / 01-03-2018 / 18:52:25 / mawalch" ! mimeTypeForFilename:filename put:mimeType - "register a mime type for a filename" + "register a MIME type for a filename" FilenameToTypeMapping isNil ifTrue:[ FilenameToTypeMapping := Dictionary new ]. FilenameToTypeMapping at:filename put:(MIMEType fromString:mimeType asLowercase) + + "Modified (comment): / 01-03-2018 / 18:52:42 / mawalch" ! mimeTypeForSuffix:suffix - "given a file suffix, return the mime-type" + "given a file suffix, return the MIME type" |type lcSuffix| @@ -1048,7 +1063,7 @@ "/ allow for fallback ... type := OperatingSystem mimeTypeForSuffix:lcSuffix. "/ the special value #unknown is returned as nil; - "/ this avoids constant retry if a suffix is not known in the OS. + "/ this avoids constant retry if a suffix is not known in the OS. type := type isNil ifTrue:[#unknown] ifFalse:[MIMEType fromString:type]. FileSuffixToTypeMapping at:lcSuffix put:type. ]. @@ -1058,18 +1073,19 @@ ^ type " - self mimeTypeForSuffix:'gif' - self mimeTypeForSuffix:'rpm' - self mimeTypeForSuffix:'zip' + self mimeTypeForSuffix:'gif' + self mimeTypeForSuffix:'rpm' + self mimeTypeForSuffix:'zip' " "Created: / 30-06-1997 / 21:55:51 / cg" "Modified: / 14-02-2011 / 17:14:34 / cg" "Modified: / 09-02-2017 / 14:57:52 / stefan" + "Modified (comment): / 01-03-2018 / 18:51:35 / mawalch" ! mimeTypeForSuffix:suffix put:mimeType - "register a mime type for a file suffix" + "register a MIME type for a file suffix" FileSuffixToTypeMapping isNil ifTrue:[ FileSuffixToTypeMapping := Dictionary new @@ -1079,6 +1095,7 @@ "Created: / 30-06-1997 / 21:56:20 / cg" "Modified: / 01-08-1998 / 17:03:18 / cg" "Modified: / 09-02-2017 / 15:09:17 / stefan" + "Modified (comment): / 01-03-2018 / 18:51:17 / mawalch" ! mimeTypeForSuffixMapping @@ -1087,38 +1104,44 @@ ! mimeTypeFromString:mimeTypeString - "given a mime-type for a string" + "given a MIME type for a string" ^ MIMEType fromString:mimeTypeString " - MIMETypes mimeTypeFromString:'text/html' - MIMETypes mimeTypeFromString:'image/gif' - MIMETypes mimeTypeFromString:'application/x-expecco-testsuite' + MIMETypes mimeTypeFromString:'text/html' + MIMETypes mimeTypeFromString:'image/gif' + MIMETypes mimeTypeFromString:'application/x-expecco-testsuite' " + + "Modified (comment): / 01-03-2018 / 18:49:50 / mawalch" ! mimeTypeOfContents:filename - "given a filename, scan the contents, return the mime-type or nil, if unknown" + "given a filename, scan the contents, return the MIME type or nil, if unknown" |typeString| typeString := filename mimeTypeOfContents. typeString isNil ifTrue:[^ nil]. ^ MIMEType fromString:typeString. + + "Modified (comment): / 01-03-2018 / 18:50:06 / mawalch" ! mimeTypeOfData:someData - "this tries to guess the mime type of contents of someData. - Returns nil, if unknown. + "this tries to guess the MIME type of contents of someData. + Returns nil if unknown. This is done using some heuristics, and may need some improvement" ^ self mimeTypeOfData:someData suffix:nil + + "Modified (comment): / 01-03-2018 / 18:50:22 / mawalch" ! mimeTypeOfData:someData suffix:fileNameSuffixOrNilIfUnknown - "this tries to guess the mime type of someData. - Returns nil, if unknown. + "this tries to guess the MIME type of someData. + Returns nil if unknown. In addition to registered detectors (see addMimeTypeDetector:), this is done using heuristics, and may need some improvement" @@ -1237,32 +1260,35 @@ ^ nil "Modified: / 12-07-2011 / 19:08:17 / cg" + "Modified (comment): / 01-03-2018 / 18:50:36 / mawalch" ! suffixForMimeType:mimeType - "given a file suffix, return the mime-type" + "given a file suffix, return the MIME type" ^ TypeToFileSuffixMapping at:mimeType ifAbsent:nil " - self suffixForMimeType:(MIMEType fromString:'image/gif') + self suffixForMimeType:(MIMEType fromString:'image/gif') " - "Created: / 30.6.1997 / 21:55:51 / cg" - "Modified: / 23.12.1999 / 22:30:55 / cg" + "Created: / 30-06-1997 / 21:55:51 / cg" + "Modified: / 23-12-1999 / 22:30:55 / cg" + "Modified (comment): / 01-03-2018 / 18:50:50 / mawalch" ! suffixForMimeTypeString:mimeTypeString - "given a file suffix, return the mime-type" + "given a file suffix, return the MIME type" - ^ self suffixForMimeType:(MIMEType fromString:mimeTypeString) + ^ self suffixForMimeType:(MIMEType fromString:mimeTypeString) " - self suffixForMimeTypeString:'image/gif' + self suffixForMimeTypeString:'image/gif' " - "Created: / 30.6.1997 / 21:55:51 / cg" - "Modified: / 23.12.1999 / 22:30:55 / cg" + "Created: / 30-06-1997 / 21:55:51 / cg" + "Modified: / 23-12-1999 / 22:30:55 / cg" + "Modified (comment): / 01-03-2018 / 18:51:06 / mawalch" ! typeToInfoMapping @@ -1277,7 +1303,7 @@ !MIMETypes class methodsFor:'queries-applications'! defaultCommandPerMIME - "returns the collection which is used to map MIME-type to command-templates." + "returns the collection which is used to map MIME type to command-templates." "TODO: move this to OS/UserPreferences" @@ -1294,6 +1320,7 @@ " "Modified (comment): / 16-09-2011 / 16:20:12 / cg" + "Modified (comment): / 01-03-2018 / 19:06:54 / mawalch" ! defaultCommandTemplateToOpenMimeType:mimeType @@ -1333,7 +1360,7 @@ ! defaultPrintCommandPerMIME - "returns the collection which is used to map MIME-type to printing command-templates." + "returns the collection which is used to map MIME type to printing command-templates." "TODO: move this to OS/UserPreferences" @@ -1362,15 +1389,16 @@ ! imageReaderForSuffix:aSuffix - "given a file suffix, return an approriate image reader class" + "given a file suffix, return an appropriate image reader class" FileSuffixToImageReaderClassMapping isNil ifTrue:[ self initializeImageReaderMappings ]. ^ FileSuffixToImageReaderClassMapping at:aSuffix asLowercase ifAbsent:nil - "Created: / 30.6.1997 / 21:59:11 / cg" - "Modified: / 1.8.1998 / 17:01:58 / cg" + "Created: / 30-06-1997 / 21:59:11 / cg" + "Modified: / 01-08-1998 / 17:01:58 / cg" + "Modified (comment): / 01-03-2018 / 18:57:59 / mawalch" ! imageReaderForSuffix:aSuffix put:aReaderClass @@ -1386,30 +1414,32 @@ ! imageReaderForType:mimeTypeString - "given a mime-type, return an approriate image reader class" + "given a MIME type, return an appropriate image reader class" TypeToImageReaderClassMapping isNil ifTrue:[ self initializeImageReaderMappings ]. ^ TypeToImageReaderClassMapping at:mimeTypeString asLowercase ifAbsent:nil - "Created: / 30.6.1997 / 21:56:01 / cg" - "Modified: / 1.8.1998 / 17:02:28 / cg" + "Created: / 30-06-1997 / 21:56:01 / cg" + "Modified: / 01-08-1998 / 17:02:28 / cg" + "Modified (format): / 01-03-2018 / 18:58:10 / mawalch" ! imageReaderForType:mimeTypeString put:aReaderClass - "register an image reader for a mime-type" + "register an image reader for a MIME type" TypeToImageReaderClassMapping isNil ifTrue:[ self initializeImageReaderMappings ]. - TypeToImageReaderClassMapping + TypeToImageReaderClassMapping at:(MIMEType fromString:mimeTypeString asLowercase) put:aReaderClass "Created: / 30-06-1997 / 21:56:11 / cg" "Modified: / 01-08-1998 / 17:02:40 / cg" "Modified: / 09-02-2017 / 15:32:58 / stefan" + "Modified (comment): / 01-03-2018 / 18:58:27 / mawalch" ! ! !MIMETypes class methodsFor:'queries-language syntax'! @@ -1427,9 +1457,9 @@ " MIMETypes commentStringsForFilename:'Makefile'. - MIMETypes commentStringsForFilename:'Object.st'. - MIMETypes commentStringsForFilename:'Foo.java'. - MIMETypes commentStringsForFilename:'Foo.html'. + MIMETypes commentStringsForFilename:'Object.st'. + MIMETypes commentStringsForFilename:'Foo.java'. + MIMETypes commentStringsForFilename:'Foo.html'. " ! @@ -1446,8 +1476,8 @@ " MIMETypes commentStringsForFilename:'Makefile'. - MIMETypes commentStringsForFilename:'Object.st'. - MIMETypes commentStringsForFilename:'Foo.java'. + MIMETypes commentStringsForFilename:'Object.st'. + MIMETypes commentStringsForFilename:'Foo.java'. " ! @@ -1458,21 +1488,21 @@ the second an array of opening/closing delimiters (or an array of nils)" ^ self - commentStringsForMimeType:mime suffix:suff - ifUnknown: #(';' (nil nil)) + commentStringsForMimeType:mime suffix:suff + ifUnknown: #(';' (nil nil)) " |mime| mime := MIMETypes mimeTypeForFilename:'Makefile'. - MIMETypes commentStringsForMimeType:mime suffix:nil. + MIMETypes commentStringsForMimeType:mime suffix:nil. " " |mime| mime := MIMETypes mimeTypeForFilename:'Object.st'. - MIMETypes commentStringsForMimeType:mime suffix:nil. + MIMETypes commentStringsForMimeType:mime suffix:nil. " ! @@ -1500,14 +1530,14 @@ |mime| mime := MIMETypes mimeTypeForFilename:'Makefile'. - MIMETypes commentStringsForMimeType:mime suffix:nil. + MIMETypes commentStringsForMimeType:mime suffix:nil. " " |mime| mime := MIMETypes mimeTypeForFilename:'Object.st'. - MIMETypes commentStringsForMimeType:mime suffix:nil. + MIMETypes commentStringsForMimeType:mime suffix:nil. " ! @@ -1521,10 +1551,10 @@ ^ self parenthesisSpecForMimeType:mime suffix:(aFilename asFilename suffix) " - MIMETypes parenthesisSpecForFilename:'Object.st'. - MIMETypes parenthesisSpecForFilename:'Foo.java'. - MIMETypes parenthesisSpecForFilename:'Foo.html'. - MIMETypes parenthesisSpecForFilename:'Foo.lsp'. + MIMETypes parenthesisSpecForFilename:'Object.st'. + MIMETypes parenthesisSpecForFilename:'Foo.java'. + MIMETypes parenthesisSpecForFilename:'Foo.html'. + MIMETypes parenthesisSpecForFilename:'Foo.lsp'. " "Created: / 10-04-2007 / 15:18:41 / cg" @@ -1541,10 +1571,11 @@ parenthesisSpecForMimeType:mime suffix:suff ^ self - parenthesisSpecForMimeType:mime suffix:suff - ifUnknown: nil + parenthesisSpecForMimeType:mime suffix:suff + ifUnknown:nil "Created: / 10-04-2007 / 15:19:39 / cg" + "Modified (format): / 01-03-2018 / 19:03:58 / mawalch" ! parenthesisSpecForMimeType:mime suffix:suff ifUnknown:alternativeValue @@ -1603,11 +1634,13 @@ !MIMETypes::MIMEType methodsFor:'queries'! fileTypeInfo - ^ MIMETypes fileTypeInfoForMimeType:self + ^ MIMETypes fileInfoForMimeType:self " - (MIMETypes mimeTypeFromString:'application/x-smalltalk-source') fileTypeInfo + (MIMETypes mimeTypeFromString:'application/x-smalltalk-source') fileTypeInfo " + + "Modified: / 01-03-2018 / 19:16:49 / mawalch" ! isArchive @@ -1719,7 +1752,7 @@ ^ MIMETypes suffixForMimeType:self " - (MIMETypes mimeTypeFromString:'application/x-expecco-testsuite') suffix + (MIMETypes mimeTypeFromString:'application/x-expecco-testsuite') suffix " ! !