about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2012-06-16 00:30:40 +0200
committerhut <hut@lavabit.com>2012-06-16 01:01:56 +0200
commitc9000fed8f7907284391eb36e2a3138752205830 (patch)
tree9eec60e2849c29bf9af69efe71513d5a97551950
parent003a26e0f232742c09ed237260cd8216c1a951e1 (diff)
downloadranger-c9000fed8f7907284391eb36e2a3138752205830.tar.gz
fsobject.fsobject: better recognition of documents
-rw-r--r--ranger/fsobject/fsobject.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/ranger/fsobject/fsobject.py b/ranger/fsobject/fsobject.py
index a29c8bcb..1fadc360 100644
--- a/ranger/fsobject/fsobject.py
+++ b/ranger/fsobject/fsobject.py
@@ -4,6 +4,11 @@
 CONTAINER_EXTENSIONS = ('7z', 'ace', 'ar', 'arc', 'bz', 'bz2', 'cab', 'cpio',
 	'cpt', 'deb', 'dgc', 'dmg', 'gz', 'iso', 'jar', 'msi', 'pkg', 'rar',
 	'shar', 'tar', 'tbz', 'tgz', 'xar', 'xpi', 'xz', 'zip')
+DOCUMENT_EXTENSIONS = ('odt', 'ods', 'odp', 'odf', 'odg', 'sxc', 'xls', 'xslx',
+	'xlw', 'gnm', 'gnumeric', 'doc', 'docx', 'rtf', 'djvu', 'pdf', 'pod',
+	'xml', 'html', 'htm', 'css', 'txt', 'cvs', 'md', 'cfg')
+DOCUMENT_BASENAMES = ('copying', 'todo', 'readme', 'bugs', 'license', 'bugs',
+	'changelog', 'install', 'help', 'credits', 'hacking')
 
 import re
 from os import lstat, stat
@@ -136,7 +141,9 @@ class FileSystemObject(FileManagerAware):
 		self.image = self._mimetype.startswith('image')
 		self.audio = self._mimetype.startswith('audio')
 		self.media = self.video or self.image or self.audio
-		self.document = self._mimetype.startswith('text')
+		self.document = self._mimetype.startswith('text') \
+				or self.extension in DOCUMENT_EXTENSIONS \
+				or self.basename.lower() in DOCUMENT_BASENAMES
 		self.container = self.extension in CONTAINER_EXTENSIONS
 
 		keys = ('video', 'audio', 'image', 'media', 'document', 'container')