Changeset 3008
- Timestamp:
- 01/09/08 03:44:14 (11 months ago)
- Files:
-
- fullblogplugin/0.11/tracfullblog/htdocs/css/fullblog.css (modified) (1 diff)
- fullblogplugin/0.11/tracfullblog/macros.py (modified) (6 diffs)
- fullblogplugin/0.11/tracfullblog/templates/fullblog_macro_post.html (modified) (1 diff)
- fullblogplugin/0.11/tracfullblog/templates/fullblog.rss (modified) (1 diff)
- fullblogplugin/0.11/tracfullblog/web_ui.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
fullblogplugin/0.11/tracfullblog/htdocs/css/fullblog.css
r2956 r3008 116 116 } 117 117 118 div.blogflash h2, div.blogflash h3 { 119 margin-left: 0; 120 font-size: 1.2em; 121 } 122 123 div.blogflash h3 { 124 margin-left: 0; 125 font-size: 1.1em; 126 } 127 118 128 div.blogflash .blog-title { 119 129 font-size: 1.35em; fullblogplugin/0.11/tracfullblog/macros.py
r2928 r3008 27 27 [[BlogList]] 28 28 }}} 29 30 Available named arguments: 31 * `recent=` - max. number of posts 32 * `category=` - a category 33 * `author=` - an author 34 * `period=` - time period of the format YYYY/MM 35 * `heading=` - a heading for the list 36 * `format=` - type of display (see below for details) 37 * `max_size=` - max. number of characters to render for each post 29 38 30 Example showing allavailable named arguments:39 Example showing some available named arguments: 31 40 {{{ 32 [[BlogList(recent=5, category=trac, period=2007/12, author=osimons, format=float, heading=Some Trac Posts)]]41 [[BlogList(recent=5, max_size=250, period=2007/12, author=osimons, format=float, heading=Some Trac Posts)]] 33 42 }}} 34 43 35 44 The arguments for criteria are 'AND'-based, so the above example will render 36 at most 5 posts by 'osimons' in December 2007 with category 'trac'.45 at most 5 posts by 'osimons' in December 2007. 37 46 38 47 There is no heading unless specified. … … 40 49 Without restriction on recent number of posts, it will use the number currently 41 50 active in the Blog module as default for 'float' and 'full' rendering, but for rendering 42 of 'inline' list it will render all found as default unless restricted. 51 of 'inline' list it will render all found as default unless restricted. Additionally for 52 'float' and 'full' it will truncate content if it is larger than a max_size (if set). 43 53 44 54 The `format=` keyword argument supports rendering these formats: … … 62 72 format = args_dict.get('format', 'inline').lower() 63 73 heading = args_dict.get('heading', '') 74 max_size = int(args_dict.get('max_size', 0)) 64 75 65 76 # Get blog posts … … 95 106 elif format == 'full': 96 107 return self._render_full_format(formatter, post_list, 97 post_instances, heading )108 post_instances, heading, max_size) 98 109 99 110 elif format == 'float': 100 111 # Essentially a 'full' list - just wrapped inside a new div 101 112 return tag.div(self._render_full_format(formatter, post_list, 102 post_instances, heading),113 post_instances, heading, max_size), 103 114 class_="blogflash") 104 115 … … 106 117 raise TracError("Invalid 'format' argument used for macro %s." % name) 107 118 108 def _render_full_format(self, formatter, post_list, post_instances, heading): 119 def _render_full_format(self, formatter, post_list, post_instances, heading, 120 max_size): 109 121 """ Renters full blog posts. """ 110 122 out = tag.div(class_="blog") … … 114 126 'list_mode': True, 115 127 'execute_blog_macro': True} 128 if max_size: 129 data['blog_max_size'] = max_size 116 130 out.append(Chrome(self.env).render_template(formatter.req, 117 131 'fullblog_macro_post.html', data=data, fragment=True)) fullblogplugin/0.11/tracfullblog/templates/fullblog_macro_post.html
r2956 r3008 6 6 py:strip="not list_mode">${post.title}</a> 7 7 </h1> 8 <div id="blog-body"> 9 ${wiki_to_html(context(post.resource), post.body)} 8 <div id="blog-body" 9 py:with="do_shorten = defined('blog_max_size') and len(post.body) > blog_max_size"> 10 ${wiki_to_html(context(post.resource), do_shorten and post.body[:blog_max_size] + ' ... ' \ 11 or post.body)} 12 <p py:if="do_shorten"><a href="${href.blog(post.name)}">(Read more)</a></p> 10 13 </div> 11 14 <ul class="metainfo"> fullblogplugin/0.11/tracfullblog/templates/fullblog.rss
r2956 r3008 10 10 <language>en-US</language> 11 11 <generator>Trac ${trac.version}</generator> 12 <image py:if="chrome.logo.src ">12 <image py:if="chrome.logo.src_abs"> 13 13 <title>${project.name}</title> 14 <url>$chrome.logo.src </url>14 <url>$chrome.logo.src_abs</url> 15 15 <link>${abs_href.blog()}</link> 16 16 </image> fullblogplugin/0.11/tracfullblog/web_ui.py
r2956 r3008 421 421 elif field == 'description': 422 422 return format_to_oneliner(self.env, 423 context(resource=bp_resource), bc.comment) 423 context(resource=bp_resource), bc.comment, 424 shorten=True) 424 425 else: # A blog post 425 426 if field == 'url': … … 431 432 return format_to_oneliner(self.env, 432 433 context(resource=bp_resource), 433 bp.version==1 and bp.body or bp.version_comment) 434 bp.version==1 and bp.body or bp.version_comment, 435 shorten=True) 434 436 435 437 # ITemplateProvider methods
