1 From efbb1121ffdc146f5c9a481a51f23ad151b9f240 Mon Sep 17 00:00:00 2001
2 From: chrysn <chrysn@fsfe.org>
3 Date: Thu, 15 Mar 2012 14:38:42 +0100
4 Subject: [PATCH] display the pagetitle() in linkmaps
6 without this patch, linkmaps display underscores and underscore escape
7 sequences in the rendered output.
9 this introduces a pageescape function, which invoces pagetitle() to get
10 rid of underscore escapes and wraps the resulting utf8 string
11 appropriately for inclusion in a dot file (using dot's html encoding
12 because it can represent the '\"' dyad properly, and because it doesn't
13 need special-casing of newlines).
15 IkiWiki/Plugin/linkmap.pm | 17 +++++++++++++++--
16 1 files changed, 15 insertions(+), 2 deletions(-)
18 diff --git a/IkiWiki/Plugin/linkmap.pm b/IkiWiki/Plugin/linkmap.pm
19 index ac26e07..b5ef1a1 100644
20 --- a/IkiWiki/Plugin/linkmap.pm
21 +++ b/IkiWiki/Plugin/linkmap.pm
22 @@ -5,6 +5,7 @@ use warnings;
29 hook(type => "getsetup", id => "linkmap", call => \&getsetup);
30 @@ -22,6 +23,18 @@ sub getsetup () {
36 + # encoding explicitly in case ikiwiki is configured to accept <> or &
38 + my $title = pagetitle($item, 1);
39 + # it would not be necessary to encode *all* the html entities (<> would
40 + # be sufficient, &" probably a good idea), as dot accepts utf8, but it
42 + $title = encode_entities($title);
49 @@ -63,7 +76,7 @@ sub preprocess (@) {
52 if (! $shown{$item}) {
53 - print OUT "\"$item\" [shape=box,href=\"$mapitems{$item}\"];\n";
54 + print OUT pageescape($item)." [shape=box,href=\"$mapitems{$item}\"];\n";
58 @@ -74,7 +87,7 @@ sub preprocess (@) {
59 foreach my $endpoint ($item, $link) {
62 - print OUT "\"$item\" -> \"$link\";\n";
63 + print OUT pageescape($item)." -> ".pageescape($link).";\n";