Mercurial > genshi > mirror
changeset 626:1fc90c02e2d8 trunk
Remove some obsoluete, unmaintained examples.
author | cmlenz |
---|---|
date | Fri, 31 Aug 2007 21:28:45 +0000 |
parents | abad7c2ebe15 |
children | 3ed77fbfafa8 |
files | examples/includes/common/macros.html examples/includes/module/test.html examples/includes/run.py examples/includes/skins/default/footer.html examples/includes/skins/default/header.html examples/includes/skins/default/layout.html examples/transform/README.txt examples/transform/index.html examples/transform/run.py examples/transform/template.xml |
diffstat | 10 files changed, 0 insertions(+), 180 deletions(-) [+] |
line wrap: on
line diff
deleted file mode 100644 --- a/examples/includes/common/macros.html +++ /dev/null @@ -1,12 +0,0 @@ -<div xmlns:py="http://genshi.edgewall.org/" - py:strip=""> - <div py:def="macro1">reference me, please</div> - <div py:def="macro2(name, classname='expanded')" class="${classname}"> - Hello ${name.title()} - </div> - <span py:match="greeting" class="greeting"> - Hello ${select('@name')} - </span> - <span py:match="span[@class='greeting']" style="text-decoration: underline" - py:content="select('text()')"/> -</div>
deleted file mode 100644 --- a/examples/includes/module/test.html +++ /dev/null @@ -1,22 +0,0 @@ -<!DOCTYPE html - PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" - "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" - xmlns:py="http://genshi.edgewall.org/" - xmlns:xi="http://www.w3.org/2001/XInclude"> - <xi:include href="${skin}/layout.html" /> - <xi:include href="custom_stuff.html"><xi:fallback/></xi:include> - <body class="$bozz"> - <ul py:attrs="{'id': 'second', 'class': None}" py:if="len(items) > 0"> - <li py:for="item in items">Item ${item.split()[-1]}</li> - XYZ ${hey} - </ul> - ${macro1()} ${macro1()} ${macro1()} - ${macro2('john')} - ${macro2('kate', classname='collapsed')} - <div py:content="macro2('helmut')" py:strip="">Replace me</div> - <greeting name="Dude" /> - <greeting name="King" /> - <span class="greeting">Hello Silicon</span> - </body> -</html>
deleted file mode 100755 --- a/examples/includes/run.py +++ /dev/null @@ -1,49 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- - -import os -import sys -import timing - -from genshi.template import Context, TemplateLoader - -def test(): - base_path = os.path.dirname(os.path.abspath(__file__)) - loader = TemplateLoader([os.path.join(base_path, 'skins'), - os.path.join(base_path, 'module'), - os.path.join(base_path, 'common')]) - - timing.start() - tmpl = loader.load('test.html') - timing.finish() - print ' --> parse stage: %dms' % timing.milli() - - data = dict(hello='<world>', skin='default', hey='ZYX', bozz=None, - items=['Number %d' % num for num in range(1, 15)]) - - print tmpl.generate(Context(**data)).render(method='html') - - times = [] - for i in range(100): - timing.start() - list(tmpl.generate(Context(**data))) - timing.finish() - times.append(timing.milli()) - sys.stdout.write('.') - sys.stdout.flush() - print - - print ' --> render stage: %dms (avg), %dms (min), %dms (max)' % ( - sum(times) / len(times), min(times), max(times)) - -if __name__ == '__main__': - if '-p' in sys.argv: - import hotshot, hotshot.stats - prof = hotshot.Profile("template.prof") - benchtime = prof.runcall(test) - stats = hotshot.stats.load("template.prof") - stats.strip_dirs() - stats.sort_stats('time', 'calls') - stats.print_stats() - else: - test()
deleted file mode 100644 --- a/examples/includes/skins/default/footer.html +++ /dev/null @@ -1,4 +0,0 @@ -<div id="footer"> - <hr /> - <h1>And goodbye</h1> -</div>
deleted file mode 100644 --- a/examples/includes/skins/default/header.html +++ /dev/null @@ -1,3 +0,0 @@ -<div id="masthead"> - <h1>Welcome</h1> -</div> \ No newline at end of file
deleted file mode 100644 --- a/examples/includes/skins/default/layout.html +++ /dev/null @@ -1,17 +0,0 @@ -<html xmlns="http://www.w3.org/1999/xhtml" - xmlns:py="http://genshi.edgewall.org/" - xmlns:xi="http://www.w3.org/2001/XInclude" - py:strip=""> - <xi:include href="../macros.html" /> - <head> - <title>Hello ${hello}</title> - <style type="text/css">@import(style.css)</style> - </head> - <body py:match="body"> - <xi:include href="header.html" /> - <div id="content"> - ${select('*')} - </div> - <xi:include href="footer.html" /> - </body> -</html>
deleted file mode 100644 --- a/examples/transform/README.txt +++ /dev/null @@ -1,3 +0,0 @@ -This example shows how to transform some HTML input, while adding -elements such as headers, and using <em>/<strong> instead of <i>/<b>. -The output is that a proper XTHML document.
deleted file mode 100644 --- a/examples/transform/index.html +++ /dev/null @@ -1,24 +0,0 @@ -<HTML> - <HEAD> - <TITLE>Aaarrgh</TITLE> - <LINK REL=stylesheet href='badstyle.css'> - </HEAD> - - <BODY> - <H1>Aaargh</H1> - <P> - <B>Lorem <I>ipsum</I></B> dolor sit amet, consectetur<BR> - adipisicing elit, sed do eiusmod tempor incididunt ut<BR> - labore et dolore magna aliqua. Ut enim ad minim veniam,<BR> - quis nostrud exercitation ullamco laboris nisi ut<BR> - aliquip ex ea commodo consequat. - </P> - <P> - Duis aute irure dolor in reprehenderit in voluptate velit<BR> - esse cillum dolore eu fugiat nulla pariatur. Excepteur sint<BR> - occaecat cupidatat non proident, sunt in culpa qui officia<BR> - deserunt mollit anim <I>id est laborum</I>. - </P> - </BODY> - -</HTML>
deleted file mode 100644 --- a/examples/transform/run.py +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- - -import os -import sys - -from genshi.input import HTMLParser -from genshi.template import Context, MarkupTemplate - -def transform(html_filename, tmpl_filename): - tmpl_fileobj = open(tmpl_filename) - tmpl = MarkupTemplate(tmpl_fileobj, tmpl_filename) - tmpl_fileobj.close() - - html_fileobj = open(html_filename) - html = HTMLParser(html_fileobj, html_filename) - print tmpl.generate(Context(input=html)).render('xhtml') - html_fileobj.close() - -if __name__ == '__main__': - basepath = os.path.dirname(os.path.abspath(__file__)) - tmpl_filename = os.path.join(basepath, 'template.xml') - html_filename = os.path.join(basepath, 'index.html') - transform(html_filename, tmpl_filename)
deleted file mode 100644 --- a/examples/transform/template.xml +++ /dev/null @@ -1,22 +0,0 @@ -<!DOCTYPE html - PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" - "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns:py="http://genshi.edgewall.org/" py:strip=""> - - <!--! Add a header DIV on top of every page with a logo image --> - <body py:match="BODY|body"> - <div id="header"> - <img src="logo.png" alt="Bad Style"/> - </div> - ${select('*')} - </body> - - <!--! Use semantic instead of presentational tags for emphasis --> - <strong py:match="B|b">${select('*|text()')}</strong> - <em py:match="I|i">${select('*|text()')}</em> - - <!--! Include the actual HTML stream, which will be processed by the rules - defined above --> - ${input} - -</html>