]> sipb.mit.edu Git - ikiwiki.git/blobdiff - doc/todo/else_parameter_for_map_plugin.mdwn
at this point I'm down to deciding which specific commits to merge and
[ikiwiki.git] / doc / todo / else_parameter_for_map_plugin.mdwn
index 859b027e799e77db8f9a67ace35ac79ee53fa71c..981e50d43803959a09d9d5ec682d88ba1e8f6b73 100644 (file)
@@ -1,4 +1,4 @@
-[[!tag patch]]
+[[!tag patch done]]
 
 [[plugins/map]] (and I) could benefit from a bonus parameter:
 
@@ -14,14 +14,14 @@ documentation yet, I'm waiting for feedback first, but I'll do it for sure. -- [
 >> Hmmm, what do you mean? Adding a syntax such as the one below?
 >> Or something else?
 
-        \[[if test="map(" then="..." else="..."]]
+        \[[!if test="map(" then="..." else="..."]]
 
 >> What would you write in the `then` clause?
 >> I'm not opposed at all to rewrite my two-liner, but I don't understand.
 >> --[[intrigeri]]
 
-       \[[if  test="foo/*" then="""
-       [[map pages="foo/*"]]
+       \[[!if  test="foo/*" then="""
+       [[!map pages="foo/*"]]
        """ else="no pages"]]
 
 --[[Joey]]
@@ -35,3 +35,22 @@ documentation yet, I'm waiting for feedback first, but I'll do it for sure. -- [
 >>> heavy duplicated syntax without bloating the map plugin with features
 >>> no-one but me needs. On the other other hand, the patch is a 3-liner.
 >>> I'm not fixed yet, I'll think about it. --[[intrigeri]]
+
+>>>> Write a [[plugins/template]] which accepts a pagespec and an
+>>>> "else" clause, and then you won't have to duplicate the
+>>>> pagespec. --[[JoshTriplett]]
+
+>>>> Yeah, the patch is obviously very simple. My problem with it really is
+>>>> that there would seem to be several other places in ikiwiki where
+>>>> someone might want to be able to handle an "else" case where a
+>>>> pagespec expands to nothing. And adding else cases for all of them
+>>>> could be a bit much. --[[Joey]]
+
+>>>>> Agreed, and tagging as done. For the record, here is the [[plugins/template]] I use:
+
+        \[[!if test="<TMPL_VAR raw_pages>"
+        then="""<TMPL_VAR intro>
+        [[!map pages="<TMPL_VAR raw_pages>"]]"""
+        else="<TMPL_VAR else>"]]
+
+>>>>> --[[intrigeri]]