]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/commitdiff
Merge branch 'master' of ssh://git.ikiwiki.info/srv/git/ikiwiki.info
authorJoey Hess <joey@kodama.kitenet.net>
Sun, 15 Jun 2008 23:10:23 +0000 (19:10 -0400)
committerJoey Hess <joey@kodama.kitenet.net>
Sun, 15 Jun 2008 23:10:23 +0000 (19:10 -0400)
IkiWiki/Plugin/map.pm
IkiWiki/Plugin/meta.pm
debian/changelog
debian/copyright
doc/plugins.mdwn
doc/plugins/map.mdwn

index af08005b8e4138e7a1791b165347e5bc97b8ce5c..5b6a843e7ae2680d654317fc35368190c2d9d087 100644 (file)
@@ -26,11 +26,12 @@ sub preprocess (@) { #{{{
        foreach my $page (keys %pagesources) {
                if (pagespec_match($page, $params{pages}, location => $params{page})) {
                        if (exists $params{show} && 
+                           exists $pagestate{$page} &&
                            exists $pagestate{$page}{meta}{$params{show}}) {
                                $mapitems{$page}=$pagestate{$page}{meta}{$params{show}};
                        }
                        else {
-                               $mapitems{$page}=$page;
+                               $mapitems{$page}='';
                        }
                        # Check for a common prefix.
                        if (! defined $common_prefix) {
@@ -58,8 +59,9 @@ sub preprocess (@) { #{{{
                $common_prefix=IkiWiki::dirname($common_prefix);
        }
 
-       # Needs to update whenever a page is added or removed, so
-       # register a dependency.
+       # Needs to update whenever a page is added or removed (or in some
+       # cases, when its content changes, if show=title), so register a
+       # dependency.
        add_depends($params{page}, $params{pages});
        # Explicitly add all currently shown pages, to detect when pages
        # are removed.
@@ -71,7 +73,8 @@ sub preprocess (@) { #{{{
        my $openli=0;
        my $dummy=0;
        my $map = "<div class='map'>\n<ul>\n";
-       foreach my $item (sort { $mapitems{$a} cmp $mapitems{$b} } keys %mapitems) {
+       foreach my $item (sort keys %mapitems) {
+               my @linktext = (length $mapitems{$item} ? (linktext => $mapitems{$item}) : ());
                $item=~s/^\Q$common_prefix\E\///
                        if defined $common_prefix && length $common_prefix;
                my $depth = ($item =~ tr/\//\//) + 1;
@@ -119,7 +122,7 @@ sub preprocess (@) { #{{{
                $map .= "<li>"
                        .htmllink($params{page}, $params{destpage}, 
                                "/".$common_prefix."/".$item,
-                               linktext => $mapitems{$item},
+                               @linktext,
                                class => "mapitem", noimageinline => 1)
                        ."\n";
                $openli=1;
index e2914a78aa1eaa73271784972851354893ca3cae..8e1b11859fdf4a3bd676d67d8c8a6211adb2c1b1 100644 (file)
@@ -78,6 +78,11 @@ sub preprocess (@) { #{{{
        # Metadata collection that needs to happen during the scan pass.
        if ($key eq 'title') {
                $pagestate{$page}{meta}{title}=HTML::Entities::encode_numeric($value);
+               # fallthrough
+       }
+       elsif ($key eq 'description') {
+               $pagestate{$page}{meta}{description}=HTML::Entities::encode_numeric($value);
+               # fallthrough
        }
        elsif ($key eq 'license') {
                push @{$metaheaders{$page}}, '<link rel="license" href="#page_license" />';
index 800a383004918ecb475867c9c6dcf9679c508dba..e1a1d7b334f9a150e7921bee3f606c7834142d15 100644 (file)
@@ -6,6 +6,8 @@ ikiwiki (2.51) UNRELEASED; urgency=low
     titles, rather than the default page name. Based on a patch from 
     Jaldhar H. Vyas, Closes: #484510
   * hnb: New plugin, contributed by Axel Beckert.
+  * meta: Store "description" in pagestate for use by other plugins.
+  * map: Support show=description.
 
  -- Joey Hess <joeyh@debian.org>  Sun, 15 Jun 2008 15:03:33 -0400
 
index bbb6d5192beba8319f15cfde15072e08b9eb07c0..d461bff29cfd8080b123678500dd4a2c5b9022b1 100644 (file)
@@ -88,6 +88,10 @@ Files: calendar.pm
 Copyright: (c) 2006, 2007 Manoj Srivastava <srivasta@debian.org>
 License: GPL-2+
 
+Files: hnb.pm
+Copyright: Copyright (C) 2008 Axel Beckert <abe@deuxchevaux.org>
+License: GPL-2+
+
 Files: doc/logo/*
 Copyright: © 2006 Recai Oktaş <roktas@debian.org>
 License: GPL-2+
index 439cecc8aff3d1efdb0fe6dfefc9fffae2882fea..ca1dfd1ff8a90d0ced43b56861f782c35d51a7f3 100644 (file)
@@ -1,6 +1,8 @@
 Most of ikiwiki's [[features]] are implemented as plugins. Many of these 
 plugins are included with ikiwiki.
 
+[[map pages="plugins/*" show=description]]
+
 [[pagestats pages="plugins/type/* and !plugins/type/slow"]]
 
 There's documentation if you want to [[write]] your own plugins, or you can
index d50c9b292538d6e220e101343536fd5964140b1a..df34d77cd8007cd72e344da43c6f8e871a2b7b35 100644 (file)
@@ -1,6 +1,8 @@
 [[template id=plugin name=map author="Alessandro Dotti Contra"]]
 [[tag type/meta]]
 
+[[meta description="some page description"]]
+
 This plugin generates a hierarchical page map for the wiki. Example usage:
 
        \[[map pages="* and !blog/* and !*/Discussion"]]
@@ -9,8 +11,9 @@ If the pages to include are not specified, all pages (and other files) in
 the wiki are mapped.
 
 By default, the names of pages are shown in the map. The `show` parameter
-can be used to show the titles of pages instead. For example:
-       
+can be used to show the titles or descriptions of pages instead (as set by
+the [[meta]] plugin). For example:
+
        \[[map pages="* and !blog/* and !*/Discussion" show=title]]
 
 Hint: To limit the map to displaying pages less than a certain level deep,