inline: allow assigning an id to postform/feedlink
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Fri, 7 Jan 2011 08:29:13 +0000 (09:29 +0100)
committerJoey Hess <joey@kitenet.net>
Tue, 22 Feb 2011 21:33:07 +0000 (17:33 -0400)
This allows per-form/feedlink group customization without having to
resort to counting.
(cherry picked from commit b134feb0dc2d9a8ff7ae447537fa8bc02811aabd)

IkiWiki/Plugin/inline.pm
doc/ikiwiki/directive/inline.mdwn
templates/blogpost.tmpl
templates/feedlink.tmpl

index 44e38436c7795c75d9eb5b88f77d706c7a331d35..ffdf397f1f337af6cfcb6435f8aaf35fcc63faf7 100644 (file)
@@ -329,6 +329,10 @@ sub preprocess_inline (@) {
                        $formtemplate->param(postformtext =>
                                gettext("Add a new post titled:"));
                }
                        $formtemplate->param(postformtext =>
                                gettext("Add a new post titled:"));
                }
+               if (exists $params{id}) {
+                       $formtemplate->param(postformid =>
+                               $params{id});
+               }
                $ret.=$formtemplate->output;
                
                # The post form includes the feed buttons, so
                $ret.=$formtemplate->output;
                
                # The post form includes the feed buttons, so
@@ -346,6 +350,9 @@ sub preprocess_inline (@) {
                        $linktemplate->param(atomurl => $atomurl);
                        $linktemplate->param(atomdesc => $atomdesc);
                }
                        $linktemplate->param(atomurl => $atomurl);
                        $linktemplate->param(atomdesc => $atomdesc);
                }
+               if (exists $params{id}) {
+                       $linktemplate->param(id => $params{id});
+               }
                $ret.=$linktemplate->output;
        }
        
                $ret.=$linktemplate->output;
        }
        
index 49b993d551a8ad488bd834374285b60b1a655eea..22c18d9a18714556591b0ac574736a291e4360cf 100644 (file)
@@ -75,6 +75,9 @@ Here are some less often needed parameters:
   disable generating any feeds.
 * `emptyfeeds` - Set to "no" to disable generation of empty feeds.
   Has no effect if `rootpage` or `postform` is set.
   disable generating any feeds.
 * `emptyfeeds` - Set to "no" to disable generation of empty feeds.
   Has no effect if `rootpage` or `postform` is set.
+* `id` - Set to specify the value of the HTML `id` attribute for the
+ feed links or the post form. Useful if you have multiple forms in the
+ same page.
 * `template` - Specifies the template to fill out to display each inlined
   page. By default the `inlinepage` template is used, while
   the `archivepage` template is used for archives. Set this parameter to
 * `template` - Specifies the template to fill out to display each inlined
   page. By default the `inlinepage` template is used, while
   the `archivepage` template is used for archives. Set this parameter to
index b9a3bc666e05430bb672b7c41ae4d0d208e4d2db..9e49c474afc4070da5bfafab16ea7a29de133670 100644 (file)
@@ -1,4 +1,4 @@
-<form action="<TMPL_VAR CGIURL>" method="get">
+<form <TMPL_IF POSTFORMID>id="<TMPL_VAR POSTFORMID ESCAPE=HTML>"</TMPL_IF> action="<TMPL_VAR CGIURL>" method="get">
 <div class="blogform">
 <TMPL_IF RSSURL>
 <a class="feedbutton" type="application/rss+xml" rel="alternate" title="<TMPL_VAR RSSDESC>" href="<TMPL_VAR RSSURL>">RSS</a>
 <div class="blogform">
 <TMPL_IF RSSURL>
 <a class="feedbutton" type="application/rss+xml" rel="alternate" title="<TMPL_VAR RSSDESC>" href="<TMPL_VAR RSSURL>">RSS</a>
index 392871e039f23183e758193c6b483db0cc5ad341..c67ad9c2b26dc752738fe5b8e47983c8a2b07342 100644 (file)
@@ -1,4 +1,4 @@
-<div class="feedlink">
+<div <TMPL_IF ID>id="<TMPL_VAR ID ESCAPE=HTML>"</TMPL_IF> class="feedlink">
 <TMPL_IF RSSURL>
 <a class="feedbutton" type="application/rss+xml" rel="alternate" title="<TMPL_VAR RSSDESC>" href="<TMPL_VAR RSSURL>">RSS</a>
 </TMPL_IF>
 <TMPL_IF RSSURL>
 <a class="feedbutton" type="application/rss+xml" rel="alternate" title="<TMPL_VAR RSSDESC>" href="<TMPL_VAR RSSURL>">RSS</a>
 </TMPL_IF>