Mercurial > hg > decoupage
diff decoupage/formatters.py @ 34:527ccb76d043
merged some stuff
author | k0s <k0scist@gmail.com> |
---|---|
date | Mon, 08 Feb 2010 11:44:20 -0500 |
parents | e384d4569ac3 fc1c479296c3 |
children | 20e3d138dc98 |
line wrap: on
line diff
--- a/decoupage/formatters.py Mon Feb 08 11:40:57 2010 -0500 +++ b/decoupage/formatters.py Mon Feb 08 11:44:20 2010 -0500 @@ -35,7 +35,11 @@ ### formatters class Ignore(object): - """ignore files of a certain pattern""" + """ + 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 + """ def __init__(self, ignore): self.match = ignore.split() @@ -76,7 +80,11 @@ data['files'] = _files class Sort(object): - """ determines how to sort the files in a directory """ + """ + determines how to sort the files in a directory; + right now only by case-insensitive alphabetically + * reverse : reverse the order of the sorting + """ def __init__(self, pattern): self.args = [i.strip() for i in pattern.split(',')] @@ -89,13 +97,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('_')]) @@ -103,8 +117,15 @@ 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': ':' } def __call__(self, request, data): @@ -136,7 +157,7 @@ for text, link in links ] class CSS(object): - """specify CSS for the page""" + """specify CSS used (whitespace separated list)""" def __init__(self, arg): self.css = arg.split()