Mercurial > hg > decoupage
diff decoupage/formatters.py @ 28:fc1c479296c3
more docmentation updates
author | k0s <k0scist@gmail.com> |
---|---|
date | Tue, 19 Jan 2010 09:15:35 -0500 |
parents | 9e86c5cb111a |
children | 527ccb76d043 |
line wrap: on
line diff
--- a/decoupage/formatters.py Mon Jan 18 15:33:42 2010 -0500 +++ b/decoupage/formatters.py Tue Jan 19 09:15:35 2010 -0500 @@ -37,7 +37,8 @@ class Ignore(object): """ - ignore files of a glob patterns. These files will not be used in the index template. + ignore files of a glob patterns. + These files will not be linked to in the template. e.g. /ignore = .* *.pdf # don't list dotfiles and PDFs """ @@ -85,7 +86,7 @@ """ determines how to sort the files in a directory; right now only by case-insensitive alphabetically - * reverse : reverse the + * reverse : reverse the order of the sorting """ def __init__(self, pattern): self.args = [i.strip() for i in pattern.split(',')] @@ -99,13 +100,19 @@ class FilenameDescription(FormatterBase): - """substitute the description for the filename""" + """ + obtain the description from the filename + the file extension (if any) will be dropped and + spaces will be substituted for underscores + """ + # TODO : deal with CamelCaseFilenames def __call__(self, request, data): for f in data['files']: if f['description'] is None: description = f['name'] - description = description.rsplit('.', 1)[0] + if '.' in description: + description = description.rsplit('.', 1)[0] decription = description.strip('_') if '_' in description: description = ' '.join([i.title() for i in description.split('_')]) @@ -113,8 +120,14 @@ class TitleDescription(FormatterBase): - """splits a description into a title and a description with a separator""" - + """ + splits a description into a title and a description via a separator in + the description. The template will now have an additional variable, + 'title', per file + Arguments: + * separator: what separator to use (':' by default) + """ + # XXX what about setting the page title? defaults = { 'separator': ':' } @@ -129,7 +142,7 @@ f['description'] = None class CSS(object): - """specify CSS""" + """specify CSS used (whitespace separated list)""" def __init__(self, arg): self.css = arg.split()