Commits

Anonymous committed 89ca7ea

[svn r9341] FullBlogPlugin: The `[[BlogList]]` macro now supports `meta=off` to hide post metadata (timestamp, author, categories) when listing.

  • Participants
  • Parent commits 3214559

Comments (0)

Files changed (3)

File 0.11/tracfullblog/macros.py

      * `heading=` - a heading for the list
      * `format=` - type of display (see below for details)
      * `max_size=` - max. number of characters to render for each post
+     * `meta=` - use `=off` to hide date, author and categories (default 'on')
 
     Example showing some available named arguments:
     {{{
         format = args_dict.get('format', 'inline').lower()
         heading = args_dict.get('heading', '')
         max_size = int(args_dict.get('max_size', 0))
+        show_meta = args_dict.get('meta', '') != 'off' and True or False
 
         # Get blog posts
         all_posts = get_blog_posts(self.env, author=author, category=category,
         if format == 'inline':
             data = {'heading': heading,
                     'posts': post_list,
+                    'show_meta': show_meta,
                     'execute_blog_macro': True}
             return Chrome(self.env).render_template(formatter.req,
                     'fullblog_macro_monthlist.html', data=data, fragment=True)
 
         elif format == 'full':
             return self._render_full_format(formatter, post_list,
-                                            post_instances, heading, max_size)
+                                post_instances, heading, max_size, show_meta)
 
         elif format == 'float':
             # Essentially a 'full' list - just wrapped inside a new div
             return tag.div(self._render_full_format(formatter, post_list,
-                                    post_instances, heading, max_size),
+                                post_instances, heading, max_size, show_meta),
                             class_="blogflash")
 
         else:
             raise TracError("Invalid 'format' argument used for macro %s." % name)
 
     def _render_full_format(self, formatter, post_list, post_instances, heading,
-                                    max_size):
+                                    max_size, metadata):
         """ Renters full blog posts. """
         out = tag.div(class_="blog")
         out.append(tag.div(heading, class_="blog-list-title"))
         for post in post_instances:
             data = {'post': post,
                     'list_mode': True,
+                    'show_meta': show_meta,
                     'execute_blog_macro': True}
             if max_size:
                 data['blog_max_size'] = max_size

File 0.11/tracfullblog/templates/fullblog_macro_monthlist.html

       <ul>
         <li py:for="name, version, time, author, title, body, categories in posts">
           <a href="${req.href.blog(name)}">${title}</a>
-          <span class="metainfo">
+          <span class="metainfo" py:if="not defined('show_meta') and True or show_meta">
             &nbsp;-- Posted on ${format_datetime(time, '%Y-%m-%d %H:%M')}
             <py:if test="not blog_personal_blog">
               : author <a href="${req.href.blog('author', author)}">${author}</a>

File 0.11/tracfullblog/templates/fullblog_macro_post.html

           or post.body)}
         <p py:if="do_shorten"><a href="${href.blog(post.name)}">(Read more)</a></p>
     </div>
-    <ul class="metainfo">
+    <ul class="metainfo" py:if="not defined('show_meta') and True or show_meta">
       <li class="metadates">Posted: ${format_datetime(post.publish_time, '%Y-%m-%d %H:%M')}
         <span class="metaupdated" py:if="len(post.versions) > 1">
           (Updated: ${format_datetime(post.version_time, '%Y-%m-%d %H:%M')})