changeset 53:9c15bde43ae6

dont capitalize unimportant words
author Jeff Hammel <jhammel@mozilla.com>
date Thu, 04 Nov 2010 18:51:30 -0700
parents 8002dcdb8e82
children 0e2b9e0507c5
files decoupage/formatters.py
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/decoupage/formatters.py	Wed Nov 03 18:41:42 2010 -0700
+++ b/decoupage/formatters.py	Thu Nov 04 18:51:30 2010 -0700
@@ -129,6 +129,7 @@
     # TODO : deal with CamelCaseFilenames
 
     separators = ['_', '-'] # space substitute separators
+    lesser_words = [ 'or', 'a', 'the', 'on', 'of' ] # unimportant words
 
     def __call__(self, request, data):
         for f in data['files']:
@@ -139,8 +140,9 @@
                 decription = description.strip('_')
                 for separator in self.separators:
                     if separator in description:
-                        description = ' '.join([i.title() for i in description.split(separator)])
-                        
+                        description = ' '.join([(i in self.lesser_words) and i or i.title()
+                                                for i in description.split(separator)])
+                        description = description[0].upper() + description[1:]
                 f['description'] = description