From c6c4cf2289f3bba2709f48422abb9838d540894e Mon Sep 17 00:00:00 2001 From: Jermolene Date: Mon, 8 Sep 2014 18:58:48 +0100 Subject: [PATCH] Improve timeline macro --- core/ui/MoreSideBar/Recent.tid | 2 +- core/ui/SideBar/Recent.tid | 2 +- core/wiki/macros/timeline.tid | 8 ++++--- .../tw5.com/tiddlers/macros/TimelineMacro.tid | 21 +++++++++++++++++++ 4 files changed, 28 insertions(+), 5 deletions(-) create mode 100644 editions/tw5.com/tiddlers/macros/TimelineMacro.tid diff --git a/core/ui/MoreSideBar/Recent.tid b/core/ui/MoreSideBar/Recent.tid index eba662616..045afe434 100644 --- a/core/ui/MoreSideBar/Recent.tid +++ b/core/ui/MoreSideBar/Recent.tid @@ -2,4 +2,4 @@ title: $:/core/ui/MoreSideBar/Recent tags: $:/tags/MoreSideBar caption: {{$:/language/SideBar/Recent/Caption}} -<> +<$macrocall $name="timeline" format={{$:/language/RecentChanges/DateFormat}}/> diff --git a/core/ui/SideBar/Recent.tid b/core/ui/SideBar/Recent.tid index 76b072a7c..19d09945d 100644 --- a/core/ui/SideBar/Recent.tid +++ b/core/ui/SideBar/Recent.tid @@ -2,4 +2,4 @@ title: $:/core/ui/SideBar/Recent tags: $:/tags/SideBar caption: {{$:/language/SideBar/Recent/Caption}} -{{$:/snippets/recentchanges}} +<$macrocall $name="timeline" format={{$:/language/RecentChanges/DateFormat}}/> diff --git a/core/wiki/macros/timeline.tid b/core/wiki/macros/timeline.tid index 4050ff962..60481ba7a 100644 --- a/core/wiki/macros/timeline.tid +++ b/core/wiki/macros/timeline.tid @@ -1,10 +1,11 @@ title: $:/core/macros/timeline tags: $:/tags/Macro -\define timeline() -<$list filter="[!is[system]has[modified]!sort[modified]limit[100]eachday[modified]]"> +\define timeline(limit:"100",format:"DDth MMM YYYY") +
+<$list filter="[!is[system]has[modified]!sort[modified]limit[$limit$]eachday[modified]]">
-<$view field="modified" format="date" template={{$:/language/RecentChanges/DateFormat}}/> +<$view field="modified" format="date" template="$format$"/> <$list filter="[sameday{!!modified}!is[system]!sort[modified]]">
<$link to={{!!title}}> @@ -14,4 +15,5 @@ tags: $:/tags/Macro
+
\end diff --git a/editions/tw5.com/tiddlers/macros/TimelineMacro.tid b/editions/tw5.com/tiddlers/macros/TimelineMacro.tid new file mode 100644 index 000000000..31ce8efcf --- /dev/null +++ b/editions/tw5.com/tiddlers/macros/TimelineMacro.tid @@ -0,0 +1,21 @@ +title: TimelineMacro +tags: macros +modified: 20140905084423561 + +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. + +! Parameters + +|!Position |!Name |!Description |!Default | +|1st |limit |The maximum number of tiddlers to list |100 | +|2nd |format |A DateFormat string for formatting the date |DDth MMM YYYY | + +! Examples + +``` +<> +``` + +Renders as: + +<>