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:[ |