Ticket #10120 (new enhancement)
Opened 14 months ago
Last modified 12 months ago
Add a `format` parameter to the RecentChanges macro
| Reported by: | Ryan J Ollos <ryano@…> | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | 0.13 |
| Component: | wiki system | Version: | 0.13dev |
| Severity: | normal | Keywords: | bitesized, macro |
| Cc: | |||
| Release Notes: | |||
| API Changes: | |||
Description
Add a format parameter to the RecentChanges macro with the following allowed values:
- groupbydate (default) - the current display format
- list - list each page on a separate line, a bullet ed list, same as the current display but without the date shown.
For reference, two macros accept a format parameter: WikiMacros#TitleIndex-macro and WikiMacros#TicketQuery-macro.
A patch will be provided shortly.
Attachments
Change History
Changed 14 months ago by ryano@…
- Attachment macros.r10668.patch added
comment:1 Changed 14 months ago by anonymous
There is an extra whitespace in the help text that should be corrected before committing the patch. The current behavior is that any value for format other than format=groupbydate
Here are the test cases I used:
{{{
[[RecentChanges]]
}}}
[[RecentChanges]]
{{{
[[RecentChanges(,3)]]
}}}
[[RecentChanges(,3)]]
{{{
[[RecentChanges(SandBox,3)]]
}}}
[[RecentChanges(SandBox,3)]]
{{{
[[RecentChanges(SandBox)]]
}}}
[[RecentChanges(SandBox)]]
{{{
[[RecentChanges(SandBox,format=list)]]
}}}
[[RecentChanges(SandBox,format=list)]]
{{{
[[RecentChanges(format=list)]]
}}}
[[RecentChanges(format=list)]]
{{{
[[RecentChanges(, 5, format=list)]]
}}}
[[RecentChanges(, 5, format=list)]]
{{{
[[RecentChanges(SandBox, 5, format=list)]]
}}}
[[RecentChanges(SandBox, 5, format=list)]]
{{{
[[RecentChanges(SandBox, 5, format=groupbydate)]]
}}}
[[RecentChanges(SandBox, 5, format=groupbydate)]]
{{{
[[RecentChanges(SandBox, format=groupbydate)]]
}}}
[[RecentChanges(SandBox, format=groupbydate)]]
{{{
[[RecentChanges(format=groupbydate)]]
}}}
[[RecentChanges(format=groupbydate)]]
{{{
[[RecentChanges(format=groupbydate, , 3)]]
}}}
[[RecentChanges(format=groupbydate, , 3)]]
{{{
[[RecentChanges(format=groupbydate, SandBox, 3)]]
}}}
[[RecentChanges(format=groupbydate, SandBox, 3)]]
comment:2 Changed 14 months ago by anonymous
Submitted my previous comment before finishing what I was writing …
The current behavior is that any value for format other than format=groupbydate results in the list format. I was thinking this might be expanded on in the future to add a format=compact option.
comment:3 follow-up: ↓ 5 Changed 14 months ago by cboos
Nice proposal, thanks!
Two remarks:
- as this is 0.13 material, please use the x if b else y style instead of b and x or y (see #9536)
- for format=list, I think it would be more appropriate to generate a single list; even if this will probably make the patch a bit longer, it more important to have a semantically correct output
comment:4 Changed 14 months ago by rblank
- Milestone set to 0.13
comment:5 in reply to: ↑ 3 ; follow-up: ↓ 6 Changed 14 months ago by anonymous
Replying to cboos:
Nice proposal, thanks!
Two remarks:
- as this is 0.13 material, please use the x if b else y style instead of b and x or y (see #9536)
- for format=list, I think it would be more appropriate to generate a single list; even if this will probably make the patch a bit longer, it more important to have a semantically correct output
I've incorporated those changes. I'm not super happy with the list generation … perhaps someone will be more clever than I have been in coding this. However, it seems to work correctly at least.
Changed 14 months ago by Ryan J Ollos <ryano@…>
- Attachment macros.r10671.patch added
comment:6 in reply to: ↑ 5 ; follow-up: ↓ 7 Changed 14 months ago by cboos
Replying to anonymous:
I've incorporated those changes.
Nice, thanks!
I'm not super happy with the list generation …
For example you could add an extra transformation step to entries_per_date and factor out the part:
tag.li(tag.a(page, href=formatter.href.wiki(name)), ' ', ... ... for date, entries in entries_per_date
into:
items_per_date = [(date, [tag.li(...)
for ...])
for ... in entries_per_date]
and from that produce either the (<h3>, <ul>) sequence or a single <ul>.
Changed 14 months ago by Ryan J Ollos <ryano@…>
- Attachment macros.r10672.patch added
comment:7 in reply to: ↑ 6 Changed 14 months ago by Ryan J Ollos <ryano@…>
Replying to cboos:
For example you could add an extra transformation step to entries_per_date and factor out the part: …
Thank you for the pointers! I attempted to incorporate those changes into the latest patch.
comment:8 Changed 12 months ago by Ryan J Ollos <ryano@…>
I've been looking closely at the syntax of the TicketQuery macro and am thinking about some ways that we can make the new arguments to this macro more like the format and group arguments of the TicketQuery macro, for consistency. I'll post some more comments about this shortly.



First cut at a patch.