Closed
Description
Desc
I want to include the newest post with tag "games". But the newest "games" post isn't the newest post at all. The rest directive post_list
(example below) doesn't return anything. It's caused by timeline filtering first.
The plugin should filter for tags first and apply the timeline filter in a second step.
Details to reproduce
Existing posts
- 20140719.news: tag: news
- 20140630.news: tag: photos
- 20140615.news: tag: games
Rest directive
.. post-list::
:start: 0
:stop: 1
:tags: games
Result
None
Expected Result
headline and date of 20140615.news
A fix may base on this patch
--- post_list.py.old 2014-07-19 08:59:55.814081440 +0200
+++ post_list.py 2014-07-19 08:49:48.887397065 +0200
@@ -129,6 +129,7 @@
else:
post_list_id = self.options.get('id', 'post_list_' + uuid.uuid4().hex)
+ filtered_timeline = []
posts = []
step = -1 if reverse is None else None
if show_all is None:
@@ -136,16 +137,21 @@
else:
timeline = [p for p in self.site.timeline if p.use_in_feeds]
- for post in timeline[start:stop:step]:
+ for post in timeline:
if tags:
cont = True
+ tags_lower = [t.lower() for t in post.tags]
for tag in tags:
- if tag in [t.lower() for t in post.tags]:
+ if tag in tags_lower:
cont = False
if cont:
continue
+ filtered_timeline.append(post)
+
+ for post in filtered_timeline[start:stop:step]:
+
if slugs:
cont = True
for slug in slugs: