On 27 Jan 2007, at 18:03, Christoph Zwerschke wrote: > Frank F Chiang wrote: >> However, there is still a great deal of spacing and newlines in >> the page >> created by the Kid template. Is there any way to condense the >> templates >> even further? For example, it would be nice to be able to have >> all the >> spacing in the page to be eliminated and all the tags squeezed >> into one >> line (like what HTML Code Cleaner does)? >> >> The extra spacing and newlines are causing a 20% increase in page >> download size and I want to minimize this. > > You should try the formatting feature of Kid >= 0.9.4. It allows > various > output formats from human readable to no whitespace at all. > > http://kid-templating.org/guide.html#id4
I was never able to get this to work with TurboGears. I think because TG is wrapping kid too strongly to easily pass these parameters. :( Has anyone gotten that to work? In case it helps anyone else, I've been using this as an outer decorator in my "loggerhead" project (www.lag.net/loggerhead) to do the equivalent whitespace trimming: @decorator def strip_whitespace(f): def _f(*a, **kw): out = f(*a, **kw) orig_len = len(out) out = re.sub(r'\n\s+', '\n', out) out = re.sub(r'[ \t]+', ' ', out) out = re.sub(r'\s+\n', '\n', out) new_len = len(out) log.debug('Saved %sB (%d%%) by stripping whitespace.', human_size(orig_len - new_len), round(100.0 - float(new_len) * 100.0 / float (orig_len))) return out return _f robey ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ kid-template-discuss mailing list kid-template-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/kid-template-discuss