--- a/MIMETypes.st Thu Jun 05 11:21:41 2008 +0200
+++ b/MIMETypes.st Thu Jun 05 11:35:57 2008 +0200
@@ -19,7 +19,7 @@
FilenameToTypeMapping FileSuffixToImageReaderClassMapping
CharSetToFontMapping LastSuffix LastType
DefaultCommandPerMIMEPerOS DefaultPrintCommandPerMIMEPerOS
- TypeToParentesisSpecMapping SuffixToParentesisSpecMapping'
+ TypeToParenthesisSpecMapping SuffixToParenthesisSpecMapping'
poolDictionaries:''
category:'Net-Communication-Support'
!
@@ -95,19 +95,16 @@
initialize
"initialize wellKnown facts"
-
- MIMEType initialize. "must be initialized first"
+
+ MIMEType initialize. "must be initialized first"
LastSuffix := LastType := nil.
-
self initializeFileNameToMimeTypeMapping.
self initializeImageReaderMappings.
self initializeCommentStringMappings.
- self initializeParentesisSpecMappings.
+ self initializeParenthesisSpecMappings.
"
- self initialize
- "
-
+ self initialize"
"Modified: / 10-04-2007 / 15:16:44 / cg"
!
@@ -334,73 +331,52 @@
FileSuffixToImageReaderClassMapping at:'tif' put:TIFFReader.
!
-initializeParentesisSpecMappings
+initializeParenthesisSpecMappings
|spec|
- TypeToParentesisSpecMapping := Dictionary new.
- SuffixToParentesisSpecMapping := Dictionary new.
-
+ TypeToParenthesisSpecMapping := Dictionary new.
+ SuffixToParenthesisSpecMapping := Dictionary new.
+
"/ ST/X spec
- spec := IdentityDictionary new.
- spec at:#open put:#( $( $[ ${ "$> $<") .
- spec at:#close put:#( $) $] $} "$> $<").
- spec at:#ignore put:#( $' $" '$[' '$]' '${' '$)' ).
- spec at:#eolComment put:'"/'.
-
- TypeToParentesisSpecMapping
- at:'application/x-smalltalk-source'
- put:spec.
-
+
+ spec := IdentityDictionary new.
+ spec at:#open put:#( $( $[ ${ ).
+ spec at:#close put:#( $) $] $} ).
+ 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 |
- TypeToParentesisSpecMapping
- at:eachXMLType
- put:spec
+
+ spec := IdentityDictionary new.
+ spec at:#open put:#( $< ).
+ spec at:#close put:#( $> ).
+ spec at:#ignore put:#( $' $" '$[' '$]' '${' '$)' ).
+ #( 'text/html' 'text/xml' 'application/xml' ) do:[:eachXMLType |
+ TypeToParenthesisSpecMapping at:eachXMLType put:spec
].
-
+
"/ ANSI-c, Java, C#
- spec := IdentityDictionary new.
- spec at:#open put:#( $( $[ ${ ) .
- spec at:#close put:#( $) $] $} ).
- spec at:#ignore put:#( $' $" ).
- spec at:#eolComment put:'//'.
-
- TypeToParentesisSpecMapping
- at:'application/x-c-source'
- put:spec.
-
- TypeToParentesisSpecMapping
- at:'application/x-cpp-source'
- put:spec.
-
- TypeToParentesisSpecMapping
- at:'application/x-csharp-source'
- put:spec.
-
- TypeToParentesisSpecMapping
- at:'application/x-java-source'
- put:spec.
-
- TypeToParentesisSpecMapping
- at:'application/x-javascript'
- put:spec.
-
+
+ spec := IdentityDictionary new.
+ spec at:#open put:#( $( $[ ${ ).
+ spec at:#close put:#( $) $] $} ).
+ spec at:#ignore put:#( $' $" ).
+ spec at:#eolComment put:'//'.
+ TypeToParenthesisSpecMapping at:'application/x-c-source' put:spec.
+ TypeToParenthesisSpecMapping at:'application/x-cpp-source' put:spec.
+ TypeToParenthesisSpecMapping at:'application/x-csharp-source' put:spec.
+ TypeToParenthesisSpecMapping at:'application/x-java-source' put:spec.
+ TypeToParenthesisSpecMapping at:'application/x-javascript' put:spec.
+
"/ Lisp
- spec := IdentityDictionary new.
- spec at:#open put:#( $( ) .
- spec at:#close put:#( $) ).
- spec at:#ignore put:#( $" ).
- spec at:#eolComment put:';'.
-
- TypeToParentesisSpecMapping
- at:'application/x-lisp-source'
- put:spec.
+
+ spec := IdentityDictionary new.
+ spec at:#open put:#( $( ).
+ spec at:#close put:#( $) ).
+ spec at:#ignore put:#( $" ).
+ spec at:#eolComment put:';'.
+ TypeToParenthesisSpecMapping at:'application/x-lisp-source' put:spec.
"Created: / 10-04-2007 / 15:16:37 / cg"
! !
@@ -611,6 +587,20 @@
!MIMETypes class methodsFor:'obsolete'!
+defaultCommandForMimeType:mimeType
+ <resource: #obsolete>
+ self obsoleteMethodWarning:'use #defaultCommandTemplateToOpenMimeType:'.
+
+ ^ self defaultCommandTemplateToOpenMimeType:mimeType
+
+ "
+ MIMETypes defaultCommandForMimeType:'application/pdf'
+ "
+
+ "Created: / 12-05-2004 / 11:09:22 / cg"
+ "Modified: / 12-05-2004 / 11:16:53 / cg"
+!
+
fontForCharset:aCharSetName
"return the font-encoding for an iso-charset"
@@ -624,6 +614,35 @@
"
"Modified: / 1.8.1998 / 17:00:57 / cg"
+!
+
+parentesisSpecForFilename:aFilename
+ <resource: #obsolete>
+ ^ self parenthesisSpecForFilename:aFilename
+
+ "Created: / 10-04-2007 / 15:18:41 / cg"
+!
+
+parentesisSpecForFilename:aFilename ifUnknown:alternative
+ <resource: #obsolete>
+
+ ^ self parenthesisSpecForFilename:aFilename ifUnknown:alternative
+
+ "Created: / 10-04-2007 / 15:26:20 / cg"
+!
+
+parentesisSpecForMimeType:mime suffix:suff
+ <resource: #obsolete>
+ ^ self parenthesisSpecForMimeType:mime suffix:suff
+
+ "Created: / 10-04-2007 / 15:19:39 / cg"
+!
+
+parentesisSpecForMimeType:mime suffix:suff ifUnknown:alternativeValue
+ <resource: #obsolete>
+ ^ self parenthesisSpecForMimeType:mime suffix:suff ifUnknown:alternativeValue
+
+ "Created: / 10-04-2007 / 15:20:38 / cg"
! !
!MIMETypes class methodsFor:'queries'!
@@ -826,19 +845,6 @@
!MIMETypes class methodsFor:'queries-applications'!
-defaultCommandForMimeType:mimeType
- self obsoleteMethodWarning:'use #defaultCommandTemplateToOpenMimeType:'.
-
- ^ self defaultCommandTemplateToOpenMimeType:mimeType
-
- "
- MIMETypes defaultCommandForMimeType:'application/pdf'
- "
-
- "Created: / 12-05-2004 / 11:09:22 / cg"
- "Modified: / 12-05-2004 / 11:16:53 / cg"
-!
-
defaultCommandPerMIME
"returns the collection which is used to map MIME-type to command-templates."
@@ -1070,51 +1076,51 @@
"
!
-parentesisSpecForFilename:aFilename
+parenthesisSpecForFilename:aFilename
"return a useful parentesis spec; heuristics for now.
The returned value is a dictionary to be used as parentesis spec in an editor"
|mime|
mime := MIMETypes mimeTypeForFilename:aFilename.
- ^ self parentesisSpecForMimeType:mime suffix:(aFilename asFilename suffix)
+ ^ self parenthesisSpecForMimeType:mime suffix:(aFilename asFilename suffix)
"
- MIMETypes parentesisSpecForFilename:'Object.st'.
- MIMETypes parentesisSpecForFilename:'Foo.java'.
- MIMETypes parentesisSpecForFilename:'Foo.html'.
- MIMETypes parentesisSpecForFilename:'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"
!
-parentesisSpecForFilename:aFilename ifUnknown:alternative
+parenthesisSpecForFilename:aFilename ifUnknown:alternative
|mime|
mime := MIMETypes mimeTypeForFilename:aFilename.
- ^ self parentesisSpecForMimeType:mime suffix:(aFilename asFilename suffix) ifUnknown:alternative
+ ^ self parenthesisSpecForMimeType:mime suffix:(aFilename asFilename suffix) ifUnknown:alternative
"Created: / 10-04-2007 / 15:26:20 / cg"
!
-parentesisSpecForMimeType:mime suffix:suff
+parenthesisSpecForMimeType:mime suffix:suff
^ self
- parentesisSpecForMimeType:mime suffix:suff
+ parenthesisSpecForMimeType:mime suffix:suff
ifUnknown: nil
"Created: / 10-04-2007 / 15:19:39 / cg"
!
-parentesisSpecForMimeType:mime suffix:suff ifUnknown:alternativeValue
+parenthesisSpecForMimeType:mime suffix:suff ifUnknown:alternativeValue
|spec|
- spec := TypeToParentesisSpecMapping at:mime ifAbsent:nil.
+ spec := TypeToParenthesisSpecMapping at:mime ifAbsent:nil.
spec notNil ifTrue:[
^ spec
].
- spec := SuffixToParentesisSpecMapping at:suff ifAbsent:nil.
+ spec := SuffixToParenthesisSpecMapping at:suff ifAbsent:nil.
spec notNil ifTrue:[
^ spec
].
@@ -1227,7 +1233,7 @@
!MIMETypes class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview2/MIMETypes.st,v 1.95 2008-06-05 09:21:41 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libview2/MIMETypes.st,v 1.96 2008-06-05 09:35:57 stefan Exp $'
! !
MIMETypes initialize!