* Hide excess backlinks and expand using CSS trick; control quantiy via
the numbacklinks setting.master
parent
f9e8c60129
commit
a2cfdaaec5
|
@ -72,6 +72,7 @@ sub defaultconfig () { #{{{
|
|||
sslcookie => 0,
|
||||
httpauth => 0,
|
||||
userdir => "",
|
||||
numbacklinks => 10,
|
||||
} #}}}
|
||||
|
||||
sub checkconfig () { #{{{
|
||||
|
|
|
@ -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),
|
||||
);
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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},
|
||||
|
|
|
@ -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 ""
|
||||
|
|
|
@ -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>
|
||||
|
||||
|
|
Loading…
Reference in New Issue