1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-27 12:07:19 +00:00

Extend timeline macro to allow a subfilter

This commit is contained in:
Jermolene 2014-09-13 11:06:50 +01:00
parent c44a3bb4a4
commit c4123ba374
2 changed files with 16 additions and 3 deletions

View File

@ -1,9 +1,9 @@
title: $:/core/macros/timeline title: $:/core/macros/timeline
tags: $:/tags/Macro tags: $:/tags/Macro
\define timeline(limit:"100",format:"DDth MMM YYYY") \define timeline(limit:"100",format:"DDth MMM YYYY",subfilter:"")
<div class="tc-timeline"> <div class="tc-timeline">
<$list filter="[!is[system]has[modified]!sort[modified]limit[$limit$]eachday[modified]]"> <$list filter="[!is[system]$subfilter$has[modified]!sort[modified]limit[$limit$]eachday[modified]]">
<div class="tc-menu-list-item"> <div class="tc-menu-list-item">
<$view field="modified" format="date" template="$format$"/> <$view field="modified" format="date" template="$format$"/>
<$list filter="[sameday{!!modified}!is[system]!sort[modified]]"> <$list filter="[sameday{!!modified}!is[system]!sort[modified]]">

View File

@ -1,6 +1,6 @@
title: TimelineMacro title: TimelineMacro
tags: Macros tags: Macros
modified: 20140905084423561 modified: 20140913100126081
caption: timeline caption: timeline
The timeline macro produces a list of tiddlers in reverse chronological order of modification date that is grouped by the date of the day of modification. The timeline macro produces a list of tiddlers in reverse chronological order of modification date that is grouped by the date of the day of modification.
@ -10,6 +10,19 @@ The timeline macro produces a list of tiddlers in reverse chronological order of
|!Position |!Name |!Description |!Default | |!Position |!Name |!Description |!Default |
|1st |limit |The maximum number of tiddlers to list |100 | |1st |limit |The maximum number of tiddlers to list |100 |
|2nd |format |A DateFormat string for formatting the date |DDth MMM YYYY | |2nd |format |A DateFormat string for formatting the date |DDth MMM YYYY |
|3rd |subfilter |A subfilter to include in the timeline filter (see below) | |
The subfilter and limit parameters are spliced into the filter string like this:
```
[!is[system]$subfilter$has[modified]!sort[modified]limit[$limit$]eachday[modified]]
```
To restrict the timeline to a particular tag, the subfilter can be set to something like `tag[mytag]`:
```
<<timeline limit:10 subfilter:"tag[mytag]">>
```
! Examples ! Examples