aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--IkiWiki.pm1
-rw-r--r--IkiWiki/Render.pm11
-rw-r--r--debian/changelog4
-rw-r--r--doc/style.css9
-rw-r--r--doc/usage.mdwn5
-rwxr-xr-xikiwiki.in1
-rw-r--r--po/ikiwiki.pot32
-rw-r--r--templates/page.tmpl9
8 files changed, 50 insertions, 22 deletions
diff --git a/IkiWiki.pm b/IkiWiki.pm
index a290b479a..558b457f1 100644
--- a/IkiWiki.pm
+++ b/IkiWiki.pm
@@ -72,6 +72,7 @@ sub defaultconfig () { #{{{
sslcookie => 0,
httpauth => 0,
userdir => "",
+ numbacklinks => 10,
} #}}}
sub checkconfig () { #{{{
diff --git a/IkiWiki/Render.pm b/IkiWiki/Render.pm
index c5d885810..7fd7daf11 100644
--- a/IkiWiki/Render.pm
+++ b/IkiWiki/Render.pm
@@ -30,7 +30,6 @@ sub backlinks ($) { #{{{
calculate_backlinks();
my @links;
- return unless $backlinks{$page};
foreach my $p (keys %{$backlinks{$page}}) {
my $href=abs2rel(htmlpage($p), dirname($page));
@@ -45,8 +44,11 @@ sub backlinks ($) { #{{{
push @links, { url => $href, page => pagetitle($p_trimmed) };
}
+ @links = sort { $a->{page} cmp $b->{page} } @links;
- return sort { $a->{page} cmp $b->{page} } @links;
+ return \@links, [] if @links <= $config{numbacklinks};
+ return [@links[0..$config{numbacklinks}-1]],
+ [@links[$config{numbacklinks}..$#links]];
} #}}}
sub parentlinks ($) { #{{{
@@ -107,6 +109,8 @@ sub genpage ($$$) { #{{{
$template->param(have_actions => 1);
}
+ my ($backlinks, $more_backlinks)=backlinks($page);
+
$template->param(
title => $page eq 'index'
? $config{wikiname}
@@ -114,7 +118,8 @@ sub genpage ($$$) { #{{{
wikiname => $config{wikiname},
parentlinks => [parentlinks($page)],
content => $content,
- backlinks => [backlinks($page)],
+ backlinks => $backlinks,
+ more_backlinks => $more_backlinks,
mtime => displaytime($mtime),
baseurl => baseurl($page),
);
diff --git a/debian/changelog b/debian/changelog
index fb310dd5e..ddec8475d 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -11,8 +11,10 @@ ikiwiki (1.49) UNRELEASED; urgency=low
* Add a popup template in the basewiki. CSS based on some by Martin Krafft.
* Make the note, popup, and plugin templates detect missing variables and be
self-documenting, listing the available variables.
+ * Hide excess backlinks and expand using CSS trick; control quantiy via
+ the numbacklinks setting.
- -- Joey Hess <joeyh@debian.org> Sat, 31 Mar 2007 02:23:46 -0400
+ -- Joey Hess <joeyh@debian.org> Sat, 31 Mar 2007 04:27:08 -0400
ikiwiki (1.48) unstable; urgency=low
diff --git a/doc/style.css b/doc/style.css
index af460dd0d..0a37e55aa 100644
--- a/doc/style.css
+++ b/doc/style.css
@@ -239,13 +239,14 @@ input#openid_url {
width: 25%
}
-/* Used by the popup template. */
+/* Used by the popup template and for backlinks hiding. */
.popup {
border-bottom: 1px dotted #366;
color: #366;
}
.popup .balloon,
-.popup .paren {
+.popup .paren,
+.popup .expand {
display: none;
}
.popup:hover .balloon,
@@ -261,3 +262,7 @@ input#openid_url {
-moz-opacity: 0.95;
filter: alpha(opacity=95);
}
+.popup:hover .expand,
+.popup:focus .expand {
+ display: inline;
+}
diff --git a/doc/usage.mdwn b/doc/usage.mdwn
index bb6f06aea..4ccd6bf44 100644
--- a/doc/usage.mdwn
+++ b/doc/usage.mdwn
@@ -233,6 +233,11 @@ configuration options of their own.
Enables or disables "Discussion" links from being added to the header of
every page. The links are enabled by default.
+* --numbacklinks n
+
+ Controls how many backlinks should be displayed maximum. Excess backlinks
+ will be hidden in a popup. Default is 10.
+
* --userdir subdir
Optionally, allows links to users of the wiki to link to pages inside a
diff --git a/ikiwiki.in b/ikiwiki.in
index 8c46d5e9f..b8589bc62 100755
--- a/ikiwiki.in
+++ b/ikiwiki.in
@@ -30,6 +30,7 @@ sub getconfig () { #{{{
"wrappers!" => \$config{wrappers},
"getctime" => \$config{getctime},
"wrappermode=i" => \$config{wrappermode},
+ "numbacklinks=i" => \$config{numbacklinks},
"rcs=s" => \$config{rcs},
"no-rcs" => sub { $config{rcs}="" },
"cgi!" => \$config{cgi},
diff --git a/po/ikiwiki.pot b/po/ikiwiki.pot
index 43f869441..9ce8b04a9 100644
--- a/po/ikiwiki.pot
+++ b/po/ikiwiki.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2007-03-31 02:06-0400\n"
+"POT-Creation-Date: 2007-03-31 04:39-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -31,8 +31,8 @@ msgstr ""
#: ../IkiWiki/CGI.pm:418 ../IkiWiki/Plugin/brokenlinks.pm:24
#: ../IkiWiki/Plugin/inline.pm:181 ../IkiWiki/Plugin/opendiscussion.pm:17
-#: ../IkiWiki/Plugin/orphans.pm:28 ../IkiWiki/Render.pm:97
-#: ../IkiWiki/Render.pm:165
+#: ../IkiWiki/Plugin/orphans.pm:28 ../IkiWiki/Render.pm:99
+#: ../IkiWiki/Render.pm:170
msgid "discussion"
msgstr ""
@@ -157,7 +157,7 @@ msgstr ""
msgid "nonexistant template %s"
msgstr ""
-#: ../IkiWiki/Plugin/inline.pm:189 ../IkiWiki/Render.pm:101
+#: ../IkiWiki/Plugin/inline.pm:189 ../IkiWiki/Render.pm:103
msgid "Discussion"
msgstr ""
@@ -420,47 +420,47 @@ msgid ""
"notifications"
msgstr ""
-#: ../IkiWiki/Render.pm:249 ../IkiWiki/Render.pm:269
+#: ../IkiWiki/Render.pm:254 ../IkiWiki/Render.pm:274
#, perl-format
msgid "skipping bad filename %s"
msgstr ""
-#: ../IkiWiki/Render.pm:309
+#: ../IkiWiki/Render.pm:314
#, perl-format
msgid "removing old page %s"
msgstr ""
-#: ../IkiWiki/Render.pm:329
+#: ../IkiWiki/Render.pm:334
#, perl-format
msgid "scanning %s"
msgstr ""
-#: ../IkiWiki/Render.pm:339
+#: ../IkiWiki/Render.pm:344
#, perl-format
msgid "rendering %s"
msgstr ""
-#: ../IkiWiki/Render.pm:351
+#: ../IkiWiki/Render.pm:356
#, perl-format
msgid "rendering %s, which links to %s"
msgstr ""
-#: ../IkiWiki/Render.pm:368
+#: ../IkiWiki/Render.pm:373
#, perl-format
msgid "rendering %s, which depends on %s"
msgstr ""
-#: ../IkiWiki/Render.pm:406
+#: ../IkiWiki/Render.pm:411
#, perl-format
msgid "rendering %s, to update its backlinks"
msgstr ""
-#: ../IkiWiki/Render.pm:418
+#: ../IkiWiki/Render.pm:423
#, perl-format
msgid "removing %s, no longer rendered by %s"
msgstr ""
-#: ../IkiWiki/Render.pm:444
+#: ../IkiWiki/Render.pm:449
#, perl-format
msgid "ikiwiki: cannot render %s"
msgstr ""
@@ -533,11 +533,11 @@ msgstr ""
msgid "usage: ikiwiki [options] source dest"
msgstr ""
-#: ../IkiWiki.pm:103
+#: ../IkiWiki.pm:104
msgid "Must specify url to wiki with --url when using --cgi"
msgstr ""
-#: ../IkiWiki.pm:150 ../IkiWiki.pm:151
+#: ../IkiWiki.pm:151 ../IkiWiki.pm:152
msgid "Error"
msgstr ""
@@ -545,7 +545,7 @@ msgstr ""
#. translators: preprocessor directive name,
#. translators: the second a page name, the
#. translators: third a number.
-#: ../IkiWiki.pm:573
+#: ../IkiWiki.pm:574
#, perl-format
msgid "%s preprocessing loop detected on %s at depth %i"
msgstr ""
diff --git a/templates/page.tmpl b/templates/page.tmpl
index 471ed1a7d..61d22723f 100644
--- a/templates/page.tmpl
+++ b/templates/page.tmpl
@@ -73,6 +73,15 @@ Links:
<TMPL_LOOP NAME="BACKLINKS">
<a href="<TMPL_VAR NAME=URL>"><TMPL_VAR NAME=PAGE></a>
</TMPL_LOOP>
+<TMPL_IF NAME="MORE_BACKLINKS">
+<span class="popup">...
+<span class="expand">
+<TMPL_LOOP NAME="MORE_BACKLINKS">
+<a href="<TMPL_VAR NAME=URL>"><TMPL_VAR NAME=PAGE></a>
+</TMPL_LOOP>
+</span>
+</span>
+</TMPL_IF>
</TMPL_IF>
</div>