MIMETypes.st
changeset 1489 9e339e123bfa
parent 1475 c13069c47858
child 1560 cd34f832b2b0
equal deleted inserted replaced
1488:9fa3505d2d85 1489:9e339e123bfa
   258      MIMETypes commentStringsForFilename:'Object.st'. 
   258      MIMETypes commentStringsForFilename:'Object.st'. 
   259      MIMETypes commentStringsForFilename:'Foo.java'. 
   259      MIMETypes commentStringsForFilename:'Foo.java'. 
   260     "
   260     "
   261 !
   261 !
   262 
   262 
       
   263 commentStringsForFilename:aFilename ifUnknown:alternativeBlockReturningCommentString
       
   264     "return a useful comment definition; heuristics for now.
       
   265      The returned value is an array of 2 elements;
       
   266      the first is the end-of-line comment string (or nil);
       
   267      the second an array of opening/closing delimiters (or an array of nils)"
       
   268 
       
   269      |mime|
       
   270 
       
   271      mime := MIMETypes mimeTypeForFilename:aFilename.
       
   272      ^ self commentStringsForMimeType:mime suffix:(aFilename asFilename suffix) ifUnknown:alternativeBlockReturningCommentString
       
   273 
       
   274     "
       
   275      MIMETypes commentStringsForFilename:'Makefile'.
       
   276      MIMETypes commentStringsForFilename:'Object.st'. 
       
   277      MIMETypes commentStringsForFilename:'Foo.java'. 
       
   278     "
       
   279 !
       
   280 
   263 commentStringsForMimeType:mime suffix:suff
   281 commentStringsForMimeType:mime suffix:suff
   264     "return a useful comment definition; heuristics for now.
   282     "return a useful comment definition; heuristics for now.
   265      The returned value is an array of 2 elements;
   283      The returned value is an array of 2 elements;
   266      the first is the end-of-line comment string (or nil);
   284      the first is the end-of-line comment string (or nil);
   267      the second an array of opening/closing delimiters (or an array of nils)"
   285      the second an array of opening/closing delimiters (or an array of nils)"
   268 
   286 
       
   287     ^ self
       
   288         commentStringsForMimeType:mime suffix:suff 
       
   289         ifUnknown: #(';' (nil nil))  
       
   290 
       
   291     "
       
   292      |mime|
       
   293 
       
   294      mime := MIMETypes mimeTypeForFilename:'Makefile'.
       
   295      MIMETypes commentStringsForMimeType:mime suffix:nil.     
       
   296     "
       
   297 
       
   298     "
       
   299      |mime|
       
   300 
       
   301      mime := MIMETypes mimeTypeForFilename:'Object.st'.
       
   302      MIMETypes commentStringsForMimeType:mime suffix:nil.    
       
   303     "
       
   304 !
       
   305 
       
   306 commentStringsForMimeType:mime suffix:suff ifUnknown:alternativeBlockReturningCommentString
       
   307     "return a useful comment definition; heuristics for now.
       
   308      The returned value is an array of 2 elements;
       
   309      the first is the end-of-line comment string (or nil);
       
   310      the second an array of opening/closing delimiters (or an array of nils)"
       
   311 
   269     (mime = 'application/x-make') ifTrue:[
   312     (mime = 'application/x-make') ifTrue:[
   270         "/ makefile
   313         "/ makefile
   271         ^ #('#' (nil nil)).
   314         ^ #('#' (nil nil)).
   272     ].
   315     ].
   273     (mime = 'application/x-sh') ifTrue:[
   316     (mime = 'application/x-sh') ifTrue:[
   307     ].
   350     ].
   308     (suff = 'rs') ifTrue:[
   351     (suff = 'rs') ifTrue:[
   309         ^ #(';' (nil nil)).
   352         ^ #(';' (nil nil)).
   310     ].
   353     ].
   311 
   354 
   312     "/ default: shell comments
   355     ^ alternativeBlockReturningCommentString value
   313 
       
   314     ^ #(';' (nil nil)).
       
   315 
   356 
   316     "
   357     "
   317      |mime|
   358      |mime|
   318 
   359 
   319      mime := MIMETypes mimeTypeForFilename:'Makefile'.
   360      mime := MIMETypes mimeTypeForFilename:'Makefile'.
   530 ! !
   571 ! !
   531 
   572 
   532 !MIMETypes class methodsFor:'documentation'!
   573 !MIMETypes class methodsFor:'documentation'!
   533 
   574 
   534 version
   575 version
   535     ^ '$Header: /cvs/stx/stx/libview2/MIMETypes.st,v 1.32 2001-05-23 14:45:50 cg Exp $'
   576     ^ '$Header: /cvs/stx/stx/libview2/MIMETypes.st,v 1.33 2001-08-03 14:52:26 tm Exp $'
   536 ! !
   577 ! !
   537 MIMETypes initialize!
   578 MIMETypes initialize!