# HG changeset patch # User k0s # Date 1265647460 18000 # Node ID 527ccb76d0431240661f36b200aad81b7ef5a461 # Parent e384d4569ac307b6f06b5047beaa99593c118a45# Parent 89a72b2fd149bffcebd6c1fefb10e56c7ba3e34d merged some stuff diff -r 89a72b2fd149 -r 527ccb76d043 decoupage/formatters.py --- a/decoupage/formatters.py Tue Feb 02 18:04:02 2010 +0000 +++ b/decoupage/formatters.py Mon Feb 08 11:44:20 2010 -0500 @@ -15,7 +15,6 @@ defaults = {} # default values for attrs to be set on the instance - def __init__(self, string): args = [ i.strip() for i in string.split(',')] for index, arg in enumerate(args): @@ -41,7 +40,6 @@ 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() @@ -66,7 +64,6 @@ def __init__(self, pattern): self.match = pattern.split() - def __call__(self, request, data): _files = [] @@ -141,6 +138,24 @@ f['title'] = f['description'] f['description'] = None +class Links(FormatterBase): + """ + allow list of links per item: + foo.html = description of foo; [PDF]=foo.pdf; [TXT]=foo.txt + """ + + defaults = { 'separator': ';' } + + def __call__(self, request, data): + for f in data['files']: + if f['description'] and self.separator in f['description']: + f['description'], links = f['description'].split(self.separator, 1) + links = links.split(self.separator) + assert min(['=' in link for link in links]) + links = [ link.split('=', 1) for link in links ] + f['links'] = [ { 'text': text, 'link': link } + for text, link in links ] + class CSS(object): """specify CSS used (whitespace separated list)""" @@ -149,6 +164,22 @@ def __call__(self, request, data): data['css'] = self.css +class JavaScript(object): + """specify JS for the page""" + + def __init__(self, arg): + self.scripts = arg.split() + def __call__(self, request, data): + data['scripts'] = self.scripts + +class Favicon(object): + """specify favicons for the page""" + + def __init__(self, icon): + self.icon = icon + def __call__(self, request, data): + data['icon'] = self.icon + class Include(object): """include a file at the top of the body""" diff -r 89a72b2fd149 -r 527ccb76d043 decoupage/templates/index.html --- a/decoupage/templates/index.html Tue Feb 02 18:04:02 2010 +0000 +++ b/decoupage/templates/index.html Mon Feb 08 11:44:20 2010 -0500 @@ -6,15 +6,25 @@ xmlns:xi="http://www.w3.org/2001/XInclude"> ${title or path} + + + -