snipsnap-help says of the {label-search} macro,
| Macro | Description | Parameters |
|---|
| label-search | type: Lister to render found snips (AtoZ, Vertical, Simple) name: Name of a Label to search for value: Value of the label too look for | Show all snips that have a certain label. |
You need to provide the named parameters
name and
value describing the label you want to search for snips with. The parameter
type defines the ListFormatter used to format the result, like Vertical, Simple, AtoZ.
One way to find out what values you need to give for
name and
value; visit a snip that has the label you want to search for, and follow the [add label] link. A table on the first [add label] page lists the
name and
value for all the snip's existing labels.
Example
Give some snips a label, for example a Category label
Customers. Now, use the label-search macro to retrive these...
{label-search:type=Vertical|name=Category|value=Customers}Note that if you don't have the option to give snips the label
Customers, you can add the option like this:
- Create a new snip called Customers
- Add a 'TypeLabel' to the snip and choose the 'Category' type
- Customers should now be in the list of categories when you add a CategoryLabel
Adding a {label-search} like the example above to your new
Customers snip would now be a cunning plan.
label-search: Number of arguments does not match{label-search:Category|Customers} produces:
snips with category: (0)
none found.
snips with category: (0)
none found.I've tried all sixteen possible combinations of | or = as a separator and C or c for category and H or h for help and " or no quotes around help - all give the same result.
{label-search:type=CategoryLabel|name=Category|value=snipsnap-documentation}- patched label search to correct display AtoZ rendered results
- patch snip-tree macro to only display the searched tree (see SnipSnap)
- patched AtoZ lister to display namespaces in index too (e.g. displays "config (SnipSnap)" instead of "config"). Also all snips with the same name (but different namespace) are listed.
Regarding 'overkill' - I agree but I did find hidden in the code another argument for the lister: Collator when used instead of AtoZ it only displays those letters that have listings. It has the same display problem that AtoZ had - so I patched it using ThoMo's patch as a guide.For Example {label-search:type=Collator|name=Category|value=FAQ}produces: