]> sipb.mit.edu Git - ikiwiki.git/blob - doc/todo/else_parameter_for_map_plugin.mdwn
a59bcfd14d43d22310d678aca691d2681564ce8f
[ikiwiki.git] / doc / todo / else_parameter_for_map_plugin.mdwn
1 [[!tag patch]]
2
3 [[plugins/map]] (and I) could benefit from a bonus parameter:
4
5         else="Display this if no page matches the PageSpec"
6
7 This was quite simple, so I implemented this (branch "map" in my
8 ikiwiki repo, see my user page for the up-to-date URL). Not patched the
9 documentation yet, I'm waiting for feedback first, but I'll do it for sure. -- [[intrigeri]]
10
11 > Can't a [[plugins/conditional]] be for this?
12 > --[[Joey]]
13
14 >> Hmmm, what do you mean? Adding a syntax such as the one below?
15 >> Or something else?
16
17         \[[if test="map(" then="..." else="..."]]
18
19 >> What would you write in the `then` clause?
20 >> I'm not opposed at all to rewrite my two-liner, but I don't understand.
21 >> --[[intrigeri]]
22
23         \[[if  test="foo/*" then="""
24         [[map pages="foo/*"]]
25         """ else="no pages"]]
26
27 --[[Joey]]
28
29 >>> I'm not convinced: the syntax you're proposing implies to duplicate
30 >>> the pagespec (once in the test clause, and once in the map query), which I find
31 >>> not only inelegant, which I can live with, but also tiring and unpractical:
32 >>> my `else` suggestion
33 >>> finds its roots in map queries with rather long pagespecs. On the other
34 >>> hand, if I'm the only one using map in such a way, I can live with this
35 >>> heavy duplicated syntax without bloating the map plugin with features
36 >>> no-one but me needs. On the other other hand, the patch is a 3-liner.
37 >>> I'm not fixed yet, I'll think about it. --[[intrigeri]]
38
39 >>>> Write a [[plugins/template]] which accepts a pagespec and an
40 >>>> "else" clause, and then you won't have to duplicate the
41 >>>> pagespec. --[[JoshTriplett]]