From 61ed480b1c55f4e4c68df55776f272903bc2f9d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20Noe=CC=81?= Date: Mon, 6 Aug 2012 16:36:46 +0200 Subject: [PATCH] Minimal documentation. --- README.md | 49 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 1b9728a..9d398f0 100644 --- a/README.md +++ b/README.md @@ -1 +1,48 @@ -A simple Django TemplateTag to help in the creation of tag clouds. +What is it ? +============ + +A simple Django TemplateTag (named compute\_tag\_cloud) to help in the creation of tag clouds. + +Tiny tutorial +============= + +Install the app in your Django project +-------------------------------------- + +This should be as simple as copying the 'django\_nuages\_tag' directory in your project and adding 'django\_nuages\_tag' to your `INSTALLED_APPS` settings. + +Example usage +------------- + +Given that we have a my\_favourite\_tools variable defined like this: + + my_favourite_tools = [{'name': 'Python', 'interest': 30}, + {'name': 'Django', 'interest': 70}, + {'name': 'PHP', 'interest': 6}, + {'name': 'Ruby', 'interest': 15}] + +We can do: + + {% compute_tag_cloud my_favourite_tools interest font_size 10 55 lin %} + +compute\_tag\_cloud will add a `font_size` attribute to each element in `my_favourite_tools` that is contained between 10 and 55 and is representative of the value of `interest`. The last parameter (`lin`) asks to use a linear formula to compute this tag cloud. Another option is to use a logarithmic formula (use the `log` parameter). You should test both options, but `log` will probably give you better results if there is a large variation in the values you want to compute. + +The rendering of the tag cloud can be done very simply with something in the lines of: + + {% for tool in my_favourite_tools %} + {{ tool.name }} + {% endfor %}