1 [[ikiwiki/directive/linkmap]]s display the file name instead of the pagetitle, showing unsightly underscore escapes and underscores instead of blanks to users.
3 the attached [[!taglink patch]] fixes this; from its commit message:
5 display the pagetitle() in linkmaps
7 without this patch, linkmaps display underscores and underscore escape
8 sequences in the rendered output.
10 this introduces a pageescape function, which invoces pagetitle() to get
11 rid of underscore escapes and wraps the resulting utf8 string
12 appropriately for inclusion in a dot file (using dot's html encoding
13 because it can represent the '\"' dyad properly, and because it doesn't
14 need special-casing of newlines).
16 the output will look much better (at least in my wikis) with the "[[bugs/pagetitle function does not respect meta titles]]" issue fixed.
18 everything below that line is the patch as produced by git-format-patch. (btw, what's the preferred way to send patches, apart from creating a git branch somewhere?)
20 --------- snap ------------<pre>
22 From efbb1121ffdc146f5c9a481a51f23ad151b9f240 Mon Sep 17 00:00:00 2001
23 From: chrysn <chrysn@fsfe.org>
24 Date: Thu, 15 Mar 2012 14:38:42 +0100
25 Subject: [PATCH] display the pagetitle() in linkmaps
27 without this patch, linkmaps display underscores and underscore escape
28 sequences in the rendered output.
30 this introduces a pageescape function, which invoces pagetitle() to get
31 rid of underscore escapes and wraps the resulting utf8 string
32 appropriately for inclusion in a dot file (using dot's html encoding
33 because it can represent the '\"' dyad properly, and because it doesn't
34 need special-casing of newlines).
36 IkiWiki/Plugin/linkmap.pm | 17 +++++++++++++++--
37 1 files changed, 15 insertions(+), 2 deletions(-)
39 diff --git a/IkiWiki/Plugin/linkmap.pm b/IkiWiki/Plugin/linkmap.pm
40 index ac26e07..b5ef1a1 100644
41 --- a/IkiWiki/Plugin/linkmap.pm
42 +++ b/IkiWiki/Plugin/linkmap.pm
43 @@ -5,6 +5,7 @@ use warnings;
50 hook(type => "getsetup", id => "linkmap", call => \&getsetup);
51 @@ -22,6 +23,18 @@ sub getsetup () {
57 + # encoding explicitly in case ikiwiki is configured to accept <> or &
59 + my $title = pagetitle($item, 1);
60 + # it would not be necessary to encode *all* the html entities (<> would
61 + # be sufficient, &" probably a good idea), as dot accepts utf8, but it
63 + $title = encode_entities($title);
70 @@ -63,7 +76,7 @@ sub preprocess (@) {
73 if (! $shown{$item}) {
74 - print OUT "\"$item\" [shape=box,href=\"$mapitems{$item}\"];\n";
75 + print OUT pageescape($item)." [shape=box,href=\"$mapitems{$item}\"];\n";
79 @@ -74,7 +87,7 @@ sub preprocess (@) {
80 foreach my $endpoint ($item, $link) {
83 - print OUT "\"$item\" -> \"$link\";\n";
84 + print OUT pageescape($item)." -> ".pageescape($link).";\n";