[Checkins] SVN: megrok.genshi/trunk/README.txt An attempt to
documentation.
Lennart Regebro
regebro at gmail.com
Mon Nov 12 17:50:54 EST 2007
Log message for revision 81796:
An attempt to documentation.
Changed:
U megrok.genshi/trunk/README.txt
-=-
Modified: megrok.genshi/trunk/README.txt
===================================================================
--- megrok.genshi/trunk/README.txt 2007-11-12 21:44:41 UTC (rev 81795)
+++ megrok.genshi/trunk/README.txt 2007-11-12 22:50:53 UTC (rev 81796)
@@ -11,16 +11,49 @@
Requirements
------------
-- Genshi. Tested with v 0.4.4.
-- Grok v0.11 or later. Tested with 0.11.
+- Genshi. Tested with v 0.4.4.
+- Grok v0.11 or later. Tested with 0.11.
Installation
------------
-I don't really know yet, because I'm just trying out how to make eggs and
-install the stuff.
+To use Genshi under Grok all you need is to add megrok.genshi as an egg in
+your buildout.cfg. Assuming you used grokproject to create your buildout,
+you should add it to the eggs list under the headings [app] and [test].
+You also need to add <include package="megrok.genshi" /> to your site.zcml,
+also under the [app] heading in your buildout.cfg.
+Then run bin/buildout again, and it should now fetch and install the eggs
+for both Genshi and megrok.genshi.
+
+Usage
+-----
+
+megrok.genshi supports the Grok standard of placing templates in a templates
+directory, for example app_templates, so you can use Genshi by simply placing
+the Genshi templates in the templates directory, just as you would with ZPT
+templates. Although Genshi itself doesn't have a standard for the file
+extensions for Genshi templates, Grok needs to have an association between an
+extension and a type so it knows which type of template each template is.
+megrok.genshi defines the extension .g for Genshi HTML templates and .gt for
+Genshi Text templates. Genshi can also include templates, and although you can
+use any extension for this we recommend you use .gi for any include templates,
+to avoid any clashes with other templating languages.
+
+You can also use Genshi templates inline. The syntax for this is:
+
+ from megrok.genshi.components import GenshiMarkupTemplate, GenshiTextTemplate
+
+ index = GenshiMarkupTemplate('<html>the html code</html>')
+ index = GenshiMarkupTemplate('Text templates')
+
+Or if you use files
+
+ index = GenshiMarkupTemplate(filename='thefilename.html')
+ index = GenshiMarkupTemplate(filename='thefilename.txt')
+
+
Authors
-------
More information about the Checkins
mailing list