Permalink
Browse files

support for client-side cloud tags

  • Loading branch information...
1 parent 787aeae commit 5189b6427db0947049a746214d53c541bd8ee977 @ralsina committed Dec 28, 2012
Showing with 23 additions and 0 deletions.
  1. +1 −0 CHANGES.txt
  2. +1 −0 nikola/data/themes/default/assets/css/slides.css
  3. +21 −0 nikola/plugins/task_render_tags.py
View
@@ -4,6 +4,7 @@ New in Master
Features
--------
+* Support for client-side cloud tags
* New ``slides`` directive, for image slideshows.
* New option DATE_FORMAT
* New "nikola console" command
@@ -4,6 +4,7 @@
margin-right: auto;
max-width: 80%;
width: 400px;
+ height: 300px;
}
.slide-current {
font-weight: bold;
@@ -23,6 +23,7 @@
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#from __future__ import unicode_literals
+import json
import os
from nikola.plugin_categories import Task
@@ -75,6 +76,26 @@ def gen_tasks(self):
yield self.list_tags_page(kw)
+ # Tag cloud json file
+ tag_cloud_data = {}
+ for tag, posts in self.site.posts_per_tag.items():
+ tag_cloud_data[tag] = [len(posts), self.site.link(
+ 'tag', tag, self.site.config['DEFAULT_LANG'])]
+ output_name = os.path.join(kw['output_folder'],
+ 'assets','js','tag_cloud_data.json')
+
+ def write_tag_data(data):
+ with open(output_name, 'wb+') as fd:
+ fd.write(json.dumps(data))
+
+ task = {
+ 'basename': str(self.name),
+ 'name': str(output_name)
+ }
+ task['uptodate'] = [utils.config_changed(tag_cloud_data)]
+ task['targets'] = [output_name]
+ task['actions'] = [(write_tag_data,[tag_cloud_data])]
+ yield task
def list_tags_page(self, kw):
"""a global "all your tags" page for each language"""

0 comments on commit 5189b64

Please sign in to comment.