]> sipb.mit.edu Git - ikiwiki.git/blob - doc/plugins/map/discussion.mdwn
fix example
[ikiwiki.git] / doc / plugins / map / discussion.mdwn
1 I'm wanting a [[map]] (with indentation levels) showing page _titles_
2 instead of page 'names'.  As far as I can see, this is not an option with
3 existing plugins - I can get a list of pages using [[inline]] and
4 appropriate [[wikitemplates]], but that has no indentation and therefore
5 doesn't show structure well.
6
7 The quick way is to modify the map plugin to have a 'titles' option.  The
8 hard way is to modify inline to have an indentation option, in which case
9 inline will be a superset of map functionality.  The second option seems a
10 little wrong from the point of view of perversely extending what 'inline'
11 means, but it seems right from the point of view of combining common
12 features.  Maybe adding template support to map is a more useful approach
13 than just adding a title option.
14
15 Thoughts, anyone?  --[[KarlMW]]
16
17 We'd also very much like to have an option to display the title of the page instead of the filename in the map plugin. --Andrew
18
19 There's a patch implementing this in [[!debbug 484510]]. It needs a few fixes
20 before I merge it. Now applied. --[[Joey]]
21
22 ----
23
24 I noticed that when the pagespec returns no map items, the map plugin does not close off the ul and div tags. Below is a simple patch 
25 that seems to work on the examples I tried. I am a beginner so please help me out here. Thanks. --[[harishcm]]
26
27     --- a/map.pm
28     +++ b/map.pm
29     @@ -81,6 +81,13 @@
30             my $openli=0;
31             my $addparent="";
32             my $map = "<div class='map'>\n<ul>\n";
33     +
34     +       # Return properly closed $map if %mapitems is empty
35     +       if (!scalar(keys %mapitems)) {
36     +               $map .= "</ul>\n</div>\n";
37     +               return $map; 
38     +       }
39     +
40             foreach my $item (sort keys %mapitems) {
41                     my @linktext = (length $mapitems{$item} ? (linktext => $mapitems{$item}) : ());
42                     $item=~s/^\Q$common_prefix\E\///
43     
44 > This was also reported as [[bugs/map_fails_to_close_ul_element_for_empty_list]];
45 > this patch is simpler than the one there, but has the same problem (it emits
46 > `<ul></ul>`, which technically isn't valid HTML either). --[[smcv]]