← Back to team overview

launchpad-dev team mailing list archive

[Bug 240432] Re: "List" macro in templates

 

Fwiw, canonical.launchpad.helpers.english_list() joins lists of strings
according to the advice in The Elements of Style. It has tests too.
Might save someone a few minutes.

-- 
"List" macro in templates
https://bugs.launchpad.net/bugs/240432
You received this bug notification because you are a member of Launchpad
Community Development Team, which is the registrant for launchpad-web.

Status in Launchpad Web UI: Triaged

Bug description:
We sometimes need to list items in the UI that are short enough to render as running text, but have enough templating in them not to belong in browser code.

A single macro ought to let us generate comma-separated lists of things that each take fmt:url and such to render.

Advanced versions could do things like add an "and" where appropriate ("x and y" but also "x, y, and z"); cut the list short with an ellipsis if it gets too long ("alpha, beta, gamma, delta, epsilon, zeta, ..."); let the user "fold" long lists; or provide other navigation aids.

mpt has been using "tal:comma" for cases where he'd want a macro like this, so if we ever implement this, grep the templates for that.