more: Add pages parameter to limit where the more is displayed. (thanks, dark)
authorJoey Hess <joey@kitenet.net>
Tue, 16 Nov 2010 19:00:04 +0000 (15:00 -0400)
committerJoey Hess <joey@kitenet.net>
Tue, 16 Nov 2010 19:00:04 +0000 (15:00 -0400)
IkiWiki/Plugin/more.pm
debian/changelog
doc/ikiwiki/directive/more.mdwn
doc/todo/selective_more_directive.mdwn

index 80e339a1be7c876e05820ba2da3e444d97770345..6880e366df3ad40b9404d915b04c28e4d3e3bfa4 100644 (file)
@@ -26,7 +26,10 @@ sub preprocess (@) {
 
        $params{linktext} = $linktext unless defined $params{linktext};
 
-       if ($params{page} ne $params{destpage}) {
+       if ($params{page} ne $params{destpage} &&
+           (! exists $params{pages} ||
+            pagespec_match($params{destpage}, $params{pages},
+                    location => $params{page}))) {
                return "\n".
                        htmllink($params{page}, $params{destpage}, $params{page},
                                linktext => $params{linktext},
index 91ff0964be38e4476a55a85760dc6a7bcd07d20e..faabf1993194b7651519ab56f2b6c7253e0b2170 100644 (file)
@@ -1,6 +1,8 @@
 ikiwiki (3.20101113) UNRELEASED; urgency=low
 
   * websetup: Fix encoding problem when restoring old setup file.
+  * more: Add pages parameter to limit where the more is displayed.
+    (thanks, dark)
 
  -- Joey Hess <joeyh@debian.org>  Tue, 16 Nov 2010 14:23:47 -0400
 
index 50655191001371b9c34d4c305c118676b7e4f80e..bda1427f39b6d3e688dc589b4ffd82aa3b09dc19 100644 (file)
@@ -11,6 +11,11 @@ leads to the full version of the page. Use it like this:
 
 If the `linktext` parameter is omitted it defaults to just "more".
 
+An optional `pages` parameter can be used to specify a
+[[ikiwiki/PageSpec]], and then the "more" link will only be displayed
+when the page is inlined into a page matching that PageSpec, and otherwise
+the full content shown.
+
 Note that you can accomplish something similar using a [[toggle]] instead.
 
 [[!meta robots="noindex, follow"]]
index 24e6ab568a7e8aa4f2acc2a113bd554ef62dc2c9..2a9998205f31460539e9c608dd3c740374bb503e 100644 (file)
@@ -24,3 +24,5 @@ I can now call it as
 I'm not entirely happy with the design, since I would rather put this information in the inline directive instead of in every story post. Unfortunately I found no way to pass parameters from the inline directive to the inlined page.
 
 -- [[dark]]
+
+> Me neither, but nor do I see a better way, so [[applied|done]]. --[[Joey]]