Edgewall Software
Modify

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

macros.r10668.patch (2.4 KB) - added by ryano@… 14 months ago.
First cut at a patch.
macros.r10671.patch (3.6 KB) - added by Ryan J Ollos <ryano@…> 14 months ago.
macros.r10672.patch (3.4 KB) - added by Ryan J Ollos <ryano@…> 14 months ago.

Download all attachments as: .zip

Change History

Changed 14 months ago by ryano@…

First cut at a patch.

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: 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: 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@…>

comment:6 in reply to: ↑ 5 ; follow-up: 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@…>

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.

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as new
as The resolution will be set. Next status will be 'closed'
to The owner will be changed from (none). Next status will be 'new'
The owner will be changed from (none) to anonymous. Next status will be 'assigned'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.