Author: gregoryjnewman
Date: Sat Oct  4 08:16:12 2008
New Revision: 1007

Added:
    trunk/apps/local_apps/blog/templates/article_content.html
    trunk/apps/local_apps/blog/templates/article_teaser.html
    trunk/apps/local_apps/blog/templatetags/__init__.pyc   (contents, props  
changed)
    trunk/apps/local_apps/blog/templatetags/blog.py
    trunk/apps/local_apps/blog/templatetags/blog.pyc   (contents, props  
changed)
    trunk/apps/local_apps/blog/templatetags/blog_tags.pyc   (contents, props  
changed)

Log:
adding templatetags and templates for blog markup

Added: trunk/apps/local_apps/blog/templates/article_content.html
==============================================================================
--- (empty file)
+++ trunk/apps/local_apps/blog/templates/article_content.html   Sat Oct  4  
08:16:12 2008
@@ -0,0 +1,14 @@
+{% load blog %}
+{% load markup %}
+{% load switchcase %}
+{% load restructuredtext %}
+{% load creole %}
+
+{% switch markup %}
+    {% case 'crl' %} {{ content|creole|safe }} {% endcase %}
+    {% case 'rst' %} {{ content|restructuredtext|safe }} {% endcase %}
+    {% case 'mrk' %} {{ content|force_escape|markdown }} {% endcase %}
+    {% case 'txl' %} {{ content|force_escape|textile }} {% endcase %}
+    {% case '' %} {{ content|force_escape|linebreaks|safe }} {% endcase %}
+{% endswitch %}
+

Added: trunk/apps/local_apps/blog/templates/article_teaser.html
==============================================================================
--- (empty file)
+++ trunk/apps/local_apps/blog/templates/article_teaser.html    Sat Oct  4  
08:16:12 2008
@@ -0,0 +1,20 @@
+
+{% load blog %}
+{% load avatar_tags %}
+
+<tr class="{% cycle odd,even %}">
+    <td class="meta">
+        <div class="avatar">{% avatar article.latest_changeset.editor  
40 %}</div>
+        <div class="details">
+            <a href="{% url profiles.views.profile  
article.latest_changeset.editor.username %}">
+                {{ article.latest_changeset.editor }}
+            </a>
+        </div>
+        {{ article.last_update|date }}
+    </td>
+    <td>
+        <h2><a href="{{ article.get_absolute_url }}">{{ article.title  
}}</a></h2>
+        <div class="body">{% render_content article 'summary' %}</div>
+    </td>
+</tr>
+

Added: trunk/apps/local_apps/blog/templatetags/__init__.pyc
==============================================================================
Binary file. No diff available.

Added: trunk/apps/local_apps/blog/templatetags/blog.py
==============================================================================
--- (empty file)
+++ trunk/apps/local_apps/blog/templatetags/blog.py     Sat Oct  4 08:16:12 2008
@@ -0,0 +1,54 @@
+# -*- coding: utf-8 -*-
+
+import re
+from django import template
+from django.conf import settings
+from django.utils.encoding import force_unicode
+from django.utils.safestring import mark_safe
+
+
+register = template.Library()
+
+
[EMAIL PROTECTED]('wiki/article_content.html')
+def render_content(article, content_attr='content', markup_attr='markup'):
+    """ Display an the body of an article, rendered with the right markup.
+
+    - content_attr is the article attribute that will be rendered.
+    - markup_attr is the article atribure with the markup that used
+      on the article. the choices are:
+      - 'rst' for reStructuredText
+      - 'mrk' for Markdown
+      - 'txl' for Textile
+
+    Use examples on templates:
+
+        {# article have a content and markup attributes #}
+        {% render_content article %}
+
+        {# article have a body and markup atributes #}
+        {% render_content article 'body' %}
+
+        {# we want to display the  summary instead #}
+        {% render_content article 'summary' %}
+
+        {# post have a tease and a markup_style attributes #}
+        {% render_content post 'tease' 'markup_style' %}
+
+        {# essay have a content and markup_lang attributes #}
+        {% render_content essay 'content' 'markup_lang' %}
+
+    """
+    return {
+        'content': getattr(article, content_attr),
+        'markup': getattr(article, markup_attr)
+    }
+
+
[EMAIL PROTECTED]('wiki/article_teaser.html')
+def show_teaser(article):
+    """ Show a teaser box for the summary of the article.
+    """
+    return {'article': article}
+
+

Added: trunk/apps/local_apps/blog/templatetags/blog.pyc
==============================================================================
Binary file. No diff available.

Added: trunk/apps/local_apps/blog/templatetags/blog_tags.pyc
==============================================================================
Binary file. No diff available.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pinax-updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pinax-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to